@everymatrix/lottery-hakuna-ticket-history 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/index-dc95b9af.js +1336 -0
- package/dist/cjs/index.cjs.js +10 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/cjs/lottery-button_8.cjs.entry.js +1427 -0
- package/dist/cjs/lottery-hakuna-ticket-history-84d9a41b.js +2697 -0
- package/dist/cjs/lottery-hakuna-ticket-history.cjs.js +25 -0
- package/dist/collection/collection-manifest.json +50 -0
- package/dist/collection/components/lottery-hakuna-ticket-history/index.js +1 -0
- package/dist/collection/components/lottery-hakuna-ticket-history/lottery-hakuna-ticket-history.css +74 -0
- package/dist/collection/components/lottery-hakuna-ticket-history/lottery-hakuna-ticket-history.js +589 -0
- package/dist/collection/components/lottery-infinite-scroll/lottery-infinite-scroll.css +69 -0
- package/dist/collection/components/lottery-infinite-scroll/lottery-infinite-scroll.js +556 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/models/index.js +21 -0
- package/dist/collection/utils/api.js +149 -0
- package/dist/collection/utils/locale.utils.js +42 -0
- package/dist/collection/utils/utils.js +3 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/index-50addd47.js +1307 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/lottery-button_8.entry.js +1417 -0
- package/dist/esm/lottery-hakuna-ticket-history-cdab50d9.js +2691 -0
- package/dist/esm/lottery-hakuna-ticket-history.js +20 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/lottery-hakuna-ticket-history/app-globals-0f993ce5.js +1 -0
- package/dist/lottery-hakuna-ticket-history/index-50addd47.js +2 -0
- package/dist/lottery-hakuna-ticket-history/index.esm.js +1 -0
- package/dist/lottery-hakuna-ticket-history/lottery-button_8.entry.js +1 -0
- package/dist/lottery-hakuna-ticket-history/lottery-hakuna-ticket-history-cdab50d9.js +1 -0
- package/dist/lottery-hakuna-ticket-history/lottery-hakuna-ticket-history.esm.js +1 -0
- package/dist/stencil.config.dev.js +19 -0
- package/dist/stencil.config.js +19 -0
- package/dist/storybook/main.js +43 -0
- package/dist/storybook/preview.js +9 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history/.stencil/packages/stencil/lottery-hakuna-ticket-history/stencil.config.d.ts +2 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history/.stencil/packages/stencil/lottery-hakuna-ticket-history/stencil.config.dev.d.ts +2 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history/.stencil/packages/stencil/lottery-hakuna-ticket-history/storybook/main.d.ts +3 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history/.stencil/packages/stencil/lottery-hakuna-ticket-history/storybook/preview.d.ts +70 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history/.stencil/tools/plugins/index.d.ts +4 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
- package/dist/types/components/lottery-hakuna-ticket-history/index.d.ts +1 -0
- package/dist/types/components/lottery-hakuna-ticket-history/lottery-hakuna-ticket-history.d.ts +131 -0
- package/dist/types/components/lottery-infinite-scroll/lottery-infinite-scroll.d.ts +106 -0
- package/dist/types/components.d.ts +362 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/models/index.d.ts +199 -0
- package/dist/types/stencil-public-runtime.d.ts +1674 -0
- package/dist/types/utils/api.d.ts +8 -0
- package/dist/types/utils/locale.utils.d.ts +3 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +27 -0
|
@@ -0,0 +1,1427 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-dc95b9af.js');
|
|
6
|
+
const lotteryHakunaTicketHistory = require('./lottery-hakuna-ticket-history-84d9a41b.js');
|
|
7
|
+
|
|
8
|
+
// This icon file is generated automatically.
|
|
9
|
+
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" };
|
|
10
|
+
const DeleteFilled$1 = DeleteFilled;
|
|
11
|
+
|
|
12
|
+
const DEFAULT_LANGUAGE$3 = 'en';
|
|
13
|
+
const SUPPORTED_LANGUAGES$3 = ['ro', 'en', 'fr', 'ar', 'hr', 'zh'];
|
|
14
|
+
const TRANSLATIONS$3 = {
|
|
15
|
+
en: {
|
|
16
|
+
loading: 'Loading'
|
|
17
|
+
},
|
|
18
|
+
ro: {},
|
|
19
|
+
fr: {},
|
|
20
|
+
ar: {},
|
|
21
|
+
hr: {}
|
|
22
|
+
};
|
|
23
|
+
const translate$3 = (key, customLang, replacements) => {
|
|
24
|
+
const lang = customLang;
|
|
25
|
+
let translation = TRANSLATIONS$3[lang !== undefined && SUPPORTED_LANGUAGES$3.includes(lang) ? lang : DEFAULT_LANGUAGE$3][key];
|
|
26
|
+
if (replacements) {
|
|
27
|
+
Object.keys(replacements).forEach((placeholder) => {
|
|
28
|
+
translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return translation;
|
|
32
|
+
};
|
|
33
|
+
const getTranslations$3 = (data) => {
|
|
34
|
+
Object.keys(data).forEach((item) => {
|
|
35
|
+
for (let key in data[item]) {
|
|
36
|
+
TRANSLATIONS$3[item][key] = data[item][key];
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const resolveTranslationUrl$2 = async (translationUrl) => {
|
|
41
|
+
if (translationUrl) {
|
|
42
|
+
try {
|
|
43
|
+
const response = await fetch(translationUrl);
|
|
44
|
+
if (!response.ok) {
|
|
45
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
46
|
+
}
|
|
47
|
+
const translations = await response.json();
|
|
48
|
+
getTranslations$3(translations);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
console.error('Failed to fetch or parse translations from URL:', error);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const lotteryButtonCss = ":host{display:inline-block}.btn{font:inherit;position:relative;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:var(--lottery-button-border-radius, 6px);font-weight:var(--lottery-button-font-weight, 500);cursor:pointer;outline:none;overflow:hidden;transition:var(--lottery-button-transition, background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s);user-select:none;-webkit-tap-highlight-color:transparent;box-shadow:var(--lottery-button-box-shadow, 0 2px 4px 0 rgba(0, 0, 0, 0.5))}.btn .content{position:relative;display:inline-flex;align-items:center;gap:var(--lottery-button-content-gap, 0.5em)}.btn .content ::slotted(span){display:inline-flex;align-items:center}.btn:hover:not(:disabled){box-shadow:var(--lottery-button-hover-box-shadow, 0 4px 8px 0 rgba(0, 0, 0, 0.5))}.btn:disabled{cursor:not-allowed;opacity:var(--lottery-button-disabled-opacity, 0.5)}.btn .loading-container{display:flex;align-items:center}.btn--loading{position:relative}.btn .spinner{display:inline-block;width:1em;height:1em;border:var(--lottery-button-spinner-border, 2px solid rgba(255, 255, 255, 0.3));border-radius:50%;border-top-color:var(--lottery-button-spinner-color, white);animation:spin 1s ease-in-out infinite;margin-left:0.5em;vertical-align:middle}.btn--small .spinner{width:0.8em;height:0.8em}.btn--large .spinner{width:1.2em;height:1.2em}@keyframes spin{to{transform:rotate(360deg)}}.btn--primary{background-color:var(--emw--color-primary, #0d196e);color:var(--emw--color-typography-inverse, #fff)}.btn--primary:hover:not(:disabled){background-color:var(--emw--color-primary-variant, #1367e7)}.btn--primary:active:not(:disabled){background-color:var(--lottery-button-primary-active-bg, #08104a)}.btn--outline .spinner,.btn--dashed .spinner,.btn--text .spinner{border-top-color:currentColor;border-color:var(--lottery-button-spinner-inverse-border-color, rgba(0, 0, 0, 0.2))}.btn--outline{background-color:var(--emw--color-background, #fff);border-color:var(--lottery-button-outline-border-color, #dcdcdc);color:var(--emw--color-typography, #000)}.btn--outline:hover:not(:disabled){background-color:var(--emw--color-background-tertiary, #ccc);border-color:var(--lottery-button-outline-hover-border-color, #a6a6a6)}.btn--outline:active:not(:disabled){background-color:var(--lottery-button-outline-active-bg, #e6e6e6)}.btn--dashed{background-color:transparent;border-style:dashed;border-color:var(--lottery-button-dashed-border-color, #dcdcdc);color:var(--lottery-button-dashed-color, #333)}.btn--dashed:hover:not(:disabled){border-color:var(--lottery-button-dashed-hover-border-color, #a6a6a6);color:var(--lottery-button-dashed-hover-color, #0052d9)}.btn--text{background-color:transparent;color:var(--lottery-button-text-color, #0052d9);border-color:transparent}.btn--text:hover:not(:disabled){background-color:var(--lottery-button-text-hover-bg, #f2f2f2)}.btn--text:active:not(:disabled){background-color:var(--lottery-button-text-active-bg, #e6e6e6)}.btn--custom-color:hover:not(:disabled){opacity:var(--lottery-button-custom-hover-opacity, 0.9)}.btn--custom-color:active:not(:disabled){opacity:var(--lottery-button-custom-active-opacity, 0.8)}.btn--small{height:var(--lottery-button-small-height, 28px);font-size:var(--lottery-button-small-font-size, 12px);padding:var(--lottery-button-small-padding, 0 12px)}.btn--medium{height:var(--lottery-button-medium-height, 34px);font-size:var(--lottery-button-medium-font-size, 14px);padding:var(--lottery-button-medium-padding, 0 18px)}.btn--large{height:var(--lottery-button-large-height, 40px);font-size:var(--lottery-button-large-font-size, 16px);padding:var(--lottery-button-large-padding, 0 24px)}.ripple-container{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;border-radius:inherit}.ripple{position:absolute;border-radius:50%;background-color:var(--lottery-button-ripple-light, rgba(255, 255, 255, 0.3));transform:scale(0);animation:ripple-animation 600ms linear}.btn--outline .ripple,.btn--dashed .ripple,.btn--text .ripple{background-color:var(--lottery-button-ripple-dark, rgba(0, 0, 0, 0.03))}@keyframes ripple-animation{to{transform:scale(4);opacity:0}}";
|
|
57
|
+
const LotteryButtonStyle0 = lotteryButtonCss;
|
|
58
|
+
|
|
59
|
+
const LotteryButton = class {
|
|
60
|
+
constructor(hostRef) {
|
|
61
|
+
index.registerInstance(this, hostRef);
|
|
62
|
+
this.handleClick = (event) => {
|
|
63
|
+
if (this.disabled) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
// Get the button element from the shadow root
|
|
67
|
+
const button = this.host.shadowRoot.querySelector('.btn');
|
|
68
|
+
if (!button)
|
|
69
|
+
return;
|
|
70
|
+
const rect = button.getBoundingClientRect();
|
|
71
|
+
const size = Math.max(rect.width, rect.height);
|
|
72
|
+
const top = event.clientY - rect.top - size / 2;
|
|
73
|
+
const left = event.clientX - rect.left - size / 2;
|
|
74
|
+
// Add the new ripple to the state, triggering a re-render
|
|
75
|
+
const newRipple = { top, left, size };
|
|
76
|
+
this.ripples = [...this.ripples, newRipple];
|
|
77
|
+
// Set a timeout to clean up the ripple from the state after the animation ends
|
|
78
|
+
// This prevents the DOM from filling up with old ripple elements
|
|
79
|
+
setTimeout(() => {
|
|
80
|
+
this.ripples = this.ripples.filter((r) => r !== newRipple);
|
|
81
|
+
}, 600); // This duration should match the CSS animation duration
|
|
82
|
+
};
|
|
83
|
+
this.variant = 'primary';
|
|
84
|
+
this.size = 'medium';
|
|
85
|
+
this.color = undefined;
|
|
86
|
+
this.disabled = false;
|
|
87
|
+
this.loading = false;
|
|
88
|
+
this.text = undefined;
|
|
89
|
+
this.mbSource = undefined;
|
|
90
|
+
this.language = 'en';
|
|
91
|
+
this.clientStyling = undefined;
|
|
92
|
+
this.clientStylingUrl = undefined;
|
|
93
|
+
this.translationUrl = '';
|
|
94
|
+
this.ripples = [];
|
|
95
|
+
}
|
|
96
|
+
handleClientStylingChange(newValue, oldValue) {
|
|
97
|
+
if (newValue != oldValue) {
|
|
98
|
+
lotteryHakunaTicketHistory.setClientStyling(this.stylingContainer, this.clientStyling);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
handleClientStylingUrlChange(newValue, oldValue) {
|
|
102
|
+
if (newValue != oldValue) {
|
|
103
|
+
lotteryHakunaTicketHistory.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
handleMbSourceChange(newValue, oldValue) {
|
|
107
|
+
if (newValue != oldValue) {
|
|
108
|
+
lotteryHakunaTicketHistory.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
disconnectedCallback() {
|
|
112
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
113
|
+
}
|
|
114
|
+
componentDidLoad() {
|
|
115
|
+
if (this.stylingContainer) {
|
|
116
|
+
if (this.mbSource)
|
|
117
|
+
lotteryHakunaTicketHistory.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
|
|
118
|
+
if (this.clientStyling)
|
|
119
|
+
lotteryHakunaTicketHistory.setClientStyling(this.stylingContainer, this.clientStyling);
|
|
120
|
+
if (this.clientStylingUrl)
|
|
121
|
+
lotteryHakunaTicketHistory.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
componentWillLoad() {
|
|
125
|
+
if (this.translationUrl) {
|
|
126
|
+
resolveTranslationUrl$2(this.translationUrl);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
render() {
|
|
130
|
+
const { variant, disabled, size, color } = this;
|
|
131
|
+
const isDisabled = disabled || this.loading;
|
|
132
|
+
// Calculate styles based on variant and color
|
|
133
|
+
const buttonStyles = {};
|
|
134
|
+
if (color) {
|
|
135
|
+
switch (variant) {
|
|
136
|
+
case 'primary':
|
|
137
|
+
Object.assign(buttonStyles, {
|
|
138
|
+
backgroundColor: color,
|
|
139
|
+
borderColor: color
|
|
140
|
+
});
|
|
141
|
+
break;
|
|
142
|
+
case 'outline':
|
|
143
|
+
case 'dashed':
|
|
144
|
+
Object.assign(buttonStyles, {
|
|
145
|
+
color: color,
|
|
146
|
+
borderColor: color
|
|
147
|
+
});
|
|
148
|
+
break;
|
|
149
|
+
case 'text':
|
|
150
|
+
Object.assign(buttonStyles, {
|
|
151
|
+
color: color
|
|
152
|
+
});
|
|
153
|
+
break;
|
|
154
|
+
default:
|
|
155
|
+
Object.assign(buttonStyles, {
|
|
156
|
+
backgroundColor: color,
|
|
157
|
+
borderColor: color
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return (index.h("button", { key: 'aa74ad98c90e7548228557bf8a8d26b125d4a83a', class: {
|
|
162
|
+
btn: true,
|
|
163
|
+
[`btn--${variant}`]: true,
|
|
164
|
+
[`btn--${size}`]: true,
|
|
165
|
+
'btn--loading': this.loading
|
|
166
|
+
}, 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$3('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: {
|
|
167
|
+
top: `${ripple.top}px`,
|
|
168
|
+
left: `${ripple.left}px`,
|
|
169
|
+
width: `${ripple.size}px`,
|
|
170
|
+
height: `${ripple.size}px`
|
|
171
|
+
} }))))));
|
|
172
|
+
}
|
|
173
|
+
get host() { return index.getElement(this); }
|
|
174
|
+
static get watchers() { return {
|
|
175
|
+
"clientStyling": ["handleClientStylingChange"],
|
|
176
|
+
"clientStylingUrl": ["handleClientStylingUrlChange"],
|
|
177
|
+
"mbSource": ["handleMbSourceChange"]
|
|
178
|
+
}; }
|
|
179
|
+
};
|
|
180
|
+
LotteryButton.style = LotteryButtonStyle0;
|
|
181
|
+
|
|
182
|
+
const DEFAULT_LANGUAGE$2 = 'en';
|
|
183
|
+
const SUPPORTED_LANGUAGES$2 = ['ro', 'en', 'fr', 'ar', 'hr'];
|
|
184
|
+
const TRANSLATIONS$2 = {
|
|
185
|
+
en: {
|
|
186
|
+
total: 'Total:',
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
const translate$2 = (key, customLang, replacements) => {
|
|
190
|
+
const lang = customLang;
|
|
191
|
+
let translation = TRANSLATIONS$2[lang !== undefined && SUPPORTED_LANGUAGES$2.includes(lang) ? lang : DEFAULT_LANGUAGE$2][key];
|
|
192
|
+
if (replacements) {
|
|
193
|
+
Object.keys(replacements).forEach((placeholder) => {
|
|
194
|
+
translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
return translation;
|
|
198
|
+
};
|
|
199
|
+
const getTranslations$2 = (data) => {
|
|
200
|
+
Object.keys(data).forEach((item) => {
|
|
201
|
+
for (let key in data[item]) {
|
|
202
|
+
TRANSLATIONS$2[item][key] = data[item][key];
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
const resolveTranslationUrl$1 = async (translationUrl) => {
|
|
207
|
+
if (translationUrl) {
|
|
208
|
+
try {
|
|
209
|
+
const response = await fetch(translationUrl);
|
|
210
|
+
if (!response.ok) {
|
|
211
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
212
|
+
}
|
|
213
|
+
const translations = await response.json();
|
|
214
|
+
getTranslations$2(translations);
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
console.error('Failed to fetch or parse translations from URL:', error);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
const lotteryHakunaTicketHistoryItemCss = ".lottery-hakuna-ticket-history-item__container{display:flex;padding:var(--lottery-hakuna-ticket-history-item-container-padding, 20px);flex-direction:column;justify-content:center;gap:var(--lottery-hakuna-ticket-history-item-container-gap, 16px);border-radius:var(--lottery-hakuna-ticket-history-item-container-border-radius, 12px);border:1px solid transparent;min-width:var(--lottery-hakuna-ticket-history-item-container-min-width, 200px);background-origin:border-box;background-clip:padding-box, border-box;background-image:linear-gradient(var(--emw-hakuna-bg-secondary, #120505), var(--emw-hakuna-bg-secondary, #120505)), linear-gradient(to top left, var(--emw-hakuna-color-primary, #c52217) var(--lottery-hakuna-ticket-history-item-border-gradient-start-stop, 22%), var(--emw-hakuna-bg-primary, #2c2525) var(--lottery-hakuna-ticket-history-item-border-gradient-end-stop, 68%))}.lottery-hakuna-ticket-history-item__top{display:flex;justify-content:space-between;align-items:center}.lottery-hakuna-ticket-history-item__country-wrapper{display:flex;align-items:center;gap:10px}.lottery-hakuna-ticket-history-item__country-flag{width:var(--lottery-hakuna-ticket-history-item-country-flag-width, 30px);object-fit:cover;aspect-ratio:var(--lottery-hakuna-ticket-history-item-country-flag-aspect-ratio, 3/2)}.lottery-hakuna-ticket-history-item__country-name{color:var(--lottery-hakuna-ticket-history-item-country-name-color, #fff);font-size:var(--lottery-hakuna-ticket-history-item-country-name-font-size, 14px);font-style:normal;font-weight:var(--lottery-hakuna-ticket-history-item-country-name-font-weight, 700);line-height:var(--lottery-hakuna-ticket-history-item-country-name-line-height, normal)}.lottery-hakuna-ticket-history-item__details{display:flex;gap:var(--lottery-hakuna-ticket-history-item-details-gap, 13px);color:var(--emw-hakuna-text-secondary, #b4a5a5);font-size:var(--lottery-hakuna-ticket-history-item-details-font-size, 10px);font-style:normal;font-weight:var(--lottery-hakuna-ticket-history-item-details-font-weight, 700);line-height:var(--lottery-hakuna-ticket-history-item-details-line-height, normal)}.lottery-hakuna-ticket-history-item__meta{display:flex;gap:var(--lottery-hakuna-ticket-history-item-meta-gap, 10px)}.lottery-hakuna-ticket-history-item__meta-value{color:var(--lottery-hakuna-ticket-history-item-meta-value-color, inherit)}.lottery-hakuna-ticket-history-item__bottom{display:flex;justify-content:space-between;align-items:center;align-self:stretch}.lottery-hakuna-ticket-history-item__numbers-wrapper{flex:1;display:flex;align-items:flex-start;gap:var(--lottery-hakuna-ticket-history-item-numbers-wrapper-gap, 8px);box-shadow:var(--lottery-hakuna-ticket-history-item-numbers-wrapper-box-shadow, 0 1px 2px 0 rgba(0, 0, 0, 0.25))}.lottery-hakuna-ticket-history-item__date-wrapper{color:var(--lottery-hakuna-ticket-history-item-date-wrapper-color, #fffefe);text-align:var(--lottery-hakuna-ticket-history-item-date-wrapper-text-align, right);font-size:var(--lottery-hakuna-ticket-history-item-date-wrapper-font-size, 8px);font-style:normal;font-weight:var(--lottery-hakuna-ticket-history-item-date-wrapper-font-weight, 400);line-height:var(--lottery-hakuna-ticket-history-item-date-wrapper-line-height, 125%);min-width:var(--lottery-hakuna-ticket-history-item-date-wrapper-min-width, 70px);max-width:var(--lottery-hakuna-ticket-history-item-date-wrapper-max-width, 100px)}lottery-selection-group{width:100%}ui-skeleton{--emw-skeleton-primary-color:#414141;--emw-skeleton-secondary-color:#2f2929}";
|
|
223
|
+
const LotteryHakunaTicketHistoryItemStyle0 = lotteryHakunaTicketHistoryItemCss;
|
|
224
|
+
|
|
225
|
+
const LotteryHakunaTicketHistoryItem = class {
|
|
226
|
+
constructor(hostRef) {
|
|
227
|
+
index.registerInstance(this, hostRef);
|
|
228
|
+
this.selectionGroupStyle = `
|
|
229
|
+
:host{
|
|
230
|
+
--lottery-selection-width: 24px;
|
|
231
|
+
--lottery-selection-height: 24px;
|
|
232
|
+
--lottery-selection-padding: 10px;
|
|
233
|
+
--lottery-selection-border-radius: 6px;
|
|
234
|
+
--lottery-selection-border-width: 1px;
|
|
235
|
+
--lottery-selection-border-color: var(--emw-hakuna-color-primary, #c52217);
|
|
236
|
+
|
|
237
|
+
--lottery-selection-color: var(--emw-hakuna-text-primary, #ffffff);
|
|
238
|
+
--lottery-selection-font-size: 14px;
|
|
239
|
+
--lottery-selection-font-weight: 500;
|
|
240
|
+
|
|
241
|
+
--lottery-selection-hover-background: transparent;
|
|
242
|
+
--lottery-selection-hover-border-color: var(--emw-hakuna-color-primary, #c52217);
|
|
243
|
+
--lottery-selection-hover-color: var(--emw-hakuna-text-primary, #ffffff);
|
|
244
|
+
|
|
245
|
+
.lottery-selection__button{
|
|
246
|
+
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.15);
|
|
247
|
+
line-height: normal;
|
|
248
|
+
}
|
|
249
|
+
.lottery-selection__button:hover{
|
|
250
|
+
cursor: default;
|
|
251
|
+
}
|
|
252
|
+
--lottery-selection-group-item-gap:6px;
|
|
253
|
+
}
|
|
254
|
+
`;
|
|
255
|
+
this.renderSkeleton = () => {
|
|
256
|
+
return (index.h("div", { class: "lottery-hakuna-ticket-history-item__container" }, index.h("div", { class: "lottery-hakuna-ticket-history-item__top" }, index.h("div", { class: "lottery-hakuna-ticket-history-item__country-wrapper" }, index.h("ui-skeleton", { structure: "image", width: "30px", height: "20px" }), index.h("ui-skeleton", { structure: "title", width: "86px", height: "17px", marginBottom: 0 })), index.h("div", { class: "lottery-hakuna-ticket-history-item__details" }, index.h("ui-skeleton", { structure: "text", width: "60%", height: "20px" }))), index.h("div", { class: "lottery-hakuna-ticket-history-item__bottom" }, index.h("div", { class: "lottery-hakuna-ticket-history-item__numbers-wrapper" }, new Array(this.selectedNumbersCount).fill(index.h("ui-skeleton", { borderRadius: "8px", structure: "rectangle", width: "24px", height: "24px" }))), index.h("div", { class: "lottery-hakuna-ticket-history-item__date-wrapper" }, index.h("ui-skeleton", { structure: "text", width: "180px", height: "14px" })))));
|
|
257
|
+
};
|
|
258
|
+
this.renderMain = () => {
|
|
259
|
+
return (index.h("div", { class: "lottery-hakuna-ticket-history-item__container" }, index.h("div", { class: "lottery-hakuna-ticket-history-item__top" }, index.h("div", { class: "lottery-hakuna-ticket-history-item__country-wrapper" }, this.historyItemImageSrc && (index.h("img", { src: this.historyItemImageSrc, alt: this.historyItemName, class: "lottery-hakuna-ticket-history-item__country-flag" })), index.h("span", { class: "lottery-hakuna-ticket-history-item__country-name" }, this.historyItemName)), index.h("div", { class: "lottery-hakuna-ticket-history-item__details" }, index.h("span", { class: "lottery-hakuna-ticket-history-item__meta" }, translate$2('total', this.language), index.h("span", { class: "lottery-hakuna-ticket-history-item__meta-value" }, this.totalAmount)))), index.h("div", { class: "lottery-hakuna-ticket-history-item__bottom" }, index.h("div", { class: "lottery-hakuna-ticket-history-item__numbers-wrapper" }, this.selectedNumbers && (index.h("lottery-selection-group", { type: "preview", bulletTexts: this.selectedNumbers, clientStyling: this.selectionGroupStyle + (this.clientStyling || ''), clientStylingUrl: this.clientStylingUrl, mbSource: this.mbSource, hasBorder: true, hasBackground: false, selectionGroupId: this.ticketId ? this.ticketId.toString() : undefined }))), index.h("div", { class: "lottery-hakuna-ticket-history-item__date-wrapper" }, this.date && index.h("div", null, this.date), this.time && index.h("div", null, this.time)))));
|
|
260
|
+
};
|
|
261
|
+
this.mbSource = undefined;
|
|
262
|
+
this.clientStyling = undefined;
|
|
263
|
+
this.clientStylingUrl = undefined;
|
|
264
|
+
this.language = 'en';
|
|
265
|
+
this.translationUrl = '';
|
|
266
|
+
this.historyItemName = undefined;
|
|
267
|
+
this.historyItemImageSrc = undefined;
|
|
268
|
+
this.ticketId = undefined;
|
|
269
|
+
this.totalAmount = undefined;
|
|
270
|
+
this.date = undefined;
|
|
271
|
+
this.time = undefined;
|
|
272
|
+
this.selectedNumbers = undefined;
|
|
273
|
+
this.showSkeleton = false;
|
|
274
|
+
this.selectedNumbersCount = 6;
|
|
275
|
+
}
|
|
276
|
+
handleClientStylingChange(newValue, oldValue) {
|
|
277
|
+
if (newValue != oldValue) {
|
|
278
|
+
lotteryHakunaTicketHistory.setClientStyling(this.stylingContainer, this.clientStyling);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
handleClientStylingUrlChange(newValue, oldValue) {
|
|
282
|
+
if (newValue != oldValue) {
|
|
283
|
+
lotteryHakunaTicketHistory.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
handleMbSourceChange(newValue, oldValue) {
|
|
287
|
+
if (newValue != oldValue) {
|
|
288
|
+
lotteryHakunaTicketHistory.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
async componentWillLoad() {
|
|
292
|
+
resolveTranslationUrl$1(this.translationUrl);
|
|
293
|
+
}
|
|
294
|
+
componentDidLoad() {
|
|
295
|
+
if (this.stylingContainer) {
|
|
296
|
+
if (this.mbSource)
|
|
297
|
+
lotteryHakunaTicketHistory.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
|
|
298
|
+
if (this.clientStyling)
|
|
299
|
+
lotteryHakunaTicketHistory.setClientStyling(this.stylingContainer, this.clientStyling);
|
|
300
|
+
if (this.clientStylingUrl)
|
|
301
|
+
lotteryHakunaTicketHistory.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
disconnectedCallback() {
|
|
305
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
306
|
+
}
|
|
307
|
+
render() {
|
|
308
|
+
return (index.h("div", { key: 'd22e301e9824aa3539e0c11ed52a1bddc5e1fb9c', ref: (el) => (this.stylingContainer = el), class: "lottery-hakuna-ticket-history-item__container-wrapper" }, this.showSkeleton ? this.renderSkeleton() : this.renderMain()));
|
|
309
|
+
}
|
|
310
|
+
static get watchers() { return {
|
|
311
|
+
"clientStyling": ["handleClientStylingChange"],
|
|
312
|
+
"clientStylingUrl": ["handleClientStylingUrlChange"],
|
|
313
|
+
"mbSource": ["handleMbSourceChange"]
|
|
314
|
+
}; }
|
|
315
|
+
};
|
|
316
|
+
LotteryHakunaTicketHistoryItem.style = LotteryHakunaTicketHistoryItemStyle0;
|
|
317
|
+
|
|
318
|
+
const lotteryInfiniteScrollCss = ":host{display:block;width:100%}.lottery-infinite-scroll__container{display:block;width:100%;overflow-x:hidden;-webkit-overflow-scrolling:touch;padding-right:10px;box-sizing:border-box;scrollbar-width:thin;scrollbar-color:var(--emw-hakuna-bg-secondary, #120505) var(--lottery-infinite-scroll-scrollbar-track-background, transparent);}.lottery-infinite-scroll__container::-webkit-scrollbar{width:var(--lottery-infinite-scroll-scrollbar-width, 2px)}.lottery-infinite-scroll__container::-webkit-scrollbar-track{background:var(--lottery-infinite-scroll-scrollbar-track-background, transparent)}.lottery-infinite-scroll__container::-webkit-scrollbar-thumb{background:var(--emw-hakuna-bg-secondary, #120505);border-radius:var(--lottery-infinite-scroll-scrollbar-thumb-border-radius, 2px)}.lottery-infinite-scroll__sentinel{width:100%;display:block;text-align:center;}.lottery-infinite-scroll__sentinel.virtual-scroll-sentinel{height:1px;pointer-events:none;opacity:0;position:absolute;width:100%}.lottery-infinite-scroll__sentinel:not(.virtual-scroll-sentinel){height:1px;}.lottery-infinite-scroll__end-message{width:100%;display:block;text-align:center;}.lottery-infinite-scroll__end-message.virtual-scroll-end-message{position:absolute;width:100%}.ptr-indicator{height:var(--pull-trigger-distance, 60px);margin-top:calc(-1 * var(--pull-trigger-distance, 60px));display:flex;align-items:center;justify-content:center;position:absolute;top:0;width:100%;z-index:10;font-size:14px;color:#666;}";
|
|
319
|
+
const LotteryInfiniteScrollStyle0 = lotteryInfiniteScrollCss;
|
|
320
|
+
|
|
321
|
+
const LotteryInfiniteScroll = class {
|
|
322
|
+
constructor(hostRef) {
|
|
323
|
+
index.registerInstance(this, hostRef);
|
|
324
|
+
this.loadMore = index.createEvent(this, "loadMore", 7);
|
|
325
|
+
this.refresh = index.createEvent(this, "refresh", 7);
|
|
326
|
+
/** Y-coordinate of the touch start event. */
|
|
327
|
+
this.startY = 0;
|
|
328
|
+
/** Indicates if a touch event is currently active for pull-to-refresh. */
|
|
329
|
+
this.isTouching = false;
|
|
330
|
+
// --- Virtual Scroll Core Logic ---
|
|
331
|
+
this.onScroll = () => {
|
|
332
|
+
if (this.enableVirtualScroll) {
|
|
333
|
+
if (this.rafId)
|
|
334
|
+
cancelAnimationFrame(this.rafId);
|
|
335
|
+
this.rafId = requestAnimationFrame(() => this.calculateVisibleRange());
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
// --- Pull to Refresh Logic (Touch handling) ---
|
|
339
|
+
this.handleTouchStart = (e) => {
|
|
340
|
+
// Only allow pull-down when scrollbar is at the top
|
|
341
|
+
if (this.scrollContainer.scrollTop <= 0) {
|
|
342
|
+
this.startY = e.touches[0].clientY;
|
|
343
|
+
this.isTouching = true;
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
this.handleTouchMove = (e) => {
|
|
347
|
+
if (!this.isTouching || this.isRefreshing)
|
|
348
|
+
return;
|
|
349
|
+
const currentY = e.touches[0].clientY;
|
|
350
|
+
const distance = currentY - this.startY;
|
|
351
|
+
// Only process pull-down and when scrollbar is at the top
|
|
352
|
+
if (distance > 0 && this.scrollContainer.scrollTop <= 0) {
|
|
353
|
+
// Prevent default scroll behavior (prevents entire page from being dragged)
|
|
354
|
+
if (e.cancelable)
|
|
355
|
+
e.preventDefault();
|
|
356
|
+
// Add damping effect (harder to pull further)
|
|
357
|
+
this.pullDistance = Math.pow(distance, 0.8);
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
// If user pushes up, or already scrolled, reset
|
|
361
|
+
this.isTouching = false;
|
|
362
|
+
this.pullDistance = 0;
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
this.handleTouchEnd = () => {
|
|
366
|
+
this.isTouching = false;
|
|
367
|
+
if (this.pullDistance >= this.pullTriggerDistance) {
|
|
368
|
+
// Trigger refresh
|
|
369
|
+
this.pullDistance = this.pullTriggerDistance; // Stay in loading area
|
|
370
|
+
this.refresh.emit();
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
// Not reached threshold, bounce back
|
|
374
|
+
this.pullDistance = 0;
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
this.items = [];
|
|
378
|
+
this.hasMore = false;
|
|
379
|
+
this.isLoading = false;
|
|
380
|
+
this.isRefreshing = false;
|
|
381
|
+
this.threshold = '0px 0px 200px 0px';
|
|
382
|
+
this.estimatedItemHeight = 200;
|
|
383
|
+
this.containerHeight = '100%';
|
|
384
|
+
this.enableVirtualScroll = false;
|
|
385
|
+
this.renderItem = undefined;
|
|
386
|
+
this.renderSkeleton = undefined;
|
|
387
|
+
this.skeletonCount = 6;
|
|
388
|
+
this.pullTriggerDistance = 60;
|
|
389
|
+
this.minItemWidth = 340;
|
|
390
|
+
this.gridGap = 10;
|
|
391
|
+
this.visibleStartIndex = 0;
|
|
392
|
+
this.visibleEndIndex = 10;
|
|
393
|
+
this.pullDistance = 0;
|
|
394
|
+
this.columns = 1;
|
|
395
|
+
}
|
|
396
|
+
componentDidLoad() {
|
|
397
|
+
if (this.enableVirtualScroll) {
|
|
398
|
+
// Listen for container size changes, recalculate columns
|
|
399
|
+
this.initResizeObserver();
|
|
400
|
+
// Initial calculation
|
|
401
|
+
this.calculateMetrics();
|
|
402
|
+
}
|
|
403
|
+
// Initialize observer on component load
|
|
404
|
+
this.initObserver();
|
|
405
|
+
}
|
|
406
|
+
componentDidUpdate() {
|
|
407
|
+
if (this.hasMore && !this.isLoading) {
|
|
408
|
+
this.initObserver();
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
disconnectedCallback() {
|
|
412
|
+
this.disconnectObserver();
|
|
413
|
+
if (this.resizeObserver)
|
|
414
|
+
this.resizeObserver.disconnect();
|
|
415
|
+
if (this.rafId)
|
|
416
|
+
cancelAnimationFrame(this.rafId);
|
|
417
|
+
}
|
|
418
|
+
initResizeObserver() {
|
|
419
|
+
if (!window.ResizeObserver || !this.scrollContainer)
|
|
420
|
+
return;
|
|
421
|
+
this.resizeObserver = new ResizeObserver((entries) => {
|
|
422
|
+
for (let entry of entries) {
|
|
423
|
+
// When width changes, recalculate the number of columns
|
|
424
|
+
const width = entry.contentRect.width;
|
|
425
|
+
this.recalcColumns(width);
|
|
426
|
+
this.calculateVisibleRange();
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
this.resizeObserver.observe(this.scrollContainer);
|
|
430
|
+
}
|
|
431
|
+
recalcColumns(containerWidth) {
|
|
432
|
+
if (!this.enableVirtualScroll)
|
|
433
|
+
return;
|
|
434
|
+
// Calculation logic must be consistent with CSS grid-template-columns: repeat(auto-fill, ...)
|
|
435
|
+
// Considering the gap
|
|
436
|
+
const effectiveWidth = containerWidth + this.gridGap;
|
|
437
|
+
const itemOccupancy = this.minItemWidth + this.gridGap;
|
|
438
|
+
// At least 1 column
|
|
439
|
+
const newColumns = Math.max(1, Math.floor(effectiveWidth / itemOccupancy));
|
|
440
|
+
if (this.columns !== newColumns) {
|
|
441
|
+
this.columns = newColumns;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
// --- Watchers ---
|
|
445
|
+
handleItemsChange() {
|
|
446
|
+
if (this.enableVirtualScroll) {
|
|
447
|
+
this.calculateVisibleRange();
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
handleRefreshingChange(newValue) {
|
|
451
|
+
if (!newValue) {
|
|
452
|
+
this.pullDistance = 0;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
// --- Observer Logic ---
|
|
456
|
+
disconnectObserver() {
|
|
457
|
+
if (this.observer) {
|
|
458
|
+
this.observer.disconnect();
|
|
459
|
+
this.observer = null;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
initObserver() {
|
|
463
|
+
this.disconnectObserver();
|
|
464
|
+
if (!this.hasMore || this.isLoading || !this.sentinel)
|
|
465
|
+
return;
|
|
466
|
+
const options = {
|
|
467
|
+
root: this.scrollContainer === this.el.shadowRoot.querySelector('.lottery-infinite-scroll__container')
|
|
468
|
+
? this.scrollContainer
|
|
469
|
+
: null,
|
|
470
|
+
rootMargin: this.threshold,
|
|
471
|
+
threshold: 0.1
|
|
472
|
+
};
|
|
473
|
+
this.observer = new IntersectionObserver((entries) => {
|
|
474
|
+
// When scrolled to bottom and not currently loading
|
|
475
|
+
if (entries[0].isIntersecting && this.hasMore && !this.isLoading) {
|
|
476
|
+
this.loadMore.emit();
|
|
477
|
+
}
|
|
478
|
+
}, options);
|
|
479
|
+
this.observer.observe(this.sentinel);
|
|
480
|
+
}
|
|
481
|
+
calculateMetrics() {
|
|
482
|
+
if (!this.scrollContainer)
|
|
483
|
+
return;
|
|
484
|
+
this.recalcColumns(this.scrollContainer.clientWidth);
|
|
485
|
+
this.calculateVisibleRange();
|
|
486
|
+
}
|
|
487
|
+
calculateVisibleRange() {
|
|
488
|
+
if (!this.scrollContainer || !this.enableVirtualScroll)
|
|
489
|
+
return;
|
|
490
|
+
const scrollTop = this.scrollContainer.scrollTop;
|
|
491
|
+
const viewportHeight = this.scrollContainer.clientHeight;
|
|
492
|
+
// 1. Calculate the current "Row" index
|
|
493
|
+
// We assume each row has a height of estimatedItemHeight (although it may differ in reality, this is sufficient for visible window calculation)
|
|
494
|
+
const startRow = Math.floor(scrollTop / this.estimatedItemHeight);
|
|
495
|
+
// 2. Buffer row count
|
|
496
|
+
const bufferRows = 3;
|
|
497
|
+
// 3. Calculate visible rows
|
|
498
|
+
const visibleRows = Math.ceil(viewportHeight / this.estimatedItemHeight);
|
|
499
|
+
// 4. Calculate start and end rows for rendering
|
|
500
|
+
const renderStartRow = Math.max(0, startRow - bufferRows);
|
|
501
|
+
const renderEndRow = startRow + visibleRows + bufferRows;
|
|
502
|
+
// 5. Convert to Item indices (Row * Columns)
|
|
503
|
+
const startIndex = renderStartRow * this.columns;
|
|
504
|
+
const endIndex = Math.min(this.items.length, renderEndRow * this.columns);
|
|
505
|
+
if (this.visibleStartIndex !== startIndex || this.visibleEndIndex !== endIndex) {
|
|
506
|
+
this.visibleStartIndex = startIndex;
|
|
507
|
+
this.visibleEndIndex = endIndex;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
render() {
|
|
511
|
+
const { items, visibleStartIndex, visibleEndIndex, estimatedItemHeight, columns, gridGap, minItemWidth } = this;
|
|
512
|
+
// Check if we should show skeleton: items are empty, loading is true, and renderSkeleton is provided
|
|
513
|
+
const showSkeleton = items.length === 0 && !!this.renderSkeleton && this.isLoading;
|
|
514
|
+
// Virtual Scroll Calculations for Spacer
|
|
515
|
+
let paddingTop = 0;
|
|
516
|
+
let paddingBottom = 0;
|
|
517
|
+
let visibleItems = [];
|
|
518
|
+
if (this.enableVirtualScroll && !showSkeleton) {
|
|
519
|
+
const totalRows = Math.ceil(items.length / columns);
|
|
520
|
+
const startRow = Math.floor(visibleStartIndex / columns);
|
|
521
|
+
// Note: Here we calculate how many rows are actually rendered based on the number of slices, for calculating bottom padding.
|
|
522
|
+
const renderedCount = visibleEndIndex - visibleStartIndex;
|
|
523
|
+
const renderedRows = Math.ceil(renderedCount / columns);
|
|
524
|
+
// Top Spacer: Number of rows hidden at the top * Estimated height
|
|
525
|
+
paddingTop = startRow * estimatedItemHeight;
|
|
526
|
+
// Bottom Spacer: Total rows - (Top rows + Rendered rows) * Estimated height
|
|
527
|
+
// Ensure the total scroll height is roughly correct
|
|
528
|
+
paddingBottom = Math.max(0, (totalRows - startRow - renderedRows) * estimatedItemHeight);
|
|
529
|
+
visibleItems = items.slice(visibleStartIndex, visibleEndIndex);
|
|
530
|
+
}
|
|
531
|
+
else {
|
|
532
|
+
visibleItems = showSkeleton ? new Array(this.skeletonCount).fill(null) : items;
|
|
533
|
+
}
|
|
534
|
+
// Styles
|
|
535
|
+
const contentTransform = {
|
|
536
|
+
transform: `translateY(${this.pullDistance}px)`,
|
|
537
|
+
transition: this.isTouching ? 'none' : 'transform 0.3s ease-out'
|
|
538
|
+
};
|
|
539
|
+
// Grid Layout Style
|
|
540
|
+
const listStyle = {
|
|
541
|
+
display: 'grid',
|
|
542
|
+
// Responsive column width
|
|
543
|
+
gridTemplateColumns: `repeat(auto-fill, minmax(${minItemWidth}px, 1fr))`,
|
|
544
|
+
gap: `${gridGap}px`,
|
|
545
|
+
// Even with Flex/Grid, we don't need absolute positioning, use margin/padding for spacing
|
|
546
|
+
paddingTop: `${paddingTop}px`,
|
|
547
|
+
paddingBottom: `${paddingBottom}px`,
|
|
548
|
+
boxSizing: 'border-box'
|
|
549
|
+
};
|
|
550
|
+
return (index.h("div", { key: '366232c373082c1a825da935fd02039c3cef5653', class: "lottery-infinite-scroll__container", style: {
|
|
551
|
+
height: this.containerHeight,
|
|
552
|
+
overflowY: 'auto',
|
|
553
|
+
position: 'relative',
|
|
554
|
+
contain: 'strict' // Performance optimization
|
|
555
|
+
}, ref: (el) => (this.scrollContainer = el), onScroll: this.onScroll, onTouchStart: this.handleTouchStart, onTouchMove: this.handleTouchMove, onTouchEnd: this.handleTouchEnd }, index.h("div", { key: '1dbe68c185299f989101ad2489319ebab82c44da', class: "ptr-indicator", style: Object.assign(Object.assign({}, contentTransform), { position: 'absolute', top: '0', left: '0', width: '100%', height: `${this.pullTriggerDistance}px`, display: 'flex', alignItems: 'center', justifyContent: 'center', marginTop: `-${this.pullTriggerDistance}px`, pointerEvents: 'none' }) }, this.isRefreshing ? (index.h("slot", { name: "refresh-loading" }, "Refreshing...")) : (index.h("slot", { name: "pull-hint" }, this.pullDistance > this.pullTriggerDistance ? 'Release' : 'Pull'))), index.h("div", { key: 'd058018d407dd0e003571e0c1259f837deb093be', class: "scroll-content-wrapper", style: contentTransform }, index.h("div", { key: '1041eb5548bc79c2a507477013e3e34f35e25c22', class: "list-content", style: listStyle }, visibleItems.map((item, i) => {
|
|
556
|
+
/* Pass the real index to renderItem */
|
|
557
|
+
const realIndex = this.enableVirtualScroll && !showSkeleton ? visibleStartIndex + i : i;
|
|
558
|
+
return (index.h("div", { key: realIndex, class: "list-item-wrapper" }, showSkeleton
|
|
559
|
+
? this.renderSkeleton
|
|
560
|
+
? this.renderSkeleton(realIndex)
|
|
561
|
+
: null
|
|
562
|
+
: this.renderItem
|
|
563
|
+
? this.renderItem(item, realIndex)
|
|
564
|
+
: null));
|
|
565
|
+
})), (this.hasMore || (this.isLoading && !showSkeleton)) && (index.h("div", { key: '0af2a85096fc16e9071ec0363a4eb58753324247', class: "lottery-infinite-scroll__sentinel", ref: (el) => (this.sentinel = el), style: { height: '20px', display: 'flex', justifyContent: 'center' } }, this.isLoading ? index.h("slot", { name: "loading-more" }, "Loading...") : null)), !this.hasMore && !this.isLoading && items.length > 0 && (index.h("div", { key: 'e6e814a96727e2442137412c25ec09908b2f9015', class: "end-message", style: { textAlign: 'center', padding: '10px' } }, index.h("slot", { key: '02831150b863992dabd59ab01f7bbb23066877bf', name: "end-message" }, "No more data"))))));
|
|
566
|
+
}
|
|
567
|
+
get el() { return index.getElement(this); }
|
|
568
|
+
static get watchers() { return {
|
|
569
|
+
"items": ["handleItemsChange"],
|
|
570
|
+
"isRefreshing": ["handleRefreshingChange"]
|
|
571
|
+
}; }
|
|
572
|
+
};
|
|
573
|
+
LotteryInfiniteScroll.style = LotteryInfiniteScrollStyle0;
|
|
574
|
+
|
|
575
|
+
// Basic sanitization method for SVG content
|
|
576
|
+
// This is NOT a complete XSS prevention for SVG, but prevents common attacks.
|
|
577
|
+
function sanitizeSvg(svgString) {
|
|
578
|
+
let sanitized = svgString.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, ''); // Remove <script> tags
|
|
579
|
+
sanitized = sanitized.replace(/on[a-z]+=[\"'][^\"']*[\"']/gi, ''); // Remove on* attributes
|
|
580
|
+
sanitized = sanitized.replace(/javascript:/gi, ''); // Remove javascript: URLs
|
|
581
|
+
return sanitized;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
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}";
|
|
585
|
+
const LotterySelectionStyle0 = lotterySelectionCss;
|
|
586
|
+
|
|
587
|
+
const LotterySelection = class {
|
|
588
|
+
constructor(hostRef) {
|
|
589
|
+
index.registerInstance(this, hostRef);
|
|
590
|
+
this.lotteryBulletClickHandler = index.createEvent(this, "lotteryBulletClick", 7);
|
|
591
|
+
this.value = 0;
|
|
592
|
+
this.text = undefined;
|
|
593
|
+
this.idx = undefined;
|
|
594
|
+
this.type = 'toggle';
|
|
595
|
+
this.mbSource = undefined;
|
|
596
|
+
this.clientStyling = undefined;
|
|
597
|
+
this.clientStylingUrl = undefined;
|
|
598
|
+
this.hasBorder = true;
|
|
599
|
+
this.hasBackground = true;
|
|
600
|
+
this.deleteIconSvg = '';
|
|
601
|
+
this.deleteIconWidth = '16px';
|
|
602
|
+
this.deleteIconHeight = '16px';
|
|
603
|
+
}
|
|
604
|
+
handleClientStylingChange(newValue, oldValue) {
|
|
605
|
+
if (newValue !== oldValue) {
|
|
606
|
+
lotteryHakunaTicketHistory.setClientStyling(this.stylingContainer, this.clientStyling);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
handleClientStylingUrlChange(newValue, oldValue) {
|
|
610
|
+
if (newValue !== oldValue) {
|
|
611
|
+
lotteryHakunaTicketHistory.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
handleMbSourceChange(newValue, oldValue) {
|
|
615
|
+
if (newValue !== oldValue) {
|
|
616
|
+
lotteryHakunaTicketHistory.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
componentDidLoad() {
|
|
620
|
+
if (this.stylingContainer) {
|
|
621
|
+
if (this.mbSource)
|
|
622
|
+
lotteryHakunaTicketHistory.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
|
|
623
|
+
if (this.clientStyling)
|
|
624
|
+
lotteryHakunaTicketHistory.setClientStyling(this.stylingContainer, this.clientStyling);
|
|
625
|
+
if (this.clientStylingUrl)
|
|
626
|
+
lotteryHakunaTicketHistory.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
disconnectedCallback() {
|
|
630
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
631
|
+
}
|
|
632
|
+
handleClick() {
|
|
633
|
+
if (this.type === 'disabled' || this.type === 'readonly') {
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
console.log('bullet clicked', this.type, this.idx, this.text, this.value);
|
|
637
|
+
this.lotteryBulletClickHandler.emit({
|
|
638
|
+
type: this.type,
|
|
639
|
+
idx: this.idx,
|
|
640
|
+
text: this.text,
|
|
641
|
+
value: this.value
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
render() {
|
|
645
|
+
let iconToRender;
|
|
646
|
+
if (this.deleteIconSvg) {
|
|
647
|
+
iconToRender = sanitizeSvg(this.deleteIconSvg);
|
|
648
|
+
}
|
|
649
|
+
else {
|
|
650
|
+
iconToRender = lotteryHakunaTicketHistory.renderIconDefinitionToSVGElement(DeleteFilled$1, {
|
|
651
|
+
extraSVGAttrs: {
|
|
652
|
+
width: this.deleteIconWidth,
|
|
653
|
+
height: this.deleteIconHeight,
|
|
654
|
+
fill: 'currentColor'
|
|
655
|
+
}
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
return (index.h("div", { key: '0d1e8aaa80a907a7467410f6b27b4b6175e82299', class: "lottery-selection", ref: (el) => (this.stylingContainer = el) }, index.h("button", { key: '11a2402abbc290dc877ad95f3433092c3a0d8419', class: {
|
|
659
|
+
'lottery-selection__button': true,
|
|
660
|
+
'lottery-selection__button--selected': this.value == 1,
|
|
661
|
+
'lottery-selection__button--disabled': this.type === 'disabled',
|
|
662
|
+
'lottery-selection__button--no-border': !this.hasBorder,
|
|
663
|
+
'lottery-selection__button--no-background': !this.hasBackground,
|
|
664
|
+
isDeleteByIcon: this.type === 'delete',
|
|
665
|
+
isCallDialogBtn: this.type === 'input' || this.type === 'readonly'
|
|
666
|
+
}, 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))));
|
|
667
|
+
}
|
|
668
|
+
static get watchers() { return {
|
|
669
|
+
"clientStyling": ["handleClientStylingChange"],
|
|
670
|
+
"clientStylingUrl": ["handleClientStylingUrlChange"],
|
|
671
|
+
"mbSource": ["handleMbSourceChange"]
|
|
672
|
+
}; }
|
|
673
|
+
};
|
|
674
|
+
LotterySelection.style = LotterySelectionStyle0;
|
|
675
|
+
|
|
676
|
+
const DEFAULT_LANGUAGE$1 = 'en';
|
|
677
|
+
const SUPPORTED_LANGUAGES$1 = ['ro', 'en', 'fr', 'ar', 'hr', 'zh'];
|
|
678
|
+
const TRANSLATIONS$1 = {
|
|
679
|
+
en: {
|
|
680
|
+
noTicketBoard: 'No ticket board available.',
|
|
681
|
+
selectionCleared: 'Your selection has been cleared.',
|
|
682
|
+
clearAll: 'Clear All',
|
|
683
|
+
stopAt: 'Stop at',
|
|
684
|
+
turnover: 'Turnover: ',
|
|
685
|
+
pleaseFillIn: 'Please fill in all the selection input!',
|
|
686
|
+
fillIn: 'Fill in',
|
|
687
|
+
noBets: 'Sorry. No bets have been placed so far. Check back later!',
|
|
688
|
+
search: 'Search',
|
|
689
|
+
clear: 'Clear',
|
|
690
|
+
oddsChart: 'Odds Chart',
|
|
691
|
+
ticketSuccess: 'Ticket purchased successfully.',
|
|
692
|
+
stakePerLine: 'Stake per Line:',
|
|
693
|
+
lowestOdds: 'Lowest Odds:',
|
|
694
|
+
highestOdds: 'Highest Odds:',
|
|
695
|
+
orderSummary: 'ORDER SUMMARY',
|
|
696
|
+
ticket: 'Ticket',
|
|
697
|
+
lines: 'Lines',
|
|
698
|
+
total: 'Total',
|
|
699
|
+
submit: 'Submit',
|
|
700
|
+
loading: 'Loading',
|
|
701
|
+
enterValidNumber: 'Please enter a valid number.',
|
|
702
|
+
enterNumberBetween: 'Please enter a number between {min} and {max}.',
|
|
703
|
+
numberAlreadySelected: 'This number has already been selected.',
|
|
704
|
+
enterScoreUpTo: 'Please enter the score (Up to {maxScore})',
|
|
705
|
+
enterValue: 'Please enter a value',
|
|
706
|
+
myChoices: 'My Choices',
|
|
707
|
+
teams: 'Teams',
|
|
708
|
+
scores: 'Scores',
|
|
709
|
+
euro: 'Euro',
|
|
710
|
+
cancel: 'Cancel',
|
|
711
|
+
confirm: 'Confirm'
|
|
712
|
+
},
|
|
713
|
+
ro: {},
|
|
714
|
+
fr: {},
|
|
715
|
+
ar: {},
|
|
716
|
+
hr: {}
|
|
717
|
+
};
|
|
718
|
+
const translate$1 = (key, customLang, replacements) => {
|
|
719
|
+
const lang = customLang;
|
|
720
|
+
let translation = TRANSLATIONS$1[lang !== undefined && SUPPORTED_LANGUAGES$1.includes(lang) ? lang : DEFAULT_LANGUAGE$1][key];
|
|
721
|
+
if (replacements) {
|
|
722
|
+
Object.keys(replacements).forEach((placeholder) => {
|
|
723
|
+
translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
return translation;
|
|
727
|
+
};
|
|
728
|
+
const getTranslations$1 = (data) => {
|
|
729
|
+
Object.keys(data).forEach((item) => {
|
|
730
|
+
for (let key in data[item]) {
|
|
731
|
+
TRANSLATIONS$1[item][key] = data[item][key];
|
|
732
|
+
}
|
|
733
|
+
});
|
|
734
|
+
};
|
|
735
|
+
|
|
736
|
+
function getBulletTextsSet(bulletTexts, splitToken) {
|
|
737
|
+
return new Set(bulletTexts ? bulletTexts.split(splitToken) : []);
|
|
738
|
+
}
|
|
739
|
+
function validateInput({ value, selectedSet, maxValue, minValue, language, type = 'integer' }) {
|
|
740
|
+
const trimmedValue = value.trim();
|
|
741
|
+
if (type === 'integer') {
|
|
742
|
+
// Strict integer check
|
|
743
|
+
if (!/^-?\d+$/.test(trimmedValue)) {
|
|
744
|
+
return {
|
|
745
|
+
valid: false,
|
|
746
|
+
errorMessage: translate$1('enterValidNumber', language),
|
|
747
|
+
value
|
|
748
|
+
};
|
|
749
|
+
}
|
|
750
|
+
const numValue = Number(trimmedValue);
|
|
751
|
+
if (isNaN(numValue)) {
|
|
752
|
+
return {
|
|
753
|
+
valid: false,
|
|
754
|
+
errorMessage: translate$1('enterValidNumber', language),
|
|
755
|
+
value
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
if ((minValue !== undefined && numValue < minValue) || (maxValue !== undefined && numValue > maxValue)) {
|
|
759
|
+
return {
|
|
760
|
+
valid: false,
|
|
761
|
+
errorMessage: translate$1('enterNumberBetween', language, {
|
|
762
|
+
min: minValue,
|
|
763
|
+
max: maxValue
|
|
764
|
+
}),
|
|
765
|
+
value
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
// Normalize value (e.g. "05" -> "5") for set check
|
|
769
|
+
const normalizedValue = String(numValue);
|
|
770
|
+
if (selectedSet.has(normalizedValue)) {
|
|
771
|
+
return {
|
|
772
|
+
valid: false,
|
|
773
|
+
errorMessage: translate$1('numberAlreadySelected', language),
|
|
774
|
+
value
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
else {
|
|
779
|
+
// Text mode validation
|
|
780
|
+
if (selectedSet.has(trimmedValue)) {
|
|
781
|
+
return {
|
|
782
|
+
valid: false,
|
|
783
|
+
errorMessage: translate$1('numberAlreadySelected', language), // Or generic 'alreadySelected' if available, but reusing key for now
|
|
784
|
+
value
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
return {
|
|
789
|
+
valid: true,
|
|
790
|
+
errorMessage: '',
|
|
791
|
+
value
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
function removeBulletTexts(text, selectedArr) {
|
|
795
|
+
return selectedArr.filter((s) => s !== text);
|
|
796
|
+
}
|
|
797
|
+
function addSelectedBulletTexts(text, selectedArr) {
|
|
798
|
+
return selectedArr.concat([text]);
|
|
799
|
+
}
|
|
800
|
+
function removeAndAddSelectedBulletTexts(text, selectedArr, maxSelectedCount) {
|
|
801
|
+
return selectedArr.slice(selectedArr.length - (maxSelectedCount - 1)).concat([text]);
|
|
802
|
+
}
|
|
803
|
+
function buildSelectedBulletTextsArr(item, selectedArr, maxSelectedCount) {
|
|
804
|
+
if (item.type === 'delete') {
|
|
805
|
+
return removeBulletTexts(item.text, selectedArr);
|
|
806
|
+
}
|
|
807
|
+
if (item.type === 'toggle') {
|
|
808
|
+
if (selectedArr.includes(item.text)) {
|
|
809
|
+
return removeBulletTexts(item.text, selectedArr);
|
|
810
|
+
}
|
|
811
|
+
if (selectedArr.length >= maxSelectedCount) {
|
|
812
|
+
return removeAndAddSelectedBulletTexts(item.text, selectedArr, maxSelectedCount);
|
|
813
|
+
}
|
|
814
|
+
return addSelectedBulletTexts(item.text, selectedArr);
|
|
815
|
+
}
|
|
816
|
+
return [];
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
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}";
|
|
820
|
+
const LotterySelectionGroupStyle0 = lotterySelectionGroupCss;
|
|
821
|
+
|
|
822
|
+
const LotterySelectionGroup = class {
|
|
823
|
+
constructor(hostRef) {
|
|
824
|
+
index.registerInstance(this, hostRef);
|
|
825
|
+
this.bulletGroupUpdateSelectedBulletTexts = index.createEvent(this, "bulletGroupUpdateSelection", 7);
|
|
826
|
+
this.mbSource = undefined;
|
|
827
|
+
this.clientStyling = undefined;
|
|
828
|
+
this.clientStylingUrl = undefined;
|
|
829
|
+
this.language = 'en';
|
|
830
|
+
this.translationUrl = '';
|
|
831
|
+
this.splitToken = ',';
|
|
832
|
+
this.selectionGroupId = undefined;
|
|
833
|
+
this.selectionGroupLabel = undefined;
|
|
834
|
+
this.type = 'bet';
|
|
835
|
+
this.selectedBulletTexts = null;
|
|
836
|
+
this.maxSelectedCount = null;
|
|
837
|
+
this.maxDisplayBulletsCount = 11;
|
|
838
|
+
this.bulletTexts = null;
|
|
839
|
+
this.maxIntegerBulletText = null;
|
|
840
|
+
this.minIntegerBulletText = 0;
|
|
841
|
+
this.bulletTextType = 'integer';
|
|
842
|
+
this.hasBorder = true;
|
|
843
|
+
this.hasBackground = true;
|
|
844
|
+
this.dialogTitle = undefined;
|
|
845
|
+
this.dialogInputPlaceholder = undefined;
|
|
846
|
+
this.dialogConfig = {
|
|
847
|
+
width: '400px',
|
|
848
|
+
visible: false,
|
|
849
|
+
onConfirm: () => this.handleFillInAddMore(),
|
|
850
|
+
onCancel: () => this.handleCloseAddMoreDialog()
|
|
851
|
+
};
|
|
852
|
+
this.inputInfo = { valid: true, errorMessage: '', value: '' };
|
|
853
|
+
}
|
|
854
|
+
handleClientStylingChange(newValue, oldValue) {
|
|
855
|
+
if (newValue != oldValue) {
|
|
856
|
+
lotteryHakunaTicketHistory.setClientStyling(this.stylingContainer, this.clientStyling);
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
handleClientStylingUrlChange(newValue, oldValue) {
|
|
860
|
+
if (newValue != oldValue) {
|
|
861
|
+
lotteryHakunaTicketHistory.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
handleMbSourceChange(newValue, oldValue) {
|
|
865
|
+
if (newValue != oldValue) {
|
|
866
|
+
lotteryHakunaTicketHistory.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
componentWillLoad() {
|
|
870
|
+
if (this.translationUrl) {
|
|
871
|
+
getTranslations$1(JSON.parse(this.translationUrl));
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
componentDidLoad() {
|
|
875
|
+
if (this.stylingContainer) {
|
|
876
|
+
if (this.mbSource)
|
|
877
|
+
lotteryHakunaTicketHistory.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
|
|
878
|
+
if (this.clientStyling)
|
|
879
|
+
lotteryHakunaTicketHistory.setClientStyling(this.stylingContainer, this.clientStyling);
|
|
880
|
+
if (this.clientStylingUrl)
|
|
881
|
+
lotteryHakunaTicketHistory.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
disconnectedCallback() {
|
|
885
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
886
|
+
}
|
|
887
|
+
lotteryBulletClickHandler(event) {
|
|
888
|
+
event.stopPropagation();
|
|
889
|
+
// if it's input type, open the dialog
|
|
890
|
+
if (event.detail.type === 'input') {
|
|
891
|
+
this.dialogConfig = Object.assign(Object.assign({}, this.dialogConfig), { visible: true });
|
|
892
|
+
return;
|
|
893
|
+
}
|
|
894
|
+
if (['delete', 'toggle'].includes(event.detail.type)) {
|
|
895
|
+
this.bulletGroupUpdateSelectedBulletTexts.emit({
|
|
896
|
+
newSelectedBulletTexts: buildSelectedBulletTextsArr(event.detail, Array.from(this.selectedSet), this.maxSelectedCount).join(this.splitToken),
|
|
897
|
+
selectionGroupId: this.selectionGroupId
|
|
898
|
+
});
|
|
899
|
+
return;
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
get selectedSet() {
|
|
903
|
+
return getBulletTextsSet(this.selectedBulletTexts, this.splitToken);
|
|
904
|
+
}
|
|
905
|
+
get bulletTextsSet() {
|
|
906
|
+
if (this.bulletTexts)
|
|
907
|
+
return getBulletTextsSet(this.bulletTexts, this.splitToken);
|
|
908
|
+
if (this.bulletTextType === 'integer' &&
|
|
909
|
+
this.maxIntegerBulletText !== null &&
|
|
910
|
+
this.maxIntegerBulletText !== undefined) {
|
|
911
|
+
return getBulletTextsSet(Array.from({ length: Number(this.lastDisplayBulletText) - this.minIntegerBulletText + 1 }, (_, index) => this.minIntegerBulletText + index).join(this.splitToken), this.splitToken);
|
|
912
|
+
}
|
|
913
|
+
// If neither bulletTexts nor maxIntegerBulletText are provided,
|
|
914
|
+
return new Set();
|
|
915
|
+
}
|
|
916
|
+
// the last bullet text
|
|
917
|
+
get lastDisplayBulletText() {
|
|
918
|
+
if (this.bulletTextType === 'integer') {
|
|
919
|
+
if (this.maxIntegerBulletText !== null && this.maxIntegerBulletText !== undefined) {
|
|
920
|
+
return Math.min(this.maxIntegerBulletText, this.minIntegerBulletText + this.maxDisplayBulletsCount - 1);
|
|
921
|
+
}
|
|
922
|
+
return this.minIntegerBulletText + this.maxDisplayBulletsCount - 1;
|
|
923
|
+
}
|
|
924
|
+
// Text mode: return the text at the max display index if available
|
|
925
|
+
if (this.bulletTextsSet.size > 0) {
|
|
926
|
+
const texts = Array.from(this.bulletTextsSet);
|
|
927
|
+
if (texts.length >= this.maxDisplayBulletsCount) {
|
|
928
|
+
return texts[this.maxDisplayBulletsCount - 1];
|
|
929
|
+
}
|
|
930
|
+
return texts[texts.length - 1]; // If fewer than maxDisplayBulletsCount, return the last one
|
|
931
|
+
}
|
|
932
|
+
return null;
|
|
933
|
+
}
|
|
934
|
+
get isSingleSelectionMode() {
|
|
935
|
+
return this.maxSelectedCount === 1;
|
|
936
|
+
}
|
|
937
|
+
getBulletToRender() {
|
|
938
|
+
const allBulletTexts = Array.from(this.bulletTextsSet);
|
|
939
|
+
// Determine which bullets to display based on type and limit
|
|
940
|
+
let bulletsToRender = allBulletTexts;
|
|
941
|
+
let showInputButton = false;
|
|
942
|
+
if (this.bulletTextType === 'text') {
|
|
943
|
+
// For text, if we have more items than the limit, we need an input button.
|
|
944
|
+
// The input button takes one slot, so we show (limit - 1) items.
|
|
945
|
+
if (allBulletTexts.length > this.maxDisplayBulletsCount) {
|
|
946
|
+
showInputButton = true;
|
|
947
|
+
bulletsToRender = allBulletTexts.slice(0, this.maxDisplayBulletsCount - 1);
|
|
948
|
+
}
|
|
949
|
+
else {
|
|
950
|
+
bulletsToRender = allBulletTexts;
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
else {
|
|
954
|
+
// For integer, logic is based on maxIntegerBulletText vs displayed range
|
|
955
|
+
showInputButton =
|
|
956
|
+
this.maxIntegerBulletText !== null &&
|
|
957
|
+
this.maxIntegerBulletText !== undefined &&
|
|
958
|
+
this.maxIntegerBulletText > Number(this.lastDisplayBulletText);
|
|
959
|
+
// Integer bullets generation already respects the count, no slicing needed on the raw set
|
|
960
|
+
bulletsToRender = allBulletTexts;
|
|
961
|
+
}
|
|
962
|
+
return {
|
|
963
|
+
bulletsToRender,
|
|
964
|
+
showInputButton
|
|
965
|
+
};
|
|
966
|
+
}
|
|
967
|
+
renderBulletGroup() {
|
|
968
|
+
let items = [];
|
|
969
|
+
if (this.type === 'bet') {
|
|
970
|
+
const isMaxSelected = this.maxSelectedCount !== null && this.selectedSet.size >= this.maxSelectedCount;
|
|
971
|
+
const { bulletsToRender, showInputButton } = this.getBulletToRender();
|
|
972
|
+
bulletsToRender.forEach((text, idx) => {
|
|
973
|
+
let bulletType = 'toggle';
|
|
974
|
+
if (!this.selectedSet.has(String(text)) && isMaxSelected && !this.isSingleSelectionMode) {
|
|
975
|
+
bulletType = 'disabled';
|
|
976
|
+
}
|
|
977
|
+
items.push({
|
|
978
|
+
value: this.selectedSet.has(String(text)) ? 1 : 0,
|
|
979
|
+
text: String(text),
|
|
980
|
+
idx,
|
|
981
|
+
type: bulletType
|
|
982
|
+
});
|
|
983
|
+
});
|
|
984
|
+
if (showInputButton) {
|
|
985
|
+
let inputBulletType = 'input';
|
|
986
|
+
if (isMaxSelected && !this.isSingleSelectionMode) {
|
|
987
|
+
inputBulletType = 'disabled';
|
|
988
|
+
}
|
|
989
|
+
const inputButtonText = this.bulletTextType === 'text' ? '...' : `${this.lastDisplayBulletText}+`;
|
|
990
|
+
const inputButtonIdx = this.bulletTextType === 'text' ? -1 : Number(this.lastDisplayBulletText) + 1;
|
|
991
|
+
// Special handling for integer mode:
|
|
992
|
+
// If the generated set is "full" (size == maxDisplayBulletsCount),
|
|
993
|
+
// we need to remove the last item to make room for the "N+" button
|
|
994
|
+
// so the total visual count remains consistent.
|
|
995
|
+
if (this.bulletTextType === 'integer' && items.length >= this.maxDisplayBulletsCount) {
|
|
996
|
+
items.pop();
|
|
997
|
+
}
|
|
998
|
+
items.push({
|
|
999
|
+
value: 0,
|
|
1000
|
+
text: inputButtonText,
|
|
1001
|
+
idx: inputButtonIdx,
|
|
1002
|
+
type: inputBulletType
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
else if (['choice', 'preview'].includes(this.type)) {
|
|
1007
|
+
// For choice/preview, also respect the visual limit for text mode
|
|
1008
|
+
const { bulletsToRender } = this.getBulletToRender();
|
|
1009
|
+
bulletsToRender.forEach((text, idx) => {
|
|
1010
|
+
let bulletType = 'toggle';
|
|
1011
|
+
if (this.type === 'preview') {
|
|
1012
|
+
bulletType = 'readonly';
|
|
1013
|
+
}
|
|
1014
|
+
else if (this.selectedSet.has(String(text))) {
|
|
1015
|
+
bulletType = 'delete';
|
|
1016
|
+
}
|
|
1017
|
+
items.push({
|
|
1018
|
+
value: this.selectedSet.has(String(text)) ? 1 : 0,
|
|
1019
|
+
text,
|
|
1020
|
+
idx,
|
|
1021
|
+
type: bulletType
|
|
1022
|
+
});
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
1025
|
+
return (index.h("div", { class: "lottery-selection-group__item--right" }, items.map((item) => {
|
|
1026
|
+
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 }));
|
|
1027
|
+
})));
|
|
1028
|
+
}
|
|
1029
|
+
handleCloseAddMoreDialog() {
|
|
1030
|
+
this.dialogConfig = Object.assign(Object.assign({}, this.dialogConfig), { visible: false });
|
|
1031
|
+
this.inputInfo = { value: '', errorMessage: '', valid: true };
|
|
1032
|
+
}
|
|
1033
|
+
handleInputChange(e) {
|
|
1034
|
+
const inputElement = e.target;
|
|
1035
|
+
const value = inputElement.value;
|
|
1036
|
+
this.inputInfo = Object.assign(Object.assign({}, this.inputInfo), { value: value });
|
|
1037
|
+
this.inputInfo = validateInput({
|
|
1038
|
+
value,
|
|
1039
|
+
selectedSet: this.selectedSet,
|
|
1040
|
+
maxValue: this.maxIntegerBulletText,
|
|
1041
|
+
minValue: this.bulletTextType === 'integer' ? Number(this.lastDisplayBulletText) + 1 : undefined,
|
|
1042
|
+
language: this.language,
|
|
1043
|
+
type: this.bulletTextType
|
|
1044
|
+
});
|
|
1045
|
+
}
|
|
1046
|
+
handleFillInAddMore() {
|
|
1047
|
+
if (this.inputInfo.valid) {
|
|
1048
|
+
const { value } = this.inputInfo;
|
|
1049
|
+
// Normalize the value (e.g., "05" -> "5") to match validation logic
|
|
1050
|
+
let normalizedValue = value;
|
|
1051
|
+
if (this.bulletTextType === 'integer') {
|
|
1052
|
+
normalizedValue = String(Number(value));
|
|
1053
|
+
}
|
|
1054
|
+
else {
|
|
1055
|
+
normalizedValue = value.trim();
|
|
1056
|
+
}
|
|
1057
|
+
let newSelectedBulletTexts;
|
|
1058
|
+
if (this.isSingleSelectionMode) {
|
|
1059
|
+
newSelectedBulletTexts = normalizedValue;
|
|
1060
|
+
}
|
|
1061
|
+
else {
|
|
1062
|
+
newSelectedBulletTexts = addSelectedBulletTexts(normalizedValue, Array.from(this.selectedSet)).join(this.splitToken);
|
|
1063
|
+
}
|
|
1064
|
+
this.bulletGroupUpdateSelectedBulletTexts.emit({
|
|
1065
|
+
newSelectedBulletTexts,
|
|
1066
|
+
selectionGroupId: this.selectionGroupId
|
|
1067
|
+
});
|
|
1068
|
+
this.handleCloseAddMoreDialog();
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
render() {
|
|
1072
|
+
return (index.h("div", { key: '66b8e9c63d948eb2f7eb37adb80892dbedd7df9a', class: "lottery-selection-group", ref: (el) => (this.stylingContainer = el) }, index.h("div", { key: '6562fdcad0f352b5e2d03edcc980a9aeab32277e', class: "lottery-selection-group__item" }, this.selectionGroupLabel && (index.h("div", { key: '43c2132e4904a2b69b970d9b2074f120ed4d0986', class: "lottery-selection-group__item--left" }, this.selectionGroupLabel)), this.renderBulletGroup()), index.h("lottery-tipping-dialog", { key: 'cb693d10e6b499628909571021d8508cdebbe29a', visible: this.dialogConfig.visible, width: this.dialogConfig.width, onCancel: this.dialogConfig.onCancel }, index.h("div", { key: 'dd312634574bbe1b4d3de7e82a9c58f58f846c1a', class: "addSelectionDialog" }, index.h("div", { key: 'b371b1090598f0219a7c652bab51e9d349703c34', class: "addSelectionDialog-title" }, this.dialogTitle || (this.bulletTextType === 'text'
|
|
1073
|
+
? translate$1('enterValue', this.language)
|
|
1074
|
+
: translate$1('enterScoreUpTo', this.language, {
|
|
1075
|
+
maxScore: this.maxIntegerBulletText
|
|
1076
|
+
}))), index.h("input", { key: 'b5f1bb74999246dac8dc20f04e3af893deae6654', type: "text", class: {
|
|
1077
|
+
'dialog-input': true,
|
|
1078
|
+
invalid: !this.inputInfo.valid
|
|
1079
|
+
}, value: this.inputInfo.value, onInput: this.handleInputChange.bind(this), placeholder: this.dialogInputPlaceholder }), index.h("div", { key: 'f33970a6dffdc881ffa9cf2c0bb54b26b27cccd6', class: "error-message" }, this.inputInfo.errorMessage)), index.h("div", { key: '4c580dae14b38aff03e17067b2c0b72d01aa4f42', slot: "footer", class: "addSelectionDialog-footer" }, index.h("lottery-button", { key: '874aa0ffde8fe2d0b08efea0cf951f101ab8dad0', onClick: this.dialogConfig.onCancel, text: translate$1('cancel', this.language), variant: "outline" }), index.h("lottery-button", { key: '63a556eb5f9ad1cdd357c017756be274d40ef235', onClick: this.dialogConfig.onConfirm, text: translate$1('confirm', this.language), variant: "primary", disabled: !this.inputInfo.valid || !this.inputInfo.value })))));
|
|
1080
|
+
}
|
|
1081
|
+
static get watchers() { return {
|
|
1082
|
+
"clientStyling": ["handleClientStylingChange"],
|
|
1083
|
+
"clientStylingUrl": ["handleClientStylingUrlChange"],
|
|
1084
|
+
"mbSource": ["handleMbSourceChange"]
|
|
1085
|
+
}; }
|
|
1086
|
+
};
|
|
1087
|
+
LotterySelectionGroup.style = LotterySelectionGroupStyle0;
|
|
1088
|
+
|
|
1089
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
1090
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
|
|
1091
|
+
const TRANSLATIONS = {
|
|
1092
|
+
en: {
|
|
1093
|
+
cancel: 'Cancel',
|
|
1094
|
+
confirm: 'Confirm'
|
|
1095
|
+
},
|
|
1096
|
+
ro: {
|
|
1097
|
+
cancel: 'Anulează',
|
|
1098
|
+
confirm: 'Confirmă'
|
|
1099
|
+
},
|
|
1100
|
+
fr: {
|
|
1101
|
+
cancel: 'Annuler',
|
|
1102
|
+
confirm: 'Confirmer'
|
|
1103
|
+
},
|
|
1104
|
+
ar: {
|
|
1105
|
+
cancel: 'إلغاء',
|
|
1106
|
+
confirm: 'تأكيد'
|
|
1107
|
+
},
|
|
1108
|
+
hr: {
|
|
1109
|
+
cancel: 'Odustani',
|
|
1110
|
+
confirm: 'Potvrdi'
|
|
1111
|
+
}
|
|
1112
|
+
};
|
|
1113
|
+
const translate = (key, customLang) => {
|
|
1114
|
+
const lang = customLang;
|
|
1115
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
1116
|
+
};
|
|
1117
|
+
const getTranslations = (data) => {
|
|
1118
|
+
Object.keys(data).forEach((item) => {
|
|
1119
|
+
for (let key in data[item]) {
|
|
1120
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
1121
|
+
}
|
|
1122
|
+
});
|
|
1123
|
+
};
|
|
1124
|
+
const resolveTranslationUrl = async (translationUrl) => {
|
|
1125
|
+
if (translationUrl) {
|
|
1126
|
+
try {
|
|
1127
|
+
const response = await fetch(translationUrl);
|
|
1128
|
+
if (!response.ok) {
|
|
1129
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
1130
|
+
}
|
|
1131
|
+
const translations = await response.json();
|
|
1132
|
+
getTranslations(translations);
|
|
1133
|
+
}
|
|
1134
|
+
catch (error) {
|
|
1135
|
+
console.error('Failed to fetch or parse translations from URL:', error);
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
};
|
|
1139
|
+
|
|
1140
|
+
const lotteryTippingDialogCss = ".dialog-wrapper{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;visibility:hidden;opacity:1;z-index:199}.dialog-wrapper-visible{visibility:visible}.mask{position:fixed;inset:0;background-color:rgba(0, 0, 0, 0.5);opacity:0;z-index:1000;transition:opacity var(--duration) linear}.mask-enter{opacity:1}.mask-leave{opacity:0}.dialog{position:relative;background:var(--emw--color-background, #fff);border-radius:12px;box-shadow:0 4px 32px rgba(0, 0, 0, 0.15);opacity:0;transform:scale(0.9);transition:all var(--duration) linear;width:100%;max-width:100vw;overflow:hidden;z-index:1000}.dialog-enter{opacity:1;transform:scale(1)}.dialog-leave{opacity:0}.dialog.fullscreen{width:100vw !important;height:100vh;overflow:auto;max-height:none;border-radius:0;overflow:hidden}.dialog-header{padding:16px 16px 0 16px;display:flex;justify-content:space-between;align-items:center}.dialog-header .dialog-title{margin:0;font-size:1.25rem;font-weight:500;color:var(--emw--color-typography, #000)}.dialog-header .close-btn{background:transparent;border:none;font-size:1.5rem;width:2rem;height:2rem;color:var(--emw--color-gray-150, #6f6f6f);cursor:pointer;border-radius:4px}.dialog-header .close-btn:hover{background:var(--emw--color-gray-50, #f5f5f5);color:var(--emw--color-gray-300, #333)}.dialog-content{padding:24px;font-size:0.95rem;line-height:1.6;color:var(--emw--color-dialog-typography, #000);flex:1;overflow-y:auto;max-height:calc(100vh - 200px)}.dialog.fullscreen .dialog-content{max-height:none}.dialog-footer{padding:0 16px 16px 16px;display:flex;justify-content:center;gap:12px}.dialog-footer .cancel-btn,.dialog-footer .confirm-btn{padding:10px 24px;border-radius:6px;font-size:0.9rem;cursor:pointer;transition:all 0.3s linear}.dialog-footer .cancel-btn{border:var(--emw--button-border, 1px solid rgba(221, 221, 221, 0.8666666667));background-color:var(--emw--color-background, #fff);color:var(--emw--color-typography, #000)}.dialog-footer .cancel-btn:hover{background-color:var(--emw--color-background-tertiary, #ccc)}.dialog-footer .confirm-btn{border:none;color:var(--emw--color-typography-normalized, #ffffff);background:var(--emw--color-primary, #009993)}.dialog-footer .confirm-btn:hover{background:var(--emw--color-primary-variant, #004d4a)}@media screen and (max-width: 480px){.dialog.fullscreen .dialog-content{padding:12px}}.Loading{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.Loading svg{animation:spin 1s linear infinite;transform-origin:center}@keyframes spin{100%{transform:rotate(360deg)}}";
|
|
1141
|
+
const LotteryTippingDialogStyle0 = lotteryTippingDialogCss;
|
|
1142
|
+
|
|
1143
|
+
const LotteryTippingDialog = class {
|
|
1144
|
+
constructor(hostRef) {
|
|
1145
|
+
index.registerInstance(this, hostRef);
|
|
1146
|
+
this.open = index.createEvent(this, "open", 7);
|
|
1147
|
+
this.close = index.createEvent(this, "close", 7);
|
|
1148
|
+
this.confirm = index.createEvent(this, "confirm", 7);
|
|
1149
|
+
this.cancel = index.createEvent(this, "cancel", 7);
|
|
1150
|
+
this.wasVisible = false;
|
|
1151
|
+
this.mbSource = undefined;
|
|
1152
|
+
this.clientStyling = '';
|
|
1153
|
+
this.clientStylingUrl = '';
|
|
1154
|
+
this.visible = undefined;
|
|
1155
|
+
this.dialogTitle = '';
|
|
1156
|
+
this.width = '520px';
|
|
1157
|
+
this.closable = true;
|
|
1158
|
+
this.mask = true;
|
|
1159
|
+
this.maskClosable = true;
|
|
1160
|
+
this.animationDuration = 300;
|
|
1161
|
+
this.fullscreen = false;
|
|
1162
|
+
this.showFooter = true;
|
|
1163
|
+
this.showCancelBtn = true;
|
|
1164
|
+
this.language = 'en';
|
|
1165
|
+
this.translationUrl = undefined;
|
|
1166
|
+
this.dialogClass = undefined;
|
|
1167
|
+
this.dialogStyle = undefined;
|
|
1168
|
+
}
|
|
1169
|
+
handleClientStylingChange(newValue, oldValue) {
|
|
1170
|
+
if (newValue != oldValue) {
|
|
1171
|
+
lotteryHakunaTicketHistory.setClientStyling(this.stylingContainer, this.clientStyling);
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
handleClientStylingUrlChange(newValue, oldValue) {
|
|
1175
|
+
if (newValue != oldValue) {
|
|
1176
|
+
lotteryHakunaTicketHistory.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
handleMbSourceChange(newValue, oldValue) {
|
|
1180
|
+
if (newValue != oldValue) {
|
|
1181
|
+
lotteryHakunaTicketHistory.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
componentWillLoad() {
|
|
1185
|
+
if (this.translationUrl) {
|
|
1186
|
+
resolveTranslationUrl(this.translationUrl);
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
componentWillUpdate() {
|
|
1190
|
+
if (this.visible && !this.wasVisible) {
|
|
1191
|
+
this.disableBodyScroll();
|
|
1192
|
+
}
|
|
1193
|
+
else if (!this.visible && this.wasVisible) {
|
|
1194
|
+
this.enableBodyScroll();
|
|
1195
|
+
}
|
|
1196
|
+
this.wasVisible = this.visible;
|
|
1197
|
+
}
|
|
1198
|
+
disconnectedCallback() {
|
|
1199
|
+
this.enableBodyScroll();
|
|
1200
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
1201
|
+
}
|
|
1202
|
+
disableBodyScroll() {
|
|
1203
|
+
document.body.style.overflow = 'hidden';
|
|
1204
|
+
}
|
|
1205
|
+
enableBodyScroll() {
|
|
1206
|
+
document.body.style.overflow = '';
|
|
1207
|
+
}
|
|
1208
|
+
handleClose() {
|
|
1209
|
+
this.cancel.emit();
|
|
1210
|
+
}
|
|
1211
|
+
handleMaskClick() {
|
|
1212
|
+
if (this.maskClosable) {
|
|
1213
|
+
this.cancel.emit();
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
handleConfirm() {
|
|
1217
|
+
this.confirm.emit();
|
|
1218
|
+
}
|
|
1219
|
+
render() {
|
|
1220
|
+
const computedDialogStyle = Object.assign({ width: typeof this.width === 'number' ? `${this.width}px` : this.width, '--duration': `${this.animationDuration}ms` }, (this.dialogStyle || {}));
|
|
1221
|
+
const dialogWrapperClass = ['dialog-wrapper', this.visible ? 'dialog-wrapper-visible' : ''];
|
|
1222
|
+
const maskClass = ['mask', this.visible ? 'mask-enter' : 'mask-leave'];
|
|
1223
|
+
const computedDialogClass = [
|
|
1224
|
+
'dialog',
|
|
1225
|
+
this.visible ? 'dialog-enter' : 'dialog-leave',
|
|
1226
|
+
this.fullscreen ? 'fullscreen' : '',
|
|
1227
|
+
this.dialogClass
|
|
1228
|
+
]
|
|
1229
|
+
.filter(Boolean)
|
|
1230
|
+
.join(' ');
|
|
1231
|
+
const contentStyle = {
|
|
1232
|
+
maxHeight: 'calc(100vh - 62px)',
|
|
1233
|
+
overflowY: 'auto'
|
|
1234
|
+
};
|
|
1235
|
+
return (index.h("div", { key: '306683c5190fa6dca57dcf75e52eca575c0215e7', class: dialogWrapperClass.join(' '), ref: (el) => (this.stylingContainer = el) }, index.h("div", { key: '8be097f3a86fcd9ad4e18c6ac56cafdcf249049b', class: maskClass.join(' '), onClick: this.handleMaskClick.bind(this) }), index.h("div", { key: '87d2206d3e3d75fe0e0ef8a6afd8de5c20892ae6', part: "dialog", class: computedDialogClass, style: computedDialogStyle, role: "dialog", "aria-modal": "true", "aria-labelledby": "dialog-title" }, index.h("div", { key: '30ca33b925ff2525ead8aae83e72031258367b40', class: "dialog-header" }, index.h("h2", { key: '492c3e864ac1547da58b0a47e4cc8d45470bde54', id: "dialog-title", class: "dialog-title" }, this.dialogTitle), this.closable && (index.h("button", { key: '8ae4b872d18ce82d33292dc794e8a1f714a96ba9', class: "close-btn", onClick: this.handleClose.bind(this) }, "x"))), index.h("div", { key: 'd661c78b333f78b9dee92e0975f8b136ef5a3071', class: "dialog-content", style: contentStyle }, index.h("slot", { key: 'f32a6f6e4962239e0148e61c4bb70f6b5d3a2c82' })), this.showFooter && (index.h("div", { key: '40b5e9fd1c9221eb4d6c87d053c5d018f540d8e7', class: "dialog-footer" }, index.h("slot", { key: '91539def47d118a69735ec229e7a6b36fc1db40b', name: "footer" }, this.showCancelBtn && (index.h("button", { key: 'f3b3add23f150c660159a906c2ef23b5fbe3b4c5', class: "cancel-btn", onClick: this.handleClose.bind(this) }, translate('cancel', this.language))), index.h("button", { key: '5fc33e89b6c55ac9e2162302e128bce0e79c5f89', class: "confirm-btn", onClick: this.handleConfirm.bind(this) }, translate('confirm', this.language))))))));
|
|
1236
|
+
}
|
|
1237
|
+
get el() { return index.getElement(this); }
|
|
1238
|
+
static get watchers() { return {
|
|
1239
|
+
"clientStyling": ["handleClientStylingChange"],
|
|
1240
|
+
"clientStylingUrl": ["handleClientStylingUrlChange"],
|
|
1241
|
+
"mbSource": ["handleMbSourceChange"]
|
|
1242
|
+
}; }
|
|
1243
|
+
};
|
|
1244
|
+
LotteryTippingDialog.style = LotteryTippingDialogStyle0;
|
|
1245
|
+
|
|
1246
|
+
const uiSkeletonCss = ":host{display:block}.Skeleton{animation:skeleton-loading 1s linear infinite alternate}.SkeletonRectangle{background-color:var(--emw-skeleton-rectangle-background, #c2c2c2);width:var(--emw-skeleton-rectangle-width, 400px);height:var(--emw-skeleton-rectangle-height, 200px);border-radius:var(--emw-skeleton-rectangle-border-radius, 10px)}.SkeletonCircle{background-color:var(--emw-skeleton-circle-background, #c2c2c2);width:var(--emw-skeleton-circle-size, 400px);height:var(--emw-skeleton-circle-size, 400px);border-radius:50%}.SkeletonText{background-color:var(--emw-skeleton-text-background, #c2c2c2);width:var(--emw-skeleton-text-width, 500px);height:var(--emw-skeleton-text-height, 20px);border-radius:var(--emw-skeleton-text-border-radius, 10px);margin-bottom:var(--emw-skeleton-text-margin-bottom, 5px)}.SkeletonText:last-child{width:calc(var(--emw-skeleton-text-width, 400px) - 100px)}.SkeletonTitle{background-color:var(--emw-skeleton-title-background, #c2c2c2);width:var(--emw-skeleton-title-width, 300px);height:var(--emw-skeleton-title-height, 30px);border-radius:var(--emw-skeleton-title-border-radius, 10px);margin-bottom:var(--emw-skeleton-title-margin-bottom, 5px)}.SkeletonImage{background-color:var(--emw-skeleton-image-background, #c2c2c2);width:var(--emw-skeleton-image-width, 100%);height:var(--emw-skeleton-image-height, 100%);border-radius:var(--emw-skeleton-image-border-radius, unset)}.SkeletonLogo{background-color:var(--emw-skeleton-logo-background, #c2c2c2);width:var(--emw-skeleton-logo-width, 120px);height:var(--emw-skeleton-logo-height, 75px);border-radius:var(--emw-skeleton-logo-border-radius, 10px)}@keyframes skeleton-loading{0%{background-color:var(--emw-skeleton-primary-color, #e0e0e0)}100%{background-color:var(--emw-skeleton-secondary-color, #f0f0f0)}}";
|
|
1247
|
+
const UiSkeletonStyle0 = uiSkeletonCss;
|
|
1248
|
+
|
|
1249
|
+
const UiSkeleton = class {
|
|
1250
|
+
constructor(hostRef) {
|
|
1251
|
+
index.registerInstance(this, hostRef);
|
|
1252
|
+
this.stylingValue = {
|
|
1253
|
+
width: this.handleStylingProps(this.width),
|
|
1254
|
+
height: this.handleStylingProps(this.height),
|
|
1255
|
+
borderRadius: this.handleStylingProps(this.borderRadius),
|
|
1256
|
+
marginBottom: this.handleStylingProps(this.marginBottom),
|
|
1257
|
+
marginTop: this.handleStylingProps(this.marginTop),
|
|
1258
|
+
marginLeft: this.handleStylingProps(this.marginLeft),
|
|
1259
|
+
marginRight: this.handleStylingProps(this.marginRight),
|
|
1260
|
+
size: this.handleStylingProps(this.size),
|
|
1261
|
+
};
|
|
1262
|
+
this.structure = undefined;
|
|
1263
|
+
this.width = 'unset';
|
|
1264
|
+
this.height = 'unset';
|
|
1265
|
+
this.borderRadius = 'unset';
|
|
1266
|
+
this.marginBottom = 'unset';
|
|
1267
|
+
this.marginTop = 'unset';
|
|
1268
|
+
this.marginLeft = 'unset';
|
|
1269
|
+
this.marginRight = 'unset';
|
|
1270
|
+
this.animation = true;
|
|
1271
|
+
this.rows = 0;
|
|
1272
|
+
this.size = '100%';
|
|
1273
|
+
}
|
|
1274
|
+
handleStructureChange(newValue, oldValue) {
|
|
1275
|
+
if (oldValue !== newValue) {
|
|
1276
|
+
this.handleStructure(newValue);
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
handleStylingProps(value) {
|
|
1280
|
+
switch (typeof value) {
|
|
1281
|
+
case 'number':
|
|
1282
|
+
return value === 0 ? 0 : `${value}px`;
|
|
1283
|
+
case 'undefined':
|
|
1284
|
+
return 'unset';
|
|
1285
|
+
case 'string':
|
|
1286
|
+
if (['auto', 'unset', 'none', 'inherit', 'initial'].includes(value) ||
|
|
1287
|
+
value.endsWith('px') ||
|
|
1288
|
+
value.endsWith('%')) {
|
|
1289
|
+
return value;
|
|
1290
|
+
}
|
|
1291
|
+
else {
|
|
1292
|
+
return 'unset';
|
|
1293
|
+
}
|
|
1294
|
+
default:
|
|
1295
|
+
return 'unset';
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
handleStructure(structure) {
|
|
1299
|
+
switch (structure) {
|
|
1300
|
+
case 'logo':
|
|
1301
|
+
return this.renderLogo();
|
|
1302
|
+
case 'image':
|
|
1303
|
+
return this.renderImage();
|
|
1304
|
+
case 'title':
|
|
1305
|
+
return this.renderTitle();
|
|
1306
|
+
case 'text':
|
|
1307
|
+
return this.renderText();
|
|
1308
|
+
case 'rectangle':
|
|
1309
|
+
return this.renderRectangle();
|
|
1310
|
+
case 'circle':
|
|
1311
|
+
return this.renderCircle();
|
|
1312
|
+
default:
|
|
1313
|
+
return null;
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
renderLogo() {
|
|
1317
|
+
return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: 'SkeletonLogo ' + (this.animation ? 'Skeleton' : '') })));
|
|
1318
|
+
}
|
|
1319
|
+
renderImage() {
|
|
1320
|
+
return index.h("div", { class: 'SkeletonImage ' + (this.animation ? 'Skeleton' : '') });
|
|
1321
|
+
}
|
|
1322
|
+
renderTitle() {
|
|
1323
|
+
return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: 'SkeletonTitle ' + (this.animation ? 'Skeleton' : '') })));
|
|
1324
|
+
}
|
|
1325
|
+
renderText() {
|
|
1326
|
+
return (index.h("div", { class: "SkeletonContainer" }, Array.from({ length: this.rows > 0 ? this.rows : 1 }).map((_, index$1) => (index.h("div", { key: index$1, class: 'SkeletonText ' + (this.animation ? 'Skeleton' : '') })))));
|
|
1327
|
+
}
|
|
1328
|
+
renderRectangle() {
|
|
1329
|
+
return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: 'SkeletonRectangle ' + (this.animation ? 'Skeleton' : '') })));
|
|
1330
|
+
}
|
|
1331
|
+
renderCircle() {
|
|
1332
|
+
return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: 'SkeletonCircle ' + (this.animation ? 'Skeleton' : '') })));
|
|
1333
|
+
}
|
|
1334
|
+
render() {
|
|
1335
|
+
let styleBlock = '';
|
|
1336
|
+
switch (this.structure) {
|
|
1337
|
+
case 'logo':
|
|
1338
|
+
styleBlock = `
|
|
1339
|
+
:host {
|
|
1340
|
+
--emw-skeleton-logo-width: ${this.stylingValue.width};
|
|
1341
|
+
--emw-skeleton-logo-height: ${this.stylingValue.height};
|
|
1342
|
+
--emw-skeleton-logo-border-radius: ${this.stylingValue.borderRadius};
|
|
1343
|
+
--emw-skeleton-logo-margin-bottom: ${this.stylingValue.marginBottom};
|
|
1344
|
+
--emw-skeleton-logo-margin-top: ${this.stylingValue.marginTop};
|
|
1345
|
+
--emw-skeleton-logo-margin-left: ${this.stylingValue.marginLeft};
|
|
1346
|
+
--emw-skeleton-logo-margin-right: ${this.stylingValue.marginRight};
|
|
1347
|
+
}
|
|
1348
|
+
`;
|
|
1349
|
+
break;
|
|
1350
|
+
case 'image':
|
|
1351
|
+
styleBlock = `
|
|
1352
|
+
:host {
|
|
1353
|
+
--emw-skeleton-image-width: ${this.stylingValue.width};
|
|
1354
|
+
--emw-skeleton-image-height: ${this.stylingValue.height};
|
|
1355
|
+
--emw-skeleton-image-border-radius: ${this.stylingValue.borderRadius};
|
|
1356
|
+
--emw-skeleton-image-margin-bottom: ${this.stylingValue.marginBottom};
|
|
1357
|
+
--emw-skeleton-image-margin-top: ${this.stylingValue.marginTop};
|
|
1358
|
+
--emw-skeleton-image-margin-left: ${this.stylingValue.marginLeft};
|
|
1359
|
+
--emw-skeleton-image-margin-right: ${this.stylingValue.marginRight};
|
|
1360
|
+
}
|
|
1361
|
+
`;
|
|
1362
|
+
break;
|
|
1363
|
+
case 'title':
|
|
1364
|
+
styleBlock = `
|
|
1365
|
+
:host {
|
|
1366
|
+
--emw-skeleton-title-width: ${this.stylingValue.width};
|
|
1367
|
+
--emw-skeleton-title-height: ${this.stylingValue.height};
|
|
1368
|
+
--emw-skeleton-title-border-radius: ${this.stylingValue.borderRadius};
|
|
1369
|
+
--emw-skeleton-title-margin-bottom: ${this.stylingValue.marginBottom};
|
|
1370
|
+
--emw-skeleton-title-margin-top: ${this.stylingValue.marginTop};
|
|
1371
|
+
--emw-skeleton-title-margin-left: ${this.stylingValue.marginLeft};
|
|
1372
|
+
--emw-skeleton-title-margin-right: ${this.stylingValue.marginRight};
|
|
1373
|
+
}
|
|
1374
|
+
`;
|
|
1375
|
+
break;
|
|
1376
|
+
case 'text':
|
|
1377
|
+
styleBlock = `
|
|
1378
|
+
:host {
|
|
1379
|
+
--emw-skeleton-text-width: ${this.stylingValue.width};
|
|
1380
|
+
--emw-skeleton-text-height: ${this.stylingValue.height};
|
|
1381
|
+
--emw-skeleton-text-border-radius: ${this.stylingValue.borderRadius};
|
|
1382
|
+
--emw-skeleton-text-margin-bottom: ${this.stylingValue.marginBottom};
|
|
1383
|
+
--emw-skeleton-text-margin-top: ${this.stylingValue.marginTop};
|
|
1384
|
+
--emw-skeleton-text-margin-left: ${this.stylingValue.marginLeft};
|
|
1385
|
+
--emw-skeleton-text-margin-right: ${this.stylingValue.marginRight};
|
|
1386
|
+
}
|
|
1387
|
+
`;
|
|
1388
|
+
break;
|
|
1389
|
+
case 'rectangle':
|
|
1390
|
+
styleBlock = `
|
|
1391
|
+
:host {
|
|
1392
|
+
--emw-skeleton-rectangle-width: ${this.stylingValue.width};
|
|
1393
|
+
--emw-skeleton-rectangle-height: ${this.stylingValue.height};
|
|
1394
|
+
--emw-skeleton-rectangle-border-radius: ${this.stylingValue.borderRadius};
|
|
1395
|
+
--emw-skeleton-rectangle-margin-bottom: ${this.stylingValue.marginBottom};
|
|
1396
|
+
--emw-skeleton-rectangle-margin-top: ${this.stylingValue.marginTop};
|
|
1397
|
+
--emw-skeleton-rectangle-margin-left: ${this.stylingValue.marginLeft};
|
|
1398
|
+
--emw-skeleton-rectangle-margin-right: ${this.stylingValue.marginRight};
|
|
1399
|
+
}
|
|
1400
|
+
`;
|
|
1401
|
+
break;
|
|
1402
|
+
case 'circle':
|
|
1403
|
+
styleBlock = `
|
|
1404
|
+
:host {
|
|
1405
|
+
--emw-skeleton-circle-size: ${this.stylingValue.size};
|
|
1406
|
+
}
|
|
1407
|
+
`;
|
|
1408
|
+
break;
|
|
1409
|
+
default:
|
|
1410
|
+
styleBlock = '';
|
|
1411
|
+
}
|
|
1412
|
+
return (index.h(index.Host, { key: 'c2a2650acd416962a2bc4e1a7ee18bc6d8e2def8' }, index.h("style", { key: '9bd7fc1f9e9ed9f17735a7b72fce6f09696f5e19' }, styleBlock), this.handleStructure(this.structure)));
|
|
1413
|
+
}
|
|
1414
|
+
static get watchers() { return {
|
|
1415
|
+
"structure": ["handleStructureChange"]
|
|
1416
|
+
}; }
|
|
1417
|
+
};
|
|
1418
|
+
UiSkeleton.style = UiSkeletonStyle0;
|
|
1419
|
+
|
|
1420
|
+
exports.lottery_hakuna_ticket_history = lotteryHakunaTicketHistory.LotteryHakunaTicketHistory;
|
|
1421
|
+
exports.lottery_button = LotteryButton;
|
|
1422
|
+
exports.lottery_hakuna_ticket_history_item = LotteryHakunaTicketHistoryItem;
|
|
1423
|
+
exports.lottery_infinite_scroll = LotteryInfiniteScroll;
|
|
1424
|
+
exports.lottery_selection = LotterySelection;
|
|
1425
|
+
exports.lottery_selection_group = LotterySelectionGroup;
|
|
1426
|
+
exports.lottery_tipping_dialog = LotteryTippingDialog;
|
|
1427
|
+
exports.ui_skeleton = UiSkeleton;
|