@everymatrix/lottery-tipping-page 1.94.62 → 1.94.64
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} +1922 -724
- 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} +1917 -725
- 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 +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);
|
|
@@ -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,7 +3067,7 @@ 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
|
}
|
|
@@ -3057,9 +3091,9 @@ const LotteryBanner = class {
|
|
|
3057
3091
|
};
|
|
3058
3092
|
LotteryBanner.style = LotteryBannerStyle0;
|
|
3059
3093
|
|
|
3060
|
-
const DEFAULT_LANGUAGE$
|
|
3061
|
-
const SUPPORTED_LANGUAGES$
|
|
3062
|
-
const TRANSLATIONS$
|
|
3094
|
+
const DEFAULT_LANGUAGE$6 = 'en';
|
|
3095
|
+
const SUPPORTED_LANGUAGES$6 = ['ro', 'en', 'fr', 'ar', 'hr', 'zh'];
|
|
3096
|
+
const TRANSLATIONS$6 = {
|
|
3063
3097
|
en: {
|
|
3064
3098
|
loading: 'Loading'
|
|
3065
3099
|
},
|
|
@@ -3068,9 +3102,9 @@ const TRANSLATIONS$4 = {
|
|
|
3068
3102
|
ar: {},
|
|
3069
3103
|
hr: {}
|
|
3070
3104
|
};
|
|
3071
|
-
const translate$
|
|
3105
|
+
const translate$6 = (key, customLang, replacements) => {
|
|
3072
3106
|
const lang = customLang;
|
|
3073
|
-
let translation = TRANSLATIONS$
|
|
3107
|
+
let translation = TRANSLATIONS$6[lang !== undefined && SUPPORTED_LANGUAGES$6.includes(lang) ? lang : DEFAULT_LANGUAGE$6][key];
|
|
3074
3108
|
if (replacements) {
|
|
3075
3109
|
Object.keys(replacements).forEach((placeholder) => {
|
|
3076
3110
|
translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
|
|
@@ -3078,14 +3112,14 @@ const translate$4 = (key, customLang, replacements) => {
|
|
|
3078
3112
|
}
|
|
3079
3113
|
return translation;
|
|
3080
3114
|
};
|
|
3081
|
-
const getTranslations$
|
|
3115
|
+
const getTranslations$6 = (data) => {
|
|
3082
3116
|
Object.keys(data).forEach((item) => {
|
|
3083
3117
|
for (let key in data[item]) {
|
|
3084
|
-
TRANSLATIONS$
|
|
3118
|
+
TRANSLATIONS$6[item][key] = data[item][key];
|
|
3085
3119
|
}
|
|
3086
3120
|
});
|
|
3087
3121
|
};
|
|
3088
|
-
const resolveTranslationUrl$
|
|
3122
|
+
const resolveTranslationUrl$3 = async (translationUrl) => {
|
|
3089
3123
|
if (translationUrl) {
|
|
3090
3124
|
try {
|
|
3091
3125
|
const response = await fetch(translationUrl);
|
|
@@ -3093,7 +3127,7 @@ const resolveTranslationUrl$2 = async (translationUrl) => {
|
|
|
3093
3127
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
3094
3128
|
}
|
|
3095
3129
|
const translations = await response.json();
|
|
3096
|
-
getTranslations$
|
|
3130
|
+
getTranslations$6(translations);
|
|
3097
3131
|
}
|
|
3098
3132
|
catch (error) {
|
|
3099
3133
|
console.error('Failed to fetch or parse translations from URL:', error);
|
|
@@ -3171,7 +3205,7 @@ const LotteryButton = class {
|
|
|
3171
3205
|
}
|
|
3172
3206
|
componentWillLoad() {
|
|
3173
3207
|
if (this.translationUrl) {
|
|
3174
|
-
resolveTranslationUrl$
|
|
3208
|
+
resolveTranslationUrl$3(this.translationUrl);
|
|
3175
3209
|
}
|
|
3176
3210
|
}
|
|
3177
3211
|
render() {
|
|
@@ -3211,7 +3245,7 @@ const LotteryButton = class {
|
|
|
3211
3245
|
[`btn--${variant}`]: true,
|
|
3212
3246
|
[`btn--${size}`]: true,
|
|
3213
3247
|
'btn--loading': this.loading
|
|
3214
|
-
}, 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: {
|
|
3215
3249
|
top: `${ripple.top}px`,
|
|
3216
3250
|
left: `${ripple.left}px`,
|
|
3217
3251
|
width: `${ripple.size}px`,
|
|
@@ -3227,21 +3261,74 @@ const LotteryButton = class {
|
|
|
3227
3261
|
};
|
|
3228
3262
|
LotteryButton.style = LotteryButtonStyle0;
|
|
3229
3263
|
|
|
3230
|
-
const
|
|
3231
|
-
|
|
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
|
+
}
|
|
3232
3299
|
|
|
3233
|
-
|
|
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 {
|
|
3234
3312
|
constructor(hostRef) {
|
|
3235
3313
|
index.registerInstance(this, hostRef);
|
|
3236
|
-
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;
|
|
3237
3320
|
this.mbSource = undefined;
|
|
3238
3321
|
this.clientStyling = undefined;
|
|
3239
3322
|
this.clientStylingUrl = undefined;
|
|
3240
|
-
this.
|
|
3241
|
-
this.
|
|
3242
|
-
this.
|
|
3243
|
-
this.
|
|
3244
|
-
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;
|
|
3245
3332
|
}
|
|
3246
3333
|
handleClientStylingChange(newValue, oldValue) {
|
|
3247
3334
|
if (newValue != oldValue) {
|
|
@@ -3268,23 +3355,77 @@ const LotteryTippingBullet = class {
|
|
|
3268
3355
|
lotteryTippingPage.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
3269
3356
|
}
|
|
3270
3357
|
}
|
|
3271
|
-
handleClick() {
|
|
3272
|
-
if (!this.disabled) {
|
|
3273
|
-
this.lotteryTippingBulletToggleEvent.emit({ positionIdx: this.positionIdx });
|
|
3274
|
-
}
|
|
3275
|
-
}
|
|
3276
3358
|
disconnectedCallback() {
|
|
3277
3359
|
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
3278
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
|
+
}
|
|
3279
3427
|
render() {
|
|
3280
|
-
return (index.h("div", { key: '
|
|
3281
|
-
LotteryTippingBullet__segment: true,
|
|
3282
|
-
'LotteryTippingBullet__segment--text': true
|
|
3283
|
-
} }, this.value)) : (index.h("button", { class: {
|
|
3284
|
-
LotteryTippingBullet__segment: true,
|
|
3285
|
-
'LotteryTippingBullet__segment--disabled': this.disabled,
|
|
3286
|
-
'LotteryTippingBullet__segment--active': this.isSelected
|
|
3287
|
-
}, 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 })))));
|
|
3288
3429
|
}
|
|
3289
3430
|
static get watchers() { return {
|
|
3290
3431
|
"clientStyling": ["handleClientStylingChange"],
|
|
@@ -3292,109 +3433,66 @@ const LotteryTippingBullet = class {
|
|
|
3292
3433
|
"mbSource": ["handleMbSourceChange"]
|
|
3293
3434
|
}; }
|
|
3294
3435
|
};
|
|
3295
|
-
|
|
3436
|
+
LotteryOrderSummary.style = LotteryOrderSummaryStyle0;
|
|
3296
3437
|
|
|
3297
|
-
const
|
|
3298
|
-
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;
|
|
3299
3440
|
|
|
3300
|
-
const
|
|
3441
|
+
const LotterySegmented = class {
|
|
3301
3442
|
constructor(hostRef) {
|
|
3302
3443
|
index.registerInstance(this, hostRef);
|
|
3303
|
-
this.
|
|
3304
|
-
this.
|
|
3305
|
-
this.
|
|
3306
|
-
this.
|
|
3307
|
-
this.
|
|
3308
|
-
this.theme = 'default';
|
|
3309
|
-
this.mode = 'single';
|
|
3310
|
-
this.bulletConfigContent = '';
|
|
3311
|
-
}
|
|
3312
|
-
get bulletConfigArr() {
|
|
3313
|
-
const defaultConfig = [
|
|
3314
|
-
{
|
|
3315
|
-
value: '1'
|
|
3316
|
-
},
|
|
3317
|
-
{
|
|
3318
|
-
value: 'X'
|
|
3319
|
-
},
|
|
3320
|
-
{
|
|
3321
|
-
value: '2'
|
|
3322
|
-
}
|
|
3323
|
-
];
|
|
3324
|
-
if (typeof this.bulletConfigContent === 'string' && this.bulletConfigContent) {
|
|
3325
|
-
try {
|
|
3326
|
-
const _temp = JSON.parse(this.bulletConfigContent);
|
|
3327
|
-
return _temp;
|
|
3328
|
-
}
|
|
3329
|
-
catch (e) {
|
|
3330
|
-
console.error('Error parsing bulletConfigContent:', e);
|
|
3331
|
-
return defaultConfig;
|
|
3332
|
-
}
|
|
3333
|
-
}
|
|
3334
|
-
else {
|
|
3335
|
-
return defaultConfig;
|
|
3336
|
-
}
|
|
3337
|
-
}
|
|
3338
|
-
handleClientStylingChange(newValue, oldValue) {
|
|
3339
|
-
if (newValue != oldValue) {
|
|
3340
|
-
lotteryTippingPage.setClientStyling(this.stylingContainer, this.clientStyling);
|
|
3341
|
-
}
|
|
3444
|
+
this.valueChange = index.createEvent(this, "valueChange", 7);
|
|
3445
|
+
this.optionRefs = [];
|
|
3446
|
+
this.label = undefined;
|
|
3447
|
+
this.options = [];
|
|
3448
|
+
this.value = undefined;
|
|
3342
3449
|
}
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
lotteryTippingPage.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
3346
|
-
}
|
|
3450
|
+
handleValueChange() {
|
|
3451
|
+
this.updateActiveIndicator();
|
|
3347
3452
|
}
|
|
3348
|
-
|
|
3349
|
-
if (
|
|
3350
|
-
|
|
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;
|
|
3351
3457
|
}
|
|
3352
3458
|
}
|
|
3353
3459
|
componentDidLoad() {
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
lotteryTippingPage.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
3357
|
-
if (this.clientStyling)
|
|
3358
|
-
lotteryTippingPage.setClientStyling(this.stylingContainer, this.clientStyling);
|
|
3359
|
-
if (this.clientStylingUrl)
|
|
3360
|
-
lotteryTippingPage.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
3361
|
-
}
|
|
3362
|
-
}
|
|
3363
|
-
disconnectedCallback() {
|
|
3364
|
-
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
3460
|
+
// Use requestAnimationFrame to ensure layout is calculated
|
|
3461
|
+
requestAnimationFrame(() => this.updateActiveIndicator());
|
|
3365
3462
|
}
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
this.handleToggle(positionIdx);
|
|
3463
|
+
handleWindowResize() {
|
|
3464
|
+
this.updateActiveIndicator();
|
|
3369
3465
|
}
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
if (this.
|
|
3373
|
-
|
|
3374
|
-
newConfigArr = newConfigArr.map((item) => (Object.assign(Object.assign({}, item), { isSelected: false })));
|
|
3375
|
-
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;
|
|
3376
3470
|
}
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
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);
|
|
3381
3481
|
}
|
|
3382
|
-
this.lotteryTippingBulletGroupToggleEvent.emit({
|
|
3383
|
-
bulletConfigArr: newConfigArr,
|
|
3384
|
-
positionIdx: this.positionIdx + '-' + index
|
|
3385
|
-
});
|
|
3386
3482
|
}
|
|
3387
3483
|
render() {
|
|
3388
|
-
|
|
3389
|
-
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))))));
|
|
3390
3485
|
}
|
|
3486
|
+
get host() { return index.getElement(this); }
|
|
3391
3487
|
static get watchers() { return {
|
|
3392
|
-
"
|
|
3393
|
-
"clientStylingUrl": ["handleClientStylingUrlChange"],
|
|
3394
|
-
"mbSource": ["handleMbSourceChange"]
|
|
3488
|
+
"value": ["handleValueChange"]
|
|
3395
3489
|
}; }
|
|
3396
3490
|
};
|
|
3397
|
-
|
|
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;
|
|
3398
3496
|
|
|
3399
3497
|
// This icon file is generated automatically.
|
|
3400
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" };
|
|
@@ -3469,42 +3567,1141 @@ function renderAbstractNodeToSVGElement(node, options) {
|
|
|
3469
3567
|
return "<".concat(node.tag).concat(attrsToken, " />");
|
|
3470
3568
|
}
|
|
3471
3569
|
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
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';
|
|
3494
3598
|
}
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
return TRANSLATIONS$3[lang !== undefined && SUPPORTED_LANGUAGES$3.includes(lang) ? lang : DEFAULT_LANGUAGE$3][key];
|
|
3499
|
-
};
|
|
3500
|
-
const getTranslations$3 = (data) => {
|
|
3501
|
-
Object.keys(data).forEach((item) => {
|
|
3502
|
-
for (let key in data[item]) {
|
|
3503
|
-
TRANSLATIONS$3[item][key] = data[item][key];
|
|
3599
|
+
handleClientStylingChange(newValue, oldValue) {
|
|
3600
|
+
if (newValue !== oldValue) {
|
|
3601
|
+
lotteryTippingPage.setClientStyling(this.stylingContainer, this.clientStyling);
|
|
3504
3602
|
}
|
|
3505
|
-
}
|
|
3506
|
-
|
|
3507
|
-
|
|
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
|
+
};
|
|
4704
|
+
const resolveTranslationUrl$1 = async (translationUrl) => {
|
|
3508
4705
|
if (translationUrl) {
|
|
3509
4706
|
try {
|
|
3510
4707
|
const response = await fetch(translationUrl);
|
|
@@ -10499,7 +11696,7 @@ const LotteryTippingFilter = class {
|
|
|
10499
11696
|
};
|
|
10500
11697
|
LotteryTippingFilter.style = LotteryTippingFilterStyle0;
|
|
10501
11698
|
|
|
10502
|
-
const generateUUID$
|
|
11699
|
+
const generateUUID$1 = () => {
|
|
10503
11700
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
10504
11701
|
var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
|
|
10505
11702
|
return v.toString(16);
|
|
@@ -10507,7 +11704,7 @@ const generateUUID$2 = () => {
|
|
|
10507
11704
|
};
|
|
10508
11705
|
function fetchRequest$1(url, method = 'GET', body = null, headers = {}) {
|
|
10509
11706
|
return new Promise((resolve, reject) => {
|
|
10510
|
-
const uuid = generateUUID$
|
|
11707
|
+
const uuid = generateUUID$1();
|
|
10511
11708
|
const headersOrigin = Object.assign({ 'Content-Type': 'application/json' }, headers);
|
|
10512
11709
|
if (method !== 'GET' && method !== 'HEAD') {
|
|
10513
11710
|
headersOrigin['X-Idempotency-Key'] = uuid;
|
|
@@ -10534,14 +11731,14 @@ function fetchRequest$1(url, method = 'GET', body = null, headers = {}) {
|
|
|
10534
11731
|
.catch((error) => reject(error));
|
|
10535
11732
|
});
|
|
10536
11733
|
}
|
|
10537
|
-
function isEmptyValueOfArray(arr) {
|
|
11734
|
+
function isEmptyValueOfArray$1(arr) {
|
|
10538
11735
|
if (arr.length === 0) {
|
|
10539
11736
|
return true;
|
|
10540
11737
|
}
|
|
10541
11738
|
const len = arr.length;
|
|
10542
11739
|
let count = 0;
|
|
10543
11740
|
for (let i = 0; i < len; i++) {
|
|
10544
|
-
if (isEmptyValue(arr[i])) {
|
|
11741
|
+
if (isEmptyValue$1(arr[i])) {
|
|
10545
11742
|
count++;
|
|
10546
11743
|
}
|
|
10547
11744
|
else {
|
|
@@ -10553,14 +11750,14 @@ function isEmptyValueOfArray(arr) {
|
|
|
10553
11750
|
}
|
|
10554
11751
|
return false;
|
|
10555
11752
|
}
|
|
10556
|
-
function isEmptyValueOfObject(obj) {
|
|
11753
|
+
function isEmptyValueOfObject$1(obj) {
|
|
10557
11754
|
if (Object.keys(obj).length === 0) {
|
|
10558
11755
|
return true;
|
|
10559
11756
|
}
|
|
10560
11757
|
const len = Object.keys(obj).length;
|
|
10561
11758
|
let count = 0;
|
|
10562
11759
|
for (const val of Object.values(obj)) {
|
|
10563
|
-
if (isEmptyValue(val)) {
|
|
11760
|
+
if (isEmptyValue$1(val)) {
|
|
10564
11761
|
count++;
|
|
10565
11762
|
}
|
|
10566
11763
|
else {
|
|
@@ -10572,7 +11769,7 @@ function isEmptyValueOfObject(obj) {
|
|
|
10572
11769
|
}
|
|
10573
11770
|
return false;
|
|
10574
11771
|
}
|
|
10575
|
-
function isEmptyValue(value, allowZero) {
|
|
11772
|
+
function isEmptyValue$1(value, allowZero) {
|
|
10576
11773
|
if (value === null || value === undefined || value === '') {
|
|
10577
11774
|
return true;
|
|
10578
11775
|
}
|
|
@@ -10580,19 +11777,19 @@ function isEmptyValue(value, allowZero) {
|
|
|
10580
11777
|
return false;
|
|
10581
11778
|
}
|
|
10582
11779
|
else if (Array.isArray(value)) {
|
|
10583
|
-
return isEmptyValueOfArray(value);
|
|
11780
|
+
return isEmptyValueOfArray$1(value);
|
|
10584
11781
|
}
|
|
10585
11782
|
else if (Object.prototype.toString.call(value) === '[object Object]') {
|
|
10586
|
-
return isEmptyValueOfObject(value);
|
|
11783
|
+
return isEmptyValueOfObject$1(value);
|
|
10587
11784
|
}
|
|
10588
11785
|
else {
|
|
10589
11786
|
return !value;
|
|
10590
11787
|
}
|
|
10591
11788
|
}
|
|
10592
|
-
function toQueryParams(params) {
|
|
11789
|
+
function toQueryParams$1(params) {
|
|
10593
11790
|
const finalParams = {};
|
|
10594
11791
|
Object.entries(params).forEach(([key, value]) => {
|
|
10595
|
-
if (!isEmptyValue(value, true)) {
|
|
11792
|
+
if (!isEmptyValue$1(value, true)) {
|
|
10596
11793
|
finalParams[key] = value;
|
|
10597
11794
|
}
|
|
10598
11795
|
});
|
|
@@ -10648,7 +11845,7 @@ const isMobile = (userAgent) => {
|
|
|
10648
11845
|
userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
|
|
10649
11846
|
userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
|
|
10650
11847
|
};
|
|
10651
|
-
const showNotification$
|
|
11848
|
+
const showNotification$1 = ({ message, theme = 'success' }) => {
|
|
10652
11849
|
window.postMessage({
|
|
10653
11850
|
type: 'ShowNotificationToast',
|
|
10654
11851
|
message,
|
|
@@ -10933,7 +12130,7 @@ const getTranslations$1 = (data) => {
|
|
|
10933
12130
|
});
|
|
10934
12131
|
};
|
|
10935
12132
|
|
|
10936
|
-
const formatDate
|
|
12133
|
+
const formatDate = ({ date, type = 'date', format: format$1 }) => {
|
|
10937
12134
|
try {
|
|
10938
12135
|
const parsedDate = parseISO(date);
|
|
10939
12136
|
if (isNaN(parsedDate.getTime())) {
|
|
@@ -10968,7 +12165,7 @@ const DEFAULT_BULLET_CONFIG = [
|
|
|
10968
12165
|
}
|
|
10969
12166
|
];
|
|
10970
12167
|
const SPLIT_TOKEN = '-';
|
|
10971
|
-
const showNotification
|
|
12168
|
+
const showNotification = ({ message, theme = 'success', renderOne = false }) => {
|
|
10972
12169
|
window.postMessage({
|
|
10973
12170
|
type: 'ShowNotificationToast',
|
|
10974
12171
|
message,
|
|
@@ -11015,7 +12212,7 @@ const LotteryTippingTicketBet = class {
|
|
|
11015
12212
|
width: 22,
|
|
11016
12213
|
align: 'right',
|
|
11017
12214
|
nowrap: true,
|
|
11018
|
-
render: (_, value) => formatDate
|
|
12215
|
+
render: (_, value) => formatDate({ date: value, format: 'ccc HH:mm' })
|
|
11019
12216
|
},
|
|
11020
12217
|
{
|
|
11021
12218
|
title: () => (index.h("lottery-tipping-bullet-group", { theme: "text", bulletConfigContent: JSON.stringify(DEFAULT_BULLET_CONFIG) })),
|
|
@@ -11150,7 +12347,7 @@ const LotteryTippingTicketBet = class {
|
|
|
11150
12347
|
}
|
|
11151
12348
|
handleClearAll() {
|
|
11152
12349
|
this._resetBulletConfig();
|
|
11153
|
-
showNotification
|
|
12350
|
+
showNotification({ message: translate$1('selectionCleared', this.language), renderOne: true });
|
|
11154
12351
|
this.lotteryTippingBulletBetEvent.emit({ hasSelectBullet: false });
|
|
11155
12352
|
}
|
|
11156
12353
|
async resetBulletConfig({ minLineNumber, maxLineNumber, defaultBoards }) {
|
|
@@ -11318,39 +12515,193 @@ const LotteryTippingTicketBet = class {
|
|
|
11318
12515
|
};
|
|
11319
12516
|
LotteryTippingTicketBet.style = LotteryTippingTicketBetStyle0;
|
|
11320
12517
|
|
|
11321
|
-
|
|
11322
|
-
(
|
|
11323
|
-
|
|
11324
|
-
|
|
11325
|
-
|
|
11326
|
-
|
|
11327
|
-
|
|
11328
|
-
|
|
11329
|
-
|
|
11330
|
-
|
|
11331
|
-
|
|
11332
|
-
|
|
11333
|
-
|
|
11334
|
-
|
|
11335
|
-
|
|
11336
|
-
|
|
11337
|
-
|
|
11338
|
-
|
|
11339
|
-
|
|
11340
|
-
|
|
11341
|
-
}
|
|
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
|
+
}
|
|
11342
12693
|
|
|
11343
12694
|
const DEFAULT_LANGUAGE = 'en';
|
|
11344
12695
|
const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
|
|
11345
12696
|
const TRANSLATIONS = {
|
|
11346
12697
|
en: {
|
|
11347
|
-
gameNotAvailable: 'Sorry. The Game is not available now.',
|
|
11348
12698
|
stop: 'Stop',
|
|
11349
12699
|
at: 'at',
|
|
11350
12700
|
turnover: 'Turnover: ',
|
|
11351
12701
|
selectionCleared: 'Your selection will be cleared.',
|
|
12702
|
+
selectionOnLineCleared: 'Your selection on this line will be cleared.',
|
|
11352
12703
|
ticketSubmitted: 'Ticket submitted successfully.',
|
|
11353
|
-
ticketFailed: 'Failed to
|
|
12704
|
+
ticketFailed: 'Failed to purchase the ticket. Please try again.',
|
|
11354
12705
|
lines: 'Lines',
|
|
11355
12706
|
line: 'Line',
|
|
11356
12707
|
bettingType: 'Betting Type',
|
|
@@ -11361,7 +12712,9 @@ const TRANSLATIONS = {
|
|
|
11361
12712
|
orderSummarySubmit: 'Submit',
|
|
11362
12713
|
cancel: 'Cancel',
|
|
11363
12714
|
confirm: 'Confirm',
|
|
11364
|
-
stakePerLine: 'Stake per Line:'
|
|
12715
|
+
stakePerLine: 'Stake per Line:',
|
|
12716
|
+
error: 'Error!',
|
|
12717
|
+
gameNotAvailable: 'Sorry. The Game is not available now.'
|
|
11365
12718
|
},
|
|
11366
12719
|
ro: {
|
|
11367
12720
|
selectionCleared: 'Selecția dvs. va fi ștearsă.',
|
|
@@ -11424,432 +12777,92 @@ const TRANSLATIONS = {
|
|
|
11424
12777
|
confirm: 'Potvrdi'
|
|
11425
12778
|
}
|
|
11426
12779
|
};
|
|
11427
|
-
const translate = (key, customLang) => {
|
|
11428
|
-
const lang = customLang;
|
|
11429
|
-
|
|
11430
|
-
|
|
11431
|
-
|
|
11432
|
-
|
|
11433
|
-
for (let key in data[item]) {
|
|
11434
|
-
TRANSLATIONS[item][key] = data[item][key];
|
|
11435
|
-
}
|
|
11436
|
-
});
|
|
11437
|
-
};
|
|
11438
|
-
const resolveTranslationUrl = async (translationUrl) => {
|
|
11439
|
-
if (translationUrl) {
|
|
11440
|
-
try {
|
|
11441
|
-
const response = await fetch(translationUrl);
|
|
11442
|
-
if (!response.ok) {
|
|
11443
|
-
throw new Error(`HTTP error! status: ${response.status}`);
|
|
11444
|
-
}
|
|
11445
|
-
const translations = await response.json();
|
|
11446
|
-
getTranslations(translations);
|
|
11447
|
-
}
|
|
11448
|
-
catch (error) {
|
|
11449
|
-
console.error('Failed to fetch or parse translations from URL:', error);
|
|
11450
|
-
}
|
|
11451
|
-
}
|
|
11452
|
-
};
|
|
11453
|
-
|
|
11454
|
-
const formatDate = ({ date, type = 'date', format: format$1 }) => {
|
|
11455
|
-
try {
|
|
11456
|
-
const parsedDate = parseISO(date);
|
|
11457
|
-
if (isNaN(parsedDate.getTime())) {
|
|
11458
|
-
throw new Error(`Invalid date: ${date}`);
|
|
11459
|
-
}
|
|
11460
|
-
if (format$1)
|
|
11461
|
-
return format(parsedDate, format$1);
|
|
11462
|
-
let formatStr = 'dd/MM/yyyy';
|
|
11463
|
-
if (type === 'time') {
|
|
11464
|
-
formatStr = 'dd/MM/yyyy HH:mm:ss';
|
|
11465
|
-
}
|
|
11466
|
-
else if (type === 'week') {
|
|
11467
|
-
formatStr = 'ccc dd/MM/yyyy HH:mm:ss';
|
|
11468
|
-
}
|
|
11469
|
-
return format(parsedDate, formatStr);
|
|
11470
|
-
}
|
|
11471
|
-
catch (error) {
|
|
11472
|
-
console.error('Error formatting date:', error.message);
|
|
11473
|
-
return '';
|
|
11474
|
-
}
|
|
11475
|
-
};
|
|
11476
|
-
const generateUUID$1 = () => {
|
|
11477
|
-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
11478
|
-
var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
|
|
11479
|
-
return v.toString(16);
|
|
11480
|
-
});
|
|
11481
|
-
};
|
|
11482
|
-
function fetchRequest(url, method = 'GET', body = null, headers = {}) {
|
|
11483
|
-
return new Promise((resolve, reject) => {
|
|
11484
|
-
const uuid = generateUUID$1();
|
|
11485
|
-
const headersOrigin = Object.assign({ 'Content-Type': 'application/json' }, headers);
|
|
11486
|
-
if (method !== 'GET' && method !== 'HEAD') {
|
|
11487
|
-
headersOrigin['X-Idempotency-Key'] = uuid;
|
|
11488
|
-
}
|
|
11489
|
-
const options = {
|
|
11490
|
-
method,
|
|
11491
|
-
headers: headersOrigin
|
|
11492
|
-
};
|
|
11493
|
-
if (body && method !== 'GET' && method !== 'HEAD') {
|
|
11494
|
-
options.body = JSON.stringify(body);
|
|
11495
|
-
}
|
|
11496
|
-
fetch(url, options)
|
|
11497
|
-
.then((response) => {
|
|
11498
|
-
if (!response.ok) {
|
|
11499
|
-
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
11500
|
-
}
|
|
11501
|
-
return response.json();
|
|
11502
|
-
})
|
|
11503
|
-
.then((data) => resolve(data))
|
|
11504
|
-
.catch((error) => reject(error));
|
|
11505
|
-
});
|
|
11506
|
-
}
|
|
11507
|
-
const showNotification = ({ message, theme = 'success' }) => {
|
|
11508
|
-
window.postMessage({
|
|
11509
|
-
type: 'ShowNotificationToast',
|
|
11510
|
-
message,
|
|
11511
|
-
theme
|
|
11512
|
-
});
|
|
11513
|
-
};
|
|
11514
|
-
const thousandSeparator = (value) => {
|
|
11515
|
-
if (value === 0) {
|
|
11516
|
-
return '0';
|
|
11517
|
-
}
|
|
11518
|
-
if (!value) {
|
|
11519
|
-
return '';
|
|
11520
|
-
}
|
|
11521
|
-
value = value.toString();
|
|
11522
|
-
const parts = value.split('.');
|
|
11523
|
-
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
11524
|
-
return parts.join('.');
|
|
11525
|
-
};
|
|
11526
|
-
const HomeDrawAwayArr = ['H', 'D', 'A'];
|
|
11527
|
-
// Utility to format raw results into winning numbers (H/D/A)
|
|
11528
|
-
const formatResultsToWinningNumbers = (rawResults) => {
|
|
11529
|
-
// Convert each bullet item into binary (1 if selected, 0 otherwise)
|
|
11530
|
-
const toBinarySelection = (matchRes) => matchRes.map((bulletItem) => (bulletItem.isSelected ? 1 : 0));
|
|
11531
|
-
// Step 1: Convert rawResults into arrays of 0/1 flags
|
|
11532
|
-
const binaryResults = rawResults.map((lineRes) => lineRes.map(toBinarySelection));
|
|
11533
|
-
const resultLinesArr = [];
|
|
11534
|
-
// Step 2: Iterate through each line of results
|
|
11535
|
-
binaryResults.forEach((line, lineIdx) => {
|
|
11536
|
-
const formattedLine = [];
|
|
11537
|
-
// Step 3: Iterate through each match in a line
|
|
11538
|
-
line.forEach((match, matchIdx) => {
|
|
11539
|
-
// Step 4: Collect the winning outcomes (H/D/A) based on binary flags
|
|
11540
|
-
const outcomes = match.map((isSelected, idx) => (isSelected ? HomeDrawAwayArr[idx] : null)).filter(Boolean);
|
|
11541
|
-
// Wrap outcomes into the expected structure [[matchRes]]
|
|
11542
|
-
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]);
|
|
11543
12786
|
});
|
|
11544
|
-
resultLinesArr[lineIdx] = formattedLine;
|
|
11545
|
-
});
|
|
11546
|
-
return resultLinesArr;
|
|
11547
|
-
};
|
|
11548
|
-
const buildSubmitParam = ({ playerId, rawResults, gameId, rawData, amount, currentStake, betTypeId, betType }) => {
|
|
11549
|
-
var _a;
|
|
11550
|
-
const body = { playerId, tickets: [] };
|
|
11551
|
-
const selections = formatResultsToWinningNumbers(rawResults);
|
|
11552
|
-
const stake = currentStake || {};
|
|
11553
|
-
body.tickets.push({
|
|
11554
|
-
startingDrawId: (_a = rawData === null || rawData === void 0 ? void 0 : rawData.currentDraw) === null || _a === void 0 ? void 0 : _a.id,
|
|
11555
|
-
amount,
|
|
11556
|
-
gameId: gameId,
|
|
11557
|
-
gameName: rawData.name,
|
|
11558
|
-
currency: stake.currency,
|
|
11559
|
-
selection: selections.map((i) => ({
|
|
11560
|
-
betType: betTypeId,
|
|
11561
|
-
stake: +stake.value,
|
|
11562
|
-
poolGameSelections: i,
|
|
11563
|
-
quickPick: false,
|
|
11564
|
-
betName: betType.name
|
|
11565
|
-
})),
|
|
11566
|
-
multiplier: false,
|
|
11567
|
-
drawCount: 1,
|
|
11568
|
-
quickPick: false
|
|
11569
|
-
});
|
|
11570
|
-
return body;
|
|
11571
|
-
};
|
|
11572
|
-
// BettingTypes, playModes and playTypes
|
|
11573
|
-
const getEnableOptions = (raw = []) => raw.filter((i) => i.enabled);
|
|
11574
|
-
// the first one in bet type config that enabled = true, will be default choice
|
|
11575
|
-
const getDefaultType = ({ playTypeConfig = [], betTypeConfig = [], enabledBettingTypeOptions = [], enabledPlayingModeOptions = [] }) => {
|
|
11576
|
-
const enabledBetTypeConfig = betTypeConfig.filter((i) => i.enabled);
|
|
11577
|
-
for (const item of enabledBetTypeConfig) {
|
|
11578
|
-
const { bettingType, playMode } = playTypeConfig === null || playTypeConfig === void 0 ? void 0 : playTypeConfig.find((i) => i.betTypeId === item.id);
|
|
11579
|
-
if (enabledBettingTypeOptions.map((i) => i.code).includes(bettingType) &&
|
|
11580
|
-
enabledPlayingModeOptions.map((i) => i.code).includes(playMode))
|
|
11581
|
-
return { bettingType, playMode };
|
|
11582
|
-
}
|
|
11583
|
-
return {};
|
|
11584
|
-
};
|
|
11585
|
-
const calculatePlayingModeOptions = ({ bettingType, playTypeConfig, betTypeConfig, enabledPlayingModeOptions }) => {
|
|
11586
|
-
const enabledBetTypeIdConfig = betTypeConfig.filter((i) => i.enabled).map((i) => i.id);
|
|
11587
|
-
const filteredPlayTypesConfig = playTypeConfig.filter((i) => enabledBetTypeIdConfig.includes(i.betTypeId));
|
|
11588
|
-
const selectedBettingTypeFilteredPlayTypesConfig = filteredPlayTypesConfig.filter((i) => i.bettingType === bettingType);
|
|
11589
|
-
const _ = selectedBettingTypeFilteredPlayTypesConfig.map((i) => i.playMode);
|
|
11590
|
-
return enabledPlayingModeOptions.filter((i) => _.includes(i.code));
|
|
11591
|
-
};
|
|
11592
|
-
const getCheckedCountForEachLineAndEachMatch = ({ rawResults }) => {
|
|
11593
|
-
const getMatchCheckRes = (matchRes) => matchRes.filter((bulletItem) => bulletItem.isSelected).length;
|
|
11594
|
-
const checkedCountForEachLineAndEachMatch = rawResults.map((lineRes) => lineRes.length > 0 ? lineRes.map(getMatchCheckRes) : [0]);
|
|
11595
|
-
return checkedCountForEachLineAndEachMatch;
|
|
11596
|
-
};
|
|
11597
|
-
const getPlayTypeConfig = ({ rawData, selectedBettingType, selectedPlayingMode }) => {
|
|
11598
|
-
var _a, _b, _c, _d, _e, _f;
|
|
11599
|
-
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;
|
|
11600
|
-
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);
|
|
11601
|
-
return { betTypeId, betType };
|
|
11602
|
-
};
|
|
11603
|
-
const getMinValue = (arr) => (arr.length ? Math.min.apply(null, arr) : undefined);
|
|
11604
|
-
function formattedTurnover(turnover, unit = '€') {
|
|
11605
|
-
if (turnover === null || turnover === undefined)
|
|
11606
|
-
return '';
|
|
11607
|
-
return `${unit}${turnover ? thousandSeparator(turnover) : 0}`;
|
|
11608
|
-
}
|
|
11609
|
-
function formattedWeekName(date) {
|
|
11610
|
-
if (!date)
|
|
11611
|
-
return '';
|
|
11612
|
-
const _temp = formatDate({ date, format: 'EEEE' });
|
|
11613
|
-
if (!['saturday', 'sunday'].includes(_temp.toLowerCase())) {
|
|
11614
|
-
return 'MIDWEEK';
|
|
11615
12787
|
}
|
|
11616
|
-
return
|
|
11617
|
-
}
|
|
11618
|
-
|
|
11619
|
-
const TICKET_INVALID_TOKEN = 'TICKET_INVALID_TOKEN';
|
|
11620
|
-
const generateUUID = () => {
|
|
11621
|
-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
11622
|
-
var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
|
|
11623
|
-
return v.toString(16);
|
|
11624
|
-
});
|
|
12788
|
+
return translation;
|
|
11625
12789
|
};
|
|
11626
|
-
const
|
|
11627
|
-
|
|
11628
|
-
|
|
11629
|
-
|
|
11630
|
-
'Content-Type': 'application/json',
|
|
11631
|
-
Accept: 'application/json',
|
|
11632
|
-
Authorization: `Bearer ${sessionId}`,
|
|
11633
|
-
'X-Idempotency-Key': generateUUID()
|
|
11634
|
-
},
|
|
11635
|
-
body: JSON.stringify(body)
|
|
11636
|
-
};
|
|
11637
|
-
return fetch(url, options).then((res) => {
|
|
11638
|
-
if (res.status === 401) {
|
|
11639
|
-
throw new Error(TICKET_INVALID_TOKEN);
|
|
11640
|
-
}
|
|
11641
|
-
if (res.status > 300) {
|
|
11642
|
-
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];
|
|
11643
12794
|
}
|
|
11644
|
-
return res.json().then((data) => {
|
|
11645
|
-
if (checkTicketDetailHasError(data.tickets))
|
|
11646
|
-
throw new Error(res.statusText);
|
|
11647
|
-
return data;
|
|
11648
|
-
});
|
|
11649
12795
|
});
|
|
11650
12796
|
};
|
|
11651
|
-
|
|
11652
|
-
if (
|
|
11653
|
-
|
|
11654
|
-
|
|
11655
|
-
|
|
11656
|
-
|
|
11657
|
-
|
|
11658
|
-
|
|
11659
|
-
|
|
11660
|
-
|
|
11661
|
-
|
|
11662
|
-
|
|
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
|
+
}
|
|
11663
12810
|
}
|
|
11664
|
-
}
|
|
12811
|
+
};
|
|
11665
12812
|
|
|
11666
|
-
const
|
|
11667
|
-
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;
|
|
11668
12815
|
|
|
11669
|
-
const
|
|
12816
|
+
const LotteryTippingTicketBuy = class {
|
|
11670
12817
|
constructor(hostRef) {
|
|
11671
12818
|
index.registerInstance(this, hostRef);
|
|
11672
|
-
this.
|
|
11673
|
-
this.
|
|
11674
|
-
this.
|
|
11675
|
-
|
|
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'
|
|
11676
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';
|
|
11677
12835
|
this.mbSource = undefined;
|
|
11678
12836
|
this.clientStyling = undefined;
|
|
11679
12837
|
this.clientStylingUrl = undefined;
|
|
11680
12838
|
this.translationUrl = '';
|
|
11681
12839
|
this.language = 'en';
|
|
11682
|
-
this.
|
|
11683
|
-
this.
|
|
11684
|
-
this.
|
|
11685
|
-
this.
|
|
11686
|
-
this.
|
|
11687
|
-
this.isLoading = true;
|
|
11688
|
-
this.bettingTypeOptions = [];
|
|
11689
|
-
this.playingModeOptions = [];
|
|
11690
|
-
this.selectedBettingType = undefined;
|
|
11691
|
-
this.selectedPlayingMode = undefined;
|
|
11692
|
-
this.hasSelectBullet = undefined;
|
|
11693
|
-
this.hasSelectAllBullet = undefined;
|
|
11694
|
-
this.totalLineCombination = 0;
|
|
11695
|
-
this.submitLoading = false;
|
|
11696
|
-
this.isSalesActive = false;
|
|
11697
|
-
this.drawSubmitAvailable = false;
|
|
11698
|
-
this.rawData = {};
|
|
11699
|
-
this.saleStatisticsInfo = {};
|
|
11700
|
-
this.currentStake = undefined;
|
|
12840
|
+
this.bulletSelectionsLineGroup = [[[]]];
|
|
12841
|
+
this.draw = undefined;
|
|
12842
|
+
this.isLoading = false;
|
|
12843
|
+
this.betCurrentPage = 1;
|
|
12844
|
+
this.betTotalPages = undefined;
|
|
11701
12845
|
this.dialogConfig = { visible: false };
|
|
12846
|
+
this.submitLoading = undefined;
|
|
12847
|
+
this.betHasErrors = false;
|
|
11702
12848
|
this.gameUnavailable = false;
|
|
11703
|
-
|
|
11704
|
-
|
|
11705
|
-
|
|
11706
|
-
|
|
11707
|
-
|
|
11708
|
-
|
|
11709
|
-
|
|
11710
|
-
|
|
11711
|
-
|
|
11712
|
-
|
|
11713
|
-
|
|
11714
|
-
const [minLineNumber, maxLineNumber] = [Math.min(...boardsAllowed), Math.max(...boardsAllowed)];
|
|
11715
|
-
const defaultBoards = (betType === null || betType === void 0 ? void 0 : betType.defaultBoards) || minLineNumber;
|
|
11716
|
-
return { minLineNumber, maxLineNumber, defaultBoards };
|
|
11717
|
-
}
|
|
11718
|
-
get playTypeConfig() {
|
|
11719
|
-
var _a, _b, _c;
|
|
11720
|
-
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;
|
|
11721
|
-
}
|
|
11722
|
-
get betTypeConfig() {
|
|
11723
|
-
var _a, _b;
|
|
11724
|
-
return (_b = (_a = this.rawData) === null || _a === void 0 ? void 0 : _a.rules) === null || _b === void 0 ? void 0 : _b.betTypes;
|
|
11725
|
-
}
|
|
11726
|
-
get isBothBettingType() {
|
|
11727
|
-
return this.selectedBettingType === BettingTypeEnum.Both;
|
|
11728
|
-
}
|
|
11729
|
-
get stakeOptions() {
|
|
11730
|
-
var _a, _b, _c;
|
|
11731
|
-
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) => {
|
|
11732
|
-
var _a;
|
|
11733
|
-
return { value: (_a = item.value) === null || _a === void 0 ? void 0 : _a.toString(), label: item.value, currency: item.currency };
|
|
11734
|
-
});
|
|
11735
|
-
}
|
|
11736
|
-
getCurrentStakeByValue(value) {
|
|
11737
|
-
var _a;
|
|
11738
|
-
return (_a = this.stakeOptions) === null || _a === void 0 ? void 0 : _a.find((item) => +item.value === +value);
|
|
11739
|
-
}
|
|
11740
|
-
initiateCurrentStake() {
|
|
11741
|
-
var _a, _b;
|
|
11742
|
-
// if only one option, default to the first one
|
|
11743
|
-
if (((_a = this.stakeOptions) === null || _a === void 0 ? void 0 : _a.length) === 1) {
|
|
11744
|
-
this.currentStake = this.stakeOptions[0];
|
|
11745
|
-
}
|
|
11746
|
-
else {
|
|
11747
|
-
// otherwise, default to the smallest stake option from the config
|
|
11748
|
-
const minValue = getMinValue(((_b = this.stakeOptions) === null || _b === void 0 ? void 0 : _b.map((i) => i.value)) || []);
|
|
11749
|
-
this.currentStake = this.getCurrentStakeByValue(minValue);
|
|
11750
|
-
}
|
|
11751
|
-
}
|
|
11752
|
-
handleBettingTypeChange(type) {
|
|
11753
|
-
var _a, _b, _c, _d;
|
|
11754
|
-
if (type === this.selectedBettingType)
|
|
11755
|
-
return;
|
|
11756
|
-
this.selectedBettingType = type;
|
|
11757
|
-
const calcPlayingModeOptions = calculatePlayingModeOptions({
|
|
11758
|
-
bettingType: this.selectedBettingType,
|
|
11759
|
-
playTypeConfig: this.playTypeConfig,
|
|
11760
|
-
betTypeConfig: this.betTypeConfig,
|
|
11761
|
-
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) || [])
|
|
11762
|
-
});
|
|
11763
|
-
this.playingModeOptions = calcPlayingModeOptions;
|
|
11764
|
-
if (!calcPlayingModeOptions.length) {
|
|
11765
|
-
this.selectedPlayingMode = undefined;
|
|
11766
|
-
}
|
|
11767
|
-
else if (!calcPlayingModeOptions.map((i) => i.code).includes(this.selectedPlayingMode)) {
|
|
11768
|
-
this.hasSelectBullet = false;
|
|
11769
|
-
this.handlePlayingModeChange((_d = calcPlayingModeOptions[0]) === null || _d === void 0 ? void 0 : _d.code);
|
|
11770
|
-
}
|
|
11771
|
-
this.clearBulletConfig();
|
|
11772
|
-
}
|
|
11773
|
-
async clearBulletConfig() {
|
|
11774
|
-
return await this.childRef.resetBulletConfig(this.lineNumberRange);
|
|
11775
|
-
}
|
|
11776
|
-
handlePlayingModeChange(mode) {
|
|
11777
|
-
if (mode === this.selectedPlayingMode)
|
|
11778
|
-
return;
|
|
11779
|
-
const doChangeSelectedPlayingMod = (closeDialog) => {
|
|
11780
|
-
this.selectedPlayingMode = mode;
|
|
11781
|
-
this.clearBulletConfig().then(() => {
|
|
11782
|
-
closeDialog === null || closeDialog === void 0 ? void 0 : closeDialog();
|
|
11783
|
-
});
|
|
11784
|
-
};
|
|
11785
|
-
if (this.hasSelectBullet) {
|
|
11786
|
-
const closeDialog = () => {
|
|
11787
|
-
this.dialogConfig = { visible: false };
|
|
11788
|
-
};
|
|
11789
|
-
const onConfirm = () => {
|
|
11790
|
-
doChangeSelectedPlayingMod(closeDialog);
|
|
11791
|
-
};
|
|
11792
|
-
this.dialogConfig = {
|
|
11793
|
-
visible: true,
|
|
11794
|
-
content: translate('selectionCleared', this.language),
|
|
11795
|
-
onConfirm: onConfirm,
|
|
11796
|
-
onCancel: closeDialog
|
|
11797
|
-
};
|
|
11798
|
-
}
|
|
11799
|
-
else {
|
|
11800
|
-
doChangeSelectedPlayingMod();
|
|
11801
|
-
}
|
|
11802
|
-
}
|
|
11803
|
-
lotteryTippingBulletGroupSelectionHandler(event) {
|
|
11804
|
-
var _a;
|
|
11805
|
-
const hasSelectBullet = (_a = event.detail) === null || _a === void 0 ? void 0 : _a.hasSelectBullet;
|
|
11806
|
-
if (hasSelectBullet !== undefined)
|
|
11807
|
-
this.hasSelectBullet = hasSelectBullet;
|
|
11808
|
-
this.bulletBetSelectChecker();
|
|
11809
|
-
}
|
|
11810
|
-
calculateCombinationInLine(checkedNumberArr) {
|
|
11811
|
-
return checkedNumberArr.reduce((pre, cur) => pre * cur, 1);
|
|
11812
|
-
}
|
|
11813
|
-
calculateTotalAmount() {
|
|
11814
|
-
const stake = this.currentStake;
|
|
11815
|
-
if (!stake) {
|
|
11816
|
-
return 0;
|
|
11817
|
-
}
|
|
11818
|
-
let totalAmount = +stake.value * this.totalLineCombination;
|
|
11819
|
-
if (this.isBothBettingType)
|
|
11820
|
-
totalAmount = this.bothBettingTypeMultiplier * totalAmount;
|
|
11821
|
-
return totalAmount;
|
|
11822
|
-
}
|
|
11823
|
-
get totalAmountFormatted() {
|
|
11824
|
-
var _a;
|
|
11825
|
-
const totalAmount = this.calculateTotalAmount();
|
|
11826
|
-
return thousandSeparator(totalAmount) + ' ' + (((_a = this.currentStake) === null || _a === void 0 ? void 0 : _a.currency) || '');
|
|
11827
|
-
}
|
|
11828
|
-
get currentStakeFormatted() {
|
|
11829
|
-
const { value = '', currency = '' } = this.currentStake || {};
|
|
11830
|
-
return `${value} ${currency}`;
|
|
11831
|
-
}
|
|
11832
|
-
bulletBetSelectChecker() {
|
|
11833
|
-
const validateSelectionsAndCalculateTotals = async () => {
|
|
11834
|
-
const doCheckIfNotCompleteSelect = ({ rawResults }) => {
|
|
11835
|
-
const checkedCountForEachLineAndEachMatch = getCheckedCountForEachLineAndEachMatch({ rawResults });
|
|
11836
|
-
// total line combination is sum of all the line's combination
|
|
11837
|
-
this.totalLineCombination = checkedCountForEachLineAndEachMatch.reduce((pre, cur) => pre + this.calculateCombinationInLine(cur), 0);
|
|
11838
|
-
// each line's combination should within in [combinations, maxCombinations]
|
|
11839
|
-
const { combinations = 1, maxCombinations = 1 } = getPlayTypeConfig({
|
|
11840
|
-
rawData: this.rawData,
|
|
11841
|
-
selectedBettingType: this.selectedBettingType,
|
|
11842
|
-
selectedPlayingMode: this.selectedPlayingMode
|
|
11843
|
-
}).betType || {};
|
|
11844
|
-
return checkedCountForEachLineAndEachMatch.some((checkedNumberArr) => {
|
|
11845
|
-
const curCombination = this.calculateCombinationInLine(checkedNumberArr);
|
|
11846
|
-
return curCombination < combinations || curCombination > maxCombinations;
|
|
11847
|
-
});
|
|
11848
|
-
};
|
|
11849
|
-
const rawResults = await this.getLotteryTippingBulletResults();
|
|
11850
|
-
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
|
|
11851
12860
|
};
|
|
11852
|
-
|
|
12861
|
+
this.eventMap = undefined;
|
|
12862
|
+
this.eventPart2EventOutcomeMap = undefined;
|
|
12863
|
+
this.betTypeOptions = [];
|
|
12864
|
+
this.eventPartOptions = [];
|
|
12865
|
+
this.stakeOptions = [];
|
|
11853
12866
|
}
|
|
11854
12867
|
handleClientStylingChange(newValue, oldValue) {
|
|
11855
12868
|
if (newValue != oldValue) {
|
|
@@ -11871,6 +12884,14 @@ const LotteryTippingTicketController = class {
|
|
|
11871
12884
|
resolveTranslationUrl(this.translationUrl);
|
|
11872
12885
|
}
|
|
11873
12886
|
}
|
|
12887
|
+
connectedCallback() {
|
|
12888
|
+
if (this.endpoint && this.gameId && this.drawId) {
|
|
12889
|
+
this.getTippingInfo();
|
|
12890
|
+
}
|
|
12891
|
+
else {
|
|
12892
|
+
console.log('no fetch');
|
|
12893
|
+
}
|
|
12894
|
+
}
|
|
11874
12895
|
componentDidLoad() {
|
|
11875
12896
|
if (this.stylingContainer) {
|
|
11876
12897
|
if (this.mbSource)
|
|
@@ -11884,9 +12905,23 @@ const LotteryTippingTicketController = class {
|
|
|
11884
12905
|
disconnectedCallback() {
|
|
11885
12906
|
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
11886
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
|
+
}
|
|
11887
12923
|
updateDrawSalesStatus() {
|
|
11888
|
-
|
|
11889
|
-
const currentDraw = (_a = this.rawData) === null || _a === void 0 ? void 0 : _a.currentDraw;
|
|
12924
|
+
const currentDraw = this.draw;
|
|
11890
12925
|
if (!currentDraw) {
|
|
11891
12926
|
this.gameUnavailable = true;
|
|
11892
12927
|
this.isSalesActive = false;
|
|
@@ -11911,139 +12946,296 @@ const LotteryTippingTicketController = class {
|
|
|
11911
12946
|
this.isSalesActive = false;
|
|
11912
12947
|
}
|
|
11913
12948
|
}
|
|
11914
|
-
|
|
11915
|
-
|
|
11916
|
-
let url = new URL(`${this.endpoint}/games/${this.gameId}`);
|
|
12949
|
+
async getTippingInfo() {
|
|
12950
|
+
try {
|
|
11917
12951
|
this.isLoading = true;
|
|
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
|
-
|
|
11944
|
-
|
|
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
|
+
}
|
|
11945
12980
|
}
|
|
11946
12981
|
updateSaleStatistics() {
|
|
11947
|
-
var _a;
|
|
12982
|
+
var _a, _b, _c;
|
|
11948
12983
|
return fetchSaleStatistics({
|
|
11949
12984
|
endpoint: this.endpoint,
|
|
11950
|
-
gameId: (_a = this.
|
|
11951
|
-
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
|
|
11952
12987
|
}).then((res) => {
|
|
11953
|
-
|
|
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
|
+
})
|
|
11954
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));
|
|
11955
13103
|
}
|
|
11956
|
-
|
|
11957
|
-
this.
|
|
11958
|
-
|
|
11959
|
-
|
|
11960
|
-
|
|
11961
|
-
|
|
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
|
+
})
|
|
11962
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) {
|
|
11963
13154
|
return;
|
|
11964
13155
|
}
|
|
11965
|
-
const
|
|
11966
|
-
|
|
11967
|
-
|
|
11968
|
-
|
|
11969
|
-
|
|
11970
|
-
|
|
11971
|
-
const url = new URL(`${this.endpoint}/tickets`);
|
|
11972
|
-
const body = buildSubmitParam({
|
|
11973
|
-
playerId: this.playerId,
|
|
11974
|
-
rawResults,
|
|
11975
|
-
gameId: this.gameId,
|
|
11976
|
-
rawData: this.rawData,
|
|
11977
|
-
amount: this.calculateTotalAmount().toString(),
|
|
11978
|
-
currentStake: this.currentStake,
|
|
11979
|
-
betTypeId,
|
|
11980
|
-
betType
|
|
11981
|
-
});
|
|
11982
|
-
this.submitLoading = true;
|
|
11983
|
-
doSubmitTicket({ body, sessionId: this.sessionId, url: url.href })
|
|
11984
|
-
.then(() => {
|
|
11985
|
-
showNotification({ message: translate('ticketSubmitted', this.language) });
|
|
11986
|
-
this.clearBulletConfig();
|
|
11987
|
-
this.updateSaleStatistics();
|
|
11988
|
-
})
|
|
11989
|
-
.catch((res) => {
|
|
11990
|
-
if (res.message === TICKET_INVALID_TOKEN) {
|
|
11991
|
-
this.logoutEventHandler.emit();
|
|
11992
|
-
showNotification({ message: TICKET_INVALID_TOKEN, theme: 'error' });
|
|
11993
|
-
return;
|
|
11994
|
-
}
|
|
11995
|
-
showNotification({ message: translate('ticketFailed', this.language), theme: 'error' });
|
|
11996
|
-
})
|
|
11997
|
-
.finally(() => {
|
|
11998
|
-
this.submitLoading = false;
|
|
11999
|
-
});
|
|
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);
|
|
12000
13162
|
}
|
|
12001
|
-
|
|
12002
|
-
const
|
|
12003
|
-
|
|
12004
|
-
|
|
12005
|
-
|
|
12006
|
-
|
|
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);
|
|
12007
13174
|
}
|
|
12008
|
-
|
|
12009
|
-
|
|
12010
|
-
|
|
12011
|
-
|
|
12012
|
-
|
|
12013
|
-
|
|
12014
|
-
|
|
12015
|
-
const
|
|
12016
|
-
|
|
12017
|
-
|
|
12018
|
-
}, onClick: this.handlePlayingModeChange.bind(this, item.code) }, item.name)))));
|
|
12019
|
-
const renderingStakeOptions = () => {
|
|
12020
|
-
var _a, _b;
|
|
12021
|
-
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();
|
|
12022
13185
|
};
|
|
12023
|
-
|
|
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
|
+
}
|
|
12024
13197
|
}
|
|
12025
|
-
|
|
12026
|
-
|
|
12027
|
-
|
|
12028
|
-
|
|
12029
|
-
|
|
12030
|
-
|
|
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
|
+
}));
|
|
12031
13216
|
}
|
|
12032
13217
|
render() {
|
|
12033
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
12034
|
-
if (this.
|
|
12035
|
-
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))));
|
|
12036
13230
|
}
|
|
12037
|
-
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))));
|
|
12038
13231
|
}
|
|
12039
|
-
static get assetsDirs() { return ["../static"]; }
|
|
12040
13232
|
static get watchers() { return {
|
|
12041
13233
|
"clientStyling": ["handleClientStylingChange"],
|
|
12042
13234
|
"clientStylingUrl": ["handleClientStylingUrlChange"],
|
|
12043
13235
|
"mbSource": ["handleMbSourceChange"]
|
|
12044
13236
|
}; }
|
|
12045
13237
|
};
|
|
12046
|
-
|
|
13238
|
+
LotteryTippingTicketBuy.style = LotteryTippingTicketBuyStyle0;
|
|
12047
13239
|
|
|
12048
13240
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
12049
13241
|
|
|
@@ -17129,7 +18321,7 @@ const LotteryTippingTicketHistory = class {
|
|
|
17129
18321
|
this.rawData = res;
|
|
17130
18322
|
}
|
|
17131
18323
|
catch (e) {
|
|
17132
|
-
showNotification$
|
|
18324
|
+
showNotification$1({ message: (_a = e.message) !== null && _a !== void 0 ? _a : e, theme: 'error' });
|
|
17133
18325
|
}
|
|
17134
18326
|
finally {
|
|
17135
18327
|
}
|
|
@@ -17165,7 +18357,7 @@ const LotteryTippingTicketHistory = class {
|
|
|
17165
18357
|
async fetchTicketList() {
|
|
17166
18358
|
this.isLoading = true;
|
|
17167
18359
|
try {
|
|
17168
|
-
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, {
|
|
17169
18361
|
Authorization: `Bearer ${this.sessionId}`
|
|
17170
18362
|
});
|
|
17171
18363
|
this.ticketHistory = items;
|
|
@@ -17177,7 +18369,7 @@ const LotteryTippingTicketHistory = class {
|
|
|
17177
18369
|
catch (e) {
|
|
17178
18370
|
console.log('in fetchTicketList error is: ', e);
|
|
17179
18371
|
if (e.status === 401) {
|
|
17180
|
-
showNotification$
|
|
18372
|
+
showNotification$1({ message: e.message, theme: 'error' });
|
|
17181
18373
|
this.logout.emit();
|
|
17182
18374
|
}
|
|
17183
18375
|
}
|
|
@@ -17370,11 +18562,17 @@ const LotteryTippingTicketHistory = class {
|
|
|
17370
18562
|
LotteryTippingTicketHistory.style = LotteryTippingTicketHistoryStyle0;
|
|
17371
18563
|
|
|
17372
18564
|
exports.lottery_tipping_page = lotteryTippingPage.LotteryTippingPage;
|
|
18565
|
+
exports.app_tooltip = Tooltip;
|
|
17373
18566
|
exports.general_multi_select = GeneralMultiSelect;
|
|
17374
18567
|
exports.general_tooltip = GeneralTooltip;
|
|
17375
18568
|
exports.helper_count_down = HelperCountDown;
|
|
17376
18569
|
exports.lottery_banner = LotteryBanner;
|
|
17377
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;
|
|
17378
18576
|
exports.lottery_tipping_bullet = LotteryTippingBullet;
|
|
17379
18577
|
exports.lottery_tipping_bullet_group = LotteryTippingBulletGroup;
|
|
17380
18578
|
exports.lottery_tipping_dialog = LotteryTippingDialog;
|
|
@@ -17382,5 +18580,5 @@ exports.lottery_tipping_filter = LotteryTippingFilter;
|
|
|
17382
18580
|
exports.lottery_tipping_pagination = LotteryTippingPagination;
|
|
17383
18581
|
exports.lottery_tipping_panel = lotteryTippingPanel;
|
|
17384
18582
|
exports.lottery_tipping_ticket_bet = LotteryTippingTicketBet;
|
|
17385
|
-
exports.
|
|
18583
|
+
exports.lottery_tipping_ticket_buy = LotteryTippingTicketBuy;
|
|
17386
18584
|
exports.lottery_tipping_ticket_history = LotteryTippingTicketHistory;
|