@everymatrix/lottery-tipping-page 1.94.61 → 1.94.63
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/{general-multi-select_15.cjs.entry.js → app-tooltip_21.cjs.entry.js} +1924 -725
- package/dist/cjs/{index-9d5d8231.js → index-d19ed439.js} +8 -4
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{lottery-tipping-page-65fd9e22.js → lottery-tipping-page-1cccdeb8.js} +24 -4
- package/dist/cjs/lottery-tipping-page.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +28 -2
- package/dist/collection/components/lottery-tipping-page/lottery-tipping-page.js +52 -3
- package/dist/collection/utils/locale.utils.js +3 -1
- package/dist/collection/utils/utils.js +7 -0
- package/dist/esm/{general-multi-select_15.entry.js → app-tooltip_21.entry.js} +1919 -726
- package/dist/esm/{index-3be4f76e.js → index-de792262.js} +9 -5
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{lottery-tipping-page-17314ef0.js → lottery-tipping-page-54ab9176.js} +24 -4
- package/dist/esm/lottery-tipping-page.js +3 -3
- package/dist/lottery-tipping-page/{general-multi-select_15.entry.js → app-tooltip_21.entry.js} +243 -243
- package/dist/lottery-tipping-page/{index-3be4f76e.js → index-de792262.js} +1 -1
- package/dist/lottery-tipping-page/index.esm.js +1 -1
- package/dist/lottery-tipping-page/lottery-tipping-page-54ab9176.js +1 -0
- package/dist/lottery-tipping-page/lottery-tipping-page.esm.js +1 -1
- package/dist/types/components/lottery-tipping-page/lottery-tipping-page.d.ts +6 -1
- package/dist/types/components.d.ts +16 -0
- package/dist/types/utils/utils.d.ts +4 -0
- package/package.json +1 -1
- package/dist/lottery-tipping-page/lottery-tipping-page-17314ef0.js +0 -1
- /package/dist/static/{poolgame-bg.webp → poolGameLogo.webp} +0 -0
|
@@ -2,8 +2,42 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const lotteryTippingPage = require('./lottery-tipping-page-
|
|
5
|
+
const index = require('./index-d19ed439.js');
|
|
6
|
+
const lotteryTippingPage = require('./lottery-tipping-page-1cccdeb8.js');
|
|
7
|
+
|
|
8
|
+
const tooltipCss = ":host{display:inline-flex;position:relative}.tooltip-wrapper{position:relative;display:inline-flex}.tooltip-content-wrapper{position:absolute;z-index:10;bottom:125%;left:50%;transform:translateX(-50%);opacity:0;visibility:hidden;transition:opacity 0.2s, visibility 0.2s}.tooltip-content-wrapper.visible{opacity:1;visibility:visible}.tooltip-content{background-color:var(--emw--tooltip-background-color, #000);color:var(--emw--tooltip-text-color, #fff);border-radius:4px;box-shadow:0 2px 8px rgba(0, 0, 0, 0.15);white-space:nowrap;padding:4px}";
|
|
9
|
+
const AppTooltipStyle0 = tooltipCss;
|
|
10
|
+
|
|
11
|
+
const Tooltip = class {
|
|
12
|
+
constructor(hostRef) {
|
|
13
|
+
index.registerInstance(this, hostRef);
|
|
14
|
+
this.show = () => (this.visible = true);
|
|
15
|
+
this.hide = () => (this.visible = false);
|
|
16
|
+
this.visible = false;
|
|
17
|
+
}
|
|
18
|
+
componentDidLoad() {
|
|
19
|
+
this.trigger = this.host.querySelector('[slot="trigger"]');
|
|
20
|
+
if (this.trigger) {
|
|
21
|
+
this.trigger.addEventListener('mouseenter', this.show);
|
|
22
|
+
this.trigger.addEventListener('mouseleave', this.hide);
|
|
23
|
+
this.trigger.addEventListener('focus', this.show);
|
|
24
|
+
this.trigger.addEventListener('blur', this.hide);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
disconnectedCallback() {
|
|
28
|
+
if (this.trigger) {
|
|
29
|
+
this.trigger.removeEventListener('mouseenter', this.show);
|
|
30
|
+
this.trigger.removeEventListener('mouseleave', this.hide);
|
|
31
|
+
this.trigger.removeEventListener('focus', this.show);
|
|
32
|
+
this.trigger.removeEventListener('blur', this.hide);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
render() {
|
|
36
|
+
return (index.h("div", { key: 'e56695ac60fcd7903127179423e9954ef40f05c0', class: "tooltip-wrapper" }, index.h("slot", { key: '4e2472a395ceeb2b911692739d326c031df07e29', name: "trigger" }), index.h("div", { key: 'f77bd72da94eb17d12e42ebb86c395c55801b728', class: { 'tooltip-content-wrapper': true, visible: this.visible } }, index.h("div", { key: '988399e2b42988622d46eaf255f17c6221eb9697', class: "tooltip-content" }, index.h("slot", { key: '05de0572ab1331d965e61947c5c15775e225197a', name: "content" })))));
|
|
37
|
+
}
|
|
38
|
+
get host() { return index.getElement(this); }
|
|
39
|
+
};
|
|
40
|
+
Tooltip.style = AppTooltipStyle0;
|
|
7
41
|
|
|
8
42
|
const generalMultiSelectCss = ".multi-select-container{position:relative;font-family:\"Inter\", sans-serif;margin-top:4px;width:100%}.flex-row{display:flex;flex-direction:row;align-items:center;flex-wrap:nowrap;padding:6px 10px;padding-right:6px;border-radius:0.25em;background:var(--emw-selector-color-background, #e8ebef);cursor:pointer}.control{flex:1;display:flex;align-items:center;flex-wrap:nowrap;overflow:hidden}.control:focus-within{border-color:var(--emw--color-primary, #fed275);box-shadow:0 0 0 2px var(--emw--button-box-shadow-color-secondary, rgba(0, 0, 0, 0.15))}.chip{display:inline-flex;align-items:center;background:var(--emw--color-gray-50, #f5f5f5);color:var(--emw--color-dialog-typography, #000);border-radius:4px;padding:2px 8px;margin-right:6px;font-size:0.875rem;line-height:1.2;justify-content:space-between;flex:0 1 auto;min-width:0}.chip-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.overflow-chip{background:var(--emw--color-gray-100, #e6e6e6);color:var(--emw--color-gray-300, #333);width:20px;text-align:center;display:block}.remove-btn{background:none;border:none;font-size:1rem;margin-left:6px;cursor:pointer;color:var(--emw--color-gray-150, #6f6f6f)}.remove-btn:hover{color:var(--emw--color-error, red)}.placeholder{color:var(--emw--color-gray-150, #6f6f6f);font-size:0.875rem;padding:3px 8px;padding-left:0;line-height:1.2}.arrow{margin-left:auto;font-size:0.8rem;width:20px;color:var(--emw--color-gray-150, #6f6f6f)}.dropdown{position:absolute;top:calc(100% + 4px);left:0;width:100%;max-height:240px;overflow-y:auto;border:1px solid var(--emw--color-gray-100, #e6e6e6);border-radius:6px;background:var(--emw--color-dialog-background, #ffffff);box-shadow:0 4px 12px var(--emw--button-box-shadow-color-secondary, rgba(0, 0, 0, 0.15));z-index:10}.dropdown-item{padding:10px 14px;cursor:pointer;font-size:0.875rem;line-height:1.4;transition:background 0.2s}.dropdown-item:hover{background:var(--emw--color-background-tertiary, #ccc);color:var(--emw--color-typography, #000)}.dropdown-item.selected{background:var(--emw--color-background-secondary, #f5f5f5);color:var(--emw--color-typography, #000);font-weight:500}.overflow-popover{position:absolute;top:var(--overflow-top, 0px);left:var(--overflow-left, 0px);max-width:200px;padding:12px;display:flex;flex-wrap:wrap;gap:6px;border:1px solid var(--emw--color-gray-100, #d0d5dd);border-radius:6px;background:var(--emw--color-background, #ffffff);box-shadow:0 4px 12px var(--emw--button-box-shadow-color-secondary, rgba(0, 0, 0, 0.15));z-index:20}";
|
|
9
43
|
const GeneralMultiSelectStyle0 = generalMultiSelectCss;
|
|
@@ -2899,9 +2933,9 @@ const HelperCountDown = class {
|
|
|
2899
2933
|
};
|
|
2900
2934
|
HelperCountDown.style = HelperCountDownStyle0;
|
|
2901
2935
|
|
|
2902
|
-
const DEFAULT_LANGUAGE$
|
|
2903
|
-
const SUPPORTED_LANGUAGES$
|
|
2904
|
-
const TRANSLATIONS$
|
|
2936
|
+
const DEFAULT_LANGUAGE$7 = 'en';
|
|
2937
|
+
const SUPPORTED_LANGUAGES$7 = ['ro', 'en', 'fr', 'ar', 'hr'];
|
|
2938
|
+
const TRANSLATIONS$7 = {
|
|
2905
2939
|
en: {
|
|
2906
2940
|
stop: 'Stop',
|
|
2907
2941
|
at: 'at',
|
|
@@ -2925,18 +2959,18 @@ const TRANSLATIONS$5 = {
|
|
|
2925
2959
|
at: 'u'
|
|
2926
2960
|
}
|
|
2927
2961
|
};
|
|
2928
|
-
const translate$
|
|
2962
|
+
const translate$7 = (key, customLang) => {
|
|
2929
2963
|
const lang = customLang;
|
|
2930
|
-
return TRANSLATIONS$
|
|
2964
|
+
return TRANSLATIONS$7[lang !== undefined && SUPPORTED_LANGUAGES$7.includes(lang) ? lang : DEFAULT_LANGUAGE$7][key];
|
|
2931
2965
|
};
|
|
2932
|
-
const getTranslations$
|
|
2966
|
+
const getTranslations$7 = (data) => {
|
|
2933
2967
|
Object.keys(data).forEach((item) => {
|
|
2934
2968
|
for (let key in data[item]) {
|
|
2935
|
-
TRANSLATIONS$
|
|
2969
|
+
TRANSLATIONS$7[item][key] = data[item][key];
|
|
2936
2970
|
}
|
|
2937
2971
|
});
|
|
2938
2972
|
};
|
|
2939
|
-
const resolveTranslationUrl$
|
|
2973
|
+
const resolveTranslationUrl$4 = async (translationUrl) => {
|
|
2940
2974
|
if (translationUrl) {
|
|
2941
2975
|
try {
|
|
2942
2976
|
const response = await fetch(translationUrl);
|
|
@@ -2944,7 +2978,7 @@ const resolveTranslationUrl$3 = async (translationUrl) => {
|
|
|
2944
2978
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
2945
2979
|
}
|
|
2946
2980
|
const translations = await response.json();
|
|
2947
|
-
getTranslations$
|
|
2981
|
+
getTranslations$7(translations);
|
|
2948
2982
|
}
|
|
2949
2983
|
catch (error) {
|
|
2950
2984
|
console.error('Failed to fetch or parse translations from URL:', error);
|
|
@@ -2952,7 +2986,7 @@ const resolveTranslationUrl$3 = async (translationUrl) => {
|
|
|
2952
2986
|
}
|
|
2953
2987
|
};
|
|
2954
2988
|
|
|
2955
|
-
const lotteryBannerCss = ":host {\n display: block;\n container-type: inline-size;\n}\n\n.lottery-banner {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--lottery-banner-gap, 0.5rem);\n padding: var(--lottery-banner-padding, 0px 20px);\n background: var(--lottery-banner-background, var(--emw--color-primary, #fed275));\n border-top: var(--lottery-banner-border-width, 2px) var(--lottery-banner-border-style, solid) var(--lottery-banner-border-color, var(--emw--color-primary, #fed275));\n border-bottom: var(--lottery-banner-border-width, 2px) var(--lottery-banner-border-style, solid) var(--lottery-banner-border-color, var(--emw--color-primary, #fed275));\n border-left: var(--lottery-banner-border-left, none);\n border-right: var(--lottery-banner-border-right, none);\n border-radius: var(--lottery-banner-border-radius, 0);\n white-space: nowrap;\n height: var(--lottery-banner-height, 50px);\n position: relative;\n box-sizing: border-box;\n}\n\n.lottery-banner__logo-wrapper {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n}\n.lottery-banner__logo-wrapper img {\n height: 100%;\n object-fit: var(--lottery-banner-logo-object-fit, contain);\n}\n\n.lottery-banner__item--center {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n}\n\n.lottery-banner__title {\n text-align: center;\n font-size: var(--lottery-banner-title-font-size, 1.5rem);\n font-weight: 800;\n font-style: italic;\n letter-spacing: var(--lottery-banner-title-font-letter-spacing, 0.04em);\n color: var(--emw--color-typography, #000);\n}\n\n.lottery-banner__info {\n display: flex;\n align-items: center;\n gap: var(--lottery-banner-info-gap, 0.75rem);\n}\n\n.lottery-banner__info-item {\n font-size: var(--lottery-banner-info-font-size, 0.9rem);\n color: var(--lottery-banner-info-color, var(--emw--color-typography, #000));\n display: inline-flex;\n align-items: center;\n gap: 0.3rem;\n}\n\n.lottery-banner__info-item-label {\n color: var(--lottery-banner-info-label-color, var(--emw--color-typography, #000));\n}\n.lottery-banner__info-item-label__strong {\n font-weight: var(--lottery-banner-info-label-font-weight, 700);\n}\n\n.lottery-banner__info-item-value {\n font-weight: var(--lottery-banner-info-value-font-weight, inherit);\n color: var(--lottery-banner-info-value-color, var(--emw--color-typography, #000));\n}\n.lottery-banner__info-item-value__strong {\n font-weight: 700;\n}\n\nhelper-count-down::part(values) {\n gap: 8px;\n}\n\n@container (max-width: 700px) {\n .lottery-banner {\n height: auto;\n padding: var(--lottery-banner-mobile-padding, 0.5rem
|
|
2989
|
+
const lotteryBannerCss = ":host {\n display: block;\n container-type: inline-size;\n}\n\n.lottery-banner {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--lottery-banner-gap, 0.5rem);\n padding: var(--lottery-banner-padding, 0px 20px);\n background: var(--lottery-banner-background, var(--emw--color-primary, #fed275));\n border-top: var(--lottery-banner-border-width, 2px) var(--lottery-banner-border-style, solid) var(--lottery-banner-border-color, var(--emw--color-primary, #fed275));\n border-bottom: var(--lottery-banner-border-width, 2px) var(--lottery-banner-border-style, solid) var(--lottery-banner-border-color, var(--emw--color-primary, #fed275));\n border-left: var(--lottery-banner-border-left, none);\n border-right: var(--lottery-banner-border-right, none);\n border-radius: var(--lottery-banner-border-radius, 0);\n white-space: nowrap;\n height: var(--lottery-banner-height, 50px);\n position: relative;\n box-sizing: border-box;\n}\n\n.lottery-banner__logo-wrapper {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n}\n.lottery-banner__logo-wrapper img {\n height: 100%;\n max-width: 32vw;\n object-fit: var(--lottery-banner-logo-object-fit, contain);\n}\n\n.lottery-banner__item--center {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n}\n\n.lottery-banner__title {\n text-align: center;\n font-size: var(--lottery-banner-title-font-size, 1.5rem);\n font-weight: 800;\n font-style: italic;\n letter-spacing: var(--lottery-banner-title-font-letter-spacing, 0.04em);\n color: var(--emw--color-typography, #000);\n}\n\n.lottery-banner__info {\n display: flex;\n align-items: center;\n gap: var(--lottery-banner-info-gap, 0.75rem);\n}\n\n.lottery-banner__info-item {\n font-size: var(--lottery-banner-info-font-size, 0.9rem);\n color: var(--lottery-banner-info-color, var(--emw--color-typography, #000));\n display: inline-flex;\n align-items: center;\n gap: 0.3rem;\n}\n\n.lottery-banner__info-item-label {\n color: var(--lottery-banner-info-label-color, var(--emw--color-typography, #000));\n}\n.lottery-banner__info-item-label__strong {\n font-weight: var(--lottery-banner-info-label-font-weight, 700);\n}\n\n.lottery-banner__info-item-value {\n font-weight: var(--lottery-banner-info-value-font-weight, inherit);\n color: var(--lottery-banner-info-value-color, var(--emw--color-typography, #000));\n}\n.lottery-banner__info-item-value__strong {\n font-weight: var(--lottery-banner-info-label-font-weight, 700);\n}\n\nhelper-count-down::part(values) {\n gap: 8px;\n}\n\n@container (max-width: 700px) {\n .lottery-banner {\n height: auto;\n padding: var(--lottery-banner-mobile-padding, 0.5rem 0.2rem);\n }\n .lottery-banner__title {\n flex-basis: 100%;\n text-align: var(--lottery-banner-mobile-title-text-align, left);\n font-size: var(--emw--font-size-small, 0.875rem);\n }\n .lottery-banner__info {\n flex-direction: column;\n align-items: flex-start;\n gap: var(--lottery-banner-mobile-info-gap, 0.1rem);\n }\n .lottery-banner__info-item {\n font-size: var(--emw--font-size-x-small, 0.75rem);\n }\n}";
|
|
2956
2990
|
const LotteryBannerStyle0 = lotteryBannerCss;
|
|
2957
2991
|
|
|
2958
2992
|
const LotteryBanner = class {
|
|
@@ -2997,7 +3031,7 @@ const LotteryBanner = class {
|
|
|
2997
3031
|
}
|
|
2998
3032
|
async componentWillLoad() {
|
|
2999
3033
|
if (this.translationUrl) {
|
|
3000
|
-
resolveTranslationUrl$
|
|
3034
|
+
resolveTranslationUrl$4(this.translationUrl);
|
|
3001
3035
|
}
|
|
3002
3036
|
this.checkWagerStatus();
|
|
3003
3037
|
}
|
|
@@ -3033,19 +3067,20 @@ const LotteryBanner = class {
|
|
|
3033
3067
|
case 'title':
|
|
3034
3068
|
return this.bannerTitle && index.h("div", { class: `lottery-banner__title ${className}` }, this.bannerTitle);
|
|
3035
3069
|
case 'info':
|
|
3036
|
-
return (index.h("div", { class: `lottery-banner__info ${className}` }, !this.isWagerStarted ? (index.h("div", { class: "lottery-banner__info-item" }, index.h("span", { class: "lottery-banner__info-item-label" }, index.h("span", { class: "lottery-banner__info-item-label__strong" }, translate$
|
|
3070
|
+
return (index.h("div", { class: `lottery-banner__info ${className}` }, !this.isWagerStarted ? (index.h("div", { class: "lottery-banner__info-item" }, index.h("span", { class: "lottery-banner__info-item-label" }, index.h("span", { class: "lottery-banner__info-item-label__strong" }, translate$7('startIn', this.language)), "\u00A0"), index.h("helper-count-down", { class: "lottery-banner__info-item-value lottery-banner__info-item-value__strong", value: this.startTime, format: "DDD HHH mmM ssS", onCountDownFinish: this.handleCountdownFinish }))) : (index.h("div", { class: "lottery-banner__info-item" }, index.h("span", { class: "lottery-banner__info-item-label" }, index.h("span", { class: "lottery-banner__info-item-label__strong" }, translate$7('stop', this.language)), "\u00A0", translate$7('at', this.language)), index.h("span", { class: "lottery-banner__info-item-value" }, this.formattedStopTime))), this.isWagerStarted && this.turnover !== null && this.turnover !== undefined && (index.h("div", { class: "lottery-banner__info-item" }, index.h("span", { class: "lottery-banner__info-item-label" }, translate$7('turnover', this.language)), index.h("span", { class: "lottery-banner__info-item-value" }, this.turnover)))));
|
|
3037
3071
|
default:
|
|
3038
3072
|
return null;
|
|
3039
3073
|
}
|
|
3040
3074
|
}
|
|
3041
3075
|
render() {
|
|
3042
3076
|
const layoutItems = this.layout.split(',').map((item) => item.trim());
|
|
3043
|
-
return (index.h("section", { key: '
|
|
3077
|
+
return (index.h("section", { key: '8714d4136821b8afd6079da769bb9cc94149ed9d', ref: (el) => (this.stylingContainer = el), class: "lottery-banner" }, layoutItems.map((item, index) => {
|
|
3044
3078
|
const isMiddle = layoutItems.length === 3 && index === 1;
|
|
3045
3079
|
const className = isMiddle ? 'lottery-banner__item--center' : '';
|
|
3046
3080
|
return this.renderElement(item, className);
|
|
3047
3081
|
})));
|
|
3048
3082
|
}
|
|
3083
|
+
static get assetsDirs() { return ["../static"]; }
|
|
3049
3084
|
static get watchers() { return {
|
|
3050
3085
|
"clientStyling": ["handleClientStylingChange"],
|
|
3051
3086
|
"clientStylingUrl": ["handleClientStylingUrlChange"],
|
|
@@ -3056,9 +3091,9 @@ const LotteryBanner = class {
|
|
|
3056
3091
|
};
|
|
3057
3092
|
LotteryBanner.style = LotteryBannerStyle0;
|
|
3058
3093
|
|
|
3059
|
-
const DEFAULT_LANGUAGE$
|
|
3060
|
-
const SUPPORTED_LANGUAGES$
|
|
3061
|
-
const TRANSLATIONS$
|
|
3094
|
+
const DEFAULT_LANGUAGE$6 = 'en';
|
|
3095
|
+
const SUPPORTED_LANGUAGES$6 = ['ro', 'en', 'fr', 'ar', 'hr', 'zh'];
|
|
3096
|
+
const TRANSLATIONS$6 = {
|
|
3062
3097
|
en: {
|
|
3063
3098
|
loading: 'Loading'
|
|
3064
3099
|
},
|
|
@@ -3067,9 +3102,9 @@ const TRANSLATIONS$4 = {
|
|
|
3067
3102
|
ar: {},
|
|
3068
3103
|
hr: {}
|
|
3069
3104
|
};
|
|
3070
|
-
const translate$
|
|
3105
|
+
const translate$6 = (key, customLang, replacements) => {
|
|
3071
3106
|
const lang = customLang;
|
|
3072
|
-
let translation = TRANSLATIONS$
|
|
3107
|
+
let translation = TRANSLATIONS$6[lang !== undefined && SUPPORTED_LANGUAGES$6.includes(lang) ? lang : DEFAULT_LANGUAGE$6][key];
|
|
3073
3108
|
if (replacements) {
|
|
3074
3109
|
Object.keys(replacements).forEach((placeholder) => {
|
|
3075
3110
|
translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
|
|
@@ -3077,14 +3112,14 @@ const translate$4 = (key, customLang, replacements) => {
|
|
|
3077
3112
|
}
|
|
3078
3113
|
return translation;
|
|
3079
3114
|
};
|
|
3080
|
-
const getTranslations$
|
|
3115
|
+
const getTranslations$6 = (data) => {
|
|
3081
3116
|
Object.keys(data).forEach((item) => {
|
|
3082
3117
|
for (let key in data[item]) {
|
|
3083
|
-
TRANSLATIONS$
|
|
3118
|
+
TRANSLATIONS$6[item][key] = data[item][key];
|
|
3084
3119
|
}
|
|
3085
3120
|
});
|
|
3086
3121
|
};
|
|
3087
|
-
const resolveTranslationUrl$
|
|
3122
|
+
const resolveTranslationUrl$3 = async (translationUrl) => {
|
|
3088
3123
|
if (translationUrl) {
|
|
3089
3124
|
try {
|
|
3090
3125
|
const response = await fetch(translationUrl);
|
|
@@ -3092,7 +3127,7 @@ const resolveTranslationUrl$2 = async (translationUrl) => {
|
|
|
3092
3127
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
3093
3128
|
}
|
|
3094
3129
|
const translations = await response.json();
|
|
3095
|
-
getTranslations$
|
|
3130
|
+
getTranslations$6(translations);
|
|
3096
3131
|
}
|
|
3097
3132
|
catch (error) {
|
|
3098
3133
|
console.error('Failed to fetch or parse translations from URL:', error);
|
|
@@ -3170,7 +3205,7 @@ const LotteryButton = class {
|
|
|
3170
3205
|
}
|
|
3171
3206
|
componentWillLoad() {
|
|
3172
3207
|
if (this.translationUrl) {
|
|
3173
|
-
resolveTranslationUrl$
|
|
3208
|
+
resolveTranslationUrl$3(this.translationUrl);
|
|
3174
3209
|
}
|
|
3175
3210
|
}
|
|
3176
3211
|
render() {
|
|
@@ -3210,7 +3245,7 @@ const LotteryButton = class {
|
|
|
3210
3245
|
[`btn--${variant}`]: true,
|
|
3211
3246
|
[`btn--${size}`]: true,
|
|
3212
3247
|
'btn--loading': this.loading
|
|
3213
|
-
}, style: color ? buttonStyles : undefined, disabled: isDisabled, onClick: this.handleClick, ref: (el) => (this.stylingContainer = el) }, this.loading ? (index.h("div", { class: "loading-container" }, index.h("span", { class: "content" }, this.text || translate$
|
|
3248
|
+
}, style: color ? buttonStyles : undefined, disabled: isDisabled, onClick: this.handleClick, ref: (el) => (this.stylingContainer = el) }, this.loading ? (index.h("div", { class: "loading-container" }, index.h("span", { class: "content" }, this.text || translate$6('loading', this.language)), index.h("span", { class: "spinner" }))) : (index.h("span", { class: "content" }, index.h("slot", { name: "icon-left" }), this.text || index.h("slot", null), index.h("slot", { name: "icon-right" }))), index.h("div", { key: '302ea02be395bb24989d4abc040a513e23fa029a', class: "ripple-container" }, this.ripples.map((ripple, index$1) => (index.h("span", { key: index$1, class: "ripple", style: {
|
|
3214
3249
|
top: `${ripple.top}px`,
|
|
3215
3250
|
left: `${ripple.left}px`,
|
|
3216
3251
|
width: `${ripple.size}px`,
|
|
@@ -3226,21 +3261,74 @@ const LotteryButton = class {
|
|
|
3226
3261
|
};
|
|
3227
3262
|
LotteryButton.style = LotteryButtonStyle0;
|
|
3228
3263
|
|
|
3229
|
-
const
|
|
3230
|
-
|
|
3264
|
+
const generateUUID$2 = () => {
|
|
3265
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
3266
|
+
var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
|
|
3267
|
+
return v.toString(16);
|
|
3268
|
+
});
|
|
3269
|
+
};
|
|
3270
|
+
function fetchRequest$2(url, method = 'GET', body = null, headers = {}) {
|
|
3271
|
+
return new Promise((resolve, reject) => {
|
|
3272
|
+
const uuid = generateUUID$2();
|
|
3273
|
+
const headersOrigin = Object.assign({ 'Content-Type': 'application/json' }, headers);
|
|
3274
|
+
if (method !== 'GET' && method !== 'HEAD') {
|
|
3275
|
+
headersOrigin['X-Idempotency-Key'] = uuid;
|
|
3276
|
+
}
|
|
3277
|
+
const options = {
|
|
3278
|
+
method,
|
|
3279
|
+
headers: headersOrigin,
|
|
3280
|
+
body: null
|
|
3281
|
+
};
|
|
3282
|
+
if (body && method !== 'GET' && method !== 'HEAD') {
|
|
3283
|
+
options.body = JSON.stringify(body);
|
|
3284
|
+
}
|
|
3285
|
+
else {
|
|
3286
|
+
delete options.body;
|
|
3287
|
+
}
|
|
3288
|
+
fetch(url, options)
|
|
3289
|
+
.then((response) => {
|
|
3290
|
+
if (!response.ok) {
|
|
3291
|
+
return reject(response);
|
|
3292
|
+
}
|
|
3293
|
+
return response.json();
|
|
3294
|
+
})
|
|
3295
|
+
.then((data) => resolve(data))
|
|
3296
|
+
.catch((error) => reject(error));
|
|
3297
|
+
});
|
|
3298
|
+
}
|
|
3231
3299
|
|
|
3232
|
-
|
|
3300
|
+
var TicketStatus;
|
|
3301
|
+
(function (TicketStatus) {
|
|
3302
|
+
TicketStatus["PURCHASED"] = "Purchased";
|
|
3303
|
+
TicketStatus["SETTLED"] = "Settled";
|
|
3304
|
+
TicketStatus["CANCELED"] = "Canceled";
|
|
3305
|
+
TicketStatus["ERROR"] = "Error";
|
|
3306
|
+
})(TicketStatus || (TicketStatus = {}));
|
|
3307
|
+
|
|
3308
|
+
const lotteryOrderSummaryCss = ":host{width:100%}.order-summary{width:100%;background:var(--emw--color-background, #fff);border-radius:var(--lottery-order-summary-border-radius, 8px);border:var(--lottery-order-summary-border, none);box-shadow:var(--lottery-order-summary-box-shadow, none);box-sizing:border-box}.order-summary__title{margin:var(--lottery-order-summary-title-margin, 0 0 30px 0);text-align:var(--lottery-order-summary-title-text-align, center);color:var(--emw--color-typography, #000);text-transform:uppercase;font-weight:var(--lottery-order-summary-title-font-weight, 700)}.order-summary__ticket-info{display:flex;align-items:center;margin-bottom:var(--lottery-order-summary-row-gap, 16px);gap:var(--lottery-order-summary-col-gap, 10px);color:var(--emw--color-typography, #000)}.order-summary__ticket-label{display:flex;flex-direction:row;align-items:center;width:var(--lottery-order-summary-label-width, 50px);max-width:var(--lottery-order-summary-label-max-width, 100%);flex-shrink:0}.order-summary__colon{margin-left:2px}.order-summary__ticket{font-weight:var(--lottery-order-summary-label-font-weight, 500);color:var(--emw--color-typography, #000);overflow-wrap:break-word}.order-summary__details{display:flex;align-items:center;color:var(--emw--color-typography, #000);font-weight:var(--lottery-order-summary-details-font-weight, 400)}.order-summary__divider{border:none;border-top:var(--lottery-order-summary-divider-border, 1px solid var(--emw--color-gray-100, #e6e6e6));margin:var(--lottery-order-summary-divider-margin, 20px 0)}.order-summary__button-wrapper{display:flex;justify-content:center;margin:var(--lottery-order-summary-button-wrapper-margin, 0);padding:var(--lottery-order-summary-button-wrapper-padding, 0)}";
|
|
3309
|
+
const LotteryOrderSummaryStyle0 = lotteryOrderSummaryCss;
|
|
3310
|
+
|
|
3311
|
+
const LotteryOrderSummary = class {
|
|
3233
3312
|
constructor(hostRef) {
|
|
3234
3313
|
index.registerInstance(this, hostRef);
|
|
3235
|
-
this.
|
|
3314
|
+
this.orderSummarySubmit = index.createEvent(this, "orderSummarySubmit", 7);
|
|
3315
|
+
this.submitSuccess = index.createEvent(this, "lotteryTicketSubmitSuccess", 7);
|
|
3316
|
+
this.submitError = index.createEvent(this, "lotteryTicketSubmitError", 7);
|
|
3317
|
+
this.sessionExpired = index.createEvent(this, "sessionExpired", 7);
|
|
3318
|
+
this.endpoint = undefined;
|
|
3319
|
+
this.sessionId = undefined;
|
|
3236
3320
|
this.mbSource = undefined;
|
|
3237
3321
|
this.clientStyling = undefined;
|
|
3238
3322
|
this.clientStylingUrl = undefined;
|
|
3239
|
-
this.
|
|
3240
|
-
this.
|
|
3241
|
-
this.
|
|
3242
|
-
this.
|
|
3243
|
-
this.
|
|
3323
|
+
this.language = 'en';
|
|
3324
|
+
this.orderSummaryTitle = undefined;
|
|
3325
|
+
this.ticketsLabel = undefined;
|
|
3326
|
+
this.totalLabel = undefined;
|
|
3327
|
+
this.showColon = true;
|
|
3328
|
+
this.showDivider = false;
|
|
3329
|
+
this.submitDisabled = false;
|
|
3330
|
+
this.submitButtonText = undefined;
|
|
3331
|
+
this.submitLoading = false;
|
|
3244
3332
|
}
|
|
3245
3333
|
handleClientStylingChange(newValue, oldValue) {
|
|
3246
3334
|
if (newValue != oldValue) {
|
|
@@ -3267,23 +3355,77 @@ const LotteryTippingBullet = class {
|
|
|
3267
3355
|
lotteryTippingPage.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
3268
3356
|
}
|
|
3269
3357
|
}
|
|
3270
|
-
handleClick() {
|
|
3271
|
-
if (!this.disabled) {
|
|
3272
|
-
this.lotteryTippingBulletToggleEvent.emit({ positionIdx: this.positionIdx });
|
|
3273
|
-
}
|
|
3274
|
-
}
|
|
3275
3358
|
disconnectedCallback() {
|
|
3276
3359
|
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
3277
3360
|
}
|
|
3361
|
+
handleLotteryTicketParamsReady(event) {
|
|
3362
|
+
if (event.detail && this.isValidTicketSubmitParam(event.detail)) {
|
|
3363
|
+
this.handleSubmitTickets(event.detail);
|
|
3364
|
+
}
|
|
3365
|
+
else {
|
|
3366
|
+
const errorMessage = 'Invalid ticket data received before submission.';
|
|
3367
|
+
console.error(errorMessage, event.detail);
|
|
3368
|
+
this.submitError.emit({
|
|
3369
|
+
message: errorMessage,
|
|
3370
|
+
dataOrigin: event.detail,
|
|
3371
|
+
status: 400 // Bad Request
|
|
3372
|
+
});
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3375
|
+
isValidTicketSubmitParam(detail) {
|
|
3376
|
+
return (detail &&
|
|
3377
|
+
Array.isArray(detail.tickets) &&
|
|
3378
|
+
detail.tickets.length > 0 &&
|
|
3379
|
+
detail.tickets.every((ticket) => this.isValidTicketParam(ticket)));
|
|
3380
|
+
}
|
|
3381
|
+
isValidTicketParam(ticket) {
|
|
3382
|
+
return (ticket &&
|
|
3383
|
+
ticket.gameName !== undefined &&
|
|
3384
|
+
ticket.startingDrawId !== undefined &&
|
|
3385
|
+
ticket.amount !== undefined &&
|
|
3386
|
+
ticket.currency !== undefined &&
|
|
3387
|
+
ticket.selection !== undefined);
|
|
3388
|
+
}
|
|
3389
|
+
async handleSubmitTickets(body) {
|
|
3390
|
+
try {
|
|
3391
|
+
this.submitLoading = true;
|
|
3392
|
+
const res = await fetchRequest$2(`${this.endpoint}/tickets`, 'POST', body, {
|
|
3393
|
+
Authorization: `Bearer ${this.sessionId}`
|
|
3394
|
+
});
|
|
3395
|
+
if (!res.tickets.every((ticket) => ticket.state === TicketStatus.PURCHASED)) {
|
|
3396
|
+
this.submitError.emit({
|
|
3397
|
+
message: 'Failed to purchase ticket',
|
|
3398
|
+
dataOrigin: res,
|
|
3399
|
+
status: 200
|
|
3400
|
+
});
|
|
3401
|
+
}
|
|
3402
|
+
else {
|
|
3403
|
+
this.submitSuccess.emit({
|
|
3404
|
+
dataOrigin: res,
|
|
3405
|
+
status: 200
|
|
3406
|
+
});
|
|
3407
|
+
}
|
|
3408
|
+
}
|
|
3409
|
+
catch (e) {
|
|
3410
|
+
if (e.status === 401) {
|
|
3411
|
+
this.sessionExpired.emit();
|
|
3412
|
+
}
|
|
3413
|
+
if (e.status > 300 || !e.status) {
|
|
3414
|
+
this.submitError.emit({
|
|
3415
|
+
dataOrigin: e,
|
|
3416
|
+
status: e.status || 0
|
|
3417
|
+
});
|
|
3418
|
+
}
|
|
3419
|
+
}
|
|
3420
|
+
finally {
|
|
3421
|
+
this.submitLoading = false;
|
|
3422
|
+
}
|
|
3423
|
+
}
|
|
3424
|
+
handleSubmit() {
|
|
3425
|
+
this.orderSummarySubmit.emit();
|
|
3426
|
+
}
|
|
3278
3427
|
render() {
|
|
3279
|
-
return (index.h("div", { key: '
|
|
3280
|
-
LotteryTippingBullet__segment: true,
|
|
3281
|
-
'LotteryTippingBullet__segment--text': true
|
|
3282
|
-
} }, this.value)) : (index.h("button", { class: {
|
|
3283
|
-
LotteryTippingBullet__segment: true,
|
|
3284
|
-
'LotteryTippingBullet__segment--disabled': this.disabled,
|
|
3285
|
-
'LotteryTippingBullet__segment--active': this.isSelected
|
|
3286
|
-
}, onClick: this.handleClick.bind(this) }, this.isSelected ? 'X' : this.value))));
|
|
3428
|
+
return (index.h("div", { key: 'bdab321b9336f47e16057d240b3226d7cba59b97', ref: (el) => (this.stylingContainer = el) }, index.h("div", { key: 'de7ffcc9f96d8c7cfc7bdb3a3c7225ee78c33483', class: "order-summary" }, index.h("h3", { key: '9500cd69a6eba0855d4981cdad8eaa91b9c98567', class: "order-summary__title" }, this.orderSummaryTitle), index.h("div", { key: 'ce29c82eef1d12bc63e94e4fa2d5474700860af2', class: "order-summary__ticket" }, index.h("div", { key: '9db79da17590c7f847f46c3b3b66489ea9a0e268', class: "order-summary__ticket-info" }, index.h("div", { key: '4b5a2df807aeb421cf3c1ebf33f410a92f39ccaf', class: "order-summary__ticket-label" }, index.h("div", { key: 'feb73e9f849d2e3d6b77e4c848657f27e6a82323', class: "order-summary__ticket" }, this.ticketsLabel), index.h("span", { key: '51f70dcdda2154d8ce97d8e1a7c0f61a6198afbb', class: "order-summary__colon" }, this.showColon ? ':' : null)), index.h("div", { key: '4fed2d63cd7a881c8844055fe1fde99c8c7aa9fb', class: "order-summary__details" }, index.h("slot", { key: '6a7969738546ee4aca81a075f6174556e78d2c31', name: "orderSummaryTicketDetail" }))), this.showDivider && index.h("hr", { key: '029803fa93960d5098a24d5ca18e77e14562b29f', class: "order-summary__divider" }), index.h("div", { key: '738096c5b605a97851dbf24a972d93d9533ad48b', class: "order-summary__ticket-info" }, index.h("div", { key: 'acd8a7f3e64c97f58c79f57a90143151c996abf8', class: "order-summary__ticket-label" }, index.h("div", { key: '44e6b29978ca4fc2b22ca9d95ee4facfc883f292', class: "order-summary__ticket" }, this.totalLabel), index.h("span", { key: '330a00a4b39e578a1b0d80211d2b68d44c5235c9', class: "order-summary__colon" }, this.showColon ? ':' : null)), index.h("span", { key: '294046815a62a80366458aade4ec5d5476577a93', class: "order-summary__details" }, index.h("slot", { key: '02d129ef0caf523ec0c9da34318df46d3b008376', name: "orderSummaryTotalDetail" })))), index.h("slot", { key: '9395396883f0594ad8db216a9aa9fa0aeff45c10', name: "orderSummaryChoice" }), index.h("div", { key: '462672abc490cde00fea90ea585f48875ca2ec47', class: "order-summary__button-wrapper" }, index.h("lottery-button", { key: '1885bee3570ce6b58d4ae1977c635f418485fdbe', onClick: this.handleSubmit.bind(this), loading: this.submitLoading, disabled: this.submitDisabled, text: this.submitButtonText })))));
|
|
3287
3429
|
}
|
|
3288
3430
|
static get watchers() { return {
|
|
3289
3431
|
"clientStyling": ["handleClientStylingChange"],
|
|
@@ -3291,109 +3433,66 @@ const LotteryTippingBullet = class {
|
|
|
3291
3433
|
"mbSource": ["handleMbSourceChange"]
|
|
3292
3434
|
}; }
|
|
3293
3435
|
};
|
|
3294
|
-
|
|
3436
|
+
LotteryOrderSummary.style = LotteryOrderSummaryStyle0;
|
|
3295
3437
|
|
|
3296
|
-
const
|
|
3297
|
-
const
|
|
3438
|
+
const lotterySegmentedCss = ":host{display:block}.wrapper{display:flex;align-items:center;gap:8px}.label{font-size:16px;color:var(--emw-segmented-label-color, #333);font-weight:500}.segmented-container{display:inline-flex;position:relative;background-color:var(--emw-segmented-bg, #f0f0f0);border-radius:20px;box-shadow:inset 0 1px 3px rgba(0, 0, 0, 0.1)}.option{position:relative;z-index:1;border:none;background-color:transparent;padding:12px 18px;cursor:pointer;font-size:14px;font-weight:500;color:var(--emw-segmented-text-color, #555);transition:color 0.3s ease;white-space:nowrap}.option.active{color:var(--emw-segmented-active-text-color, #000);font-weight:bold}.active-indicator{position:absolute;z-index:0;top:2px;bottom:2px;background-color:var(--emw-segmented-active-bg, #fff);border-radius:22px;box-shadow:0 2px 4px rgba(0, 0, 0, 0.15);transition:transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1)}";
|
|
3439
|
+
const LotterySegmentedStyle0 = lotterySegmentedCss;
|
|
3298
3440
|
|
|
3299
|
-
const
|
|
3441
|
+
const LotterySegmented = class {
|
|
3300
3442
|
constructor(hostRef) {
|
|
3301
3443
|
index.registerInstance(this, hostRef);
|
|
3302
|
-
this.
|
|
3303
|
-
this.
|
|
3304
|
-
this.
|
|
3305
|
-
this.
|
|
3306
|
-
this.
|
|
3307
|
-
this.theme = 'default';
|
|
3308
|
-
this.mode = 'single';
|
|
3309
|
-
this.bulletConfigContent = '';
|
|
3310
|
-
}
|
|
3311
|
-
get bulletConfigArr() {
|
|
3312
|
-
const defaultConfig = [
|
|
3313
|
-
{
|
|
3314
|
-
value: '1'
|
|
3315
|
-
},
|
|
3316
|
-
{
|
|
3317
|
-
value: 'X'
|
|
3318
|
-
},
|
|
3319
|
-
{
|
|
3320
|
-
value: '2'
|
|
3321
|
-
}
|
|
3322
|
-
];
|
|
3323
|
-
if (typeof this.bulletConfigContent === 'string' && this.bulletConfigContent) {
|
|
3324
|
-
try {
|
|
3325
|
-
const _temp = JSON.parse(this.bulletConfigContent);
|
|
3326
|
-
return _temp;
|
|
3327
|
-
}
|
|
3328
|
-
catch (e) {
|
|
3329
|
-
console.error('Error parsing bulletConfigContent:', e);
|
|
3330
|
-
return defaultConfig;
|
|
3331
|
-
}
|
|
3332
|
-
}
|
|
3333
|
-
else {
|
|
3334
|
-
return defaultConfig;
|
|
3335
|
-
}
|
|
3336
|
-
}
|
|
3337
|
-
handleClientStylingChange(newValue, oldValue) {
|
|
3338
|
-
if (newValue != oldValue) {
|
|
3339
|
-
lotteryTippingPage.setClientStyling(this.stylingContainer, this.clientStyling);
|
|
3340
|
-
}
|
|
3444
|
+
this.valueChange = index.createEvent(this, "valueChange", 7);
|
|
3445
|
+
this.optionRefs = [];
|
|
3446
|
+
this.label = undefined;
|
|
3447
|
+
this.options = [];
|
|
3448
|
+
this.value = undefined;
|
|
3341
3449
|
}
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
lotteryTippingPage.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
3345
|
-
}
|
|
3450
|
+
handleValueChange() {
|
|
3451
|
+
this.updateActiveIndicator();
|
|
3346
3452
|
}
|
|
3347
|
-
|
|
3348
|
-
if (
|
|
3349
|
-
|
|
3453
|
+
componentWillLoad() {
|
|
3454
|
+
if (!this.value && this.options.length > 0) {
|
|
3455
|
+
// Default to the first option if no value is provided
|
|
3456
|
+
this.value = this.options[0].value;
|
|
3350
3457
|
}
|
|
3351
3458
|
}
|
|
3352
3459
|
componentDidLoad() {
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
lotteryTippingPage.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
3356
|
-
if (this.clientStyling)
|
|
3357
|
-
lotteryTippingPage.setClientStyling(this.stylingContainer, this.clientStyling);
|
|
3358
|
-
if (this.clientStylingUrl)
|
|
3359
|
-
lotteryTippingPage.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
3360
|
-
}
|
|
3460
|
+
// Use requestAnimationFrame to ensure layout is calculated
|
|
3461
|
+
requestAnimationFrame(() => this.updateActiveIndicator());
|
|
3361
3462
|
}
|
|
3362
|
-
|
|
3363
|
-
this.
|
|
3364
|
-
}
|
|
3365
|
-
lotteryTippingBulletSelectionHandler(event) {
|
|
3366
|
-
const { positionIdx } = event.detail;
|
|
3367
|
-
this.handleToggle(positionIdx);
|
|
3463
|
+
handleWindowResize() {
|
|
3464
|
+
this.updateActiveIndicator();
|
|
3368
3465
|
}
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
if (this.
|
|
3372
|
-
|
|
3373
|
-
newConfigArr = newConfigArr.map((item) => (Object.assign(Object.assign({}, item), { isSelected: false })));
|
|
3374
|
-
newConfigArr[index].isSelected = true;
|
|
3466
|
+
updateActiveIndicator() {
|
|
3467
|
+
const selectedIndex = this.options.findIndex((opt) => opt.value === this.value);
|
|
3468
|
+
if (selectedIndex === -1 || !this.activeIndicator || !this.optionRefs[selectedIndex]) {
|
|
3469
|
+
return;
|
|
3375
3470
|
}
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3471
|
+
const selectedOptionEl = this.optionRefs[selectedIndex];
|
|
3472
|
+
const containerEl = this.activeIndicator.parentElement;
|
|
3473
|
+
const containerRect = containerEl.getBoundingClientRect();
|
|
3474
|
+
const optionRect = selectedOptionEl.getBoundingClientRect();
|
|
3475
|
+
this.activeIndicator.style.transform = `translateX(${optionRect.left - containerRect.left}px)`;
|
|
3476
|
+
this.activeIndicator.style.width = `${optionRect.width}px`;
|
|
3477
|
+
}
|
|
3478
|
+
onOptionClick(optionValue) {
|
|
3479
|
+
if (this.value !== optionValue) {
|
|
3480
|
+
this.valueChange.emit(optionValue);
|
|
3380
3481
|
}
|
|
3381
|
-
this.lotteryTippingBulletGroupToggleEvent.emit({
|
|
3382
|
-
bulletConfigArr: newConfigArr,
|
|
3383
|
-
positionIdx: this.positionIdx + '-' + index
|
|
3384
|
-
});
|
|
3385
3482
|
}
|
|
3386
3483
|
render() {
|
|
3387
|
-
|
|
3388
|
-
return (index.h("div", { ref: (el) => (this.stylingContainer = el), key: this.positionIdx }, index.h("div", { key: '68223022eed831932c571378164be913206d98e9', style: { display: 'flex', flexDirection: 'row', gap: '10px' } }, (_a = this.bulletConfigArr) === null || _a === void 0 ? void 0 : _a.map((item, index$1) => (index.h("div", { key: index$1 }, index.h("lottery-tipping-bullet", { value: item.value, isSelected: item.isSelected, "position-idx": index$1, disabled: item.disabled, theme: this.theme, clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, mbSource: this.mbSource })))))));
|
|
3484
|
+
return (index.h("div", { key: '675f17d5fd8ddef56324416fda27ffd130ddafa3', class: "wrapper" }, this.label && index.h("label", { key: 'd6dfc897e2014a7ce57cc4ddca57b1e6173eb1a5', class: "label" }, this.label), index.h("div", { key: 'e89097f2a9536ada1e0edf52e0d50cdd8f88c52e', class: "segmented-container" }, index.h("div", { key: 'f720dc7b9b8957cb6d363fd6a2313978eba6988e', class: "active-indicator", ref: (el) => (this.activeIndicator = el) }), this.options.map((option, index$1) => (index.h("button", { class: { option: true, active: this.value === option.value }, onClick: () => this.onOptionClick(option.value), ref: (el) => (this.optionRefs[index$1] = el) }, option.label))))));
|
|
3389
3485
|
}
|
|
3486
|
+
get host() { return index.getElement(this); }
|
|
3390
3487
|
static get watchers() { return {
|
|
3391
|
-
"
|
|
3392
|
-
"clientStylingUrl": ["handleClientStylingUrlChange"],
|
|
3393
|
-
"mbSource": ["handleMbSourceChange"]
|
|
3488
|
+
"value": ["handleValueChange"]
|
|
3394
3489
|
}; }
|
|
3395
3490
|
};
|
|
3396
|
-
|
|
3491
|
+
LotterySegmented.style = LotterySegmentedStyle0;
|
|
3492
|
+
|
|
3493
|
+
// This icon file is generated automatically.
|
|
3494
|
+
var DeleteFilled = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M864 256H736v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zm-200 0H360v-72h304v72z" } }] }, "name": "delete", "theme": "filled" };
|
|
3495
|
+
const DeleteFilled$1 = DeleteFilled;
|
|
3397
3496
|
|
|
3398
3497
|
// This icon file is generated automatically.
|
|
3399
3498
|
var DeleteOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z" } }] }, "name": "delete", "theme": "outlined" };
|
|
@@ -3468,41 +3567,1140 @@ function renderAbstractNodeToSVGElement(node, options) {
|
|
|
3468
3567
|
return "<".concat(node.tag).concat(attrsToken, " />");
|
|
3469
3568
|
}
|
|
3470
3569
|
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3570
|
+
// Basic sanitization method for SVG content
|
|
3571
|
+
// This is NOT a complete XSS prevention for SVG, but prevents common attacks.
|
|
3572
|
+
function sanitizeSvg(svgString) {
|
|
3573
|
+
let sanitized = svgString.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, ''); // Remove <script> tags
|
|
3574
|
+
sanitized = sanitized.replace(/on[a-z]+=[\"'][^\"']*[\"']/gi, ''); // Remove on* attributes
|
|
3575
|
+
sanitized = sanitized.replace(/javascript:/gi, ''); // Remove javascript: URLs
|
|
3576
|
+
return sanitized;
|
|
3577
|
+
}
|
|
3578
|
+
|
|
3579
|
+
const lotterySelectionCss = ":host{display:inline-block}.lottery-selection__button{display:flex;align-items:center;justify-content:center;width:var(--lottery-selection-width, 32px);height:var(--lottery-selection-height, 32px);padding:var(--lottery-selection-padding, 0);box-sizing:border-box;background:var(--lottery-selection-background, var(--emw--color-background, #fff));border:var(--lottery-selection-border-width, 2px) var(--lottery-selection-border-style, solid) var(--lottery-selection-border-color, var(--emw--color-primary, #0d196e));border-radius:var(--lottery-selection-border-radius, var(--emw--border-radius-medium, 8px));color:var(--lottery-selection-color, var(--emw--color-typography, #000));font-weight:var(--lottery-selection-font-weight, bold);font-size:var(--lottery-selection-font-size, 1em);cursor:pointer;user-select:none;}.lottery-selection__button:hover{background:var(--lottery-selection-hover-background, var(--emw--color-background, #fff));border-color:var(--lottery-selection-hover-border-color, var(--emw--color-primary, #0d196e));color:var(--lottery-selection-hover-color, var(--emw--color-typography, #000))}.lottery-selection__button .lottery-selection__delete-icon{display:none}.lottery-selection__button.isDeleteByIcon:hover .lottery-selection__text{display:none}.lottery-selection__button.isDeleteByIcon:hover .lottery-selection__delete-icon{display:flex;align-items:center;justify-content:center;fill:var(--lottery-selection-delete-icon-color, var(--emw--color-typography, #000));vertical-align:middle}.lottery-selection__button.lottery-selection__button--selected{background-color:var(--lottery-selection-selected-background, var(--emw--color-primary, #0d196e));border-color:var(--lottery-selection-selected-border-color, var(--emw--color-primary, #0d196e));color:var(--lottery-selection-selected-color, var(--emw--color-typography-inverse, #fff))}.lottery-selection__button.lottery-selection__button--disabled{background-color:var(--lottery-selection-disabled-background, var(--emw--color-gray-50, #f5f5f5));border-color:var(--lottery-selection-disabled-border-color, var(--emw--color-gray-100, #e6e6e6));color:var(--lottery-selection-disabled-color, var(--emw--color-gray-150, #6f6f6f));cursor:not-allowed;pointer-events:none;}.lottery-selection__button.lottery-selection__button--no-border{border:none}.lottery-selection__button.lottery-selection__button--no-background{background:transparent}";
|
|
3580
|
+
const LotterySelectionStyle0 = lotterySelectionCss;
|
|
3581
|
+
|
|
3582
|
+
const LotterySelection = class {
|
|
3583
|
+
constructor(hostRef) {
|
|
3584
|
+
index.registerInstance(this, hostRef);
|
|
3585
|
+
this.lotteryBulletClickHandler = index.createEvent(this, "lotteryBulletClick", 7);
|
|
3586
|
+
this.value = 0;
|
|
3587
|
+
this.text = undefined;
|
|
3588
|
+
this.idx = undefined;
|
|
3589
|
+
this.type = 'toggle';
|
|
3590
|
+
this.mbSource = undefined;
|
|
3591
|
+
this.clientStyling = undefined;
|
|
3592
|
+
this.clientStylingUrl = undefined;
|
|
3593
|
+
this.hasBorder = true;
|
|
3594
|
+
this.hasBackground = true;
|
|
3595
|
+
this.deleteIconSvg = '';
|
|
3596
|
+
this.deleteIconWidth = '16px';
|
|
3597
|
+
this.deleteIconHeight = '16px';
|
|
3493
3598
|
}
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
return TRANSLATIONS$3[lang !== undefined && SUPPORTED_LANGUAGES$3.includes(lang) ? lang : DEFAULT_LANGUAGE$3][key];
|
|
3498
|
-
};
|
|
3499
|
-
const getTranslations$3 = (data) => {
|
|
3500
|
-
Object.keys(data).forEach((item) => {
|
|
3501
|
-
for (let key in data[item]) {
|
|
3502
|
-
TRANSLATIONS$3[item][key] = data[item][key];
|
|
3599
|
+
handleClientStylingChange(newValue, oldValue) {
|
|
3600
|
+
if (newValue !== oldValue) {
|
|
3601
|
+
lotteryTippingPage.setClientStyling(this.stylingContainer, this.clientStyling);
|
|
3503
3602
|
}
|
|
3504
|
-
}
|
|
3505
|
-
|
|
3603
|
+
}
|
|
3604
|
+
handleClientStylingUrlChange(newValue, oldValue) {
|
|
3605
|
+
if (newValue !== oldValue) {
|
|
3606
|
+
lotteryTippingPage.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
3607
|
+
}
|
|
3608
|
+
}
|
|
3609
|
+
handleMbSourceChange(newValue, oldValue) {
|
|
3610
|
+
if (newValue !== oldValue) {
|
|
3611
|
+
lotteryTippingPage.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
3612
|
+
}
|
|
3613
|
+
}
|
|
3614
|
+
componentDidLoad() {
|
|
3615
|
+
if (this.stylingContainer) {
|
|
3616
|
+
if (this.mbSource)
|
|
3617
|
+
lotteryTippingPage.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
3618
|
+
if (this.clientStyling)
|
|
3619
|
+
lotteryTippingPage.setClientStyling(this.stylingContainer, this.clientStyling);
|
|
3620
|
+
if (this.clientStylingUrl)
|
|
3621
|
+
lotteryTippingPage.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
3622
|
+
}
|
|
3623
|
+
}
|
|
3624
|
+
disconnectedCallback() {
|
|
3625
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
3626
|
+
}
|
|
3627
|
+
handleClick() {
|
|
3628
|
+
if (this.type === 'disabled' || this.type === 'readonly') {
|
|
3629
|
+
return;
|
|
3630
|
+
}
|
|
3631
|
+
console.log('bullet clicked', this.type, this.idx, this.text, this.value);
|
|
3632
|
+
this.lotteryBulletClickHandler.emit({
|
|
3633
|
+
type: this.type,
|
|
3634
|
+
idx: this.idx,
|
|
3635
|
+
text: this.text,
|
|
3636
|
+
value: this.value
|
|
3637
|
+
});
|
|
3638
|
+
}
|
|
3639
|
+
render() {
|
|
3640
|
+
let iconToRender;
|
|
3641
|
+
if (this.deleteIconSvg) {
|
|
3642
|
+
iconToRender = sanitizeSvg(this.deleteIconSvg);
|
|
3643
|
+
}
|
|
3644
|
+
else {
|
|
3645
|
+
iconToRender = renderIconDefinitionToSVGElement(DeleteFilled$1, {
|
|
3646
|
+
extraSVGAttrs: {
|
|
3647
|
+
width: this.deleteIconWidth,
|
|
3648
|
+
height: this.deleteIconHeight,
|
|
3649
|
+
fill: 'currentColor'
|
|
3650
|
+
}
|
|
3651
|
+
});
|
|
3652
|
+
}
|
|
3653
|
+
return (index.h("div", { key: '0d1e8aaa80a907a7467410f6b27b4b6175e82299', class: "lottery-selection", ref: (el) => (this.stylingContainer = el) }, index.h("button", { key: '11a2402abbc290dc877ad95f3433092c3a0d8419', class: {
|
|
3654
|
+
'lottery-selection__button': true,
|
|
3655
|
+
'lottery-selection__button--selected': this.value == 1,
|
|
3656
|
+
'lottery-selection__button--disabled': this.type === 'disabled',
|
|
3657
|
+
'lottery-selection__button--no-border': !this.hasBorder,
|
|
3658
|
+
'lottery-selection__button--no-background': !this.hasBackground,
|
|
3659
|
+
isDeleteByIcon: this.type === 'delete',
|
|
3660
|
+
isCallDialogBtn: this.type === 'input' || this.type === 'readonly'
|
|
3661
|
+
}, onClick: this.handleClick.bind(this), disabled: this.type === 'disabled' }, this.type === 'delete' && index.h("span", { key: 'f99001d936a8f7bdf8adc5c46e82caf730a9442a', class: "lottery-selection__delete-icon", innerHTML: iconToRender }), index.h("span", { key: '55775e2492a1fe45cc8a457ac0a0d206744461ab', class: "lottery-selection__text" }, this.text))));
|
|
3662
|
+
}
|
|
3663
|
+
static get watchers() { return {
|
|
3664
|
+
"clientStyling": ["handleClientStylingChange"],
|
|
3665
|
+
"clientStylingUrl": ["handleClientStylingUrlChange"],
|
|
3666
|
+
"mbSource": ["handleMbSourceChange"]
|
|
3667
|
+
}; }
|
|
3668
|
+
};
|
|
3669
|
+
LotterySelection.style = LotterySelectionStyle0;
|
|
3670
|
+
|
|
3671
|
+
const DEFAULT_LANGUAGE$5 = 'en';
|
|
3672
|
+
const SUPPORTED_LANGUAGES$5 = ['ro', 'en', 'fr', 'ar', 'hr', 'zh'];
|
|
3673
|
+
const TRANSLATIONS$5 = {
|
|
3674
|
+
en: {
|
|
3675
|
+
noTicketBoard: 'No ticket board available.',
|
|
3676
|
+
selectionCleared: 'Your selection has been cleared.',
|
|
3677
|
+
clearAll: 'Clear All',
|
|
3678
|
+
stopAt: 'Stop at',
|
|
3679
|
+
turnover: 'Turnover: ',
|
|
3680
|
+
pleaseFillIn: 'Please fill in all the selection input!',
|
|
3681
|
+
fillIn: 'Fill in',
|
|
3682
|
+
noBets: 'Sorry. No bets have been placed so far. Check back later!',
|
|
3683
|
+
search: 'Search',
|
|
3684
|
+
clear: 'Clear',
|
|
3685
|
+
oddsChart: 'Odds Chart',
|
|
3686
|
+
ticketSuccess: 'Ticket purchased successfully.',
|
|
3687
|
+
stakePerLine: 'Stake per Line:',
|
|
3688
|
+
lowestOdds: 'Lowest Odds:',
|
|
3689
|
+
highestOdds: 'Highest Odds:',
|
|
3690
|
+
orderSummary: 'ORDER SUMMARY',
|
|
3691
|
+
ticket: 'Ticket',
|
|
3692
|
+
lines: 'Lines',
|
|
3693
|
+
total: 'Total',
|
|
3694
|
+
submit: 'Submit',
|
|
3695
|
+
loading: 'Loading',
|
|
3696
|
+
enterValidNumber: 'Please enter a valid number.',
|
|
3697
|
+
enterNumberBetween: 'Please enter a number between {min} and {max}.',
|
|
3698
|
+
numberAlreadySelected: 'This number has already been selected.',
|
|
3699
|
+
enterScoreUpTo: 'Please enter the score (Up to {maxScore})',
|
|
3700
|
+
enterValue: 'Please enter a value',
|
|
3701
|
+
myChoices: 'My Choices',
|
|
3702
|
+
teams: 'Teams',
|
|
3703
|
+
scores: 'Scores',
|
|
3704
|
+
euro: 'Euro',
|
|
3705
|
+
cancel: 'Cancel',
|
|
3706
|
+
confirm: 'Confirm'
|
|
3707
|
+
},
|
|
3708
|
+
ro: {},
|
|
3709
|
+
fr: {},
|
|
3710
|
+
ar: {},
|
|
3711
|
+
hr: {}
|
|
3712
|
+
};
|
|
3713
|
+
const translate$5 = (key, customLang, replacements) => {
|
|
3714
|
+
const lang = customLang;
|
|
3715
|
+
let translation = TRANSLATIONS$5[lang !== undefined && SUPPORTED_LANGUAGES$5.includes(lang) ? lang : DEFAULT_LANGUAGE$5][key];
|
|
3716
|
+
if (replacements) {
|
|
3717
|
+
Object.keys(replacements).forEach((placeholder) => {
|
|
3718
|
+
translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
|
|
3719
|
+
});
|
|
3720
|
+
}
|
|
3721
|
+
return translation;
|
|
3722
|
+
};
|
|
3723
|
+
const getTranslations$5 = (data) => {
|
|
3724
|
+
Object.keys(data).forEach((item) => {
|
|
3725
|
+
for (let key in data[item]) {
|
|
3726
|
+
TRANSLATIONS$5[item][key] = data[item][key];
|
|
3727
|
+
}
|
|
3728
|
+
});
|
|
3729
|
+
};
|
|
3730
|
+
|
|
3731
|
+
function getBulletTextsSet(bulletTexts, splitToken) {
|
|
3732
|
+
return new Set(bulletTexts ? bulletTexts.split(splitToken) : []);
|
|
3733
|
+
}
|
|
3734
|
+
function validateInput({ value, selectedSet, maxValue, minValue, language, type = 'integer' }) {
|
|
3735
|
+
const trimmedValue = value.trim();
|
|
3736
|
+
if (type === 'integer') {
|
|
3737
|
+
// Strict integer check
|
|
3738
|
+
if (!/^-?\d+$/.test(trimmedValue)) {
|
|
3739
|
+
return {
|
|
3740
|
+
valid: false,
|
|
3741
|
+
errorMessage: translate$5('enterValidNumber', language),
|
|
3742
|
+
value
|
|
3743
|
+
};
|
|
3744
|
+
}
|
|
3745
|
+
const numValue = Number(trimmedValue);
|
|
3746
|
+
if (isNaN(numValue)) {
|
|
3747
|
+
return {
|
|
3748
|
+
valid: false,
|
|
3749
|
+
errorMessage: translate$5('enterValidNumber', language),
|
|
3750
|
+
value
|
|
3751
|
+
};
|
|
3752
|
+
}
|
|
3753
|
+
if ((minValue !== undefined && numValue < minValue) || (maxValue !== undefined && numValue > maxValue)) {
|
|
3754
|
+
return {
|
|
3755
|
+
valid: false,
|
|
3756
|
+
errorMessage: translate$5('enterNumberBetween', language, {
|
|
3757
|
+
min: minValue,
|
|
3758
|
+
max: maxValue
|
|
3759
|
+
}),
|
|
3760
|
+
value
|
|
3761
|
+
};
|
|
3762
|
+
}
|
|
3763
|
+
// Normalize value (e.g. "05" -> "5") for set check
|
|
3764
|
+
const normalizedValue = String(numValue);
|
|
3765
|
+
if (selectedSet.has(normalizedValue)) {
|
|
3766
|
+
return {
|
|
3767
|
+
valid: false,
|
|
3768
|
+
errorMessage: translate$5('numberAlreadySelected', language),
|
|
3769
|
+
value
|
|
3770
|
+
};
|
|
3771
|
+
}
|
|
3772
|
+
}
|
|
3773
|
+
else {
|
|
3774
|
+
// Text mode validation
|
|
3775
|
+
if (selectedSet.has(trimmedValue)) {
|
|
3776
|
+
return {
|
|
3777
|
+
valid: false,
|
|
3778
|
+
errorMessage: translate$5('numberAlreadySelected', language), // Or generic 'alreadySelected' if available, but reusing key for now
|
|
3779
|
+
value
|
|
3780
|
+
};
|
|
3781
|
+
}
|
|
3782
|
+
}
|
|
3783
|
+
return {
|
|
3784
|
+
valid: true,
|
|
3785
|
+
errorMessage: '',
|
|
3786
|
+
value
|
|
3787
|
+
};
|
|
3788
|
+
}
|
|
3789
|
+
function removeBulletTexts(text, selectedArr) {
|
|
3790
|
+
return selectedArr.filter((s) => s !== text);
|
|
3791
|
+
}
|
|
3792
|
+
function addSelectedBulletTexts(text, selectedArr) {
|
|
3793
|
+
return selectedArr.concat([text]);
|
|
3794
|
+
}
|
|
3795
|
+
function removeAndAddSelectedBulletTexts(text, selectedArr, maxSelectedCount) {
|
|
3796
|
+
return selectedArr.slice(selectedArr.length - (maxSelectedCount - 1)).concat([text]);
|
|
3797
|
+
}
|
|
3798
|
+
function buildSelectedBulletTextsArr(item, selectedArr, maxSelectedCount) {
|
|
3799
|
+
if (item.type === 'delete') {
|
|
3800
|
+
return removeBulletTexts(item.text, selectedArr);
|
|
3801
|
+
}
|
|
3802
|
+
if (item.type === 'toggle') {
|
|
3803
|
+
if (selectedArr.includes(item.text)) {
|
|
3804
|
+
return removeBulletTexts(item.text, selectedArr);
|
|
3805
|
+
}
|
|
3806
|
+
if (selectedArr.length >= maxSelectedCount) {
|
|
3807
|
+
return removeAndAddSelectedBulletTexts(item.text, selectedArr, maxSelectedCount);
|
|
3808
|
+
}
|
|
3809
|
+
return addSelectedBulletTexts(item.text, selectedArr);
|
|
3810
|
+
}
|
|
3811
|
+
return [];
|
|
3812
|
+
}
|
|
3813
|
+
|
|
3814
|
+
const lotterySelectionGroupCss = ":host {\n width: 100%;\n}\n\n.lottery-selection-group {\n container-type: inline-size;\n padding: var(--lottery-selection-group-padding, 0);\n background: var(--lottery-selection-group-background, transparent);\n border: var(--lottery-selection-group-border, none);\n border-radius: var(--lottery-selection-group-border-radius, 0);\n}\n.lottery-selection-group__item {\n display: flex;\n flex-direction: var(--lottery-selection-group-flex-direction, row);\n align-items: var(--lottery-selection-group-item-align, center);\n justify-content: var(--lottery-selection-group-item-justify, flex-start);\n gap: var(--lottery-selection-group-item-gap, 16px);\n width: 100%;\n}\n.lottery-selection-group__item--left {\n width: var(--lottery-selection-group-label-width, 130px);\n min-width: var(--lottery-selection-group-label-min-width, auto);\n max-width: var(--lottery-selection-group-label-max-width, none);\n color: var(--lottery-selection-group-label-color, var(--emw--color-typography, #000));\n font-size: var(--lottery-selection-group-label-font-size, 1em);\n font-weight: var(--lottery-selection-group-label-font-weight, bold);\n text-align: var(--lottery-selection-group-label-align, left);\n white-space: var(--lottery-selection-group-label-white-space, normal);\n}\n.lottery-selection-group__item--right {\n flex: 1;\n display: flex;\n flex-wrap: var(--lottery-selection-group-bullets-wrap, wrap); /* Allow items to wrap */\n gap: var(--lottery-selection-group-bullets-gap, 8px); /* Gap between bullets */\n align-items: var(--lottery-selection-group-bullets-align, center);\n justify-content: var(--lottery-selection-group-bullets-justify, flex-start); /* Align bullets to start */\n}\n@container (max-width: 320px) {\n .lottery-selection-group__item--left {\n width: 100px;\n max-width: 100px;\n }\n}\n\n.dialog-input {\n width: 100%;\n padding: var(--lottery-selection-group-input-padding, 8px);\n border: var(--lottery-selection-group-input-border-width, 1px) var(--lottery-selection-group-input-border-style, solid) var(--lottery-selection-group-input-border-color, var(--emw--color-gray-100, #e6e6e6));\n border-radius: var(--lottery-selection-group-input-radius, 4px);\n background-color: var(--lottery-selection-group-input-bg, #fff);\n color: var(--lottery-selection-group-input-color, #000);\n box-sizing: border-box;\n margin-top: var(--lottery-selection-group-input-margin-top, 10px);\n font-size: var(--lottery-selection-group-input-font-size, 1em);\n}\n.dialog-input::placeholder {\n color: var(--lottery-selection-group-input-placeholder-color, #999);\n}\n\n.dialog-input.invalid,\n.dialog-input.invalid:focus {\n border-color: var(--emw--color-error, #ff3d00);\n outline-color: var(--emw--color-error, #ff3d00);\n}\n\n.error-message {\n color: var(--lottery-selection-group-error-color, var(--emw--color-error, #ff3d00));\n font-size: var(--lottery-selection-group-error-font-size, 12px);\n font-weight: var(--lottery-selection-group-error-font-weight, normal);\n margin-top: 4px;\n}\n\n.addSelectionDialog-title {\n color: var(--lottery-selection-group-dialog-title-color, var(--emw--color-typography, #000));\n font-size: var(--lottery-selection-group-dialog-title-font-size, 1.2em);\n font-weight: var(--lottery-selection-group-dialog-title-font-weight, bold);\n margin-bottom: var(--lottery-selection-group-dialog-title-margin-bottom, 0);\n}\n.addSelectionDialog-footer {\n display: flex;\n justify-content: var(--lottery-selection-group-dialog-footer-justify, flex-end);\n gap: var(--lottery-selection-group-dialog-footer-gap, 18px);\n margin-top: var(--lottery-selection-group-dialog-footer-margin-top, 0);\n}";
|
|
3815
|
+
const LotterySelectionGroupStyle0 = lotterySelectionGroupCss;
|
|
3816
|
+
|
|
3817
|
+
const LotterySelectionGroup = class {
|
|
3818
|
+
constructor(hostRef) {
|
|
3819
|
+
index.registerInstance(this, hostRef);
|
|
3820
|
+
this.bulletGroupUpdateSelectedBulletTexts = index.createEvent(this, "bulletGroupUpdateSelection", 7);
|
|
3821
|
+
this.mbSource = undefined;
|
|
3822
|
+
this.clientStyling = undefined;
|
|
3823
|
+
this.clientStylingUrl = undefined;
|
|
3824
|
+
this.language = 'en';
|
|
3825
|
+
this.translationUrl = '';
|
|
3826
|
+
this.splitToken = ',';
|
|
3827
|
+
this.selectionGroupId = undefined;
|
|
3828
|
+
this.selectionGroupLabel = undefined;
|
|
3829
|
+
this.type = 'bet';
|
|
3830
|
+
this.selectedBulletTexts = null;
|
|
3831
|
+
this.maxSelectedCount = null;
|
|
3832
|
+
this.maxDisplayBulletsCount = 11;
|
|
3833
|
+
this.bulletTexts = null;
|
|
3834
|
+
this.maxIntegerBulletText = null;
|
|
3835
|
+
this.minIntegerBulletText = 0;
|
|
3836
|
+
this.bulletTextType = 'integer';
|
|
3837
|
+
this.hasBorder = true;
|
|
3838
|
+
this.hasBackground = true;
|
|
3839
|
+
this.dialogTitle = undefined;
|
|
3840
|
+
this.dialogInputPlaceholder = undefined;
|
|
3841
|
+
this.disabledBulletTexts = '';
|
|
3842
|
+
this.dialogConfig = {
|
|
3843
|
+
width: '400px',
|
|
3844
|
+
visible: false,
|
|
3845
|
+
onConfirm: () => this.handleFillInAddMore(),
|
|
3846
|
+
onCancel: () => this.handleCloseAddMoreDialog()
|
|
3847
|
+
};
|
|
3848
|
+
this.inputInfo = { valid: true, errorMessage: '', value: '' };
|
|
3849
|
+
}
|
|
3850
|
+
handleClientStylingChange(newValue, oldValue) {
|
|
3851
|
+
if (newValue != oldValue) {
|
|
3852
|
+
lotteryTippingPage.setClientStyling(this.stylingContainer, this.clientStyling);
|
|
3853
|
+
}
|
|
3854
|
+
}
|
|
3855
|
+
handleClientStylingUrlChange(newValue, oldValue) {
|
|
3856
|
+
if (newValue != oldValue) {
|
|
3857
|
+
lotteryTippingPage.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
3858
|
+
}
|
|
3859
|
+
}
|
|
3860
|
+
handleMbSourceChange(newValue, oldValue) {
|
|
3861
|
+
if (newValue != oldValue) {
|
|
3862
|
+
lotteryTippingPage.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
3863
|
+
}
|
|
3864
|
+
}
|
|
3865
|
+
componentWillLoad() {
|
|
3866
|
+
if (this.translationUrl) {
|
|
3867
|
+
getTranslations$5(JSON.parse(this.translationUrl));
|
|
3868
|
+
}
|
|
3869
|
+
}
|
|
3870
|
+
componentDidLoad() {
|
|
3871
|
+
if (this.stylingContainer) {
|
|
3872
|
+
if (this.mbSource)
|
|
3873
|
+
lotteryTippingPage.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
3874
|
+
if (this.clientStyling)
|
|
3875
|
+
lotteryTippingPage.setClientStyling(this.stylingContainer, this.clientStyling);
|
|
3876
|
+
if (this.clientStylingUrl)
|
|
3877
|
+
lotteryTippingPage.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
3878
|
+
}
|
|
3879
|
+
}
|
|
3880
|
+
disconnectedCallback() {
|
|
3881
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
3882
|
+
}
|
|
3883
|
+
lotteryBulletClickHandler(event) {
|
|
3884
|
+
event.stopPropagation();
|
|
3885
|
+
// if it's input type, open the dialog
|
|
3886
|
+
if (event.detail.type === 'input') {
|
|
3887
|
+
this.dialogConfig = Object.assign(Object.assign({}, this.dialogConfig), { visible: true });
|
|
3888
|
+
return;
|
|
3889
|
+
}
|
|
3890
|
+
if (['delete', 'toggle'].includes(event.detail.type)) {
|
|
3891
|
+
this.bulletGroupUpdateSelectedBulletTexts.emit({
|
|
3892
|
+
newSelectedBulletTexts: buildSelectedBulletTextsArr(event.detail, Array.from(this.selectedSet), this.maxSelectedCount).join(this.splitToken),
|
|
3893
|
+
selectionGroupId: this.selectionGroupId
|
|
3894
|
+
});
|
|
3895
|
+
return;
|
|
3896
|
+
}
|
|
3897
|
+
}
|
|
3898
|
+
get selectedSet() {
|
|
3899
|
+
return getBulletTextsSet(this.selectedBulletTexts, this.splitToken);
|
|
3900
|
+
}
|
|
3901
|
+
get disabledSet() {
|
|
3902
|
+
return getBulletTextsSet(this.disabledBulletTexts, this.splitToken);
|
|
3903
|
+
}
|
|
3904
|
+
get bulletTextsSet() {
|
|
3905
|
+
if (this.bulletTexts)
|
|
3906
|
+
return getBulletTextsSet(this.bulletTexts, this.splitToken);
|
|
3907
|
+
if (this.bulletTextType === 'integer' &&
|
|
3908
|
+
this.maxIntegerBulletText !== null &&
|
|
3909
|
+
this.maxIntegerBulletText !== undefined) {
|
|
3910
|
+
return getBulletTextsSet(Array.from({ length: Number(this.lastDisplayBulletText) - this.minIntegerBulletText + 1 }, (_, index) => this.minIntegerBulletText + index).join(this.splitToken), this.splitToken);
|
|
3911
|
+
}
|
|
3912
|
+
// If neither bulletTexts nor maxIntegerBulletText are provided,
|
|
3913
|
+
return new Set();
|
|
3914
|
+
}
|
|
3915
|
+
// the last bullet text
|
|
3916
|
+
get lastDisplayBulletText() {
|
|
3917
|
+
if (this.bulletTextType === 'integer') {
|
|
3918
|
+
if (this.maxIntegerBulletText !== null && this.maxIntegerBulletText !== undefined) {
|
|
3919
|
+
return Math.min(this.maxIntegerBulletText, this.minIntegerBulletText + this.maxDisplayBulletsCount - 1);
|
|
3920
|
+
}
|
|
3921
|
+
return this.minIntegerBulletText + this.maxDisplayBulletsCount - 1;
|
|
3922
|
+
}
|
|
3923
|
+
// Text mode: return the text at the max display index if available
|
|
3924
|
+
if (this.bulletTextsSet.size > 0) {
|
|
3925
|
+
const texts = Array.from(this.bulletTextsSet);
|
|
3926
|
+
if (texts.length >= this.maxDisplayBulletsCount) {
|
|
3927
|
+
return texts[this.maxDisplayBulletsCount - 1];
|
|
3928
|
+
}
|
|
3929
|
+
return texts[texts.length - 1]; // If fewer than maxDisplayBulletsCount, return the last one
|
|
3930
|
+
}
|
|
3931
|
+
return null;
|
|
3932
|
+
}
|
|
3933
|
+
get isSingleSelectionMode() {
|
|
3934
|
+
return this.maxSelectedCount === 1;
|
|
3935
|
+
}
|
|
3936
|
+
getBulletToRender() {
|
|
3937
|
+
const allBulletTexts = Array.from(this.bulletTextsSet);
|
|
3938
|
+
// Determine which bullets to display based on type and limit
|
|
3939
|
+
let bulletsToRender = allBulletTexts;
|
|
3940
|
+
let showInputButton = false;
|
|
3941
|
+
if (this.bulletTextType === 'text') {
|
|
3942
|
+
// For text, if we have more items than the limit, we need an input button.
|
|
3943
|
+
// The input button takes one slot, so we show (limit - 1) items.
|
|
3944
|
+
if (allBulletTexts.length > this.maxDisplayBulletsCount) {
|
|
3945
|
+
showInputButton = true;
|
|
3946
|
+
bulletsToRender = allBulletTexts.slice(0, this.maxDisplayBulletsCount - 1);
|
|
3947
|
+
}
|
|
3948
|
+
else {
|
|
3949
|
+
bulletsToRender = allBulletTexts;
|
|
3950
|
+
}
|
|
3951
|
+
}
|
|
3952
|
+
else {
|
|
3953
|
+
// For integer, logic is based on maxIntegerBulletText vs displayed range
|
|
3954
|
+
showInputButton =
|
|
3955
|
+
this.maxIntegerBulletText !== null &&
|
|
3956
|
+
this.maxIntegerBulletText !== undefined &&
|
|
3957
|
+
this.maxIntegerBulletText > Number(this.lastDisplayBulletText);
|
|
3958
|
+
// Integer bullets generation already respects the count, no slicing needed on the raw set
|
|
3959
|
+
bulletsToRender = allBulletTexts;
|
|
3960
|
+
}
|
|
3961
|
+
return {
|
|
3962
|
+
bulletsToRender,
|
|
3963
|
+
showInputButton
|
|
3964
|
+
};
|
|
3965
|
+
}
|
|
3966
|
+
renderBulletGroup() {
|
|
3967
|
+
let items = [];
|
|
3968
|
+
if (this.type === 'bet') {
|
|
3969
|
+
const isMaxSelected = this.maxSelectedCount !== null && this.selectedSet.size >= this.maxSelectedCount;
|
|
3970
|
+
const { bulletsToRender, showInputButton } = this.getBulletToRender();
|
|
3971
|
+
bulletsToRender.forEach((text, idx) => {
|
|
3972
|
+
let bulletType = 'toggle';
|
|
3973
|
+
if (this.disabledSet.has(String(text))) {
|
|
3974
|
+
bulletType = 'disabled';
|
|
3975
|
+
}
|
|
3976
|
+
else if (!this.selectedSet.has(String(text)) && isMaxSelected && !this.isSingleSelectionMode) {
|
|
3977
|
+
bulletType = 'disabled';
|
|
3978
|
+
}
|
|
3979
|
+
items.push({
|
|
3980
|
+
value: this.selectedSet.has(String(text)) ? 1 : 0,
|
|
3981
|
+
text: String(text),
|
|
3982
|
+
idx,
|
|
3983
|
+
type: bulletType
|
|
3984
|
+
});
|
|
3985
|
+
});
|
|
3986
|
+
if (showInputButton) {
|
|
3987
|
+
let inputBulletType = 'input';
|
|
3988
|
+
if (isMaxSelected && !this.isSingleSelectionMode) {
|
|
3989
|
+
inputBulletType = 'disabled';
|
|
3990
|
+
}
|
|
3991
|
+
const inputButtonText = this.bulletTextType === 'text' ? '...' : `${this.lastDisplayBulletText}+`;
|
|
3992
|
+
const inputButtonIdx = this.bulletTextType === 'text' ? -1 : Number(this.lastDisplayBulletText) + 1;
|
|
3993
|
+
// Special handling for integer mode:
|
|
3994
|
+
// If the generated set is "full" (size == maxDisplayBulletsCount),
|
|
3995
|
+
// we need to remove the last item to make room for the "N+" button
|
|
3996
|
+
// so the total visual count remains consistent.
|
|
3997
|
+
if (this.bulletTextType === 'integer' && items.length >= this.maxDisplayBulletsCount) {
|
|
3998
|
+
items.pop();
|
|
3999
|
+
}
|
|
4000
|
+
items.push({
|
|
4001
|
+
value: 0,
|
|
4002
|
+
text: inputButtonText,
|
|
4003
|
+
idx: inputButtonIdx,
|
|
4004
|
+
type: inputBulletType
|
|
4005
|
+
});
|
|
4006
|
+
}
|
|
4007
|
+
}
|
|
4008
|
+
else if (['choice', 'preview'].includes(this.type)) {
|
|
4009
|
+
// For choice/preview, also respect the visual limit for text mode
|
|
4010
|
+
const { bulletsToRender } = this.getBulletToRender();
|
|
4011
|
+
bulletsToRender.forEach((text, idx) => {
|
|
4012
|
+
let bulletType = 'toggle';
|
|
4013
|
+
if (this.disabledSet.has(String(text))) {
|
|
4014
|
+
bulletType = 'disabled';
|
|
4015
|
+
}
|
|
4016
|
+
else if (this.type === 'preview') {
|
|
4017
|
+
bulletType = 'readonly';
|
|
4018
|
+
}
|
|
4019
|
+
else if (this.selectedSet.has(String(text))) {
|
|
4020
|
+
bulletType = 'delete';
|
|
4021
|
+
}
|
|
4022
|
+
items.push({
|
|
4023
|
+
value: this.selectedSet.has(String(text)) ? 1 : 0,
|
|
4024
|
+
text,
|
|
4025
|
+
idx,
|
|
4026
|
+
type: bulletType
|
|
4027
|
+
});
|
|
4028
|
+
});
|
|
4029
|
+
}
|
|
4030
|
+
return (index.h("div", { class: "lottery-selection-group__item--right" }, items.map((item) => {
|
|
4031
|
+
return (index.h("lottery-selection", { clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, mbSource: this.mbSource, text: item.text, idx: item.idx, value: item.value, type: item.type, hasBorder: this.hasBorder, hasBackground: this.hasBackground }));
|
|
4032
|
+
})));
|
|
4033
|
+
}
|
|
4034
|
+
handleCloseAddMoreDialog() {
|
|
4035
|
+
this.dialogConfig = Object.assign(Object.assign({}, this.dialogConfig), { visible: false });
|
|
4036
|
+
this.inputInfo = { value: '', errorMessage: '', valid: true };
|
|
4037
|
+
}
|
|
4038
|
+
handleInputChange(e) {
|
|
4039
|
+
const inputElement = e.target;
|
|
4040
|
+
const value = inputElement.value;
|
|
4041
|
+
this.inputInfo = Object.assign(Object.assign({}, this.inputInfo), { value: value });
|
|
4042
|
+
this.inputInfo = validateInput({
|
|
4043
|
+
value,
|
|
4044
|
+
selectedSet: this.selectedSet,
|
|
4045
|
+
maxValue: this.maxIntegerBulletText,
|
|
4046
|
+
minValue: this.bulletTextType === 'integer' ? Number(this.lastDisplayBulletText) + 1 : undefined,
|
|
4047
|
+
language: this.language,
|
|
4048
|
+
type: this.bulletTextType
|
|
4049
|
+
});
|
|
4050
|
+
}
|
|
4051
|
+
handleFillInAddMore() {
|
|
4052
|
+
if (this.inputInfo.valid) {
|
|
4053
|
+
const { value } = this.inputInfo;
|
|
4054
|
+
// Normalize the value (e.g., "05" -> "5") to match validation logic
|
|
4055
|
+
let normalizedValue = value;
|
|
4056
|
+
if (this.bulletTextType === 'integer') {
|
|
4057
|
+
normalizedValue = String(Number(value));
|
|
4058
|
+
}
|
|
4059
|
+
else {
|
|
4060
|
+
normalizedValue = value.trim();
|
|
4061
|
+
}
|
|
4062
|
+
let newSelectedBulletTexts;
|
|
4063
|
+
if (this.isSingleSelectionMode) {
|
|
4064
|
+
newSelectedBulletTexts = normalizedValue;
|
|
4065
|
+
}
|
|
4066
|
+
else {
|
|
4067
|
+
newSelectedBulletTexts = addSelectedBulletTexts(normalizedValue, Array.from(this.selectedSet)).join(this.splitToken);
|
|
4068
|
+
}
|
|
4069
|
+
this.bulletGroupUpdateSelectedBulletTexts.emit({
|
|
4070
|
+
newSelectedBulletTexts,
|
|
4071
|
+
selectionGroupId: this.selectionGroupId
|
|
4072
|
+
});
|
|
4073
|
+
this.handleCloseAddMoreDialog();
|
|
4074
|
+
}
|
|
4075
|
+
}
|
|
4076
|
+
render() {
|
|
4077
|
+
return (index.h("div", { key: '39225bad75cf435b166269367df570732eff7ef4', class: "lottery-selection-group", ref: (el) => (this.stylingContainer = el) }, index.h("div", { key: '2bb2bc539c9fc05aeece7145b13f722756bc054e', class: "lottery-selection-group__item" }, this.selectionGroupLabel && (index.h("div", { key: 'dc15197dca90375bd4eb50e87d96402d1ef694d2', class: "lottery-selection-group__item--left" }, this.selectionGroupLabel)), this.renderBulletGroup()), index.h("lottery-tipping-dialog", { key: '9526dbb5d1656d6724e6566465febde778437c64', visible: this.dialogConfig.visible, width: this.dialogConfig.width, onCancel: this.dialogConfig.onCancel }, index.h("div", { key: 'ecf5800430e92be4a2af279f1d8c5075d5965b7e', class: "addSelectionDialog" }, index.h("div", { key: '3e8a2f445679ef5fe2ada60d4a6832f472f27dfa', class: "addSelectionDialog-title" }, this.dialogTitle ||
|
|
4078
|
+
(this.bulletTextType === 'text'
|
|
4079
|
+
? translate$5('enterValue', this.language)
|
|
4080
|
+
: translate$5('enterScoreUpTo', this.language, {
|
|
4081
|
+
maxScore: this.maxIntegerBulletText
|
|
4082
|
+
}))), index.h("input", { key: '46462ee8f27410639d45970a76fc3d90a03f3a10', type: "text", class: {
|
|
4083
|
+
'dialog-input': true,
|
|
4084
|
+
invalid: !this.inputInfo.valid
|
|
4085
|
+
}, value: this.inputInfo.value, onInput: this.handleInputChange.bind(this), placeholder: this.dialogInputPlaceholder }), index.h("div", { key: '2e66988e4186f8f4f773ed548fc76e53085be946', class: "error-message" }, this.inputInfo.errorMessage)), index.h("div", { key: '81dc64f0b7cba422a54af8ecff4734aa19832583', slot: "footer", class: "addSelectionDialog-footer" }, index.h("lottery-button", { key: '3027240894aef525dc9fc50db79597cf29f9cb99', onClick: this.dialogConfig.onCancel, text: translate$5('cancel', this.language), variant: "outline" }), index.h("lottery-button", { key: 'ab8c6deed9ab4a7d79d71ed6fe8122b23af5741b', onClick: this.dialogConfig.onConfirm, text: translate$5('confirm', this.language), variant: "primary", disabled: !this.inputInfo.valid || !this.inputInfo.value })))));
|
|
4086
|
+
}
|
|
4087
|
+
static get watchers() { return {
|
|
4088
|
+
"clientStyling": ["handleClientStylingChange"],
|
|
4089
|
+
"clientStylingUrl": ["handleClientStylingUrlChange"],
|
|
4090
|
+
"mbSource": ["handleMbSourceChange"]
|
|
4091
|
+
}; }
|
|
4092
|
+
};
|
|
4093
|
+
LotterySelectionGroup.style = LotterySelectionGroupStyle0;
|
|
4094
|
+
|
|
4095
|
+
const DEFAULT_LANGUAGE$4 = 'en';
|
|
4096
|
+
const SUPPORTED_LANGUAGES$4 = ['ro', 'en', 'fr', 'ar', 'hr'];
|
|
4097
|
+
const TRANSLATIONS$4 = {
|
|
4098
|
+
en: {
|
|
4099
|
+
homeTeam: 'Home team:',
|
|
4100
|
+
awayTeam: 'Away team:',
|
|
4101
|
+
loading: 'Loading...',
|
|
4102
|
+
error: 'Error!',
|
|
4103
|
+
noData: 'No data available.',
|
|
4104
|
+
lineInfo: 'Line {currentPage} of {totalPages}',
|
|
4105
|
+
clearAll: 'Clear All'
|
|
4106
|
+
},
|
|
4107
|
+
ro: {
|
|
4108
|
+
homeTeam: 'Echipa gazdă:',
|
|
4109
|
+
awayTeam: 'Echipa oaspete:',
|
|
4110
|
+
selectionCleared: 'Selecția dvs. a fost ștearsă.',
|
|
4111
|
+
selectionOnLineCleared: 'Selecția dvs. de pe această linie va fi ștearsă.',
|
|
4112
|
+
loading: `Se încarcă...',n error: 'Eroare!`,
|
|
4113
|
+
noData: 'Nu sunt date disponibile.',
|
|
4114
|
+
lineInfo: 'Linia {currentPage} din {totalPages}',
|
|
4115
|
+
clearAll: 'Șterge tot',
|
|
4116
|
+
cancel: 'Anulează',
|
|
4117
|
+
confirm: 'Confirmă'
|
|
4118
|
+
},
|
|
4119
|
+
fr: {
|
|
4120
|
+
homeTeam: 'Équipe à domicile:',
|
|
4121
|
+
awayTeam: `Équipe à l'extérieur:`,
|
|
4122
|
+
selectionCleared: 'Votre sélection a été effacée.',
|
|
4123
|
+
selectionOnLineCleared: 'Votre sélection sur cette ligne sera effacée.',
|
|
4124
|
+
loading: `Chargement...',n error: 'Erreur!`,
|
|
4125
|
+
noData: 'Aucune donnée disponible.',
|
|
4126
|
+
lineInfo: 'Ligne {currentPage} sur {totalPages}',
|
|
4127
|
+
clearAll: 'Tout effacer',
|
|
4128
|
+
cancel: 'Annuler',
|
|
4129
|
+
confirm: 'Confirmer'
|
|
4130
|
+
},
|
|
4131
|
+
ar: {
|
|
4132
|
+
homeTeam: 'الفريق المضيف:',
|
|
4133
|
+
awayTeam: 'الفريق الضيف:',
|
|
4134
|
+
selectionCleared: 'تم مسح اختيارك.',
|
|
4135
|
+
selectionOnLineCleared: 'سيتم مسح اختيارك في هذا السطر.',
|
|
4136
|
+
loading: `جار التحميل...',n error: 'خطأ!`,
|
|
4137
|
+
noData: 'لا توجد بيانات متاحة.',
|
|
4138
|
+
lineInfo: 'السطر {currentPage} من {totalPages}',
|
|
4139
|
+
clearAll: 'مسح الكل',
|
|
4140
|
+
cancel: 'إلغاء',
|
|
4141
|
+
confirm: 'تأكيد'
|
|
4142
|
+
},
|
|
4143
|
+
hr: {
|
|
4144
|
+
homeTeam: 'Domaći tim:',
|
|
4145
|
+
awayTeam: 'Gostujući tim:',
|
|
4146
|
+
selectionCleared: 'Vaš odabir je obrisan.',
|
|
4147
|
+
selectionOnLineCleared: 'Vaš odabir na ovoj liniji bit će obrisan.',
|
|
4148
|
+
loading: `Učitavanje...',n error: 'Greška!`,
|
|
4149
|
+
noData: 'Nema dostupnih podataka.',
|
|
4150
|
+
lineInfo: 'Linija {currentPage} od {totalPages}',
|
|
4151
|
+
clearAll: 'Očisti sve',
|
|
4152
|
+
cancel: 'Odustani',
|
|
4153
|
+
confirm: 'Potvrdi'
|
|
4154
|
+
}
|
|
4155
|
+
};
|
|
4156
|
+
const translate$4 = (key, customLang, replacements) => {
|
|
4157
|
+
const lang = customLang;
|
|
4158
|
+
let translation = TRANSLATIONS$4[lang !== undefined && SUPPORTED_LANGUAGES$4.includes(lang) ? lang : DEFAULT_LANGUAGE$4][key];
|
|
4159
|
+
if (replacements) {
|
|
4160
|
+
Object.keys(replacements).forEach((placeholder) => {
|
|
4161
|
+
translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
|
|
4162
|
+
});
|
|
4163
|
+
}
|
|
4164
|
+
return translation;
|
|
4165
|
+
};
|
|
4166
|
+
const getTranslations$4 = (data) => {
|
|
4167
|
+
Object.keys(data).forEach((item) => {
|
|
4168
|
+
for (let key in data[item]) {
|
|
4169
|
+
TRANSLATIONS$4[item][key] = data[item][key];
|
|
4170
|
+
}
|
|
4171
|
+
});
|
|
4172
|
+
};
|
|
4173
|
+
const resolveTranslationUrl$2 = async (translationUrl) => {
|
|
4174
|
+
if (translationUrl) {
|
|
4175
|
+
try {
|
|
4176
|
+
const response = await fetch(translationUrl);
|
|
4177
|
+
if (!response.ok) {
|
|
4178
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
4179
|
+
}
|
|
4180
|
+
const translations = await response.json();
|
|
4181
|
+
getTranslations$4(translations);
|
|
4182
|
+
}
|
|
4183
|
+
catch (error) {
|
|
4184
|
+
console.error('Failed to fetch or parse translations from URL:', error);
|
|
4185
|
+
}
|
|
4186
|
+
}
|
|
4187
|
+
};
|
|
4188
|
+
|
|
4189
|
+
const formatDate$1 = ({ date, type = 'date', format: format$1 }) => {
|
|
4190
|
+
try {
|
|
4191
|
+
const parsedDate = parseISO(date);
|
|
4192
|
+
if (isNaN(parsedDate.getTime())) {
|
|
4193
|
+
throw new Error(`Invalid date: ${date}`);
|
|
4194
|
+
}
|
|
4195
|
+
if (format$1)
|
|
4196
|
+
return format(parsedDate, format$1);
|
|
4197
|
+
let formatStr = 'dd/MM/yyyy';
|
|
4198
|
+
if (type === 'time') {
|
|
4199
|
+
formatStr = 'dd/MM/yyyy HH:mm:ss';
|
|
4200
|
+
}
|
|
4201
|
+
else if (type === 'week') {
|
|
4202
|
+
formatStr = 'ccc dd/MM/yyyy HH:mm:ss';
|
|
4203
|
+
}
|
|
4204
|
+
return format(parsedDate, formatStr);
|
|
4205
|
+
}
|
|
4206
|
+
catch (error) {
|
|
4207
|
+
console.error('Error formatting date:', error.message);
|
|
4208
|
+
return '';
|
|
4209
|
+
}
|
|
4210
|
+
};
|
|
4211
|
+
|
|
4212
|
+
const lotteryTippingBetSlipCss = ":host {\n --lottery-button-border-radius: 16px;\n}\n\n.LotteryTippingTicketBet__container {\n display: block; /* Or inline-block, depending on desired layout flow */\n font-size: 14px;\n padding: 12px;\n border: 1px solid var(--emw--color-gray-100, #e6e6e6);\n border-radius: var(--emw--button-border-radius, 4px);\n line-height: 1.5715;\n color: var(--emw--color-typography, #000);\n background: var(--emw--color-background, #fff);\n overflow: hidden;\n min-width: 300px;\n container-type: inline-size;\n}\n@container (max-width: 375px) {\n .LotteryTippingTicketBet__container {\n font-size: 12px;\n }\n}\n\n.table-wrapper {\n overflow-x: auto; /* Handle horizontal scroll if content overflows */\n}\n\n.LotteryTippingTicketBet__main {\n overflow: hidden;\n}\n\n.table-scroll-wrapper {\n overflow-x: auto;\n flex-grow: 1;\n min-width: 0;\n}\n\n.my-table-component {\n width: 100%;\n border-collapse: collapse; /* Important for borders */\n text-align: left;\n border-radius: 0.1rem; /* Ant Design like subtle rounding */\n border-spacing: 0;\n}\n\n/* Header */\n.my-table-component th {\n background: var(--emw--color-background-secondary, #f5f5f5);\n color: var(--emw--color-typography, #000);\n font-weight: 500;\n padding: 0.4rem 0.5rem;\n transition: background 0.3s ease;\n}\n@container (max-width: 400px) {\n .my-table-component th {\n padding: 0.3rem 0.3rem;\n }\n}\n\n/* Cells */\n.my-table-component td {\n padding: 0.4rem 0.5rem;\n color: var(--emw--color-typography, #000);\n background: var(--emw--color-background, #fff);\n transition: background 0.3s;\n}\n@container (max-width: 400px) {\n .my-table-component td {\n padding: 0.3rem 0.3rem;\n }\n}\n\n.my-table-component th:nth-child(1),\n.my-table-component td:nth-child(1) {\n /* index */\n min-width: 10px;\n}\n.my-table-component th:nth-child(3),\n.my-table-component td:nth-child(3) {\n /* startTime */\n min-width: 60px;\n}\n.my-table-component th:nth-child(4),\n.my-table-component td:nth-child(4) {\n /* results */\n min-width: 120px;\n}\n\n.my-table-component.bordered th,\n.my-table-component.bordered td {\n border-bottom: 1px solid var(--emw--color-gray-100, #e6e6e6);\n}\n\n/* Bordered style */\n.my-table-component.grid th,\n.my-table-component.grid td {\n border: 1px solid var(--emw--color-gray-100, #e6e6e6);\n}\n\n.my-table-component.grid th {\n border-bottom-width: 1px; /* Ensure bottom border is consistent */\n}\n\n.my-table-component.grid {\n border: 1px solid var(--emw--color-gray-100, #e6e6e6); /* Outer border */\n border-right-width: 0;\n border-bottom-width: 0;\n}\n\n.my-table-component.grid th:last-child,\n.my-table-component.grid td:last-child {\n border-right: 1px solid var(--emw--color-gray-100, #e6e6e6);\n}\n\n.my-table-component.grid tr:last-child td {\n border-bottom: 1px solid var(--emw--color-gray-100, #e6e6e6);\n}\n\n/* Striped style */\n.my-table-component.striped tbody tr:nth-child(even) td {\n background-color: var(--emw--color-background-secondary, #f5f5f5);\n}\n\n/* Hover (optional, but nice) */\n.my-table-component tbody tr:hover td {\n background-color: var(--emw--color-background-secondary, #f5f5f5);\n}\n\n.flex {\n display: flex;\n}\n\n.justify-end {\n justify-content: flex-end;\n}\n\n.gap-1 {\n gap: 4px;\n}\n\n.justify-between {\n justify-content: space-between;\n}\n\n.align-center {\n align-items: center;\n}\n\n.gap-1 {\n gap: 0.5rem;\n}\n\n.btn {\n color: var(--emw--color-typography, #000);\n background: var(--emw--color-background, #fff);\n font-size: 14px;\n transition: all 0.2s ease;\n}\n.btn:hover {\n cursor: pointer;\n}\n\n.btn:hover {\n background-color: var(--emw--color-gray-100, #e6e6e6);\n}\n\n.btn.disabled {\n opacity: 0.5;\n pointer-events: none;\n}\n.btn.disabled:hover {\n cursor: not-allowed !important;\n}\n\n.LotteryTippingTicketBet__tableToolbar {\n width: 100%;\n margin-bottom: 1rem;\n}\n\n.LotteryTippingTicketBet__tableToolbar--item {\n margin-right: 2rem;\n}\n.LotteryTippingTicketBet__tableToolbar--item.mr-0 {\n margin-right: 0rem !important;\n}\n\n.LotteryTippingTicketBet__lineOperatorGroup {\n flex-basis: 2rem;\n display: flex;\n flex-direction: column;\n gap: 1rem;\n border-radius: 8px;\n}\n\n.LotteryTippingTicketBet__lineOperatorGroup--item {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 2rem;\n height: 2rem;\n background-color: var(--emw--color-background-secondary, #f5f5f5);\n color: var(--emw--color-typography, #000);\n border-radius: 8px;\n border: none;\n transition: all 0.2s ease-in-out;\n cursor: pointer;\n}\n\n.LotteryTippingTicketBet__lineOperatorGroup--item:hover {\n transform: scale(1.1);\n box-shadow: 0 6px 14px var(--emw-calender-curday-box-shadow, rgba(0, 0, 0, 0.09));\n}\n\n.LotteryTippingTicketBet__lineOperatorGroup--item .icon {\n width: 20px;\n height: 20px;\n transition: filter 0.2s ease-in-out;\n filter: grayscale(0.3);\n}\n\n.LotteryTippingTicketBet__lineOperatorGroup--item:hover .icon {\n filter: grayscale(0);\n transform: rotate(3deg);\n}\n\ndiv.border-line {\n margin-top: 1rem;\n height: 1px;\n width: 100%;\n box-sizing: border-box;\n background-color: var(--emw--color-background-secondary, #f5f5f5);\n transition: all 0.3s ease;\n}\n\n.LotteryTippingTicketBet__footer {\n padding: 0.5rem;\n}\n\n.my-pagination {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 1rem;\n font-size: 0.8rem;\n color: var(--emw--color-typography-secondary, #333);\n}\n\n.my-pagination span {\n font-weight: 500;\n user-select: none;\n}\n\n.my-pagination .btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 2rem;\n height: 2rem;\n border-radius: 50%;\n border: none;\n transition: all 0.3s ease;\n cursor: pointer;\n opacity: 0.9;\n color: var(--emw--color-typography, #000);\n background-color: var(--emw--color-background-secondary, #f5f5f5);\n}\n\n.my-pagination .btn .icon {\n width: 20px;\n height: 20px;\n transition: transform 0.2s ease;\n}\n\n.my-pagination .btn:hover {\n transform: scale(1.1);\n box-shadow: 0 6px 14px var(--emw-calender-curday-box-shadow, rgba(0, 0, 0, 0.09));\n}\n\n.my-pagination .btn.disabled {\n background-color: var(--emw--color-background-tertiary, #ccc);\n cursor: not-allowed;\n opacity: 0.5;\n transform: scale(1);\n}\n\n.match-info-item {\n display: flex;\n}\n\n.match-info-item-label {\n margin-right: 6px;\n}\n\n.info-icon:hover {\n cursor: pointer;\n}\n\n.LotteryTippingTicketBet__empty p {\n text-align: center;\n}\n\n.no-wrap {\n white-space: nowrap;\n overflow: hidden;\n}\n\n.eventNameContainer__item--title {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 300px;\n}\n@container (max-width: 600px) {\n .eventNameContainer__item--title {\n max-width: 180px;\n }\n}\n@container (max-width: 500px) {\n .eventNameContainer__item--title {\n max-width: 150px;\n }\n}\n@container (max-width: 400px) {\n .eventNameContainer__item--title {\n max-width: 100px;\n }\n}\n@container (max-width: 330px) {\n .eventNameContainer__item--title {\n max-width: 70px;\n }\n}\n\n.LotteryTippingTicketBet__main {\n perspective: 800px;\n will-change: transform, opacity;\n}\n\n@container (max-width: 520px) {\n .LotteryTippingTicketBet__main {\n flex-wrap: wrap;\n justify-content: center;\n }\n .LotteryTippingTicketBet__tableToolbar--item {\n margin-right: 0 !important;\n }\n}\n/* Fade-In Keyframes */\n@keyframes fadeInLeft {\n from {\n opacity: 0;\n transform: translateX(100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n/* Fade-Out Keyframes */\n@keyframes fadeOut {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n@keyframes fadeInRight {\n from {\n opacity: 0;\n transform: translateX(-100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n@keyframes fadeInUp {\n from {\n opacity: 0;\n transform: translateY(100%);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n@-webkit-keyframes slide-left {\n 0% {\n -webkit-transform: translateX(0);\n transform: translateX(0);\n }\n 100% {\n -webkit-transform: translateX(-100px);\n transform: translateX(-100px);\n }\n}\n@keyframes slide-left {\n 0% {\n -webkit-transform: translateX(100%);\n transform: translateX(100%);\n }\n 100% {\n -webkit-transform: translateX(0px);\n transform: translateX(0px);\n }\n}\n@-webkit-keyframes slide-right {\n 0% {\n -webkit-transform: translateX(-100%);\n transform: translateX(-100%);\n }\n 100% {\n -webkit-transform: translateX(0px);\n transform: translateX(0px);\n }\n}\n@keyframes slide-right {\n 0% {\n -webkit-transform: translateX(-100px);\n transform: translateX(-100px);\n }\n 100% {\n -webkit-transform: translateX(0);\n transform: translateX(0);\n }\n}\n@-webkit-keyframes slide-top {\n 0% {\n -webkit-transform: translateY(-100px);\n transform: translateY(-100px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slide-top {\n 0% {\n -webkit-transform: translateY(-100px);\n transform: translateY(-100px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n/* Apply to your card classes */\n.card-in-left {\n -webkit-animation: slide-left 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slide-left 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n}\n\n.card-out-left {\n animation: fadeOut 0.2s ease-out both;\n}\n\n.card-in-right {\n -webkit-animation: slide-right 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slide-right 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n}\n\n.card-out-right {\n animation: fadeOut 0.2s ease-out both;\n}\n\n.card-in-up {\n -webkit-animation: slide-top 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slide-top 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n}\n\n.card-out-down {\n animation: fadeOut 0.2s ease-out both;\n}\n\n.loading-wrap {\n margin: 20px 0;\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 40vh;\n}\n.loading-wrap .dots-container {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n}\n.loading-wrap .dot {\n height: 14px;\n width: 14px;\n margin-right: 14px;\n border-radius: 14px;\n background-color: var(--emw--color-gray-300, #333);\n animation: pulse 1.5s infinite ease-in-out;\n}\n.loading-wrap .dot:last-child {\n margin-right: 0;\n}\n.loading-wrap .dot:nth-child(1) {\n animation-delay: -0.3s;\n}\n.loading-wrap .dot:nth-child(2) {\n animation-delay: -0.1s;\n}\n.loading-wrap .dot:nth-child(3) {\n animation-delay: 0.1s;\n}\n@keyframes pulse {\n 0% {\n transform: scale(0.8);\n background-color: var(--emw--color-gray-300, #333);\n }\n 50% {\n transform: scale(1.2);\n background-color: var(--emw--color-gray-100, #e6e6e6);\n }\n 100% {\n transform: scale(0.8);\n background-color: var(--emw--color-gray-150, #6f6f6f);\n }\n}\n\n.lottery-selection-group-table-header .lottery-selection__button {\n border: none;\n background: none;\n}";
|
|
4213
|
+
const LotteryTippingBetSlipStyle0 = lotteryTippingBetSlipCss;
|
|
4214
|
+
|
|
4215
|
+
const MyTable = ({ columns, dataSource, hideHead = false, grid = true, bordered = true }) => (index.h("table", { class: { bordered: bordered, grid: grid, 'my-table-component': true } }, !hideHead && (index.h("thead", null, index.h("tr", null, columns.map((column) => {
|
|
4216
|
+
var _a;
|
|
4217
|
+
return (index.h("th", { key: column.value, style: { width: column.width + '%', textAlign: column.align } }, typeof column.title === 'string' ? column.title : (_a = column.title) === null || _a === void 0 ? void 0 : _a.call(column)));
|
|
4218
|
+
})))), index.h("tbody", null, dataSource.map((row, index$1) => (index.h("tr", { key: index$1 }, columns.map((column) => (index.h("td", { key: column.value, style: { width: column.width + '%', textAlign: column.align }, class: { 'no-wrap': column.nowrap } }, column.render ? column.render(row, row[column.value], index$1) : row[column.value])))))))));
|
|
4219
|
+
const LotteryTippingBetSlip = class {
|
|
4220
|
+
constructor(hostRef) {
|
|
4221
|
+
index.registerInstance(this, hostRef);
|
|
4222
|
+
this.selectionChangeHandler = index.createEvent(this, "lotteryTippingBetSelectionChange", 7);
|
|
4223
|
+
this.clearAll = index.createEvent(this, "lotteryTippingBetClearAll", 7);
|
|
4224
|
+
this.addLine = index.createEvent(this, "lotteryTippingBetAddLine", 7);
|
|
4225
|
+
this.removeLine = index.createEvent(this, "lotteryTippingBetRemoveLine", 7);
|
|
4226
|
+
this.pageChange = index.createEvent(this, "lotteryTippingBetPageChange", 7);
|
|
4227
|
+
this.columns = [
|
|
4228
|
+
{ title: '', value: 'index', width: 3 },
|
|
4229
|
+
{
|
|
4230
|
+
title: '',
|
|
4231
|
+
value: 'eventName',
|
|
4232
|
+
width: 65,
|
|
4233
|
+
render: (item, value) => this.renderEventName(item, value)
|
|
4234
|
+
},
|
|
4235
|
+
{
|
|
4236
|
+
title: '',
|
|
4237
|
+
value: 'startTime',
|
|
4238
|
+
width: 22,
|
|
4239
|
+
align: 'right',
|
|
4240
|
+
nowrap: true,
|
|
4241
|
+
render: (_, value) => formatDate$1({ date: value, format: 'ccc HH:mm' })
|
|
4242
|
+
},
|
|
4243
|
+
{
|
|
4244
|
+
title: () => (index.h("lottery-selection-group", { language: this.language, "translation-url": this.translationUrl, "client-styling": this.clientStyling, clientStylingUrl: this.clientStylingUrl, type: "preview", splitToken: this.bulletTextsSplitToken, "bullet-texts": this.bulletNames, bulletTextType: "text", hasBackground: false, hasBorder: false })),
|
|
4245
|
+
value: 'results',
|
|
4246
|
+
width: 10,
|
|
4247
|
+
render: (_, __, curRow) => (index.h("lottery-selection-group", { language: this.language, "translation-url": this.translationUrl, "client-styling": this.clientStyling, clientStylingUrl: this.clientStylingUrl, "mb-source": this.mbSource, selectionGroupId: `${this.currentPage - 1}${this.bulletTextsSplitToken}${curRow}`, type: this.readPretty ? 'preview' : 'bet', "selected-bullet-texts": this.selectedBulletTexts(curRow), "disabled-bullet-texts": this.getBulletDisabledOptions(curRow), "max-selected-count": this.mode === 'single' ? 1 : this.bulletTexts.split(this.bulletTextsSplitToken).length, "bullet-texts": this.bulletTexts, splitToken: this.bulletTextsSplitToken, bulletTextType: "text" }))
|
|
4248
|
+
}
|
|
4249
|
+
];
|
|
4250
|
+
this.mbSource = undefined;
|
|
4251
|
+
this.clientStyling = undefined;
|
|
4252
|
+
this.clientStylingUrl = undefined;
|
|
4253
|
+
this.translationUrl = '';
|
|
4254
|
+
this.language = 'en';
|
|
4255
|
+
this.totalPages = 1;
|
|
4256
|
+
this.minTotalPages = 1;
|
|
4257
|
+
this.maxTotalPages = 3;
|
|
4258
|
+
this.bulletTexts = '1,X,2';
|
|
4259
|
+
this.bulletNames = 'Home,Draw,Away';
|
|
4260
|
+
this.bulletTextsSplitToken = ',';
|
|
4261
|
+
this.showClearButton = true;
|
|
4262
|
+
this.addImage = renderIconDefinitionToSVGElement(PlusSquareOutlined$1, {
|
|
4263
|
+
extraSVGAttrs: { width: '20px', height: '20px', fill: 'currentColor' }
|
|
4264
|
+
});
|
|
4265
|
+
this.deleteImage = renderIconDefinitionToSVGElement(DeleteOutlined$1, {
|
|
4266
|
+
extraSVGAttrs: { width: '20px', height: '20px', fill: 'currentColor' }
|
|
4267
|
+
});
|
|
4268
|
+
this.infoImage = renderIconDefinitionToSVGElement(InfoCircleOutlined$1, {
|
|
4269
|
+
extraSVGAttrs: { width: '16px', height: '16px', fill: 'currentColor' }
|
|
4270
|
+
});
|
|
4271
|
+
this.leftImage = renderIconDefinitionToSVGElement(LeftOutlined$1, {
|
|
4272
|
+
extraSVGAttrs: { width: '20px', height: '20px', fill: 'currentColor' }
|
|
4273
|
+
});
|
|
4274
|
+
this.rightImage = renderIconDefinitionToSVGElement(RightOutlined$1, {
|
|
4275
|
+
extraSVGAttrs: { width: '20px', height: '20px', fill: 'currentColor' }
|
|
4276
|
+
});
|
|
4277
|
+
this.mode = 'multi';
|
|
4278
|
+
this.readPretty = false;
|
|
4279
|
+
this.ticketDataSourceStr = '[]';
|
|
4280
|
+
this.bulletSelectionsLineGroupStr = '[]';
|
|
4281
|
+
this.currentPage = 1;
|
|
4282
|
+
this.bulletSelectionsLineGroup = [];
|
|
4283
|
+
this.ticketDataSource = [];
|
|
4284
|
+
this.betIsLoading = false;
|
|
4285
|
+
this.betHasErrors = false;
|
|
4286
|
+
}
|
|
4287
|
+
renderEventName(_, value) {
|
|
4288
|
+
const [homeName, awayName] = value.split(' vs ');
|
|
4289
|
+
return (index.h("div", { class: "flex gap-1 eventNameContainer__item" }, index.h("span", { class: "eventNameContainer__item--title" }, value), index.h("app-tooltip", null, index.h("span", { slot: "trigger", class: "icon info-icon", innerHTML: this.infoImage, style: { width: '18px' } }), index.h("div", { slot: "content" }, index.h("div", { class: "match-info" }, index.h("div", { class: "match-info-item" }, index.h("div", { class: "match-info-item-label" }, translate$4('homeTeam', this.language)), index.h("div", { class: "match-info-item-value" }, homeName)), index.h("div", { class: "match-info-item" }, index.h("div", { class: "match-info-item-label" }, translate$4('awayTeam', this.language)), index.h("div", { class: "match-info-item-value" }, awayName)))))));
|
|
4290
|
+
}
|
|
4291
|
+
selectedBulletTexts(curRow) {
|
|
4292
|
+
var _a, _b, _c;
|
|
4293
|
+
return ((_c = (_b = (_a = this.bulletSelectionsLineGroup) === null || _a === void 0 ? void 0 : _a[this.currentPage - 1]) === null || _b === void 0 ? void 0 : _b[curRow]) === null || _c === void 0 ? void 0 : _c.join(this.bulletTextsSplitToken)) || '';
|
|
4294
|
+
}
|
|
4295
|
+
getBulletDisabledOptions(curRow) {
|
|
4296
|
+
const { outcomes } = this.ticketDataSource[curRow];
|
|
4297
|
+
const curActiveOptions = outcomes.map((ev) => ev.betOn);
|
|
4298
|
+
const bulletText = this.bulletTexts.split(this.bulletTextsSplitToken);
|
|
4299
|
+
const disabledOptions = bulletText.filter((bullet) => !curActiveOptions.includes(bullet));
|
|
4300
|
+
return disabledOptions.join(this.bulletTextsSplitToken);
|
|
4301
|
+
}
|
|
4302
|
+
handleNewTranslations() {
|
|
4303
|
+
resolveTranslationUrl$2(this.translationUrl);
|
|
4304
|
+
}
|
|
4305
|
+
handleClientStylingChange(newValue, oldValue) {
|
|
4306
|
+
if (newValue != oldValue) {
|
|
4307
|
+
lotteryTippingPage.setClientStyling(this.stylingContainer, this.clientStyling);
|
|
4308
|
+
}
|
|
4309
|
+
}
|
|
4310
|
+
handleClientStylingUrlChange(newValue, oldValue) {
|
|
4311
|
+
if (newValue != oldValue) {
|
|
4312
|
+
lotteryTippingPage.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
4313
|
+
}
|
|
4314
|
+
}
|
|
4315
|
+
handleMbSourceChange(newValue, oldValue) {
|
|
4316
|
+
if (newValue != oldValue) {
|
|
4317
|
+
lotteryTippingPage.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
4318
|
+
}
|
|
4319
|
+
}
|
|
4320
|
+
parseTicketDataSource(newValue) {
|
|
4321
|
+
try {
|
|
4322
|
+
this.ticketDataSource = JSON.parse(newValue || '[]');
|
|
4323
|
+
}
|
|
4324
|
+
catch (e) {
|
|
4325
|
+
console.error('Failed to parse ticketDataSourceStr:', e);
|
|
4326
|
+
}
|
|
4327
|
+
}
|
|
4328
|
+
parseBulletSelectionsLineGroup(newValue) {
|
|
4329
|
+
try {
|
|
4330
|
+
this.bulletSelectionsLineGroup = JSON.parse(newValue || '[]');
|
|
4331
|
+
}
|
|
4332
|
+
catch (e) {
|
|
4333
|
+
console.error('Failed to parse bulletSelectionsLineGroupStr:', e);
|
|
4334
|
+
}
|
|
4335
|
+
}
|
|
4336
|
+
connectedCallback() {
|
|
4337
|
+
this.boundMessageHandler = this.messageHandler.bind(this);
|
|
4338
|
+
window.addEventListener('message', this.boundMessageHandler);
|
|
4339
|
+
}
|
|
4340
|
+
disconnectedCallback() {
|
|
4341
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
4342
|
+
if (this.boundMessageHandler) {
|
|
4343
|
+
window.removeEventListener('message', this.boundMessageHandler);
|
|
4344
|
+
}
|
|
4345
|
+
}
|
|
4346
|
+
messageHandler() {
|
|
4347
|
+
// This handler can be kept for other potential messages, or removed if no longer needed.
|
|
4348
|
+
}
|
|
4349
|
+
componentWillLoad() {
|
|
4350
|
+
resolveTranslationUrl$2(this.translationUrl);
|
|
4351
|
+
this.parseTicketDataSource(this.ticketDataSourceStr);
|
|
4352
|
+
this.parseBulletSelectionsLineGroup(this.bulletSelectionsLineGroupStr);
|
|
4353
|
+
}
|
|
4354
|
+
componentDidLoad() {
|
|
4355
|
+
if (this.stylingContainer) {
|
|
4356
|
+
if (this.mbSource)
|
|
4357
|
+
lotteryTippingPage.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
4358
|
+
if (this.clientStyling)
|
|
4359
|
+
lotteryTippingPage.setClientStyling(this.stylingContainer, this.clientStyling);
|
|
4360
|
+
if (this.clientStylingUrl)
|
|
4361
|
+
lotteryTippingPage.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
4362
|
+
}
|
|
4363
|
+
}
|
|
4364
|
+
handleClearAll() {
|
|
4365
|
+
this.clearAll.emit();
|
|
4366
|
+
}
|
|
4367
|
+
bulletGroupUpdateSelectionHandler(event) {
|
|
4368
|
+
event.stopPropagation();
|
|
4369
|
+
const { newSelectedBulletTexts, selectionGroupId } = event.detail;
|
|
4370
|
+
if (!selectionGroupId) {
|
|
4371
|
+
console.error('Miss selectionGroupId');
|
|
4372
|
+
return;
|
|
4373
|
+
}
|
|
4374
|
+
const idParts = selectionGroupId.split(this.bulletTextsSplitToken);
|
|
4375
|
+
if (idParts.length !== 2) {
|
|
4376
|
+
console.error('Invalid selectionGroupId format:', selectionGroupId);
|
|
4377
|
+
return;
|
|
4378
|
+
}
|
|
4379
|
+
const [boardId, matchId] = idParts;
|
|
4380
|
+
this.selectionChangeHandler.emit({
|
|
4381
|
+
newSelections: newSelectedBulletTexts.split(this.bulletTextsSplitToken),
|
|
4382
|
+
matchId,
|
|
4383
|
+
boardId
|
|
4384
|
+
});
|
|
4385
|
+
}
|
|
4386
|
+
prevPage() {
|
|
4387
|
+
const doPrev = () => {
|
|
4388
|
+
this.pageChange.emit({ newPage: this.currentPage - 1 });
|
|
4389
|
+
};
|
|
4390
|
+
this.swapCard('prev', doPrev);
|
|
4391
|
+
}
|
|
4392
|
+
nextPage() {
|
|
4393
|
+
const doNext = () => {
|
|
4394
|
+
this.pageChange.emit({ newPage: this.currentPage + 1 });
|
|
4395
|
+
};
|
|
4396
|
+
this.swapCard('next', doNext);
|
|
4397
|
+
}
|
|
4398
|
+
handleAddLine() {
|
|
4399
|
+
const doAdd = () => {
|
|
4400
|
+
this.addLine.emit();
|
|
4401
|
+
};
|
|
4402
|
+
this.swapCard('add', doAdd);
|
|
4403
|
+
}
|
|
4404
|
+
handleRemoveLine() {
|
|
4405
|
+
this.removeLine.emit({
|
|
4406
|
+
boardId: this.currentPage - 1,
|
|
4407
|
+
close: (onClose) => {
|
|
4408
|
+
onClose && this.swapCard('remove', onClose);
|
|
4409
|
+
}
|
|
4410
|
+
});
|
|
4411
|
+
}
|
|
4412
|
+
swapCard(action, cb) {
|
|
4413
|
+
const wrapper = this.mainContainer;
|
|
4414
|
+
if (!wrapper)
|
|
4415
|
+
return;
|
|
4416
|
+
// Prevent new animations if one is already in progress
|
|
4417
|
+
const isAnimating = Array.from(wrapper.classList).some((cls) => cls.startsWith('card-out-') || cls.startsWith('card-in-'));
|
|
4418
|
+
if (isAnimating) {
|
|
4419
|
+
return;
|
|
4420
|
+
}
|
|
4421
|
+
const map = {
|
|
4422
|
+
next: { out: 'card-out-left', in: 'card-in-left' },
|
|
4423
|
+
prev: { out: 'card-out-right', in: 'card-in-right' },
|
|
4424
|
+
remove: { out: 'card-out-down', in: 'card-in-right' },
|
|
4425
|
+
add: { out: 'card-out-left', in: 'card-in-up' }
|
|
4426
|
+
};
|
|
4427
|
+
const { out: outCls, in: inCls } = map[action];
|
|
4428
|
+
wrapper.classList.add(outCls);
|
|
4429
|
+
wrapper.addEventListener('animationend', () => {
|
|
4430
|
+
wrapper.classList.remove(outCls);
|
|
4431
|
+
cb();
|
|
4432
|
+
const newWrapper = this.mainContainer;
|
|
4433
|
+
if (!newWrapper)
|
|
4434
|
+
return;
|
|
4435
|
+
newWrapper.classList.add(inCls);
|
|
4436
|
+
newWrapper.addEventListener('animationend', () => newWrapper.classList.remove(inCls), { once: true });
|
|
4437
|
+
}, { once: true });
|
|
4438
|
+
}
|
|
4439
|
+
renderLoading() {
|
|
4440
|
+
return (index.h("div", { class: "loading-wrap" }, index.h("section", { class: "dots-container" }, index.h("div", { class: "dot" }), index.h("div", { class: "dot" }), index.h("div", { class: "dot" }), index.h("div", { class: "dot" }), index.h("div", { class: "dot" }))));
|
|
4441
|
+
}
|
|
4442
|
+
renderErrorContent() {
|
|
4443
|
+
return index.h("p", null, translate$4('error', this.language));
|
|
4444
|
+
}
|
|
4445
|
+
renderEmptyContent() {
|
|
4446
|
+
return (index.h("div", { class: "LotteryTippingTicketBet__empty" }, index.h("p", null, translate$4('noData', this.language))));
|
|
4447
|
+
}
|
|
4448
|
+
renderPageFooter() {
|
|
4449
|
+
if (this.totalPages <= 1)
|
|
4450
|
+
return null;
|
|
4451
|
+
return (index.h("div", null, index.h("div", { class: 'border-line' }), index.h("div", { class: "LotteryTippingTicketBet__footer" }, index.h("div", { class: "my-pagination flex justify-between" }, index.h("span", null, translate$4('lineInfo', this.language, { currentPage: this.currentPage, totalPages: this.totalPages })), index.h("div", { class: 'flex gap-1' }, index.h("button", { type: "button", class: `btn ${this.currentPage === 1 ? 'disabled' : ''}`, onClick: () => this.prevPage(), disabled: this.currentPage === 1 }, index.h("span", { class: "icon", innerHTML: this.leftImage })), index.h("button", { type: "button", class: `btn ${this.currentPage === this.totalPages ? 'disabled' : ''}`, onClick: () => this.nextPage(), disabled: this.currentPage === this.totalPages }, index.h("span", { class: "icon", innerHTML: this.rightImage })))))));
|
|
4452
|
+
}
|
|
4453
|
+
renderReadPrettyContent() {
|
|
4454
|
+
var _a;
|
|
4455
|
+
return (index.h("div", { class: "LotteryTippingTicketBet__main", ref: (el) => (this.mainContainer = el) }, index.h("div", { class: "table-scroll-wrapper" }, index.h(MyTable, { columns: this.columns, dataSource: ((_a = this.ticketDataSource) === null || _a === void 0 ? void 0 : _a.map((item, index) => (Object.assign(Object.assign({}, item), { index: index + 1 })))) || [], hideHead: false, grid: false, bordered: false })), this.renderPageFooter()));
|
|
4456
|
+
}
|
|
4457
|
+
renderDefaultContent() {
|
|
4458
|
+
var _a;
|
|
4459
|
+
const lineOperatorAddShow = this.totalPages < this.maxTotalPages && this.currentPage === this.totalPages ? true : false;
|
|
4460
|
+
const lineOperatorRemoveShow = this.totalPages > this.minTotalPages ? true : false;
|
|
4461
|
+
return (index.h("div", null, index.h("div", { class: "LotteryTippingTicketBet__tableToolbar flex justify-end gap-1" }, this.showClearButton && (index.h("lottery-button", { class: {
|
|
4462
|
+
'LotteryTippingTicketBet__tableToolbar--item': true,
|
|
4463
|
+
'mr-0': !(lineOperatorAddShow || lineOperatorRemoveShow)
|
|
4464
|
+
}, text: translate$4('clearAll', this.language), onClick: () => this.handleClearAll(), variant: "text", clientStyling: this.clientStyling || '' }))), index.h("div", { class: "flex align-center LotteryTippingTicketBet__main", ref: (el) => (this.mainContainer = el) }, index.h("div", { class: "table-scroll-wrapper" }, index.h(MyTable, { columns: this.columns, dataSource: ((_a = this.ticketDataSource) === null || _a === void 0 ? void 0 : _a.map((item, index) => (Object.assign(Object.assign({}, item), { index: index + 1 })))) || [], hideHead: false, grid: false, bordered: false })), (lineOperatorAddShow || lineOperatorRemoveShow) && (index.h("div", { class: "LotteryTippingTicketBet__lineOperatorGroup" }, lineOperatorAddShow && (index.h("button", { type: "button", class: {
|
|
4465
|
+
'LotteryTippingTicketBet__lineOperatorGroup--item': true
|
|
4466
|
+
}, onClick: () => this.handleAddLine() }, index.h("span", { class: "icon", innerHTML: this.addImage }))), lineOperatorRemoveShow && (index.h("button", { type: "button", class: {
|
|
4467
|
+
'LotteryTippingTicketBet__lineOperatorGroup--item': true
|
|
4468
|
+
}, onClick: () => this.handleRemoveLine() }, index.h("span", { class: "icon", innerHTML: this.deleteImage })))))), this.renderPageFooter()));
|
|
4469
|
+
}
|
|
4470
|
+
render() {
|
|
4471
|
+
let content;
|
|
4472
|
+
if (this.betIsLoading) {
|
|
4473
|
+
content = this.renderLoading();
|
|
4474
|
+
}
|
|
4475
|
+
else if (this.betHasErrors) {
|
|
4476
|
+
content = this.renderErrorContent();
|
|
4477
|
+
}
|
|
4478
|
+
else if (this.ticketDataSource.length === 0) {
|
|
4479
|
+
content = this.renderEmptyContent();
|
|
4480
|
+
}
|
|
4481
|
+
else if (this.readPretty) {
|
|
4482
|
+
content = this.renderReadPrettyContent();
|
|
4483
|
+
}
|
|
4484
|
+
else {
|
|
4485
|
+
content = this.renderDefaultContent();
|
|
4486
|
+
}
|
|
4487
|
+
return (index.h("div", { key: '425f7f3d185616af3189857a9159868e3c57f100', ref: (el) => (this.stylingContainer = el), class: "LotteryTippingTicketBet__container" }, content));
|
|
4488
|
+
}
|
|
4489
|
+
static get watchers() { return {
|
|
4490
|
+
"translationUrl": ["handleNewTranslations"],
|
|
4491
|
+
"clientStyling": ["handleClientStylingChange"],
|
|
4492
|
+
"clientStylingUrl": ["handleClientStylingUrlChange"],
|
|
4493
|
+
"mbSource": ["handleMbSourceChange"],
|
|
4494
|
+
"ticketDataSourceStr": ["parseTicketDataSource"],
|
|
4495
|
+
"bulletSelectionsLineGroupStr": ["parseBulletSelectionsLineGroup"]
|
|
4496
|
+
}; }
|
|
4497
|
+
};
|
|
4498
|
+
LotteryTippingBetSlip.style = LotteryTippingBetSlipStyle0;
|
|
4499
|
+
|
|
4500
|
+
const lotteryTippingBulletCss = ".LotteryTippingBullet__segment{display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;font-size:16px;line-height:1;font-weight:500;color:var(--emw--color-typography, #000);background:var(--emw--color-background, #fff);border:1px solid var(--emw--color-gray-100, #e6e6e6);border-radius:6px;cursor:pointer;transition:all 0.2s ease;user-select:none}.LotteryTippingBullet__segment:not(.LotteryTippingBullet__segment--disabled):hover{cursor:pointer;animation:jelly 0.3s ease-in-out;transform:scale(1.02)}.LotteryTippingBullet__segment--text{border:none;color:var(--emw--color-typography, #000);background:transparent;font-weight:400}.LotteryTippingBullet__segment--text:hover{cursor:not-allowed !important}.LotteryTippingBullet__segment--active{font-weight:600;background-color:var(--emw--color-background-inverse, #000);color:var(--emw--color-primary, #fed275)}.LotteryTippingBullet__segment--disabled:not(.LotteryTippingBullet__segment--active){background-color:var(--emw--color-background-tertiary, #ccc);color:var(--emw--color-gray-150, #6f6f6f);border-color:var(--emw--color-gray-100, #e6e6e6)}.LotteryTippingBullet__segment--disabled:hover{cursor:not-allowed}@keyframes jelly{0%{transform:translate(0, 0)}20%{transform:translate(-0.5px, -0.5px)}40%{transform:translate(0.5px, 0.5px)}60%{transform:translate(-0.25px, -0.25px)}80%{transform:translate(0.25px, 0.25px)}100%{transform:translate(0, 0)}}";
|
|
4501
|
+
const LotteryTippingBulletStyle0 = lotteryTippingBulletCss;
|
|
4502
|
+
|
|
4503
|
+
const LotteryTippingBullet = class {
|
|
4504
|
+
constructor(hostRef) {
|
|
4505
|
+
index.registerInstance(this, hostRef);
|
|
4506
|
+
this.lotteryTippingBulletToggleEvent = index.createEvent(this, "lotteryTippingBulletToggle", 7);
|
|
4507
|
+
this.mbSource = undefined;
|
|
4508
|
+
this.clientStyling = undefined;
|
|
4509
|
+
this.clientStylingUrl = undefined;
|
|
4510
|
+
this.positionIdx = undefined;
|
|
4511
|
+
this.theme = 'default';
|
|
4512
|
+
this.value = '';
|
|
4513
|
+
this.disabled = false;
|
|
4514
|
+
this.isSelected = false;
|
|
4515
|
+
}
|
|
4516
|
+
handleClientStylingChange(newValue, oldValue) {
|
|
4517
|
+
if (newValue != oldValue) {
|
|
4518
|
+
lotteryTippingPage.setClientStyling(this.stylingContainer, this.clientStyling);
|
|
4519
|
+
}
|
|
4520
|
+
}
|
|
4521
|
+
handleClientStylingUrlChange(newValue, oldValue) {
|
|
4522
|
+
if (newValue != oldValue) {
|
|
4523
|
+
lotteryTippingPage.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
4524
|
+
}
|
|
4525
|
+
}
|
|
4526
|
+
handleMbSourceChange(newValue, oldValue) {
|
|
4527
|
+
if (newValue != oldValue) {
|
|
4528
|
+
lotteryTippingPage.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
4529
|
+
}
|
|
4530
|
+
}
|
|
4531
|
+
componentDidLoad() {
|
|
4532
|
+
if (this.stylingContainer) {
|
|
4533
|
+
if (this.mbSource)
|
|
4534
|
+
lotteryTippingPage.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
4535
|
+
if (this.clientStyling)
|
|
4536
|
+
lotteryTippingPage.setClientStyling(this.stylingContainer, this.clientStyling);
|
|
4537
|
+
if (this.clientStylingUrl)
|
|
4538
|
+
lotteryTippingPage.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
4539
|
+
}
|
|
4540
|
+
}
|
|
4541
|
+
handleClick() {
|
|
4542
|
+
if (!this.disabled) {
|
|
4543
|
+
this.lotteryTippingBulletToggleEvent.emit({ positionIdx: this.positionIdx });
|
|
4544
|
+
}
|
|
4545
|
+
}
|
|
4546
|
+
disconnectedCallback() {
|
|
4547
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
4548
|
+
}
|
|
4549
|
+
render() {
|
|
4550
|
+
return (index.h("div", { key: 'ef0fee38ed62adb7809b5a60668af6a499ebe5a6', ref: (el) => (this.stylingContainer = el) }, this.theme === 'text' ? (index.h("div", { class: {
|
|
4551
|
+
LotteryTippingBullet__segment: true,
|
|
4552
|
+
'LotteryTippingBullet__segment--text': true
|
|
4553
|
+
} }, this.value)) : (index.h("button", { class: {
|
|
4554
|
+
LotteryTippingBullet__segment: true,
|
|
4555
|
+
'LotteryTippingBullet__segment--disabled': this.disabled,
|
|
4556
|
+
'LotteryTippingBullet__segment--active': this.isSelected
|
|
4557
|
+
}, onClick: this.handleClick.bind(this) }, this.isSelected ? 'X' : this.value))));
|
|
4558
|
+
}
|
|
4559
|
+
static get watchers() { return {
|
|
4560
|
+
"clientStyling": ["handleClientStylingChange"],
|
|
4561
|
+
"clientStylingUrl": ["handleClientStylingUrlChange"],
|
|
4562
|
+
"mbSource": ["handleMbSourceChange"]
|
|
4563
|
+
}; }
|
|
4564
|
+
};
|
|
4565
|
+
LotteryTippingBullet.style = LotteryTippingBulletStyle0;
|
|
4566
|
+
|
|
4567
|
+
const lotteryTippingBulletGroupCss = "";
|
|
4568
|
+
const LotteryTippingBulletGroupStyle0 = lotteryTippingBulletGroupCss;
|
|
4569
|
+
|
|
4570
|
+
const LotteryTippingBulletGroup = class {
|
|
4571
|
+
constructor(hostRef) {
|
|
4572
|
+
index.registerInstance(this, hostRef);
|
|
4573
|
+
this.lotteryTippingBulletGroupToggleEvent = index.createEvent(this, "lotteryTippingBulletGroupToggle", 7);
|
|
4574
|
+
this.mbSource = undefined;
|
|
4575
|
+
this.clientStyling = undefined;
|
|
4576
|
+
this.clientStylingUrl = undefined;
|
|
4577
|
+
this.positionIdx = undefined;
|
|
4578
|
+
this.theme = 'default';
|
|
4579
|
+
this.mode = 'single';
|
|
4580
|
+
this.bulletConfigContent = '';
|
|
4581
|
+
}
|
|
4582
|
+
get bulletConfigArr() {
|
|
4583
|
+
const defaultConfig = [
|
|
4584
|
+
{
|
|
4585
|
+
value: '1'
|
|
4586
|
+
},
|
|
4587
|
+
{
|
|
4588
|
+
value: 'X'
|
|
4589
|
+
},
|
|
4590
|
+
{
|
|
4591
|
+
value: '2'
|
|
4592
|
+
}
|
|
4593
|
+
];
|
|
4594
|
+
if (typeof this.bulletConfigContent === 'string' && this.bulletConfigContent) {
|
|
4595
|
+
try {
|
|
4596
|
+
const _temp = JSON.parse(this.bulletConfigContent);
|
|
4597
|
+
return _temp;
|
|
4598
|
+
}
|
|
4599
|
+
catch (e) {
|
|
4600
|
+
console.error('Error parsing bulletConfigContent:', e);
|
|
4601
|
+
return defaultConfig;
|
|
4602
|
+
}
|
|
4603
|
+
}
|
|
4604
|
+
else {
|
|
4605
|
+
return defaultConfig;
|
|
4606
|
+
}
|
|
4607
|
+
}
|
|
4608
|
+
handleClientStylingChange(newValue, oldValue) {
|
|
4609
|
+
if (newValue != oldValue) {
|
|
4610
|
+
lotteryTippingPage.setClientStyling(this.stylingContainer, this.clientStyling);
|
|
4611
|
+
}
|
|
4612
|
+
}
|
|
4613
|
+
handleClientStylingUrlChange(newValue, oldValue) {
|
|
4614
|
+
if (newValue != oldValue) {
|
|
4615
|
+
lotteryTippingPage.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
4616
|
+
}
|
|
4617
|
+
}
|
|
4618
|
+
handleMbSourceChange(newValue, oldValue) {
|
|
4619
|
+
if (newValue != oldValue) {
|
|
4620
|
+
lotteryTippingPage.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
4621
|
+
}
|
|
4622
|
+
}
|
|
4623
|
+
componentDidLoad() {
|
|
4624
|
+
if (this.stylingContainer) {
|
|
4625
|
+
if (this.mbSource)
|
|
4626
|
+
lotteryTippingPage.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
4627
|
+
if (this.clientStyling)
|
|
4628
|
+
lotteryTippingPage.setClientStyling(this.stylingContainer, this.clientStyling);
|
|
4629
|
+
if (this.clientStylingUrl)
|
|
4630
|
+
lotteryTippingPage.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
4631
|
+
}
|
|
4632
|
+
}
|
|
4633
|
+
disconnectedCallback() {
|
|
4634
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
4635
|
+
}
|
|
4636
|
+
lotteryTippingBulletSelectionHandler(event) {
|
|
4637
|
+
const { positionIdx } = event.detail;
|
|
4638
|
+
this.handleToggle(positionIdx);
|
|
4639
|
+
}
|
|
4640
|
+
handleToggle(index) {
|
|
4641
|
+
let newConfigArr = [...this.bulletConfigArr];
|
|
4642
|
+
if (this.mode === 'single') {
|
|
4643
|
+
// single mode: only one button can be selected
|
|
4644
|
+
newConfigArr = newConfigArr.map((item) => (Object.assign(Object.assign({}, item), { isSelected: false })));
|
|
4645
|
+
newConfigArr[index].isSelected = true;
|
|
4646
|
+
}
|
|
4647
|
+
else {
|
|
4648
|
+
// multi mode: multiple buttons can be selected
|
|
4649
|
+
newConfigArr = newConfigArr.map((item) => (Object.assign({}, item)));
|
|
4650
|
+
newConfigArr[index].isSelected = !newConfigArr[index].isSelected;
|
|
4651
|
+
}
|
|
4652
|
+
this.lotteryTippingBulletGroupToggleEvent.emit({
|
|
4653
|
+
bulletConfigArr: newConfigArr,
|
|
4654
|
+
positionIdx: this.positionIdx + '-' + index
|
|
4655
|
+
});
|
|
4656
|
+
}
|
|
4657
|
+
render() {
|
|
4658
|
+
var _a;
|
|
4659
|
+
return (index.h("div", { ref: (el) => (this.stylingContainer = el), key: this.positionIdx }, index.h("div", { key: '68223022eed831932c571378164be913206d98e9', style: { display: 'flex', flexDirection: 'row', gap: '10px' } }, (_a = this.bulletConfigArr) === null || _a === void 0 ? void 0 : _a.map((item, index$1) => (index.h("div", { key: index$1 }, index.h("lottery-tipping-bullet", { value: item.value, isSelected: item.isSelected, "position-idx": index$1, disabled: item.disabled, theme: this.theme, clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, mbSource: this.mbSource })))))));
|
|
4660
|
+
}
|
|
4661
|
+
static get watchers() { return {
|
|
4662
|
+
"clientStyling": ["handleClientStylingChange"],
|
|
4663
|
+
"clientStylingUrl": ["handleClientStylingUrlChange"],
|
|
4664
|
+
"mbSource": ["handleMbSourceChange"]
|
|
4665
|
+
}; }
|
|
4666
|
+
};
|
|
4667
|
+
LotteryTippingBulletGroup.style = LotteryTippingBulletGroupStyle0;
|
|
4668
|
+
|
|
4669
|
+
const DEFAULT_LANGUAGE$3 = 'en';
|
|
4670
|
+
const SUPPORTED_LANGUAGES$3 = ['ro', 'en', 'fr', 'ar', 'hr'];
|
|
4671
|
+
const TRANSLATIONS$3 = {
|
|
4672
|
+
en: {
|
|
4673
|
+
cancel: 'Cancel',
|
|
4674
|
+
confirm: 'Confirm'
|
|
4675
|
+
},
|
|
4676
|
+
ro: {
|
|
4677
|
+
cancel: 'Anulează',
|
|
4678
|
+
confirm: 'Confirmă'
|
|
4679
|
+
},
|
|
4680
|
+
fr: {
|
|
4681
|
+
cancel: 'Annuler',
|
|
4682
|
+
confirm: 'Confirmer'
|
|
4683
|
+
},
|
|
4684
|
+
ar: {
|
|
4685
|
+
cancel: 'إلغاء',
|
|
4686
|
+
confirm: 'تأكيد'
|
|
4687
|
+
},
|
|
4688
|
+
hr: {
|
|
4689
|
+
cancel: 'Odustani',
|
|
4690
|
+
confirm: 'Potvrdi'
|
|
4691
|
+
}
|
|
4692
|
+
};
|
|
4693
|
+
const translate$3 = (key, customLang) => {
|
|
4694
|
+
const lang = customLang;
|
|
4695
|
+
return TRANSLATIONS$3[lang !== undefined && SUPPORTED_LANGUAGES$3.includes(lang) ? lang : DEFAULT_LANGUAGE$3][key];
|
|
4696
|
+
};
|
|
4697
|
+
const getTranslations$3 = (data) => {
|
|
4698
|
+
Object.keys(data).forEach((item) => {
|
|
4699
|
+
for (let key in data[item]) {
|
|
4700
|
+
TRANSLATIONS$3[item][key] = data[item][key];
|
|
4701
|
+
}
|
|
4702
|
+
});
|
|
4703
|
+
};
|
|
3506
4704
|
const resolveTranslationUrl$1 = async (translationUrl) => {
|
|
3507
4705
|
if (translationUrl) {
|
|
3508
4706
|
try {
|
|
@@ -10498,7 +11696,7 @@ const LotteryTippingFilter = class {
|
|
|
10498
11696
|
};
|
|
10499
11697
|
LotteryTippingFilter.style = LotteryTippingFilterStyle0;
|
|
10500
11698
|
|
|
10501
|
-
const generateUUID$
|
|
11699
|
+
const generateUUID$1 = () => {
|
|
10502
11700
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
10503
11701
|
var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
|
|
10504
11702
|
return v.toString(16);
|
|
@@ -10506,7 +11704,7 @@ const generateUUID$2 = () => {
|
|
|
10506
11704
|
};
|
|
10507
11705
|
function fetchRequest$1(url, method = 'GET', body = null, headers = {}) {
|
|
10508
11706
|
return new Promise((resolve, reject) => {
|
|
10509
|
-
const uuid = generateUUID$
|
|
11707
|
+
const uuid = generateUUID$1();
|
|
10510
11708
|
const headersOrigin = Object.assign({ 'Content-Type': 'application/json' }, headers);
|
|
10511
11709
|
if (method !== 'GET' && method !== 'HEAD') {
|
|
10512
11710
|
headersOrigin['X-Idempotency-Key'] = uuid;
|
|
@@ -10533,14 +11731,14 @@ function fetchRequest$1(url, method = 'GET', body = null, headers = {}) {
|
|
|
10533
11731
|
.catch((error) => reject(error));
|
|
10534
11732
|
});
|
|
10535
11733
|
}
|
|
10536
|
-
function isEmptyValueOfArray(arr) {
|
|
11734
|
+
function isEmptyValueOfArray$1(arr) {
|
|
10537
11735
|
if (arr.length === 0) {
|
|
10538
11736
|
return true;
|
|
10539
11737
|
}
|
|
10540
11738
|
const len = arr.length;
|
|
10541
11739
|
let count = 0;
|
|
10542
11740
|
for (let i = 0; i < len; i++) {
|
|
10543
|
-
if (isEmptyValue(arr[i])) {
|
|
11741
|
+
if (isEmptyValue$1(arr[i])) {
|
|
10544
11742
|
count++;
|
|
10545
11743
|
}
|
|
10546
11744
|
else {
|
|
@@ -10552,14 +11750,14 @@ function isEmptyValueOfArray(arr) {
|
|
|
10552
11750
|
}
|
|
10553
11751
|
return false;
|
|
10554
11752
|
}
|
|
10555
|
-
function isEmptyValueOfObject(obj) {
|
|
11753
|
+
function isEmptyValueOfObject$1(obj) {
|
|
10556
11754
|
if (Object.keys(obj).length === 0) {
|
|
10557
11755
|
return true;
|
|
10558
11756
|
}
|
|
10559
11757
|
const len = Object.keys(obj).length;
|
|
10560
11758
|
let count = 0;
|
|
10561
11759
|
for (const val of Object.values(obj)) {
|
|
10562
|
-
if (isEmptyValue(val)) {
|
|
11760
|
+
if (isEmptyValue$1(val)) {
|
|
10563
11761
|
count++;
|
|
10564
11762
|
}
|
|
10565
11763
|
else {
|
|
@@ -10571,7 +11769,7 @@ function isEmptyValueOfObject(obj) {
|
|
|
10571
11769
|
}
|
|
10572
11770
|
return false;
|
|
10573
11771
|
}
|
|
10574
|
-
function isEmptyValue(value, allowZero) {
|
|
11772
|
+
function isEmptyValue$1(value, allowZero) {
|
|
10575
11773
|
if (value === null || value === undefined || value === '') {
|
|
10576
11774
|
return true;
|
|
10577
11775
|
}
|
|
@@ -10579,19 +11777,19 @@ function isEmptyValue(value, allowZero) {
|
|
|
10579
11777
|
return false;
|
|
10580
11778
|
}
|
|
10581
11779
|
else if (Array.isArray(value)) {
|
|
10582
|
-
return isEmptyValueOfArray(value);
|
|
11780
|
+
return isEmptyValueOfArray$1(value);
|
|
10583
11781
|
}
|
|
10584
11782
|
else if (Object.prototype.toString.call(value) === '[object Object]') {
|
|
10585
|
-
return isEmptyValueOfObject(value);
|
|
11783
|
+
return isEmptyValueOfObject$1(value);
|
|
10586
11784
|
}
|
|
10587
11785
|
else {
|
|
10588
11786
|
return !value;
|
|
10589
11787
|
}
|
|
10590
11788
|
}
|
|
10591
|
-
function toQueryParams(params) {
|
|
11789
|
+
function toQueryParams$1(params) {
|
|
10592
11790
|
const finalParams = {};
|
|
10593
11791
|
Object.entries(params).forEach(([key, value]) => {
|
|
10594
|
-
if (!isEmptyValue(value, true)) {
|
|
11792
|
+
if (!isEmptyValue$1(value, true)) {
|
|
10595
11793
|
finalParams[key] = value;
|
|
10596
11794
|
}
|
|
10597
11795
|
});
|
|
@@ -10647,7 +11845,7 @@ const isMobile = (userAgent) => {
|
|
|
10647
11845
|
userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
|
|
10648
11846
|
userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
|
|
10649
11847
|
};
|
|
10650
|
-
const showNotification$
|
|
11848
|
+
const showNotification$1 = ({ message, theme = 'success' }) => {
|
|
10651
11849
|
window.postMessage({
|
|
10652
11850
|
type: 'ShowNotificationToast',
|
|
10653
11851
|
message,
|
|
@@ -10932,7 +12130,7 @@ const getTranslations$1 = (data) => {
|
|
|
10932
12130
|
});
|
|
10933
12131
|
};
|
|
10934
12132
|
|
|
10935
|
-
const formatDate
|
|
12133
|
+
const formatDate = ({ date, type = 'date', format: format$1 }) => {
|
|
10936
12134
|
try {
|
|
10937
12135
|
const parsedDate = parseISO(date);
|
|
10938
12136
|
if (isNaN(parsedDate.getTime())) {
|
|
@@ -10967,7 +12165,7 @@ const DEFAULT_BULLET_CONFIG = [
|
|
|
10967
12165
|
}
|
|
10968
12166
|
];
|
|
10969
12167
|
const SPLIT_TOKEN = '-';
|
|
10970
|
-
const showNotification
|
|
12168
|
+
const showNotification = ({ message, theme = 'success', renderOne = false }) => {
|
|
10971
12169
|
window.postMessage({
|
|
10972
12170
|
type: 'ShowNotificationToast',
|
|
10973
12171
|
message,
|
|
@@ -11014,7 +12212,7 @@ const LotteryTippingTicketBet = class {
|
|
|
11014
12212
|
width: 22,
|
|
11015
12213
|
align: 'right',
|
|
11016
12214
|
nowrap: true,
|
|
11017
|
-
render: (_, value) => formatDate
|
|
12215
|
+
render: (_, value) => formatDate({ date: value, format: 'ccc HH:mm' })
|
|
11018
12216
|
},
|
|
11019
12217
|
{
|
|
11020
12218
|
title: () => (index.h("lottery-tipping-bullet-group", { theme: "text", bulletConfigContent: JSON.stringify(DEFAULT_BULLET_CONFIG) })),
|
|
@@ -11149,7 +12347,7 @@ const LotteryTippingTicketBet = class {
|
|
|
11149
12347
|
}
|
|
11150
12348
|
handleClearAll() {
|
|
11151
12349
|
this._resetBulletConfig();
|
|
11152
|
-
showNotification
|
|
12350
|
+
showNotification({ message: translate$1('selectionCleared', this.language), renderOne: true });
|
|
11153
12351
|
this.lotteryTippingBulletBetEvent.emit({ hasSelectBullet: false });
|
|
11154
12352
|
}
|
|
11155
12353
|
async resetBulletConfig({ minLineNumber, maxLineNumber, defaultBoards }) {
|
|
@@ -11317,39 +12515,193 @@ const LotteryTippingTicketBet = class {
|
|
|
11317
12515
|
};
|
|
11318
12516
|
LotteryTippingTicketBet.style = LotteryTippingTicketBetStyle0;
|
|
11319
12517
|
|
|
11320
|
-
|
|
11321
|
-
(
|
|
11322
|
-
|
|
11323
|
-
|
|
11324
|
-
|
|
11325
|
-
|
|
11326
|
-
|
|
11327
|
-
|
|
11328
|
-
|
|
11329
|
-
|
|
11330
|
-
|
|
11331
|
-
|
|
11332
|
-
|
|
11333
|
-
|
|
11334
|
-
|
|
11335
|
-
|
|
11336
|
-
|
|
11337
|
-
|
|
11338
|
-
|
|
11339
|
-
|
|
11340
|
-
}
|
|
12518
|
+
function isEmptyValue(value, allowZero) {
|
|
12519
|
+
if (value === null || value === undefined || value === '') {
|
|
12520
|
+
return true;
|
|
12521
|
+
}
|
|
12522
|
+
else if (value === 0 && allowZero) {
|
|
12523
|
+
return false;
|
|
12524
|
+
}
|
|
12525
|
+
else if (Array.isArray(value)) {
|
|
12526
|
+
return isEmptyValueOfArray(value);
|
|
12527
|
+
}
|
|
12528
|
+
else if (Object.prototype.toString.call(value) === '[object Object]') {
|
|
12529
|
+
return isEmptyValueOfObject(value);
|
|
12530
|
+
}
|
|
12531
|
+
else {
|
|
12532
|
+
return !value;
|
|
12533
|
+
}
|
|
12534
|
+
}
|
|
12535
|
+
function isEmptyValueOfArray(arr) {
|
|
12536
|
+
if (arr.length === 0) {
|
|
12537
|
+
return true;
|
|
12538
|
+
}
|
|
12539
|
+
const len = arr.length;
|
|
12540
|
+
let count = 0;
|
|
12541
|
+
for (let i = 0; i < len; i++) {
|
|
12542
|
+
if (isEmptyValue(arr[i])) {
|
|
12543
|
+
count++;
|
|
12544
|
+
}
|
|
12545
|
+
else {
|
|
12546
|
+
return false;
|
|
12547
|
+
}
|
|
12548
|
+
}
|
|
12549
|
+
if (count === len) {
|
|
12550
|
+
return true;
|
|
12551
|
+
}
|
|
12552
|
+
return false;
|
|
12553
|
+
}
|
|
12554
|
+
function isEmptyValueOfObject(obj) {
|
|
12555
|
+
if (Object.keys(obj).length === 0) {
|
|
12556
|
+
return true;
|
|
12557
|
+
}
|
|
12558
|
+
const len = Object.keys(obj).length;
|
|
12559
|
+
let count = 0;
|
|
12560
|
+
for (const val of Object.values(obj)) {
|
|
12561
|
+
if (isEmptyValue(val)) {
|
|
12562
|
+
count++;
|
|
12563
|
+
}
|
|
12564
|
+
else {
|
|
12565
|
+
return false;
|
|
12566
|
+
}
|
|
12567
|
+
}
|
|
12568
|
+
if (count === len) {
|
|
12569
|
+
return true;
|
|
12570
|
+
}
|
|
12571
|
+
return false;
|
|
12572
|
+
}
|
|
12573
|
+
function thousandSeparator(value) {
|
|
12574
|
+
if (value === 0) {
|
|
12575
|
+
return '0';
|
|
12576
|
+
}
|
|
12577
|
+
if (!value) {
|
|
12578
|
+
return '';
|
|
12579
|
+
}
|
|
12580
|
+
value = value.toString();
|
|
12581
|
+
const parts = value.split('.');
|
|
12582
|
+
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
12583
|
+
return parts.join('.');
|
|
12584
|
+
}
|
|
12585
|
+
function formattedTurnover(turnover, unit = '€') {
|
|
12586
|
+
if (turnover === null || turnover === undefined)
|
|
12587
|
+
return '';
|
|
12588
|
+
return `${unit}${turnover ? thousandSeparator(turnover) : 0}`;
|
|
12589
|
+
}
|
|
12590
|
+
function calculateCombinationInLine(selectionsInLine = [[]], matchNum) {
|
|
12591
|
+
let res = 1;
|
|
12592
|
+
for (let i = 0; i < matchNum; i++) {
|
|
12593
|
+
const curMatchSelections = (selectionsInLine[i] || []).filter((i) => i);
|
|
12594
|
+
res *= curMatchSelections.length;
|
|
12595
|
+
if (res === 0)
|
|
12596
|
+
return 0;
|
|
12597
|
+
}
|
|
12598
|
+
return res;
|
|
12599
|
+
}
|
|
12600
|
+
function getTotalLinesAndCheckIfNotComplete(bulletSelectionsLineGroup, matchNum, minCombinations, maxCombinations) {
|
|
12601
|
+
const isEffectivelyEmpty = !bulletSelectionsLineGroup ||
|
|
12602
|
+
bulletSelectionsLineGroup.length === 0 ||
|
|
12603
|
+
bulletSelectionsLineGroup.every((board) => !board.some((match) => match && match.length > 0));
|
|
12604
|
+
if (isEffectivelyEmpty || matchNum === undefined || matchNum === null) {
|
|
12605
|
+
return {
|
|
12606
|
+
totalLines: 0,
|
|
12607
|
+
notComplete: true
|
|
12608
|
+
};
|
|
12609
|
+
}
|
|
12610
|
+
// total line combination is sum of all the line's combination
|
|
12611
|
+
const _totalLines = bulletSelectionsLineGroup.reduce((pre, cur) => pre + calculateCombinationInLine(cur, matchNum), 0);
|
|
12612
|
+
// each line's combination should within in [minCombinations, maxCombinations]
|
|
12613
|
+
return {
|
|
12614
|
+
totalLines: _totalLines,
|
|
12615
|
+
notComplete: bulletSelectionsLineGroup.some((selectionsInLine) => {
|
|
12616
|
+
const curCombination = calculateCombinationInLine(selectionsInLine, matchNum);
|
|
12617
|
+
return curCombination < minCombinations || curCombination > maxCombinations;
|
|
12618
|
+
})
|
|
12619
|
+
};
|
|
12620
|
+
}
|
|
12621
|
+
|
|
12622
|
+
const generateUUID = () => {
|
|
12623
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
12624
|
+
var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
|
|
12625
|
+
return v.toString(16);
|
|
12626
|
+
});
|
|
12627
|
+
};
|
|
12628
|
+
function fetchRequest(url, method = 'GET', body = null, headers = {}) {
|
|
12629
|
+
return new Promise((resolve, reject) => {
|
|
12630
|
+
const uuid = generateUUID();
|
|
12631
|
+
const headersOrigin = Object.assign({ 'Content-Type': 'application/json', 'X-APP-KEY': '123456' }, headers);
|
|
12632
|
+
if (method !== 'GET' && method !== 'HEAD') {
|
|
12633
|
+
headersOrigin['X-Idempotency-Key'] = uuid;
|
|
12634
|
+
}
|
|
12635
|
+
const options = {
|
|
12636
|
+
method,
|
|
12637
|
+
headers: headersOrigin,
|
|
12638
|
+
body: null
|
|
12639
|
+
};
|
|
12640
|
+
if (body && method !== 'GET' && method !== 'HEAD') {
|
|
12641
|
+
options.body = JSON.stringify(body);
|
|
12642
|
+
}
|
|
12643
|
+
else {
|
|
12644
|
+
delete options.body;
|
|
12645
|
+
}
|
|
12646
|
+
fetch(url, options)
|
|
12647
|
+
.then((response) => {
|
|
12648
|
+
if (!response.ok) {
|
|
12649
|
+
return response.json().then((errorData) => {
|
|
12650
|
+
const error = {
|
|
12651
|
+
status: response.status,
|
|
12652
|
+
statusText: response.statusText,
|
|
12653
|
+
code: errorData.code || 'UNKNOWN_ERROR',
|
|
12654
|
+
message: errorData.message || 'An unknown error occurred',
|
|
12655
|
+
data: errorData.data || null
|
|
12656
|
+
};
|
|
12657
|
+
reject(error);
|
|
12658
|
+
}, () => reject({
|
|
12659
|
+
status: response.status,
|
|
12660
|
+
statusText: response.statusText,
|
|
12661
|
+
code: 'PARSE_ERROR',
|
|
12662
|
+
message: 'Failed to parse error response'
|
|
12663
|
+
}));
|
|
12664
|
+
}
|
|
12665
|
+
else {
|
|
12666
|
+
return response.json();
|
|
12667
|
+
}
|
|
12668
|
+
})
|
|
12669
|
+
.then((data) => resolve(data), (error) => reject(error));
|
|
12670
|
+
});
|
|
12671
|
+
}
|
|
12672
|
+
async function fetchSaleStatistics({ endpoint, gameId, drawId }) {
|
|
12673
|
+
try {
|
|
12674
|
+
const res = await fetchRequest(`${endpoint}/games/${gameId}/draws/${drawId}/saleStatistics`);
|
|
12675
|
+
return res;
|
|
12676
|
+
}
|
|
12677
|
+
catch (error) {
|
|
12678
|
+
return Promise.reject(error);
|
|
12679
|
+
}
|
|
12680
|
+
}
|
|
12681
|
+
function toQueryParams(params) {
|
|
12682
|
+
const finalParams = {};
|
|
12683
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
12684
|
+
if (!isEmptyValue(value, true)) {
|
|
12685
|
+
finalParams[key] = value;
|
|
12686
|
+
}
|
|
12687
|
+
});
|
|
12688
|
+
const queryString = Object.entries(finalParams)
|
|
12689
|
+
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
|
|
12690
|
+
.join('&');
|
|
12691
|
+
return queryString ? `?${queryString}` : '';
|
|
12692
|
+
}
|
|
11341
12693
|
|
|
11342
12694
|
const DEFAULT_LANGUAGE = 'en';
|
|
11343
12695
|
const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
|
|
11344
12696
|
const TRANSLATIONS = {
|
|
11345
12697
|
en: {
|
|
11346
|
-
gameNotAvailable: 'Sorry. The Game is not available now.',
|
|
11347
12698
|
stop: 'Stop',
|
|
11348
12699
|
at: 'at',
|
|
11349
12700
|
turnover: 'Turnover: ',
|
|
11350
12701
|
selectionCleared: 'Your selection will be cleared.',
|
|
12702
|
+
selectionOnLineCleared: 'Your selection on this line will be cleared.',
|
|
11351
12703
|
ticketSubmitted: 'Ticket submitted successfully.',
|
|
11352
|
-
ticketFailed: 'Failed to
|
|
12704
|
+
ticketFailed: 'Failed to purchase the ticket. Please try again.',
|
|
11353
12705
|
lines: 'Lines',
|
|
11354
12706
|
line: 'Line',
|
|
11355
12707
|
bettingType: 'Betting Type',
|
|
@@ -11360,7 +12712,9 @@ const TRANSLATIONS = {
|
|
|
11360
12712
|
orderSummarySubmit: 'Submit',
|
|
11361
12713
|
cancel: 'Cancel',
|
|
11362
12714
|
confirm: 'Confirm',
|
|
11363
|
-
stakePerLine: 'Stake per Line:'
|
|
12715
|
+
stakePerLine: 'Stake per Line:',
|
|
12716
|
+
error: 'Error!',
|
|
12717
|
+
gameNotAvailable: 'Sorry. The Game is not available now.'
|
|
11364
12718
|
},
|
|
11365
12719
|
ro: {
|
|
11366
12720
|
selectionCleared: 'Selecția dvs. va fi ștearsă.',
|
|
@@ -11423,432 +12777,92 @@ const TRANSLATIONS = {
|
|
|
11423
12777
|
confirm: 'Potvrdi'
|
|
11424
12778
|
}
|
|
11425
12779
|
};
|
|
11426
|
-
const translate = (key, customLang) => {
|
|
11427
|
-
const lang = customLang;
|
|
11428
|
-
|
|
11429
|
-
|
|
11430
|
-
|
|
11431
|
-
|
|
11432
|
-
for (let key in data[item]) {
|
|
11433
|
-
TRANSLATIONS[item][key] = data[item][key];
|
|
11434
|
-
}
|
|
11435
|
-
});
|
|
11436
|
-
};
|
|
11437
|
-
const resolveTranslationUrl = async (translationUrl) => {
|
|
11438
|
-
if (translationUrl) {
|
|
11439
|
-
try {
|
|
11440
|
-
const response = await fetch(translationUrl);
|
|
11441
|
-
if (!response.ok) {
|
|
11442
|
-
throw new Error(`HTTP error! status: ${response.status}`);
|
|
11443
|
-
}
|
|
11444
|
-
const translations = await response.json();
|
|
11445
|
-
getTranslations(translations);
|
|
11446
|
-
}
|
|
11447
|
-
catch (error) {
|
|
11448
|
-
console.error('Failed to fetch or parse translations from URL:', error);
|
|
11449
|
-
}
|
|
11450
|
-
}
|
|
11451
|
-
};
|
|
11452
|
-
|
|
11453
|
-
const formatDate = ({ date, type = 'date', format: format$1 }) => {
|
|
11454
|
-
try {
|
|
11455
|
-
const parsedDate = parseISO(date);
|
|
11456
|
-
if (isNaN(parsedDate.getTime())) {
|
|
11457
|
-
throw new Error(`Invalid date: ${date}`);
|
|
11458
|
-
}
|
|
11459
|
-
if (format$1)
|
|
11460
|
-
return format(parsedDate, format$1);
|
|
11461
|
-
let formatStr = 'dd/MM/yyyy';
|
|
11462
|
-
if (type === 'time') {
|
|
11463
|
-
formatStr = 'dd/MM/yyyy HH:mm:ss';
|
|
11464
|
-
}
|
|
11465
|
-
else if (type === 'week') {
|
|
11466
|
-
formatStr = 'ccc dd/MM/yyyy HH:mm:ss';
|
|
11467
|
-
}
|
|
11468
|
-
return format(parsedDate, formatStr);
|
|
11469
|
-
}
|
|
11470
|
-
catch (error) {
|
|
11471
|
-
console.error('Error formatting date:', error.message);
|
|
11472
|
-
return '';
|
|
11473
|
-
}
|
|
11474
|
-
};
|
|
11475
|
-
const generateUUID$1 = () => {
|
|
11476
|
-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
11477
|
-
var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
|
|
11478
|
-
return v.toString(16);
|
|
11479
|
-
});
|
|
11480
|
-
};
|
|
11481
|
-
function fetchRequest(url, method = 'GET', body = null, headers = {}) {
|
|
11482
|
-
return new Promise((resolve, reject) => {
|
|
11483
|
-
const uuid = generateUUID$1();
|
|
11484
|
-
const headersOrigin = Object.assign({ 'Content-Type': 'application/json' }, headers);
|
|
11485
|
-
if (method !== 'GET' && method !== 'HEAD') {
|
|
11486
|
-
headersOrigin['X-Idempotency-Key'] = uuid;
|
|
11487
|
-
}
|
|
11488
|
-
const options = {
|
|
11489
|
-
method,
|
|
11490
|
-
headers: headersOrigin
|
|
11491
|
-
};
|
|
11492
|
-
if (body && method !== 'GET' && method !== 'HEAD') {
|
|
11493
|
-
options.body = JSON.stringify(body);
|
|
11494
|
-
}
|
|
11495
|
-
fetch(url, options)
|
|
11496
|
-
.then((response) => {
|
|
11497
|
-
if (!response.ok) {
|
|
11498
|
-
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
11499
|
-
}
|
|
11500
|
-
return response.json();
|
|
11501
|
-
})
|
|
11502
|
-
.then((data) => resolve(data))
|
|
11503
|
-
.catch((error) => reject(error));
|
|
11504
|
-
});
|
|
11505
|
-
}
|
|
11506
|
-
const showNotification = ({ message, theme = 'success' }) => {
|
|
11507
|
-
window.postMessage({
|
|
11508
|
-
type: 'ShowNotificationToast',
|
|
11509
|
-
message,
|
|
11510
|
-
theme
|
|
11511
|
-
});
|
|
11512
|
-
};
|
|
11513
|
-
const thousandSeparator = (value) => {
|
|
11514
|
-
if (value === 0) {
|
|
11515
|
-
return '0';
|
|
11516
|
-
}
|
|
11517
|
-
if (!value) {
|
|
11518
|
-
return '';
|
|
11519
|
-
}
|
|
11520
|
-
value = value.toString();
|
|
11521
|
-
const parts = value.split('.');
|
|
11522
|
-
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
11523
|
-
return parts.join('.');
|
|
11524
|
-
};
|
|
11525
|
-
const HomeDrawAwayArr = ['H', 'D', 'A'];
|
|
11526
|
-
// Utility to format raw results into winning numbers (H/D/A)
|
|
11527
|
-
const formatResultsToWinningNumbers = (rawResults) => {
|
|
11528
|
-
// Convert each bullet item into binary (1 if selected, 0 otherwise)
|
|
11529
|
-
const toBinarySelection = (matchRes) => matchRes.map((bulletItem) => (bulletItem.isSelected ? 1 : 0));
|
|
11530
|
-
// Step 1: Convert rawResults into arrays of 0/1 flags
|
|
11531
|
-
const binaryResults = rawResults.map((lineRes) => lineRes.map(toBinarySelection));
|
|
11532
|
-
const resultLinesArr = [];
|
|
11533
|
-
// Step 2: Iterate through each line of results
|
|
11534
|
-
binaryResults.forEach((line, lineIdx) => {
|
|
11535
|
-
const formattedLine = [];
|
|
11536
|
-
// Step 3: Iterate through each match in a line
|
|
11537
|
-
line.forEach((match, matchIdx) => {
|
|
11538
|
-
// Step 4: Collect the winning outcomes (H/D/A) based on binary flags
|
|
11539
|
-
const outcomes = match.map((isSelected, idx) => (isSelected ? HomeDrawAwayArr[idx] : null)).filter(Boolean);
|
|
11540
|
-
// Wrap outcomes into the expected structure [[matchRes]]
|
|
11541
|
-
formattedLine[matchIdx] = [outcomes];
|
|
12780
|
+
const translate = (key, customLang, replacements) => {
|
|
12781
|
+
const lang = customLang;
|
|
12782
|
+
let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
12783
|
+
if (replacements) {
|
|
12784
|
+
Object.keys(replacements).forEach((placeholder) => {
|
|
12785
|
+
translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
|
|
11542
12786
|
});
|
|
11543
|
-
resultLinesArr[lineIdx] = formattedLine;
|
|
11544
|
-
});
|
|
11545
|
-
return resultLinesArr;
|
|
11546
|
-
};
|
|
11547
|
-
const buildSubmitParam = ({ playerId, rawResults, gameId, rawData, amount, currentStake, betTypeId, betType }) => {
|
|
11548
|
-
var _a;
|
|
11549
|
-
const body = { playerId, tickets: [] };
|
|
11550
|
-
const selections = formatResultsToWinningNumbers(rawResults);
|
|
11551
|
-
const stake = currentStake || {};
|
|
11552
|
-
body.tickets.push({
|
|
11553
|
-
startingDrawId: (_a = rawData === null || rawData === void 0 ? void 0 : rawData.currentDraw) === null || _a === void 0 ? void 0 : _a.id,
|
|
11554
|
-
amount,
|
|
11555
|
-
gameId: gameId,
|
|
11556
|
-
gameName: rawData.name,
|
|
11557
|
-
currency: stake.currency,
|
|
11558
|
-
selection: selections.map((i) => ({
|
|
11559
|
-
betType: betTypeId,
|
|
11560
|
-
stake: +stake.value,
|
|
11561
|
-
poolGameSelections: i,
|
|
11562
|
-
quickPick: false,
|
|
11563
|
-
betName: betType.name
|
|
11564
|
-
})),
|
|
11565
|
-
multiplier: false,
|
|
11566
|
-
drawCount: 1,
|
|
11567
|
-
quickPick: false
|
|
11568
|
-
});
|
|
11569
|
-
return body;
|
|
11570
|
-
};
|
|
11571
|
-
// BettingTypes, playModes and playTypes
|
|
11572
|
-
const getEnableOptions = (raw = []) => raw.filter((i) => i.enabled);
|
|
11573
|
-
// the first one in bet type config that enabled = true, will be default choice
|
|
11574
|
-
const getDefaultType = ({ playTypeConfig = [], betTypeConfig = [], enabledBettingTypeOptions = [], enabledPlayingModeOptions = [] }) => {
|
|
11575
|
-
const enabledBetTypeConfig = betTypeConfig.filter((i) => i.enabled);
|
|
11576
|
-
for (const item of enabledBetTypeConfig) {
|
|
11577
|
-
const { bettingType, playMode } = playTypeConfig === null || playTypeConfig === void 0 ? void 0 : playTypeConfig.find((i) => i.betTypeId === item.id);
|
|
11578
|
-
if (enabledBettingTypeOptions.map((i) => i.code).includes(bettingType) &&
|
|
11579
|
-
enabledPlayingModeOptions.map((i) => i.code).includes(playMode))
|
|
11580
|
-
return { bettingType, playMode };
|
|
11581
|
-
}
|
|
11582
|
-
return {};
|
|
11583
|
-
};
|
|
11584
|
-
const calculatePlayingModeOptions = ({ bettingType, playTypeConfig, betTypeConfig, enabledPlayingModeOptions }) => {
|
|
11585
|
-
const enabledBetTypeIdConfig = betTypeConfig.filter((i) => i.enabled).map((i) => i.id);
|
|
11586
|
-
const filteredPlayTypesConfig = playTypeConfig.filter((i) => enabledBetTypeIdConfig.includes(i.betTypeId));
|
|
11587
|
-
const selectedBettingTypeFilteredPlayTypesConfig = filteredPlayTypesConfig.filter((i) => i.bettingType === bettingType);
|
|
11588
|
-
const _ = selectedBettingTypeFilteredPlayTypesConfig.map((i) => i.playMode);
|
|
11589
|
-
return enabledPlayingModeOptions.filter((i) => _.includes(i.code));
|
|
11590
|
-
};
|
|
11591
|
-
const getCheckedCountForEachLineAndEachMatch = ({ rawResults }) => {
|
|
11592
|
-
const getMatchCheckRes = (matchRes) => matchRes.filter((bulletItem) => bulletItem.isSelected).length;
|
|
11593
|
-
const checkedCountForEachLineAndEachMatch = rawResults.map((lineRes) => lineRes.length > 0 ? lineRes.map(getMatchCheckRes) : [0]);
|
|
11594
|
-
return checkedCountForEachLineAndEachMatch;
|
|
11595
|
-
};
|
|
11596
|
-
const getPlayTypeConfig = ({ rawData, selectedBettingType, selectedPlayingMode }) => {
|
|
11597
|
-
var _a, _b, _c, _d, _e, _f;
|
|
11598
|
-
const betTypeId = (_d = (_c = (_b = (_a = rawData === null || rawData === void 0 ? void 0 : rawData.rules) === null || _a === void 0 ? void 0 : _a.poolGame) === null || _b === void 0 ? void 0 : _b.playTypes) === null || _c === void 0 ? void 0 : _c.find((i) => i.bettingType === selectedBettingType && i.playMode === selectedPlayingMode)) === null || _d === void 0 ? void 0 : _d.betTypeId;
|
|
11599
|
-
const betType = (_f = (_e = rawData === null || rawData === void 0 ? void 0 : rawData.rules) === null || _e === void 0 ? void 0 : _e.betTypes) === null || _f === void 0 ? void 0 : _f.find((i) => i.id === betTypeId);
|
|
11600
|
-
return { betTypeId, betType };
|
|
11601
|
-
};
|
|
11602
|
-
const getMinValue = (arr) => (arr.length ? Math.min.apply(null, arr) : undefined);
|
|
11603
|
-
function formattedTurnover(turnover, unit = '€') {
|
|
11604
|
-
if (turnover === null || turnover === undefined)
|
|
11605
|
-
return '';
|
|
11606
|
-
return `${unit}${turnover ? thousandSeparator(turnover) : 0}`;
|
|
11607
|
-
}
|
|
11608
|
-
function formattedWeekName(date) {
|
|
11609
|
-
if (!date)
|
|
11610
|
-
return '';
|
|
11611
|
-
const _temp = formatDate({ date, format: 'EEEE' });
|
|
11612
|
-
if (!['saturday', 'sunday'].includes(_temp.toLowerCase())) {
|
|
11613
|
-
return 'MIDWEEK';
|
|
11614
12787
|
}
|
|
11615
|
-
return
|
|
11616
|
-
}
|
|
11617
|
-
|
|
11618
|
-
const TICKET_INVALID_TOKEN = 'TICKET_INVALID_TOKEN';
|
|
11619
|
-
const generateUUID = () => {
|
|
11620
|
-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
11621
|
-
var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
|
|
11622
|
-
return v.toString(16);
|
|
11623
|
-
});
|
|
12788
|
+
return translation;
|
|
11624
12789
|
};
|
|
11625
|
-
const
|
|
11626
|
-
|
|
11627
|
-
|
|
11628
|
-
|
|
11629
|
-
'Content-Type': 'application/json',
|
|
11630
|
-
Accept: 'application/json',
|
|
11631
|
-
Authorization: `Bearer ${sessionId}`,
|
|
11632
|
-
'X-Idempotency-Key': generateUUID()
|
|
11633
|
-
},
|
|
11634
|
-
body: JSON.stringify(body)
|
|
11635
|
-
};
|
|
11636
|
-
return fetch(url, options).then((res) => {
|
|
11637
|
-
if (res.status === 401) {
|
|
11638
|
-
throw new Error(TICKET_INVALID_TOKEN);
|
|
11639
|
-
}
|
|
11640
|
-
if (res.status > 300) {
|
|
11641
|
-
throw new Error(res.statusText);
|
|
12790
|
+
const getTranslations = (data) => {
|
|
12791
|
+
Object.keys(data).forEach((item) => {
|
|
12792
|
+
for (let key in data[item]) {
|
|
12793
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
11642
12794
|
}
|
|
11643
|
-
return res.json().then((data) => {
|
|
11644
|
-
if (checkTicketDetailHasError(data.tickets))
|
|
11645
|
-
throw new Error(res.statusText);
|
|
11646
|
-
return data;
|
|
11647
|
-
});
|
|
11648
12795
|
});
|
|
11649
12796
|
};
|
|
11650
|
-
|
|
11651
|
-
if (
|
|
11652
|
-
|
|
11653
|
-
|
|
11654
|
-
|
|
11655
|
-
|
|
11656
|
-
|
|
11657
|
-
|
|
11658
|
-
|
|
11659
|
-
|
|
11660
|
-
|
|
11661
|
-
|
|
12797
|
+
const resolveTranslationUrl = async (translationUrl) => {
|
|
12798
|
+
if (translationUrl) {
|
|
12799
|
+
try {
|
|
12800
|
+
const response = await fetch(translationUrl);
|
|
12801
|
+
if (!response.ok) {
|
|
12802
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
12803
|
+
}
|
|
12804
|
+
const translations = await response.json();
|
|
12805
|
+
getTranslations(translations);
|
|
12806
|
+
}
|
|
12807
|
+
catch (error) {
|
|
12808
|
+
console.error('Failed to fetch or parse translations from URL:', error);
|
|
12809
|
+
}
|
|
11662
12810
|
}
|
|
11663
|
-
}
|
|
12811
|
+
};
|
|
11664
12812
|
|
|
11665
|
-
const
|
|
11666
|
-
const
|
|
12813
|
+
const lotteryTippingTicketBuyCss = ":host {\n --vaadin-input-field-background: var(--emw--color-background, #fff);\n --vaadin-input-field-border-color: var(--emw--color-gray-100, #e6e6e6);\n --vaadin-input-field-invalid-hover-highlight: var(--emw--color-background, #fff);\n --vaadin-input-field-hover-highlight: var(--emw--color-background, #fff);\n --vaadin-input-field-border-width: 1px;\n --lottery-selection-border-color: #e6e6e6;\n --lottery-selection-hover-border-color: #e6e6e6;\n --lottery-selection-selected-border-color: #e6e6e6;\n --lottery-selection-selected-color: #fed275;\n --lottery-button-primary-active-bg: #fed275;\n --lottery-selection-selected-background: #000;\n --lottery-button-text-color: #000;\n}\n\n.lottery-tipping-ticket-buy {\n container-type: inline-size;\n container-name: lottery-tipping-ticket-buy;\n}\n\n.flex {\n display: flex;\n}\n\n.flex-wrap {\n flex-wrap: wrap;\n}\n\n.order-summary__details {\n display: flex;\n align-items: center;\n color: var(--emw--color-typography, #000);\n}\n\n.order-summary__multiplier {\n color: var(--emw--color-typography-secondary, #333);\n margin: 0 8px;\n}\n\n.bet-selector {\n display: flex;\n gap: 18px;\n flex-direction: column;\n width: 80%;\n max-width: 800px;\n margin: 20px auto;\n}\n.bet-selector-line {\n display: flex;\n align-items: center;\n}\n.bet-selector-line-segments {\n width: 100%;\n display: flex;\n flex-wrap: wrap;\n gap: 18px;\n justify-content: space-between;\n}\n.bet-selector-line-label {\n font-size: 16px;\n margin-right: 8px;\n color: var(--emw--color-typography, #000);\n}\n\n.bet-board {\n display: flex;\n width: 84vw;\n max-width: 1200px;\n margin: 0px auto;\n gap: 30px;\n flex-wrap: wrap;\n}\n.bet-board-slip {\n min-width: 460px;\n flex: 1.6;\n}\n.bet-board-order {\n flex: 1;\n min-width: 200px;\n}\n\n@container lottery-tipping-ticket-buy (max-width: 768px) {\n .bet-board {\n width: 94%;\n }\n .bet-board-slip {\n min-width: 100%;\n }\n}\n.skeleton-block {\n background-color: var(--emw--color-background-tertiary, #e0e0e0);\n border-radius: 4px;\n position: relative;\n overflow: hidden;\n}\n.skeleton-block::after {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: linear-gradient(90deg, transparent, var(--emw--color-background-secondary, rgba(255, 255, 255, 0.4)), transparent);\n animation: shimmer 1.5s infinite;\n}\n\n@keyframes shimmer {\n 0% {\n transform: translateX(-100%);\n }\n 100% {\n transform: translateX(100%);\n }\n}\n.no-active-draw {\n margin: 100px auto;\n padding: 24px;\n border: 2px solid var(--emw--color-primary, #fed275);\n border-radius: 4px;\n width: 280px;\n color: var(--emw--color-typography, #000);\n}";
|
|
12814
|
+
const LotteryTippingTicketBuyStyle0 = lotteryTippingTicketBuyCss;
|
|
11667
12815
|
|
|
11668
|
-
const
|
|
12816
|
+
const LotteryTippingTicketBuy = class {
|
|
11669
12817
|
constructor(hostRef) {
|
|
11670
12818
|
index.registerInstance(this, hostRef);
|
|
11671
|
-
this.
|
|
11672
|
-
this.
|
|
11673
|
-
this.
|
|
11674
|
-
|
|
12819
|
+
this.onClearAll = index.createEvent(this, "lotteryTippingSelectionClear", 7);
|
|
12820
|
+
this.lotteryTicketParamsReady = index.createEvent(this, "lotteryTicketParamsReady", 7);
|
|
12821
|
+
this.SPLIT_TOKEN = ',';
|
|
12822
|
+
this.EVENT_PART_MAP = {
|
|
12823
|
+
'3': 'Full Time',
|
|
12824
|
+
'5': 'Half Time'
|
|
11675
12825
|
};
|
|
12826
|
+
this.endpoint = '';
|
|
12827
|
+
this.sessionId = undefined;
|
|
12828
|
+
this.playerId = '';
|
|
12829
|
+
this.gameId = '';
|
|
12830
|
+
this.drawId = '';
|
|
12831
|
+
this.currency = 'EUR';
|
|
12832
|
+
this.tippingBetOptions = '1,X,2';
|
|
12833
|
+
this.tippingBetOptionNames = 'Home,Draw,Away';
|
|
12834
|
+
this.groupBy = 'BettingType,EventPart,Event';
|
|
11676
12835
|
this.mbSource = undefined;
|
|
11677
12836
|
this.clientStyling = undefined;
|
|
11678
12837
|
this.clientStylingUrl = undefined;
|
|
11679
12838
|
this.translationUrl = '';
|
|
11680
12839
|
this.language = 'en';
|
|
11681
|
-
this.
|
|
11682
|
-
this.
|
|
11683
|
-
this.
|
|
11684
|
-
this.
|
|
11685
|
-
this.
|
|
11686
|
-
this.isLoading = true;
|
|
11687
|
-
this.bettingTypeOptions = [];
|
|
11688
|
-
this.playingModeOptions = [];
|
|
11689
|
-
this.selectedBettingType = undefined;
|
|
11690
|
-
this.selectedPlayingMode = undefined;
|
|
11691
|
-
this.hasSelectBullet = undefined;
|
|
11692
|
-
this.hasSelectAllBullet = undefined;
|
|
11693
|
-
this.totalLineCombination = 0;
|
|
11694
|
-
this.submitLoading = false;
|
|
11695
|
-
this.isSalesActive = false;
|
|
11696
|
-
this.drawSubmitAvailable = false;
|
|
11697
|
-
this.rawData = {};
|
|
11698
|
-
this.saleStatisticsInfo = {};
|
|
11699
|
-
this.currentStake = undefined;
|
|
12840
|
+
this.bulletSelectionsLineGroup = [[[]]];
|
|
12841
|
+
this.draw = undefined;
|
|
12842
|
+
this.isLoading = false;
|
|
12843
|
+
this.betCurrentPage = 1;
|
|
12844
|
+
this.betTotalPages = undefined;
|
|
11700
12845
|
this.dialogConfig = { visible: false };
|
|
12846
|
+
this.submitLoading = undefined;
|
|
12847
|
+
this.betHasErrors = false;
|
|
11701
12848
|
this.gameUnavailable = false;
|
|
11702
|
-
|
|
11703
|
-
|
|
11704
|
-
|
|
11705
|
-
|
|
11706
|
-
|
|
11707
|
-
|
|
11708
|
-
|
|
11709
|
-
|
|
11710
|
-
|
|
11711
|
-
|
|
11712
|
-
|
|
11713
|
-
const [minLineNumber, maxLineNumber] = [Math.min(...boardsAllowed), Math.max(...boardsAllowed)];
|
|
11714
|
-
const defaultBoards = (betType === null || betType === void 0 ? void 0 : betType.defaultBoards) || minLineNumber;
|
|
11715
|
-
return { minLineNumber, maxLineNumber, defaultBoards };
|
|
11716
|
-
}
|
|
11717
|
-
get playTypeConfig() {
|
|
11718
|
-
var _a, _b, _c;
|
|
11719
|
-
return (_c = (_b = (_a = this.rawData) === null || _a === void 0 ? void 0 : _a.rules) === null || _b === void 0 ? void 0 : _b.poolGame) === null || _c === void 0 ? void 0 : _c.playTypes;
|
|
11720
|
-
}
|
|
11721
|
-
get betTypeConfig() {
|
|
11722
|
-
var _a, _b;
|
|
11723
|
-
return (_b = (_a = this.rawData) === null || _a === void 0 ? void 0 : _a.rules) === null || _b === void 0 ? void 0 : _b.betTypes;
|
|
11724
|
-
}
|
|
11725
|
-
get isBothBettingType() {
|
|
11726
|
-
return this.selectedBettingType === BettingTypeEnum.Both;
|
|
11727
|
-
}
|
|
11728
|
-
get stakeOptions() {
|
|
11729
|
-
var _a, _b, _c;
|
|
11730
|
-
return (_c = (_b = (_a = this.rawData) === null || _a === void 0 ? void 0 : _a.rules) === null || _b === void 0 ? void 0 : _b.stakes) === null || _c === void 0 ? void 0 : _c.map((item) => {
|
|
11731
|
-
var _a;
|
|
11732
|
-
return { value: (_a = item.value) === null || _a === void 0 ? void 0 : _a.toString(), label: item.value, currency: item.currency };
|
|
11733
|
-
});
|
|
11734
|
-
}
|
|
11735
|
-
getCurrentStakeByValue(value) {
|
|
11736
|
-
var _a;
|
|
11737
|
-
return (_a = this.stakeOptions) === null || _a === void 0 ? void 0 : _a.find((item) => +item.value === +value);
|
|
11738
|
-
}
|
|
11739
|
-
initiateCurrentStake() {
|
|
11740
|
-
var _a, _b;
|
|
11741
|
-
// if only one option, default to the first one
|
|
11742
|
-
if (((_a = this.stakeOptions) === null || _a === void 0 ? void 0 : _a.length) === 1) {
|
|
11743
|
-
this.currentStake = this.stakeOptions[0];
|
|
11744
|
-
}
|
|
11745
|
-
else {
|
|
11746
|
-
// otherwise, default to the smallest stake option from the config
|
|
11747
|
-
const minValue = getMinValue(((_b = this.stakeOptions) === null || _b === void 0 ? void 0 : _b.map((i) => i.value)) || []);
|
|
11748
|
-
this.currentStake = this.getCurrentStakeByValue(minValue);
|
|
11749
|
-
}
|
|
11750
|
-
}
|
|
11751
|
-
handleBettingTypeChange(type) {
|
|
11752
|
-
var _a, _b, _c, _d;
|
|
11753
|
-
if (type === this.selectedBettingType)
|
|
11754
|
-
return;
|
|
11755
|
-
this.selectedBettingType = type;
|
|
11756
|
-
const calcPlayingModeOptions = calculatePlayingModeOptions({
|
|
11757
|
-
bettingType: this.selectedBettingType,
|
|
11758
|
-
playTypeConfig: this.playTypeConfig,
|
|
11759
|
-
betTypeConfig: this.betTypeConfig,
|
|
11760
|
-
enabledPlayingModeOptions: getEnableOptions(((_c = (_b = (_a = this.rawData) === null || _a === void 0 ? void 0 : _a.rules) === null || _b === void 0 ? void 0 : _b.poolGame) === null || _c === void 0 ? void 0 : _c.playModes) || [])
|
|
11761
|
-
});
|
|
11762
|
-
this.playingModeOptions = calcPlayingModeOptions;
|
|
11763
|
-
if (!calcPlayingModeOptions.length) {
|
|
11764
|
-
this.selectedPlayingMode = undefined;
|
|
11765
|
-
}
|
|
11766
|
-
else if (!calcPlayingModeOptions.map((i) => i.code).includes(this.selectedPlayingMode)) {
|
|
11767
|
-
this.hasSelectBullet = false;
|
|
11768
|
-
this.handlePlayingModeChange((_d = calcPlayingModeOptions[0]) === null || _d === void 0 ? void 0 : _d.code);
|
|
11769
|
-
}
|
|
11770
|
-
this.clearBulletConfig();
|
|
11771
|
-
}
|
|
11772
|
-
async clearBulletConfig() {
|
|
11773
|
-
return await this.childRef.resetBulletConfig(this.lineNumberRange);
|
|
11774
|
-
}
|
|
11775
|
-
handlePlayingModeChange(mode) {
|
|
11776
|
-
if (mode === this.selectedPlayingMode)
|
|
11777
|
-
return;
|
|
11778
|
-
const doChangeSelectedPlayingMod = (closeDialog) => {
|
|
11779
|
-
this.selectedPlayingMode = mode;
|
|
11780
|
-
this.clearBulletConfig().then(() => {
|
|
11781
|
-
closeDialog === null || closeDialog === void 0 ? void 0 : closeDialog();
|
|
11782
|
-
});
|
|
11783
|
-
};
|
|
11784
|
-
if (this.hasSelectBullet) {
|
|
11785
|
-
const closeDialog = () => {
|
|
11786
|
-
this.dialogConfig = { visible: false };
|
|
11787
|
-
};
|
|
11788
|
-
const onConfirm = () => {
|
|
11789
|
-
doChangeSelectedPlayingMod(closeDialog);
|
|
11790
|
-
};
|
|
11791
|
-
this.dialogConfig = {
|
|
11792
|
-
visible: true,
|
|
11793
|
-
content: translate('selectionCleared', this.language),
|
|
11794
|
-
onConfirm: onConfirm,
|
|
11795
|
-
onCancel: closeDialog
|
|
11796
|
-
};
|
|
11797
|
-
}
|
|
11798
|
-
else {
|
|
11799
|
-
doChangeSelectedPlayingMod();
|
|
11800
|
-
}
|
|
11801
|
-
}
|
|
11802
|
-
lotteryTippingBulletGroupSelectionHandler(event) {
|
|
11803
|
-
var _a;
|
|
11804
|
-
const hasSelectBullet = (_a = event.detail) === null || _a === void 0 ? void 0 : _a.hasSelectBullet;
|
|
11805
|
-
if (hasSelectBullet !== undefined)
|
|
11806
|
-
this.hasSelectBullet = hasSelectBullet;
|
|
11807
|
-
this.bulletBetSelectChecker();
|
|
11808
|
-
}
|
|
11809
|
-
calculateCombinationInLine(checkedNumberArr) {
|
|
11810
|
-
return checkedNumberArr.reduce((pre, cur) => pre * cur, 1);
|
|
11811
|
-
}
|
|
11812
|
-
calculateTotalAmount() {
|
|
11813
|
-
const stake = this.currentStake;
|
|
11814
|
-
if (!stake) {
|
|
11815
|
-
return 0;
|
|
11816
|
-
}
|
|
11817
|
-
let totalAmount = +stake.value * this.totalLineCombination;
|
|
11818
|
-
if (this.isBothBettingType)
|
|
11819
|
-
totalAmount = this.bothBettingTypeMultiplier * totalAmount;
|
|
11820
|
-
return totalAmount;
|
|
11821
|
-
}
|
|
11822
|
-
get totalAmountFormatted() {
|
|
11823
|
-
var _a;
|
|
11824
|
-
const totalAmount = this.calculateTotalAmount();
|
|
11825
|
-
return thousandSeparator(totalAmount) + ' ' + (((_a = this.currentStake) === null || _a === void 0 ? void 0 : _a.currency) || '');
|
|
11826
|
-
}
|
|
11827
|
-
get currentStakeFormatted() {
|
|
11828
|
-
const { value = '', currency = '' } = this.currentStake || {};
|
|
11829
|
-
return `${value} ${currency}`;
|
|
11830
|
-
}
|
|
11831
|
-
bulletBetSelectChecker() {
|
|
11832
|
-
const validateSelectionsAndCalculateTotals = async () => {
|
|
11833
|
-
const doCheckIfNotCompleteSelect = ({ rawResults }) => {
|
|
11834
|
-
const checkedCountForEachLineAndEachMatch = getCheckedCountForEachLineAndEachMatch({ rawResults });
|
|
11835
|
-
// total line combination is sum of all the line's combination
|
|
11836
|
-
this.totalLineCombination = checkedCountForEachLineAndEachMatch.reduce((pre, cur) => pre + this.calculateCombinationInLine(cur), 0);
|
|
11837
|
-
// each line's combination should within in [combinations, maxCombinations]
|
|
11838
|
-
const { combinations = 1, maxCombinations = 1 } = getPlayTypeConfig({
|
|
11839
|
-
rawData: this.rawData,
|
|
11840
|
-
selectedBettingType: this.selectedBettingType,
|
|
11841
|
-
selectedPlayingMode: this.selectedPlayingMode
|
|
11842
|
-
}).betType || {};
|
|
11843
|
-
return checkedCountForEachLineAndEachMatch.some((checkedNumberArr) => {
|
|
11844
|
-
const curCombination = this.calculateCombinationInLine(checkedNumberArr);
|
|
11845
|
-
return curCombination < combinations || curCombination > maxCombinations;
|
|
11846
|
-
});
|
|
11847
|
-
};
|
|
11848
|
-
const rawResults = await this.getLotteryTippingBulletResults();
|
|
11849
|
-
this.hasSelectAllBullet = !doCheckIfNotCompleteSelect({ rawResults });
|
|
12849
|
+
this.isSalesActive = false;
|
|
12850
|
+
this.currentStake = undefined;
|
|
12851
|
+
this.gameConfig = undefined;
|
|
12852
|
+
this.turnover = undefined;
|
|
12853
|
+
this.betTypes = undefined;
|
|
12854
|
+
this.curBetType = undefined;
|
|
12855
|
+
this.eventPartIds = undefined;
|
|
12856
|
+
this.curEventPartId = undefined;
|
|
12857
|
+
this.boardRange = {
|
|
12858
|
+
min: 1,
|
|
12859
|
+
max: 3
|
|
11850
12860
|
};
|
|
11851
|
-
|
|
12861
|
+
this.eventMap = undefined;
|
|
12862
|
+
this.eventPart2EventOutcomeMap = undefined;
|
|
12863
|
+
this.betTypeOptions = [];
|
|
12864
|
+
this.eventPartOptions = [];
|
|
12865
|
+
this.stakeOptions = [];
|
|
11852
12866
|
}
|
|
11853
12867
|
handleClientStylingChange(newValue, oldValue) {
|
|
11854
12868
|
if (newValue != oldValue) {
|
|
@@ -11870,6 +12884,14 @@ const LotteryTippingTicketController = class {
|
|
|
11870
12884
|
resolveTranslationUrl(this.translationUrl);
|
|
11871
12885
|
}
|
|
11872
12886
|
}
|
|
12887
|
+
connectedCallback() {
|
|
12888
|
+
if (this.endpoint && this.gameId && this.drawId) {
|
|
12889
|
+
this.getTippingInfo();
|
|
12890
|
+
}
|
|
12891
|
+
else {
|
|
12892
|
+
console.log('no fetch');
|
|
12893
|
+
}
|
|
12894
|
+
}
|
|
11873
12895
|
componentDidLoad() {
|
|
11874
12896
|
if (this.stylingContainer) {
|
|
11875
12897
|
if (this.mbSource)
|
|
@@ -11883,9 +12905,23 @@ const LotteryTippingTicketController = class {
|
|
|
11883
12905
|
disconnectedCallback() {
|
|
11884
12906
|
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
11885
12907
|
}
|
|
12908
|
+
parsedOutcome(tippingInfo) {
|
|
12909
|
+
const { outcomes } = tippingInfo;
|
|
12910
|
+
const eventPartIdList = [];
|
|
12911
|
+
for (const bettingTypeId in outcomes) {
|
|
12912
|
+
const eventParts = outcomes[bettingTypeId];
|
|
12913
|
+
this.eventPart2EventOutcomeMap = eventParts;
|
|
12914
|
+
for (const eventPartId in eventParts) {
|
|
12915
|
+
eventPartIdList.push(eventPartId);
|
|
12916
|
+
}
|
|
12917
|
+
}
|
|
12918
|
+
if (eventPartIdList.length > 0) {
|
|
12919
|
+
this.eventPartIds = eventPartIdList;
|
|
12920
|
+
this.curEventPartId = eventPartIdList[0];
|
|
12921
|
+
}
|
|
12922
|
+
}
|
|
11886
12923
|
updateDrawSalesStatus() {
|
|
11887
|
-
|
|
11888
|
-
const currentDraw = (_a = this.rawData) === null || _a === void 0 ? void 0 : _a.currentDraw;
|
|
12924
|
+
const currentDraw = this.draw;
|
|
11889
12925
|
if (!currentDraw) {
|
|
11890
12926
|
this.gameUnavailable = true;
|
|
11891
12927
|
this.isSalesActive = false;
|
|
@@ -11910,139 +12946,296 @@ const LotteryTippingTicketController = class {
|
|
|
11910
12946
|
this.isSalesActive = false;
|
|
11911
12947
|
}
|
|
11912
12948
|
}
|
|
11913
|
-
|
|
11914
|
-
|
|
11915
|
-
let url = new URL(`${this.endpoint}/games/${this.gameId}`);
|
|
12949
|
+
async getTippingInfo() {
|
|
12950
|
+
try {
|
|
11916
12951
|
this.isLoading = true;
|
|
11917
|
-
|
|
11918
|
-
|
|
11919
|
-
|
|
11920
|
-
|
|
11921
|
-
|
|
11922
|
-
|
|
11923
|
-
|
|
11924
|
-
|
|
11925
|
-
|
|
11926
|
-
|
|
11927
|
-
|
|
11928
|
-
|
|
11929
|
-
|
|
11930
|
-
|
|
11931
|
-
|
|
11932
|
-
|
|
11933
|
-
|
|
11934
|
-
|
|
11935
|
-
|
|
11936
|
-
|
|
11937
|
-
|
|
11938
|
-
|
|
11939
|
-
|
|
11940
|
-
|
|
11941
|
-
|
|
11942
|
-
|
|
11943
|
-
|
|
12952
|
+
const { gameId, drawId, endpoint, groupBy } = this;
|
|
12953
|
+
const res = await fetchRequest(`${endpoint}/poolgames/${gameId}/draws/${drawId}/bettingSelections${toQueryParams({
|
|
12954
|
+
groupBy
|
|
12955
|
+
})}`, 'GET');
|
|
12956
|
+
const { game, eventMap } = res;
|
|
12957
|
+
this.gameConfig = res;
|
|
12958
|
+
this.draw = game.currentDraw;
|
|
12959
|
+
this.betTypes = game.rules.betTypes;
|
|
12960
|
+
this._setBetType(this.betTypes[0]);
|
|
12961
|
+
this.currentStake = String(game.rules.stakes[0].value);
|
|
12962
|
+
this.eventMap = eventMap;
|
|
12963
|
+
this.parsedOutcome(res);
|
|
12964
|
+
const betTypeOptions = this.betTypes.map((bt) => ({ label: bt.name, value: bt.name }));
|
|
12965
|
+
this.betTypeOptions = betTypeOptions;
|
|
12966
|
+
const eventPartOptions = this.eventPartIds.map((id) => ({ label: this.EVENT_PART_MAP[id], value: id }));
|
|
12967
|
+
this.eventPartOptions = eventPartOptions;
|
|
12968
|
+
const stakeOptions = game.rules.stakes.map((stake) => ({ label: stake.value, value: stake.value }));
|
|
12969
|
+
this.stakeOptions = stakeOptions;
|
|
12970
|
+
this.updateDrawSalesStatus();
|
|
12971
|
+
this.updateSaleStatistics();
|
|
12972
|
+
}
|
|
12973
|
+
catch (err) {
|
|
12974
|
+
this.betHasErrors = true;
|
|
12975
|
+
console.error('Failed to get tipping info:', err);
|
|
12976
|
+
}
|
|
12977
|
+
finally {
|
|
12978
|
+
this.isLoading = false;
|
|
12979
|
+
}
|
|
11944
12980
|
}
|
|
11945
12981
|
updateSaleStatistics() {
|
|
11946
|
-
var _a;
|
|
12982
|
+
var _a, _b, _c;
|
|
11947
12983
|
return fetchSaleStatistics({
|
|
11948
12984
|
endpoint: this.endpoint,
|
|
11949
|
-
gameId: (_a = this.
|
|
11950
|
-
drawId: this.
|
|
12985
|
+
gameId: (_b = (_a = this.gameConfig) === null || _a === void 0 ? void 0 : _a.game) === null || _b === void 0 ? void 0 : _b.type,
|
|
12986
|
+
drawId: (_c = this.draw) === null || _c === void 0 ? void 0 : _c.id
|
|
11951
12987
|
}).then((res) => {
|
|
11952
|
-
|
|
12988
|
+
var _a;
|
|
12989
|
+
this.turnover = (_a = res === null || res === void 0 ? void 0 : res.wagerSegment) === null || _a === void 0 ? void 0 : _a.totalSalesCrossDraw;
|
|
12990
|
+
});
|
|
12991
|
+
}
|
|
12992
|
+
handleSelectionChange(event) {
|
|
12993
|
+
const { newSelections, matchId, boardId } = event.detail;
|
|
12994
|
+
const boardIndex = parseInt(boardId, 10);
|
|
12995
|
+
const matchIndex = parseInt(matchId, 10);
|
|
12996
|
+
const newBulletSelectionsLineGroup = this.bulletSelectionsLineGroup.map((board, index) => {
|
|
12997
|
+
if (index !== boardIndex)
|
|
12998
|
+
return board;
|
|
12999
|
+
const newBoard = [...board];
|
|
13000
|
+
newBoard[matchIndex] = newSelections;
|
|
13001
|
+
return newBoard;
|
|
13002
|
+
});
|
|
13003
|
+
// console.log('newBulletSelectionsLineGroup', newBulletSelectionsLineGroup);
|
|
13004
|
+
this.bulletSelectionsLineGroup = newBulletSelectionsLineGroup;
|
|
13005
|
+
}
|
|
13006
|
+
handleClearAll() {
|
|
13007
|
+
this._resetBulletConfig();
|
|
13008
|
+
this.onClearAll.emit();
|
|
13009
|
+
}
|
|
13010
|
+
handlePageChange(event) {
|
|
13011
|
+
const { newPage } = event.detail;
|
|
13012
|
+
if (newPage >= 1 && newPage <= this.betTotalPages) {
|
|
13013
|
+
this.betCurrentPage = newPage;
|
|
13014
|
+
}
|
|
13015
|
+
}
|
|
13016
|
+
handleAddLine() {
|
|
13017
|
+
if (this.betTotalPages < this.boardRange.max) {
|
|
13018
|
+
this.bulletSelectionsLineGroup = [...this.bulletSelectionsLineGroup, this.initLineForBulletConfig()];
|
|
13019
|
+
this.betTotalPages++;
|
|
13020
|
+
this.betCurrentPage = this.betTotalPages;
|
|
13021
|
+
}
|
|
13022
|
+
}
|
|
13023
|
+
handleRemoveLine(event) {
|
|
13024
|
+
const { boardId, close } = event.detail;
|
|
13025
|
+
if (this.betTotalPages > this.boardRange.min) {
|
|
13026
|
+
const closeDialog = () => {
|
|
13027
|
+
this.dialogConfig = { visible: false };
|
|
13028
|
+
};
|
|
13029
|
+
const doRemove = () => {
|
|
13030
|
+
this.bulletSelectionsLineGroup = this.bulletSelectionsLineGroup.filter((_, index) => index !== boardId);
|
|
13031
|
+
this.betTotalPages--;
|
|
13032
|
+
const removedPage = boardId + 1;
|
|
13033
|
+
if (this.betCurrentPage > removedPage) {
|
|
13034
|
+
this.betCurrentPage--;
|
|
13035
|
+
}
|
|
13036
|
+
if (this.betCurrentPage > this.betTotalPages) {
|
|
13037
|
+
this.betCurrentPage = this.betTotalPages;
|
|
13038
|
+
}
|
|
13039
|
+
close(closeDialog);
|
|
13040
|
+
};
|
|
13041
|
+
this.dialogConfig = {
|
|
13042
|
+
visible: true,
|
|
13043
|
+
content: translate('selectionOnLineCleared', this.language),
|
|
13044
|
+
onConfirm: doRemove,
|
|
13045
|
+
onCancel: closeDialog
|
|
13046
|
+
};
|
|
13047
|
+
}
|
|
13048
|
+
}
|
|
13049
|
+
handleSubmitTickets() {
|
|
13050
|
+
const params = this.buildTicketParam();
|
|
13051
|
+
this.lotteryTicketParamsReady.emit(params);
|
|
13052
|
+
}
|
|
13053
|
+
handleTicketSubmitSuccess() {
|
|
13054
|
+
this._resetBulletConfig();
|
|
13055
|
+
this.updateSaleStatistics();
|
|
13056
|
+
}
|
|
13057
|
+
buildTicketParam() {
|
|
13058
|
+
let body = {
|
|
13059
|
+
tickets: []
|
|
13060
|
+
};
|
|
13061
|
+
body.tickets.push({
|
|
13062
|
+
gameName: this.gameConfig.game.name,
|
|
13063
|
+
startingDrawId: this.draw.id,
|
|
13064
|
+
amount: this.calculateTotalAmount(),
|
|
13065
|
+
currency: this.currency,
|
|
13066
|
+
selection: this.bulletSelectionsLineGroup.map((boardInfo) => {
|
|
13067
|
+
const matchList = boardInfo.map((matchSelection, matchIdx) => {
|
|
13068
|
+
const curBettingTypeMatches = matchSelection.map((bet) => {
|
|
13069
|
+
return {
|
|
13070
|
+
betOn: bet,
|
|
13071
|
+
id: this.parsedEvent[matchIdx].outcomes.find((outcome) => outcome.betOn === bet).id
|
|
13072
|
+
};
|
|
13073
|
+
});
|
|
13074
|
+
return [curBettingTypeMatches];
|
|
13075
|
+
});
|
|
13076
|
+
return {
|
|
13077
|
+
betType: this.curBetType.id,
|
|
13078
|
+
prizePool: this.parsedEvent[0].outcomes[0].prizePools[0],
|
|
13079
|
+
stake: this.currentStake,
|
|
13080
|
+
poolGameSelections: matchList
|
|
13081
|
+
};
|
|
13082
|
+
})
|
|
11953
13083
|
});
|
|
13084
|
+
return body;
|
|
13085
|
+
}
|
|
13086
|
+
initLineForBulletConfig() {
|
|
13087
|
+
return [[]];
|
|
13088
|
+
}
|
|
13089
|
+
_resetBulletConfig() {
|
|
13090
|
+
this.bulletSelectionsLineGroup = Array.from({ length: this.betTotalPages }).map(this.initLineForBulletConfig.bind(this));
|
|
13091
|
+
this.betCurrentPage = 1;
|
|
13092
|
+
}
|
|
13093
|
+
calculateTotalAmount() {
|
|
13094
|
+
const stake = this.currentStake;
|
|
13095
|
+
if (!stake) {
|
|
13096
|
+
return '0';
|
|
13097
|
+
}
|
|
13098
|
+
let totalAmount = +stake * this.totalLineCombination;
|
|
13099
|
+
return totalAmount.toString();
|
|
13100
|
+
}
|
|
13101
|
+
get hasSelection() {
|
|
13102
|
+
return this.bulletSelectionsLineGroup.some((board) => board.some((match) => match && match.length > 0));
|
|
11954
13103
|
}
|
|
11955
|
-
|
|
11956
|
-
this.
|
|
11957
|
-
|
|
11958
|
-
|
|
11959
|
-
|
|
11960
|
-
|
|
13104
|
+
get parsedEvent() {
|
|
13105
|
+
if (!this.eventPart2EventOutcomeMap || !this.curEventPartId || !this.eventMap) {
|
|
13106
|
+
return [];
|
|
13107
|
+
}
|
|
13108
|
+
const curEventObj = this.eventPart2EventOutcomeMap[this.curEventPartId];
|
|
13109
|
+
const flatEvents = [];
|
|
13110
|
+
for (const eventId in curEventObj) {
|
|
13111
|
+
const curEventOutcomeArr = curEventObj[eventId];
|
|
13112
|
+
const eventDetail = this.eventMap[eventId];
|
|
13113
|
+
const { eventName, startTime, order } = eventDetail;
|
|
13114
|
+
flatEvents.push({
|
|
13115
|
+
eventName,
|
|
13116
|
+
startTime,
|
|
13117
|
+
order,
|
|
13118
|
+
outcomes: curEventOutcomeArr.map((outcome) => {
|
|
13119
|
+
const { betOn, outcomeId, prizePools } = outcome;
|
|
13120
|
+
return {
|
|
13121
|
+
betOn,
|
|
13122
|
+
id: outcomeId,
|
|
13123
|
+
prizePools
|
|
13124
|
+
};
|
|
13125
|
+
})
|
|
11961
13126
|
});
|
|
13127
|
+
}
|
|
13128
|
+
flatEvents.sort((a, b) => a.order - b.order);
|
|
13129
|
+
// console.log('flatEvents', flatEvents);
|
|
13130
|
+
return flatEvents;
|
|
13131
|
+
}
|
|
13132
|
+
get _selectionStats() {
|
|
13133
|
+
const { combinations: minCombinations = 1, maxCombinations = 1 } = this.curBetType || {};
|
|
13134
|
+
return getTotalLinesAndCheckIfNotComplete(this.bulletSelectionsLineGroup, this.parsedEvent.length, minCombinations, maxCombinations);
|
|
13135
|
+
}
|
|
13136
|
+
get totalLineCombination() {
|
|
13137
|
+
return this._selectionStats.totalLines;
|
|
13138
|
+
}
|
|
13139
|
+
get hasSelectAllBullet() {
|
|
13140
|
+
return !this._selectionStats.notComplete;
|
|
13141
|
+
}
|
|
13142
|
+
_setBetType(betType) {
|
|
13143
|
+
if (!betType)
|
|
13144
|
+
return;
|
|
13145
|
+
this.curBetType = betType;
|
|
13146
|
+
this.boardRange.min = Math.min(...betType.boardsAllowed);
|
|
13147
|
+
this.boardRange.max = Math.max(...betType.boardsAllowed);
|
|
13148
|
+
this.betTotalPages = betType.defaultBoards;
|
|
13149
|
+
this._resetBulletConfig();
|
|
13150
|
+
}
|
|
13151
|
+
handleBetTypeChange(event) {
|
|
13152
|
+
const newBetTypeName = event.detail;
|
|
13153
|
+
if (newBetTypeName === this.curBetType.name) {
|
|
11962
13154
|
return;
|
|
11963
13155
|
}
|
|
11964
|
-
const
|
|
11965
|
-
|
|
11966
|
-
|
|
11967
|
-
|
|
11968
|
-
|
|
11969
|
-
|
|
11970
|
-
const url = new URL(`${this.endpoint}/tickets`);
|
|
11971
|
-
const body = buildSubmitParam({
|
|
11972
|
-
playerId: this.playerId,
|
|
11973
|
-
rawResults,
|
|
11974
|
-
gameId: this.gameId,
|
|
11975
|
-
rawData: this.rawData,
|
|
11976
|
-
amount: this.calculateTotalAmount().toString(),
|
|
11977
|
-
currentStake: this.currentStake,
|
|
11978
|
-
betTypeId,
|
|
11979
|
-
betType
|
|
11980
|
-
});
|
|
11981
|
-
this.submitLoading = true;
|
|
11982
|
-
doSubmitTicket({ body, sessionId: this.sessionId, url: url.href })
|
|
11983
|
-
.then(() => {
|
|
11984
|
-
showNotification({ message: translate('ticketSubmitted', this.language) });
|
|
11985
|
-
this.clearBulletConfig();
|
|
11986
|
-
this.updateSaleStatistics();
|
|
11987
|
-
})
|
|
11988
|
-
.catch((res) => {
|
|
11989
|
-
if (res.message === TICKET_INVALID_TOKEN) {
|
|
11990
|
-
this.logoutEventHandler.emit();
|
|
11991
|
-
showNotification({ message: TICKET_INVALID_TOKEN, theme: 'error' });
|
|
11992
|
-
return;
|
|
11993
|
-
}
|
|
11994
|
-
showNotification({ message: translate('ticketFailed', this.language), theme: 'error' });
|
|
11995
|
-
})
|
|
11996
|
-
.finally(() => {
|
|
11997
|
-
this.submitLoading = false;
|
|
11998
|
-
});
|
|
13156
|
+
const switchBetType = () => {
|
|
13157
|
+
const newBetType = this.betTypes.find((bt) => bt.name === newBetTypeName);
|
|
13158
|
+
this._setBetType(newBetType);
|
|
13159
|
+
this.dialogConfig = { visible: false };
|
|
13160
|
+
};
|
|
13161
|
+
this.handleSwitchWithConfirmation(switchBetType);
|
|
11999
13162
|
}
|
|
12000
|
-
|
|
12001
|
-
const
|
|
12002
|
-
|
|
12003
|
-
|
|
12004
|
-
|
|
12005
|
-
|
|
13163
|
+
handleEventPartChange(event) {
|
|
13164
|
+
const newEventPartId = event.detail;
|
|
13165
|
+
if (newEventPartId === this.curEventPartId) {
|
|
13166
|
+
return;
|
|
13167
|
+
}
|
|
13168
|
+
const switchEventPart = () => {
|
|
13169
|
+
this.curEventPartId = newEventPartId;
|
|
13170
|
+
this._resetBulletConfig();
|
|
13171
|
+
this.dialogConfig = { visible: false };
|
|
13172
|
+
};
|
|
13173
|
+
this.handleSwitchWithConfirmation(switchEventPart);
|
|
12006
13174
|
}
|
|
12007
|
-
|
|
12008
|
-
|
|
12009
|
-
|
|
12010
|
-
|
|
12011
|
-
|
|
12012
|
-
|
|
12013
|
-
|
|
12014
|
-
const
|
|
12015
|
-
|
|
12016
|
-
|
|
12017
|
-
}, onClick: this.handlePlayingModeChange.bind(this, item.code) }, item.name)))));
|
|
12018
|
-
const renderingStakeOptions = () => {
|
|
12019
|
-
var _a, _b;
|
|
12020
|
-
return (index.h("div", null, ((_a = this.stakeOptions) === null || _a === void 0 ? void 0 : _a.length) === 1 ? (index.h("div", null, this.stakeOptions[0].label)) : (index.h("vaadin-select", { items: this.stakeOptions || [], value: ((_b = this.currentStake) === null || _b === void 0 ? void 0 : _b.value) || '', "on-value-changed": this.onStakeChange.bind(this), "no-vertical-overlap": true }))));
|
|
13175
|
+
onStakeChange(event) {
|
|
13176
|
+
this.currentStake = event.detail.value;
|
|
13177
|
+
}
|
|
13178
|
+
handleSwitchWithConfirmation(switchAction) {
|
|
13179
|
+
const closeDialog = () => {
|
|
13180
|
+
this.dialogConfig = { visible: false };
|
|
13181
|
+
};
|
|
13182
|
+
const doConfirm = () => {
|
|
13183
|
+
switchAction();
|
|
13184
|
+
closeDialog();
|
|
12021
13185
|
};
|
|
12022
|
-
|
|
13186
|
+
if (this.hasSelection) {
|
|
13187
|
+
this.dialogConfig = {
|
|
13188
|
+
visible: true,
|
|
13189
|
+
content: translate('selectionCleared', this.language),
|
|
13190
|
+
onConfirm: doConfirm,
|
|
13191
|
+
onCancel: closeDialog
|
|
13192
|
+
};
|
|
13193
|
+
}
|
|
13194
|
+
else {
|
|
13195
|
+
switchAction();
|
|
13196
|
+
}
|
|
12023
13197
|
}
|
|
12024
|
-
|
|
12025
|
-
|
|
12026
|
-
|
|
12027
|
-
|
|
12028
|
-
|
|
12029
|
-
|
|
13198
|
+
_renderSkeletonBlock(style) {
|
|
13199
|
+
return index.h("div", { class: "skeleton-block", style: style });
|
|
13200
|
+
}
|
|
13201
|
+
renderSkeletons() {
|
|
13202
|
+
return (index.h("div", { class: "lottery-tipping-ticket-buy", ref: (el) => (this.stylingContainer = el) }, this._renderSkeletonBlock({ height: '60px', marginBottom: '16px' }), this._renderSkeletonBlock({ width: '60%', margin: '0 auto', height: '80px', marginBottom: '16px' }), index.h("div", { class: "bet-board", style: { display: 'flex', gap: '16px' } }, this._renderSkeletonBlock({ flex: '2', height: '400px' }), this._renderSkeletonBlock({ flex: '1', height: '400px' }))));
|
|
13203
|
+
}
|
|
13204
|
+
renderErrorContent() {
|
|
13205
|
+
return index.h("p", null, translate('error', this.language));
|
|
13206
|
+
}
|
|
13207
|
+
renderNoActiveDraw() {
|
|
13208
|
+
return (index.h("div", { class: "lottery-tipping-ticket-buy", ref: (el) => (this.stylingContainer = el) }, index.h("div", { class: "no-active-draw" }, translate('gameNotAvailable', this.language))));
|
|
13209
|
+
}
|
|
13210
|
+
get ticketDataSourceForBetSlip() {
|
|
13211
|
+
return this.parsedEvent.map(({ eventName, startTime, outcomes }) => ({
|
|
13212
|
+
eventName,
|
|
13213
|
+
startTime,
|
|
13214
|
+
outcomes: outcomes.map(({ betOn }) => ({ betOn }))
|
|
13215
|
+
}));
|
|
12030
13216
|
}
|
|
12031
13217
|
render() {
|
|
12032
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
12033
|
-
if (this.
|
|
12034
|
-
return
|
|
13218
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
13219
|
+
if (this.isLoading) {
|
|
13220
|
+
return this.renderSkeletons();
|
|
13221
|
+
}
|
|
13222
|
+
else if (this.betHasErrors) {
|
|
13223
|
+
return this.renderErrorContent();
|
|
13224
|
+
}
|
|
13225
|
+
else if (this.gameUnavailable) {
|
|
13226
|
+
return this.renderNoActiveDraw();
|
|
13227
|
+
}
|
|
13228
|
+
else {
|
|
13229
|
+
return (index.h("div", { class: "lottery-tipping-ticket-buy", ref: (el) => (this.stylingContainer = el) }, index.h("lottery-banner", { clientStylingUrl: this.clientStylingUrl, stopTime: (_a = this.draw) === null || _a === void 0 ? void 0 : _a.wagerCloseTime, startTime: (_b = this.draw) === null || _b === void 0 ? void 0 : _b.wagerStartTime, "banner-title": (_d = (_c = this.gameConfig) === null || _c === void 0 ? void 0 : _c.game) === null || _d === void 0 ? void 0 : _d.name, turnover: formattedTurnover(this.turnover), language: this.language, "translation-url": this.translationUrl, onLotteryBannerWagerStarted: () => this.updateDrawSalesStatus() }), index.h("div", { class: "bet-selector" }, index.h("div", { class: "bet-selector-line" }, index.h("div", { class: "bet-selector-line-segments" }, index.h("lottery-segmented", { class: "event-part-selector", label: "Event Part", options: this.eventPartOptions, value: this.curEventPartId.toString(), onValueChange: this.handleEventPartChange.bind(this) }), index.h("lottery-segmented", { label: "Bet Type", options: this.betTypeOptions, value: ((_e = this.curBetType) === null || _e === void 0 ? void 0 : _e.name) || '', onValueChange: this.handleBetTypeChange.bind(this) }))), index.h("div", { class: "bet-selector-line" }, index.h("div", { class: "bet-selector-line-label" }, translate('stakePerLine', this.language)), index.h("div", { class: "bet-selector-line-input" }, this.stakeOptions.length > 1 ? (index.h("vaadin-select", { items: this.stakeOptions, value: this.currentStake, "on-value-changed": this.onStakeChange.bind(this), "no-vertical-overlap": true })) : (this.currentStake)))), index.h("div", { class: "bet-board" }, index.h("div", { class: "bet-board-slip" }, index.h("lottery-tipping-bet-slip", { language: this.language, "mb-source": this.mbSource, "client-styling": this.clientStyling, "client-styling-url": this.clientStylingUrl, "translation-url": this.translationUrl, "current-page": this.betCurrentPage, "total-pages": this.betTotalPages, "max-total-pages": this.boardRange.max, "min-total-pages": this.boardRange.min, mode: ((_f = this.curBetType) === null || _f === void 0 ? void 0 : _f.combinations) > 1 ? 'multi' : 'single', readPretty: false, bulletTexts: this.tippingBetOptions, bulletNames: this.tippingBetOptionNames, bulletTextsSplitToken: this.SPLIT_TOKEN, "ticket-data-source-str": JSON.stringify(this.ticketDataSourceForBetSlip), "bullet-selections-line-group-str": JSON.stringify(this.bulletSelectionsLineGroup), showClearButton: true })), index.h("div", { class: "bet-board-order" }, index.h("lottery-order-summary", { "client-styling": this.clientStyling, clientStylingUrl: this.clientStylingUrl, mbSource: this.mbSource, language: this.language, "translation-url": this.translationUrl, endpoint: this.endpoint, sessionId: this.sessionId, orderSummaryTitle: translate('orderSummaryTitle', this.language), ticketsLabel: translate('orderSummaryTickets', this.language), totalLabel: translate('orderSummaryTotal', this.language), "show-divider": true, submitLoading: this.submitLoading, submitDisabled: !this.hasSelectAllBullet || this.submitLoading || !this.isSalesActive, submitButtonText: translate('orderSummarySubmit', this.language) }, index.h("div", { class: "order-summary__details", slot: "orderSummaryTicketDetail" }, index.h("span", { class: "order-summary__line-count" }, `${this.totalLineCombination} ${this.totalLineCombination > 1 ? translate('lines', this.language) : translate('line', this.language)}`), index.h("div", null, index.h("span", { class: "order-summary__multiplier" }, "x"), index.h("span", { class: "order-summary__stake" }, `${this.currentStake} ${this.currency}`))), index.h("span", { class: "order-summary__details", slot: "orderSummaryTotalDetail" }, `${this.calculateTotalAmount()} ${this.currency}`)))), this.dialogConfig.visible && (index.h("vaadin-confirm-dialog", { rejectButtonVisible: true, rejectText: translate('cancel', this.language), confirmText: translate('confirm', this.language), opened: (_g = this.dialogConfig) === null || _g === void 0 ? void 0 : _g.visible, onConfirm: this.dialogConfig.onConfirm, onReject: this.dialogConfig.onCancel }, (_h = this.dialogConfig) === null || _h === void 0 ? void 0 : _h.content))));
|
|
12035
13230
|
}
|
|
12036
|
-
return (index.h("div", { class: "lottery-tipping-ticket-controller__container", ref: (el) => (this.stylingContainer = el) }, index.h("lottery-banner", { "client-styling": this.clientStyling, "client-styling-Url": this.clientStylingUrl, stopTime: (_b = (_a = this.rawData) === null || _a === void 0 ? void 0 : _a.currentDraw) === null || _b === void 0 ? void 0 : _b.wagerCloseTime, startTime: (_d = (_c = this.rawData) === null || _c === void 0 ? void 0 : _c.currentDraw) === null || _d === void 0 ? void 0 : _d.wagerStartTime, "banner-title": formattedWeekName((_f = (_e = this.rawData) === null || _e === void 0 ? void 0 : _e.currentDraw) === null || _f === void 0 ? void 0 : _f.date), turnover: formattedTurnover((_h = (_g = this.saleStatisticsInfo) === null || _g === void 0 ? void 0 : _g.wagerSegment) === null || _h === void 0 ? void 0 : _h.totalSalesCrossDraw), language: this.language, onLotteryBannerWagerStarted: () => this.updateDrawSalesStatus(), "translation-url": this.translationUrl }), this.renderBettingControls(), index.h("div", { class: "flex flex-wrap LotteryTippingTicketController__main" }, index.h("div", { class: "LotteryTippingTicketController__main--left" }, index.h("lottery-tipping-ticket-bet", { ref: (el) => (this.childRef = el), endpoint: this.endpoint, "session-id": this.sessionId, "game-id": (_j = this.rawData) === null || _j === void 0 ? void 0 : _j.type, "draw-id": this.drawId, language: this.language, "translation-url": this.translationUrl, "max-total-pages": this.lineNumberRange.maxLineNumber, "min-total-pages": this.lineNumberRange.minLineNumber, "total-pages": this.lineNumberRange.defaultBoards, mode: this.selectedPlayingMode === PlayModeEnum.SingleBet ? 'single' : 'multi', "client-styling": this.clientStyling, "client-styling-Url": this.clientStylingUrl })), this.renderOrderSummary()), this.dialogConfig.visible && (index.h("vaadin-confirm-dialog", { rejectButtonVisible: true, rejectText: translate('cancel', this.language), confirmText: translate('confirm', this.language), opened: (_k = this.dialogConfig) === null || _k === void 0 ? void 0 : _k.visible, onConfirm: this.dialogConfig.onConfirm, onReject: this.dialogConfig.onCancel }, (_l = this.dialogConfig) === null || _l === void 0 ? void 0 : _l.content))));
|
|
12037
13231
|
}
|
|
12038
|
-
static get assetsDirs() { return ["../static"]; }
|
|
12039
13232
|
static get watchers() { return {
|
|
12040
13233
|
"clientStyling": ["handleClientStylingChange"],
|
|
12041
13234
|
"clientStylingUrl": ["handleClientStylingUrlChange"],
|
|
12042
13235
|
"mbSource": ["handleMbSourceChange"]
|
|
12043
13236
|
}; }
|
|
12044
13237
|
};
|
|
12045
|
-
|
|
13238
|
+
LotteryTippingTicketBuy.style = LotteryTippingTicketBuyStyle0;
|
|
12046
13239
|
|
|
12047
13240
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
12048
13241
|
|
|
@@ -17128,7 +18321,7 @@ const LotteryTippingTicketHistory = class {
|
|
|
17128
18321
|
this.rawData = res;
|
|
17129
18322
|
}
|
|
17130
18323
|
catch (e) {
|
|
17131
|
-
showNotification$
|
|
18324
|
+
showNotification$1({ message: (_a = e.message) !== null && _a !== void 0 ? _a : e, theme: 'error' });
|
|
17132
18325
|
}
|
|
17133
18326
|
finally {
|
|
17134
18327
|
}
|
|
@@ -17164,7 +18357,7 @@ const LotteryTippingTicketHistory = class {
|
|
|
17164
18357
|
async fetchTicketList() {
|
|
17165
18358
|
this.isLoading = true;
|
|
17166
18359
|
try {
|
|
17167
|
-
const { items, total } = await fetchRequest$1(`${this.endpoint}/tickets${toQueryParams(this.filterData)}`, 'GET', null, {
|
|
18360
|
+
const { items, total } = await fetchRequest$1(`${this.endpoint}/tickets${toQueryParams$1(this.filterData)}`, 'GET', null, {
|
|
17168
18361
|
Authorization: `Bearer ${this.sessionId}`
|
|
17169
18362
|
});
|
|
17170
18363
|
this.ticketHistory = items;
|
|
@@ -17176,7 +18369,7 @@ const LotteryTippingTicketHistory = class {
|
|
|
17176
18369
|
catch (e) {
|
|
17177
18370
|
console.log('in fetchTicketList error is: ', e);
|
|
17178
18371
|
if (e.status === 401) {
|
|
17179
|
-
showNotification$
|
|
18372
|
+
showNotification$1({ message: e.message, theme: 'error' });
|
|
17180
18373
|
this.logout.emit();
|
|
17181
18374
|
}
|
|
17182
18375
|
}
|
|
@@ -17369,11 +18562,17 @@ const LotteryTippingTicketHistory = class {
|
|
|
17369
18562
|
LotteryTippingTicketHistory.style = LotteryTippingTicketHistoryStyle0;
|
|
17370
18563
|
|
|
17371
18564
|
exports.lottery_tipping_page = lotteryTippingPage.LotteryTippingPage;
|
|
18565
|
+
exports.app_tooltip = Tooltip;
|
|
17372
18566
|
exports.general_multi_select = GeneralMultiSelect;
|
|
17373
18567
|
exports.general_tooltip = GeneralTooltip;
|
|
17374
18568
|
exports.helper_count_down = HelperCountDown;
|
|
17375
18569
|
exports.lottery_banner = LotteryBanner;
|
|
17376
18570
|
exports.lottery_button = LotteryButton;
|
|
18571
|
+
exports.lottery_order_summary = LotteryOrderSummary;
|
|
18572
|
+
exports.lottery_segmented = LotterySegmented;
|
|
18573
|
+
exports.lottery_selection = LotterySelection;
|
|
18574
|
+
exports.lottery_selection_group = LotterySelectionGroup;
|
|
18575
|
+
exports.lottery_tipping_bet_slip = LotteryTippingBetSlip;
|
|
17377
18576
|
exports.lottery_tipping_bullet = LotteryTippingBullet;
|
|
17378
18577
|
exports.lottery_tipping_bullet_group = LotteryTippingBulletGroup;
|
|
17379
18578
|
exports.lottery_tipping_dialog = LotteryTippingDialog;
|
|
@@ -17381,5 +18580,5 @@ exports.lottery_tipping_filter = LotteryTippingFilter;
|
|
|
17381
18580
|
exports.lottery_tipping_pagination = LotteryTippingPagination;
|
|
17382
18581
|
exports.lottery_tipping_panel = lotteryTippingPanel;
|
|
17383
18582
|
exports.lottery_tipping_ticket_bet = LotteryTippingTicketBet;
|
|
17384
|
-
exports.
|
|
18583
|
+
exports.lottery_tipping_ticket_buy = LotteryTippingTicketBuy;
|
|
17385
18584
|
exports.lottery_tipping_ticket_history = LotteryTippingTicketHistory;
|