@everymatrix/bonus-elevate-shop-item 1.94.52 → 1.94.54
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/bonus-elevate-shop-item/bonus-elevate-shop-assets-slider_5.entry.js +1 -0
- package/dist/bonus-elevate-shop-item/bonus-elevate-shop-item.esm.js +1 -1
- package/dist/cjs/bonus-elevate-shop-assets-slider_5.cjs.entry.js +918 -0
- package/dist/cjs/bonus-elevate-shop-item.cjs.js +1 -1
- package/dist/cjs/index-ad2fddb6.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/bonus-elevate-shop-item/bonus-elevate-shop-assets-slider.js +5 -5
- package/dist/collection/components/bonus-elevate-shop-item/bonus-elevate-shop-item.css +92 -1
- package/dist/collection/components/bonus-elevate-shop-item/bonus-elevate-shop-item.js +85 -4
- package/dist/collection/utils/locale.utils.js +1 -0
- package/dist/esm/bonus-elevate-shop-assets-slider_5.entry.js +910 -0
- package/dist/esm/bonus-elevate-shop-item.js +1 -1
- package/dist/esm/index-fca048d8.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/bonus-elevate-shop-item/.stencil/libs/common/src/types/casino/tournaments.d.ts +111 -0
- package/dist/types/components/bonus-elevate-shop-item/bonus-elevate-shop-item.d.ts +11 -0
- package/dist/types/models/bonus-elevate-shop-item.d.ts +1 -0
- package/package.json +1 -1
- package/dist/bonus-elevate-shop-item/bonus-elevate-shop-assets-slider_3.entry.js +0 -1
- package/dist/cjs/bonus-elevate-shop-assets-slider_3.cjs.entry.js +0 -600
- package/dist/esm/bonus-elevate-shop-assets-slider_3.entry.js +0 -594
|
@@ -0,0 +1,910 @@
|
|
|
1
|
+
import { r as registerInstance, h, g as getElement, c as createEvent, F as Fragment, H as Host } from './index-fca048d8.js';
|
|
2
|
+
|
|
3
|
+
const BonusElevateShopAssetsSlider = class {
|
|
4
|
+
constructor(hostRef) {
|
|
5
|
+
registerInstance(this, hostRef);
|
|
6
|
+
this.xDown = null;
|
|
7
|
+
this.yDown = null;
|
|
8
|
+
this.orientationChangeHandler = () => {
|
|
9
|
+
setTimeout(() => {
|
|
10
|
+
this.recalculateItemsPerPage();
|
|
11
|
+
}, 10);
|
|
12
|
+
};
|
|
13
|
+
this.resizeHandler = () => {
|
|
14
|
+
this.recalculateItemsPerPage();
|
|
15
|
+
};
|
|
16
|
+
this.showSliderDots = false;
|
|
17
|
+
this.showSliderArrows = true;
|
|
18
|
+
this.itemsPerPage = 1;
|
|
19
|
+
this.sliderItems = [];
|
|
20
|
+
this.activeIndex = 0;
|
|
21
|
+
}
|
|
22
|
+
setActive(index) {
|
|
23
|
+
var _a;
|
|
24
|
+
const maxLength = (_a = this.sliderItems) === null || _a === void 0 ? void 0 : _a.length;
|
|
25
|
+
if (index >= 0) {
|
|
26
|
+
if (index >= maxLength - 1) {
|
|
27
|
+
this.activeIndex = maxLength - 1;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
this.activeIndex = index;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this.activeIndex = 0;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
move(direction) {
|
|
38
|
+
this.setActive(this.activeIndex + direction);
|
|
39
|
+
}
|
|
40
|
+
goTo(index) {
|
|
41
|
+
let diff = this.activeIndex - index;
|
|
42
|
+
if (diff > 0) {
|
|
43
|
+
for (let i = 0; i < diff; i++) {
|
|
44
|
+
this.move(-1);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
for (let i = 0; i > diff; i--) {
|
|
49
|
+
this.move(1);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
handleTouchStart(evt) {
|
|
54
|
+
const firstTouch = this.getTouches(evt)[0];
|
|
55
|
+
this.xDown = firstTouch.clientX;
|
|
56
|
+
this.yDown = firstTouch.clientY;
|
|
57
|
+
}
|
|
58
|
+
getTouches(evt) {
|
|
59
|
+
return evt.touches || evt.originalEvent.touches;
|
|
60
|
+
}
|
|
61
|
+
handleTouchMove(evt) {
|
|
62
|
+
if (!this.xDown || !this.yDown)
|
|
63
|
+
return;
|
|
64
|
+
let xUp = evt.touches[0].clientX;
|
|
65
|
+
let yUp = evt.touches[0].clientY;
|
|
66
|
+
let xDiff = this.xDown - xUp;
|
|
67
|
+
let yDiff = this.yDown - yUp;
|
|
68
|
+
if (Math.abs(xDiff) > Math.abs(yDiff)) {
|
|
69
|
+
if (xDiff > 0) {
|
|
70
|
+
this.move(1);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
this.move(-1);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
this.xDown = null;
|
|
77
|
+
this.yDown = null;
|
|
78
|
+
}
|
|
79
|
+
;
|
|
80
|
+
recalculateItemsPerPage() {
|
|
81
|
+
if (!this.sliderItemsElement)
|
|
82
|
+
return;
|
|
83
|
+
this.itemElementWidth = this.sliderItemsElement.clientWidth;
|
|
84
|
+
this.sliderItemsElementWidth = (this.sliderItems.length - 1) * this.itemElementWidth;
|
|
85
|
+
}
|
|
86
|
+
;
|
|
87
|
+
renderDots() {
|
|
88
|
+
var _a;
|
|
89
|
+
const dots = [];
|
|
90
|
+
for (let index = 0; index < ((_a = this.sliderItems) === null || _a === void 0 ? void 0 : _a.length) / this.itemsPerPage; index++) {
|
|
91
|
+
dots.push(h("li", { class: index == this.activeIndex ? 'active' : 'default', onClick: () => { this.goTo(index); this.setActive(index); } }));
|
|
92
|
+
}
|
|
93
|
+
return dots;
|
|
94
|
+
}
|
|
95
|
+
componentDidRender() {
|
|
96
|
+
this.el.addEventListener('touchstart', this.handleTouchStart.bind(this), { passive: true });
|
|
97
|
+
this.el.addEventListener('touchmove', this.handleTouchMove.bind(this), { passive: true });
|
|
98
|
+
this.recalculateItemsPerPage();
|
|
99
|
+
}
|
|
100
|
+
componentDidUpdate() {
|
|
101
|
+
this.recalculateItemsPerPage();
|
|
102
|
+
}
|
|
103
|
+
connectedCallback() {
|
|
104
|
+
window.screen.orientation.addEventListener('change', this.orientationChangeHandler);
|
|
105
|
+
}
|
|
106
|
+
disconnectedCallback() {
|
|
107
|
+
this.el.removeEventListener('touchstart', this.handleTouchStart);
|
|
108
|
+
this.el.removeEventListener('touchmove', this.handleTouchMove);
|
|
109
|
+
window.screen.orientation.removeEventListener('change', this.orientationChangeHandler);
|
|
110
|
+
window.removeEventListener('resize', this.resizeHandler);
|
|
111
|
+
}
|
|
112
|
+
render() {
|
|
113
|
+
var _a;
|
|
114
|
+
const styles = {
|
|
115
|
+
transform: `translate(${(this.sliderItemsElementWidth / (((_a = this.sliderItems) === null || _a === void 0 ? void 0 : _a.length) - 1) * this.activeIndex) * -1}px, 0px)`
|
|
116
|
+
};
|
|
117
|
+
const itemStyle = {
|
|
118
|
+
width: `${this.itemElementWidth / this.itemsPerPage}px`
|
|
119
|
+
};
|
|
120
|
+
return h("div", { key: '740222cee57f5759854860f015dd900c1cb66f80', class: "SliderWrapper" }, h("div", { key: '6d8971425bc1fc42bc4e64331b0c5f21d4ed1c40', class: 'MainContent ' }, this.showSliderArrows &&
|
|
121
|
+
h("div", { key: '1db77bb5cd7dfb6d5e06a4f42a33ff435f9eb224', class: `SliderNavButton LeftArrow ${this.activeIndex === 0 ? 'DisabledArrow ' : ''} ${this.sliderItems.length === 1 ? 'HiddenArrow ' : ''}`, onClick: () => this.move(-1) }, h("svg", { key: 'e406abe6d9d44ab3809322d2f0699ea3ee372b0f', fill: "none", stroke: "var(--emw--color-secondary, #FD2839)", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, h("path", { key: 'a8ee39ea455a06058466e03755582fbd07391514', "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M15 19l-7-7 7-7" }))), h("div", { key: 'a2681048af708d96aa6886db7b6b94639a650a26', class: 'ItemsWrapper', ref: (el) => this.sliderItemsElement = el }, h("div", { key: 'be1c762012144756bda71a46302dfe0954bc6add', class: 'Items AssetsItems', style: styles }, this.sliderItems.map((assetUrl) => h("img", { class: `img${this.itemsPerPage}`, alt: 'Gift Thumbnails', style: itemStyle, src: assetUrl })))), this.showSliderArrows &&
|
|
122
|
+
h("div", { key: '927367a3bbc674cc953eccc3359639381423d0a4', class: `SliderNavButton RightArrow ${this.sliderItems.length === 1 ? 'HiddenArrow ' : ''}
|
|
123
|
+
${(this.activeIndex === (this.sliderItems.length - 1) || this.itemsPerPage == this.sliderItems.length) ? 'DisabledArrow' : ''}`, onClick: () => this.move(1) }, h("svg", { key: 'd84e6e3011f8609f1ded47098bb28333f352f430', fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, h("path", { key: 'f05768932ee5e8fb74b6b1016612320d0e4ed737', "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M9 5l7 7-7 7" })))), this.showSliderDots && this.sliderItems.length > 1 &&
|
|
124
|
+
h("div", { key: 'a08098a90c717ccceda93cd741cb65521a83df9b', class: "DotsWrapper" }, h("ul", { key: '8c873c229c603b4aca57e277f74cdf3d2192c01b', class: "Dots" }, this.renderDots())));
|
|
125
|
+
}
|
|
126
|
+
get el() { return getElement(this); }
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
130
|
+
const TRANSLATIONS = {
|
|
131
|
+
en: {
|
|
132
|
+
coins: 'Coins',
|
|
133
|
+
noGiftPresentation: 'No description',
|
|
134
|
+
redeemGift: 'Redeem Gift',
|
|
135
|
+
noDataFound: 'No data found',
|
|
136
|
+
error4003: 'Invalid Session',
|
|
137
|
+
redeemFailed: 'Failed to redeem',
|
|
138
|
+
back: 'Back',
|
|
139
|
+
games: 'Games'
|
|
140
|
+
},
|
|
141
|
+
tr: {
|
|
142
|
+
coins: 'Coin',
|
|
143
|
+
noGiftPresentation: 'Açıklama yok',
|
|
144
|
+
redeemGift: 'Hediye Al',
|
|
145
|
+
noDataFound: 'Veri bulunamadı',
|
|
146
|
+
error4003: 'Geçersiz Oturum',
|
|
147
|
+
redeemFailed: 'Kullanım başarısız',
|
|
148
|
+
back: 'Geri',
|
|
149
|
+
},
|
|
150
|
+
ro: {
|
|
151
|
+
coins: 'Coins',
|
|
152
|
+
noGiftPresentation: 'No description',
|
|
153
|
+
redeemGift: 'Redeem Gift',
|
|
154
|
+
noDataFound: 'No data found',
|
|
155
|
+
error4003: 'Invalid Session',
|
|
156
|
+
redeemFailed: 'Failed to redeem',
|
|
157
|
+
back: 'Back',
|
|
158
|
+
},
|
|
159
|
+
fr: {
|
|
160
|
+
coins: 'Coins',
|
|
161
|
+
noGiftPresentation: 'No description',
|
|
162
|
+
redeemGift: 'Redeem Gift',
|
|
163
|
+
noDataFound: 'No data found',
|
|
164
|
+
error4003: 'Invalid Session',
|
|
165
|
+
redeemFailed: 'Failed to redeem',
|
|
166
|
+
back: 'Back',
|
|
167
|
+
},
|
|
168
|
+
ar: {
|
|
169
|
+
coins: 'Coins',
|
|
170
|
+
noGiftPresentation: 'No description',
|
|
171
|
+
redeemGift: 'Redeem Gift',
|
|
172
|
+
noDataFound: 'No data found',
|
|
173
|
+
error4003: 'Invalid Session',
|
|
174
|
+
redeemFailed: 'Failed to redeem',
|
|
175
|
+
back: 'Back',
|
|
176
|
+
},
|
|
177
|
+
hu: {
|
|
178
|
+
coins: 'Coins',
|
|
179
|
+
noGiftPresentation: 'No description',
|
|
180
|
+
redeemGift: 'Redeem Gift',
|
|
181
|
+
noDataFound: 'No data found',
|
|
182
|
+
error4003: 'Invalid Session',
|
|
183
|
+
redeemFailed: 'Failed to redeem',
|
|
184
|
+
back: 'Back',
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
const translate = (key, customLang) => {
|
|
188
|
+
const lang = customLang ? customLang : DEFAULT_LANGUAGE;
|
|
189
|
+
return TRANSLATIONS[lang][key] || TRANSLATIONS[DEFAULT_LANGUAGE][key];
|
|
190
|
+
};
|
|
191
|
+
const getTranslations = (url) => {
|
|
192
|
+
// fetch url, get the data, replace the TRANSLATIONS content
|
|
193
|
+
return new Promise((resolve) => {
|
|
194
|
+
fetch(url)
|
|
195
|
+
.then((res) => res.json())
|
|
196
|
+
.then((data) => {
|
|
197
|
+
Object.keys(data).forEach((item) => {
|
|
198
|
+
TRANSLATIONS[item] = TRANSLATIONS[item] || {};
|
|
199
|
+
for (let key in data[item]) {
|
|
200
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
resolve(true);
|
|
204
|
+
}).catch((err) => {
|
|
205
|
+
console.error("Failed to load translations:", err);
|
|
206
|
+
resolve(false);
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* @name isMobile
|
|
213
|
+
* @description A method that returns if the browser used to access the app is from a mobile device or not
|
|
214
|
+
* @param {String} userAgent window.navigator.userAgent
|
|
215
|
+
* @returns {Boolean} true or false
|
|
216
|
+
*/
|
|
217
|
+
const getDevice = () => {
|
|
218
|
+
let userAgent = window.navigator.userAgent;
|
|
219
|
+
if (userAgent.toLowerCase().match(/android/i)) {
|
|
220
|
+
return 'Android';
|
|
221
|
+
}
|
|
222
|
+
if (userAgent.toLowerCase().match(/iphone/i)) {
|
|
223
|
+
return 'iPhone';
|
|
224
|
+
}
|
|
225
|
+
if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
|
|
226
|
+
return 'iPad';
|
|
227
|
+
}
|
|
228
|
+
return 'PC';
|
|
229
|
+
};
|
|
230
|
+
const getDevicePlatform = () => {
|
|
231
|
+
const device = getDevice();
|
|
232
|
+
if (device) {
|
|
233
|
+
if (device === 'PC') {
|
|
234
|
+
return 'dk';
|
|
235
|
+
}
|
|
236
|
+
else if (device === 'iPad' || device === 'iPhone') {
|
|
237
|
+
return 'ios';
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
return 'mtWeb';
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
const bonusElevateShopItemCss = ":host{display:block;--game-amount-per-line:6}.ElevateDetails{display:flex;flex-direction:row;padding:10px;width:calc(100% - 20px);}.ElevateDetails .RedeemError{display:none}.ElevateDetails .Error{color:var(--emw--color-error, #FD2839)}.ElevateDetails .Row{flex-direction:row;display:flex}.ElevateDetails .Col{flex-direction:column;display:flex}.ElevateDetails .Details{padding:20px}.ElevateDetails .ThumbnailRow{display:flex;flex-direction:column;justify-content:space-between;min-width:268px;max-width:398px}.ElevateDetails .ThumbnailRow .BackButton{width:100px;height:20px;padding:5px;background:white;box-shadow:0px 4px 40px 0px rgba(138, 149, 158, 0.2);margin:10px 0 10px;cursor:pointer;animation-timing-function:ease-out;animation-duration:300ms;transition-property:all;border:1px solid #e4e6e8;border-radius:5px;text-align:center}.ElevateDetails .ThumbnailRow .BackButton:hover{background:rgb(227, 222, 222)}.ElevateDetails .ThumbnailRow .Thumbnails{display:flex;flex-direction:column;position:relative;width:calc(100% - 40px)}.ElevateDetails .ShopItemDetail{flex-grow:1;min-width:300px;display:flex;flex-direction:column;justify-content:space-between}.ElevateDetails .GiftPoints .Points{font-size:21px}.ElevateDetails .GiftPoints .PointsLabel{font-size:12px;color:var(--emw--color-gray-300, rgb(78, 90, 55));font-weight:400;line-height:29px;letter-spacing:0.04em;text-align:left}.ElevateDetails .RedeemButton{width:150px;padding:5px 0px;border:2px solid var(--emw--button-border-color, rgba(8, 59, 23, 0.1098039216));text-align:center;color:var(--emw--button-typography, var(--emw--color-white, #FFFFFF));font-size:var(--emw--font-size-small, 12px);font-weight:var(--emw--font-weight-bold, 700);line-height:var(--emw--font-size-medium, 14px);text-transform:uppercase;border-radius:var(--emw--border-radius-medium, 10px)}.ElevateDetails .RedeemButton.active{background:var(--emw--color-primary, #18CE51)}.ElevateDetails .RedeemButton.active:hover{background:var(--mmw--color-main-button-hover, #24B24E)}.ElevateDetails .RedeemButton.deactive,.ElevateDetails .RedeemButton.disabled{background:var(--mmw--color-disabled, rgba(153, 153, 153, 0.5019607843))}.ElevateDetails .SliderWrapper{display:flex;flex-direction:column;position:relative;width:calc(100% - 40px)}.ElevateDetails .SliderWrapper .MainContent{display:flex;flex-direction:row;justify-content:space-around}.ElevateDetails .SliderWrapper .MainContent .LeftArrow,.ElevateDetails .SliderWrapper .MainContent .RightArrow{width:20px}.ElevateDetails .SliderWrapper .MainContent .ItemsWrapper{overflow:hidden;display:inline-flex;width:calc(100% - 40px);flex-direction:column}.ElevateDetails .SliderWrapper .MainContent .ItemsWrapper .Items{display:inline-flex;transition:transform 0.4s ease-in-out;transform:translateX(0px);margin:auto}.ElevateDetails .SliderWrapper .MainContent .ItemsWrapper img.img2{width:50%}.ElevateDetails .SliderWrapper .MainContent .ItemsWrapper img.img3{width:30%}.ElevateDetails .SliderWrapper .MainContent .ItemsWrapper img,.ElevateDetails .SliderWrapper .MainContent .ItemsWrapper img.img1{max-width:100%;background:rgb(239, 239, 239);border:1px solid rgb(239, 239, 239);border-radius:18px;border:1px;margin:10px 0 10px}.ElevateDetails .SliderWrapper .DotsWrapper{width:100%;margin:0 auto;height:30px}.ElevateDetails .SliderWrapper .DotsWrapper ul.Dots{display:flex;justify-content:center;padding:0}.ElevateDetails .SliderWrapper .DotsWrapper ul.Dots li{height:10px;width:10px;background:#ccc;border-radius:50%;margin-left:3px;margin-right:3px;list-style:none;cursor:pointer}.ElevateDetails .SliderWrapper .DotsWrapper ul.Dots li:hover{background:#bbb}.ElevateDetails .SliderWrapper .DotsWrapper ul.Dots li.active{border:solid 1px var(--emw--color-secondary, #FD2839);background:var(--emw--color-secondary, #FD2839)}.ElevateDetails .SliderWrapper .DotsWrapper ul.Dots li.default{border:solid 1px var(--emw--color-secondary, #FD2839);background-color:#FFF}.ElevateDetails .SliderNavButton{border:0px;width:25px;display:flex;align-items:center;justify-content:center;cursor:pointer}.ElevateDetails .SliderNavButton.HiddenArrow{visibility:hidden}.ElevateDetails .SliderNavButton svg{width:20px;stroke:var(--emw--color-secondary, #FD2839)}.ElevateDetails .DisabledArrow svg{opacity:0.2;stroke:var(--emw--color-secondary, #FD2839);pointer-events:none}.GamesContent{margin:20px;padding:15px;min-height:500px;flex:1;gap:12px;display:flex;flex-direction:column;border-radius:8px;border:2px solid var(--emw--color-powup-light-green-0D, rgba(188, 252, 177, 0.0509803922))}.GamesContent .GamesTitle{display:flex;flex-direction:row}.GamesContent .GamesTitle .Title2{text-transform:capitalize}.GamesContent .GamesTitle .GamesAmount{opacity:0.8}.GamesContent .GameTitleTip{color:var(--emw--color-powup-gray-green, #C8D6CE);font-size:0.8rem}.GamesContent .GamesList{display:flex;justify-content:center;width:100%;max-height:300px;flex:1;overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--emw--background-gray-color, gray) transparent}.GamesContent .GamesList::-webkit-scrollbar-track{background-color:transparent;border-radius:5px}.GamesContent .GamesList .Games{width:100%;padding:0;display:flex;align-items:flex-start;justify-content:flex-start;flex-wrap:wrap;gap:calc(30px / (var(--game-amount-per-line) - 1))}.GamesContent .GamesList .Games .Game{width:calc((100% - 30px) / var(--game-amount-per-line));cursor:pointer;position:relative}.GamesContent .GamesList .Games .Game .GameMask{transition:opacity;transition-duration:0.2s;opacity:0;position:absolute;width:70%;height:100%}.GamesContent .GamesList .Games .Game:hover .mask-filter{opacity:1}.GamesContent .GamesList .Games .Game:hover img{opacity:0.4;filter:blur(1.5px)}.GamesContent .GamesList .Games .Game:hover .GameMask{opacity:1;mix-blend-mode:screen;background-color:var(--emw--color-powup-green, #24B24E);display:flex;justify-content:center;align-items:center;position:absolute;width:100%;left:0;height:100%;top:0;border-radius:8px}.GamesContent .GamesList .Games .Game:hover .GameMask .PlayBtn{border:2px solid var(--emw--color-powup-gray, #f0f0f0);padding:5px 3px;border-radius:3px}";
|
|
246
|
+
const BonusElevateShopItemStyle0 = bonusElevateShopItemCss;
|
|
247
|
+
|
|
248
|
+
const BonusElevateShopItem = class {
|
|
249
|
+
constructor(hostRef) {
|
|
250
|
+
registerInstance(this, hostRef);
|
|
251
|
+
this.redeemGiftButton = createEvent(this, "redeemGiftButton", 7);
|
|
252
|
+
this.bindedHandler = this.handleMessage.bind(this);
|
|
253
|
+
this.deviceType = getDevicePlatform();
|
|
254
|
+
this.powerUpGameSearchConditions = {
|
|
255
|
+
expand: "games",
|
|
256
|
+
fields: "powerUpID,games(id,gameId,slug,name,thumbnail)"
|
|
257
|
+
};
|
|
258
|
+
this.endpoint = undefined;
|
|
259
|
+
this.language = 'en';
|
|
260
|
+
this.itemId = undefined;
|
|
261
|
+
this.elevateGift = undefined;
|
|
262
|
+
this.session = undefined;
|
|
263
|
+
this.mbSource = undefined;
|
|
264
|
+
this.clientStyling = '';
|
|
265
|
+
this.clientStylingUrl = '';
|
|
266
|
+
this.translationUrl = '';
|
|
267
|
+
this.showSliderDots = false;
|
|
268
|
+
this.showSliderArrows = true;
|
|
269
|
+
this.isGiftNotFound = false;
|
|
270
|
+
this.redeemErrorMsg = '';
|
|
271
|
+
this.isRedeeming = false;
|
|
272
|
+
this.powerUpGames = undefined;
|
|
273
|
+
this.isLoadingGames = false;
|
|
274
|
+
}
|
|
275
|
+
redeemGiftConfirm() {
|
|
276
|
+
if (this.isRedeeming || this.elevateGift.available != 'true') {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
window.postMessage({ type: 'BEERedeemConfirm', shopItem: this.elevateGift }, window.location.href);
|
|
280
|
+
}
|
|
281
|
+
handleMessage(message) {
|
|
282
|
+
if (message.data && message.data.type === "bee-redeem-confirmed" &&
|
|
283
|
+
message.data.id == this.elevateGift.id) {
|
|
284
|
+
this.redeemGift();
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
onBackClicked() {
|
|
288
|
+
window.postMessage({ type: 'OnGiftDetailsBackButtonClicked' }, window.location.href);
|
|
289
|
+
}
|
|
290
|
+
redeemGift() {
|
|
291
|
+
if (this.elevateGift.available.toLowerCase() === 'false' || this.isRedeeming) {
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
let url = new URL(`${this.endpoint}/v1/elevate/redeem`);
|
|
295
|
+
let claimGiftOptions = {
|
|
296
|
+
method: 'PUT',
|
|
297
|
+
headers: {
|
|
298
|
+
'x-SessionId': this.session,
|
|
299
|
+
'Content-Type': 'application/json-patch+json',
|
|
300
|
+
},
|
|
301
|
+
body: JSON.stringify({ giftId: this.elevateGift.id }),
|
|
302
|
+
};
|
|
303
|
+
this.redeemErrorMsg = '';
|
|
304
|
+
this.isRedeeming = true;
|
|
305
|
+
fetch(url.toString(), claimGiftOptions)
|
|
306
|
+
.then((res) => res.json())
|
|
307
|
+
.then((res) => {
|
|
308
|
+
if (res.success) {
|
|
309
|
+
this.redeemGiftButton.emit();
|
|
310
|
+
window.postMessage({ type: 'BEEGiftRedeem', itemId: this.elevateGift.id }, window.location.href);
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
let translatedError = translate(`error${res.errorCode}`, this.language);
|
|
314
|
+
this.redeemErrorMsg = translatedError ? translatedError : translate('redeemFailed', this.language);
|
|
315
|
+
window.postMessage({ type: 'BEEGiftRedeemFailed', itemId: this.elevateGift.id, res }, window.location.href);
|
|
316
|
+
}
|
|
317
|
+
})
|
|
318
|
+
.catch((err) => {
|
|
319
|
+
window.postMessage({ type: 'BEEGiftClaimFailed', itemId: this.elevateGift.id, err }, window.location.href);
|
|
320
|
+
}).finally(() => {
|
|
321
|
+
this.isRedeeming = false;
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
async loadElevateGift() {
|
|
325
|
+
let url = new URL(`${this.endpoint}/v1/elevate/shop?language=${this.language}&filter=id=${this.itemId}`);
|
|
326
|
+
let options = {
|
|
327
|
+
headers: {
|
|
328
|
+
'Content-Type': 'application/json',
|
|
329
|
+
'x-SessionId': this.session,
|
|
330
|
+
},
|
|
331
|
+
method: 'GET',
|
|
332
|
+
};
|
|
333
|
+
await new Promise((resolve) => {
|
|
334
|
+
fetch(url.href, options)
|
|
335
|
+
.then((res) => res.json())
|
|
336
|
+
.then((data) => {
|
|
337
|
+
let filteredGifts = data.data;
|
|
338
|
+
if (filteredGifts && filteredGifts.length == 1) {
|
|
339
|
+
this.elevateGift = filteredGifts[0];
|
|
340
|
+
if (this.elevateGift.type === 'powerUp' && this.elevateGift.powerUpID) {
|
|
341
|
+
this.loadMoreGames();
|
|
342
|
+
}
|
|
343
|
+
this.isGiftNotFound = false;
|
|
344
|
+
}
|
|
345
|
+
else {
|
|
346
|
+
this.isGiftNotFound = true;
|
|
347
|
+
}
|
|
348
|
+
resolve(true);
|
|
349
|
+
});
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
async loadMoreGames() {
|
|
353
|
+
var _a, _b, _c, _d, _e;
|
|
354
|
+
if (this.isLoadingGames || (((_a = this.powerUpGames) === null || _a === void 0 ? void 0 : _a.total) > 0 && ((_b = this.powerUpGames) === null || _b === void 0 ? void 0 : _b.items.length) >= ((_c = this.powerUpGames) === null || _c === void 0 ? void 0 : _c.total))) {
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
this.isLoadingGames = true;
|
|
358
|
+
try {
|
|
359
|
+
const url = new URL(`${this.endpoint}/v1/elevate/powerups/available?pagination=games(limit=20,offset=${((_d = this.powerUpGames) === null || _d === void 0 ? void 0 : _d.items.length) || 0})`);
|
|
360
|
+
const options = {
|
|
361
|
+
headers: { 'x-SessionId': this.session },
|
|
362
|
+
};
|
|
363
|
+
url.searchParams.append('filter', `id=${this.elevateGift.powerUpID}`);
|
|
364
|
+
Object.entries(this.powerUpGameSearchConditions).forEach(([key, value]) => {
|
|
365
|
+
url.searchParams.append(key, value);
|
|
366
|
+
});
|
|
367
|
+
const response = await fetch(url.toString(), options);
|
|
368
|
+
if (!response.ok) {
|
|
369
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
370
|
+
}
|
|
371
|
+
const { data } = await response.json();
|
|
372
|
+
const fetchedPowerUp = data === null || data === void 0 ? void 0 : data[0];
|
|
373
|
+
if ((_e = fetchedPowerUp === null || fetchedPowerUp === void 0 ? void 0 : fetchedPowerUp.games) === null || _e === void 0 ? void 0 : _e.items) {
|
|
374
|
+
if (!this.powerUpGames) {
|
|
375
|
+
this.powerUpGames = fetchedPowerUp.games;
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
this.powerUpGames.items = [...this.powerUpGames.items, ...fetchedPowerUp.games.items];
|
|
379
|
+
}
|
|
380
|
+
this.powerUpGames = Object.assign({}, this.powerUpGames);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
catch (error) {
|
|
384
|
+
console.error('Failed to load more games:', error);
|
|
385
|
+
}
|
|
386
|
+
finally {
|
|
387
|
+
this.isLoadingGames = false;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
initializeGamesObserver() {
|
|
391
|
+
if (this.loadMoreGamesObserver) {
|
|
392
|
+
this.loadMoreGamesObserver.disconnect();
|
|
393
|
+
}
|
|
394
|
+
this.loadMoreGamesObserver = new IntersectionObserver((entries) => {
|
|
395
|
+
entries.forEach((entry) => {
|
|
396
|
+
if (entry.isIntersecting) {
|
|
397
|
+
this.loadMoreGames();
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
});
|
|
401
|
+
if (this.lastGameElement) {
|
|
402
|
+
this.loadMoreGamesObserver.observe(this.lastGameElement);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
onGameClick(game) {
|
|
406
|
+
window.postMessage({ type: 'EngagementSuiteGameRedirect', data: { Slug: game.slug } });
|
|
407
|
+
}
|
|
408
|
+
disconnectedCallback() {
|
|
409
|
+
window.removeEventListener('message', this.bindedHandler, false);
|
|
410
|
+
if (this.loadMoreGamesObserver) {
|
|
411
|
+
this.loadMoreGamesObserver.disconnect();
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
componentDidLoad() {
|
|
415
|
+
window.addEventListener('message', this.bindedHandler, false);
|
|
416
|
+
}
|
|
417
|
+
async componentWillLoad() {
|
|
418
|
+
if (this.translationUrl.length > 2) {
|
|
419
|
+
await getTranslations(this.translationUrl);
|
|
420
|
+
}
|
|
421
|
+
if (this.elevateGift) {
|
|
422
|
+
this.isGiftNotFound = false;
|
|
423
|
+
}
|
|
424
|
+
else {
|
|
425
|
+
await this.loadElevateGift();
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
componentDidUpdate() {
|
|
429
|
+
var _a, _b;
|
|
430
|
+
if (((_a = this.powerUpGames) === null || _a === void 0 ? void 0 : _a.items.length) < ((_b = this.powerUpGames) === null || _b === void 0 ? void 0 : _b.total)) {
|
|
431
|
+
this.initializeGamesObserver();
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
render() {
|
|
435
|
+
var _a, _b, _c;
|
|
436
|
+
return (h(Host, { key: '02194284778bc18ed94c17ee0c4a682da0c9935e' }, h("general-styling-wrapper", { key: '3109c90669d039df0aa7caf8dac48ca7576b1db2', clientStylingUrl: this.clientStylingUrl, clientStyling: this.clientStyling, mbSource: this.mbSource }), h("div", { key: 'aa8fa9853ff3f0c50cf055f622640f187138531b', class: 'ElevateDetails' }, this.isGiftNotFound && (h(Fragment, { key: '1ff8d0e249663ea5f2ee0de06d406f962f973493' }, h("div", { key: '5575275bd24e74a530ffd2b8b17045f7b0daed7c', class: "Row ThumbnailRow" }, h("div", { key: '501b117a2c493750deb056ecf8f8614351c0fac2', class: "BackButton", onClick: () => {
|
|
437
|
+
this.onBackClicked();
|
|
438
|
+
} }, h("span", { key: '556a1ece3c4b8398277ad996ed58d0d84db0f7b4', class: "BackArrow", innerHTML: "<" }), h("span", { key: '43f9a46fe32710cc7d05e953475088f049999791', class: "BackTxt" }, " ", translate('back', this.language), " "))), h("div", { key: 'ba220234e040ed863b3bbc1960b54ced43fe4303', class: "Thumnails GiftNotFound" }, translate('noDataFound', this.language), "."))), this.elevateGift && h(Fragment, { key: 'e1f7f2dfd7d80da3fafdc5edd8d8686522509893' }, h("div", { key: '4a8f3ee47e7ef7bd87eafa5ebdd3346b523f13fd', class: "ThumbnailRow" }, h("div", { key: 'd8dcab9b4b3d4963cd4ef7904caca9e1df3a6e88', class: 'Row' }, h("div", { key: '6368dc35f95a2202cc38c5dc05bdf6f6d83fce55', class: "BackButton", onClick: () => { this.onBackClicked(); } }, h("span", { key: '64f67312085b9216b42cb61a9ee7ea780058856d', class: "BackArrow", innerHTML: "<" }), h("span", { key: '4e5d8bdec62fe9e32cb839e3904113449e4d4c0c', class: "BackTxt" }, " ", translate('back', this.language), " ")), h("bonus-elevate-shop-assets-slider", { key: '0b9e8164653ec6a7c8b9d1d260ed44ca641f0726', class: 'Thumbnails', itemsPerPage: 1, sliderItems: this.elevateGift.presentation.assets, showSliderDots: this.showSliderDots })), h("div", { key: 'd911392a0ce5afac58cdf26046d80cfdaf7c1793', class: 'Col Details' }, h("h3", { key: '273ff2eb682767a5429dc99642b1c166921cb1dc', class: "GiftName" }, this.elevateGift.presentation.displayName || this.elevateGift.displayName), h("div", { key: '459bcb83df4dc907bb7cc9757a86c88b39ca4905', class: "GiftPoints" }, h("span", { key: '3648c21ea2133c6a3050f2417449ab046e51c04b', class: "Points" }, this.elevateGift.points, " "), h("span", { key: '8b6665da119f9dd777644592cc2815fc77dffda1', class: " PointsLabel" }, translate('coins', this.language))))), h("div", { key: '6e9a28dd26368897ddfd76032ce1e3882a886a5b', class: 'ShopItemDetail Details' }, h("div", { key: 'd2844066fe51e4b3d43689406879e1306d494f0a', class: "GiftPresentation" }, h("p", { key: '12f8bce3abf0df34657392e95aa8ddfb42d4c088' }, this.elevateGift.presentation.description ? this.elevateGift.presentation.description : translate('noGiftPresentation', this.language))), h("div", { key: '2b0cc39b8e53336355f1f5d0576a59bfd9859abf', class: 'BottomDetail' }, h("div", { key: '0eabb8f4ecb8236d78665110c835a0cf2689e864', class: `RedeemButton ${this.elevateGift.available === 'false' || this.isRedeeming ? 'Disabled deactive' : ' active '}
|
|
439
|
+
${this.deviceType == 'dk' ? 'DkButton' : ''}`, onClick: this.redeemGiftConfirm.bind(this) }, translate('redeemGift', this.language)), h("span", { key: '9773077b08f77bc2940519070053aee362f34e2a', class: 'RedeemError Error' }, " ", this.redeemErrorMsg, " "))))), ((_a = this.elevateGift) === null || _a === void 0 ? void 0 : _a.type) === 'powerUp' && this.powerUpGames && h("div", { key: 'ec880bb1c11a7fb485f4d7e80dce6e250f2b4e19', class: 'GamesContent' }, h("div", { key: 'a6dc572f4f5b6732ed6d29fad4c76fbf0415ca68', class: 'GamesTitle' }, h("span", { key: '2904186a96290683dbbcd06cfca99f48c616f6f1', class: 'Title2' }, " ", translate('games', this.language)), h("span", { key: '9c7f5fa7f0441721bc32aab10b07c3f7f2de91c4', class: 'GamesAmount' }, " ( ", ((_b = this.powerUpGames) === null || _b === void 0 ? void 0 : _b.total) || 0, " ) ")), h("div", { key: '4f465d62df13e07bf2d946416ed70cdd52591cbb', class: 'GamesList' }, h("div", { key: 'd23fc7b21125dd6467ad56cbd7d2ce03a579d689', class: 'Games' }, (_c = this.powerUpGames) === null || _c === void 0 ? void 0 : _c.items.map((g, index) => {
|
|
440
|
+
const isLastItem = index === this.powerUpGames.items.length - 1;
|
|
441
|
+
return h("div", { class: 'Game', ref: isLastItem ? (el) => (this.lastGameElement = el) : null }, h("ui-image", { src: g.thumbnail }), h("div", { class: 'GameMask', onClick: this.onGameClick.bind(this, g) }, h("span", { class: 'PlayBtn' }, "Start Now!")));
|
|
442
|
+
})), this.isLoadingGames && h("p", { key: '89e860b88abc15beda61b9989e5a82a9f445aadd' }, "Loading more games...")))));
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
BonusElevateShopItem.style = BonusElevateShopItemStyle0;
|
|
446
|
+
|
|
447
|
+
const mergeTranslations = (url, target) => {
|
|
448
|
+
return new Promise((resolve) => {
|
|
449
|
+
fetch(url)
|
|
450
|
+
.then((res) => res.json())
|
|
451
|
+
.then((data) => {
|
|
452
|
+
Object.keys(data).forEach((item) => {
|
|
453
|
+
target[item] = target[item] || {};
|
|
454
|
+
Object.keys(data[item]).forEach((key) => {
|
|
455
|
+
//if there is no key in target, do nothing
|
|
456
|
+
if (!target['en'][key]) {
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
const defaultTranslation = target['en'][key];
|
|
460
|
+
if (typeof data[item][key] === 'object') {
|
|
461
|
+
// if the key is not in target, then take from en
|
|
462
|
+
target[item][key] = target[item][key] || Object.assign({}, defaultTranslation);
|
|
463
|
+
Object.keys(data[item][key]).forEach((subKey) => {
|
|
464
|
+
target[item][key][subKey] = data[item][key][subKey];
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
else {
|
|
468
|
+
target[item][key] = data[item][key] || Object.assign({}, defaultTranslation);
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
});
|
|
472
|
+
resolve(true);
|
|
473
|
+
})
|
|
474
|
+
.catch(err => {
|
|
475
|
+
console.error("Failed to load translations:", err);
|
|
476
|
+
resolve(false);
|
|
477
|
+
});
|
|
478
|
+
});
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* @name setClientStyling
|
|
485
|
+
* @description Method used to create and append to the passed element of the widget a style element with the content received
|
|
486
|
+
* @param {HTMLElement} stylingContainer The reference element of the widget
|
|
487
|
+
* @param {string} clientStyling The style content
|
|
488
|
+
*/
|
|
489
|
+
function setClientStyling(stylingContainer, clientStyling) {
|
|
490
|
+
if (stylingContainer) {
|
|
491
|
+
const sheet = document.createElement('style');
|
|
492
|
+
sheet.innerHTML = clientStyling;
|
|
493
|
+
stylingContainer.appendChild(sheet);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* @name setClientStylingURL
|
|
499
|
+
* @description Method used to create and append to the passed element of the widget a style element with the content fetched from a given URL
|
|
500
|
+
* @param {HTMLElement} stylingContainer The reference element of the widget
|
|
501
|
+
* @param {string} clientStylingUrl The URL of the style content
|
|
502
|
+
*/
|
|
503
|
+
function setClientStylingURL(stylingContainer, clientStylingUrl) {
|
|
504
|
+
if (!stylingContainer || !clientStylingUrl) return;
|
|
505
|
+
|
|
506
|
+
const url = new URL(clientStylingUrl);
|
|
507
|
+
|
|
508
|
+
fetch(url.href)
|
|
509
|
+
.then((res) => res.text())
|
|
510
|
+
.then((data) => {
|
|
511
|
+
const cssFile = document.createElement('style');
|
|
512
|
+
cssFile.innerHTML = data;
|
|
513
|
+
if (stylingContainer) {
|
|
514
|
+
stylingContainer.appendChild(cssFile);
|
|
515
|
+
}
|
|
516
|
+
})
|
|
517
|
+
.catch((err) => {
|
|
518
|
+
console.error('There was an error while trying to load client styling from URL', err);
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* @name setStreamLibrary
|
|
524
|
+
* @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
|
|
525
|
+
* @param {HTMLElement} stylingContainer The highest element of the widget
|
|
526
|
+
* @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
|
|
527
|
+
* @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
|
|
528
|
+
* @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
|
|
529
|
+
*/
|
|
530
|
+
function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
|
|
531
|
+
if (!window.emMessageBus) return;
|
|
532
|
+
|
|
533
|
+
const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
|
|
534
|
+
|
|
535
|
+
if (!supportAdoptStyle || !useAdoptedStyleSheets) {
|
|
536
|
+
subscription = getStyleTagSubscription(stylingContainer, domain);
|
|
537
|
+
|
|
538
|
+
return subscription;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
if (!window[StyleCacheKey]) {
|
|
542
|
+
window[StyleCacheKey] = {};
|
|
543
|
+
}
|
|
544
|
+
subscription = getAdoptStyleSubscription(stylingContainer, domain);
|
|
545
|
+
|
|
546
|
+
const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
|
|
547
|
+
const wrappedUnsubscribe = () => {
|
|
548
|
+
if (window[StyleCacheKey][domain]) {
|
|
549
|
+
const cachedObject = window[StyleCacheKey][domain];
|
|
550
|
+
cachedObject.refCount > 1
|
|
551
|
+
? (cachedObject.refCount = cachedObject.refCount - 1)
|
|
552
|
+
: delete window[StyleCacheKey][domain];
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
originalUnsubscribe();
|
|
556
|
+
};
|
|
557
|
+
subscription.unsubscribe = wrappedUnsubscribe;
|
|
558
|
+
|
|
559
|
+
return subscription;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
function getStyleTagSubscription(stylingContainer, domain) {
|
|
563
|
+
const sheet = document.createElement('style');
|
|
564
|
+
|
|
565
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
566
|
+
if (stylingContainer) {
|
|
567
|
+
sheet.innerHTML = data;
|
|
568
|
+
stylingContainer.appendChild(sheet);
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
function getAdoptStyleSubscription(stylingContainer, domain) {
|
|
574
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
575
|
+
if (!stylingContainer) return;
|
|
576
|
+
|
|
577
|
+
const shadowRoot = stylingContainer.getRootNode();
|
|
578
|
+
const cacheStyleObject = window[StyleCacheKey];
|
|
579
|
+
let cachedStyle = cacheStyleObject[domain] && cacheStyleObject[domain].sheet;
|
|
580
|
+
|
|
581
|
+
if (!cachedStyle) {
|
|
582
|
+
cachedStyle = new CSSStyleSheet();
|
|
583
|
+
cachedStyle.replaceSync(data);
|
|
584
|
+
cacheStyleObject[domain] = {
|
|
585
|
+
sheet: cachedStyle,
|
|
586
|
+
refCount: 1
|
|
587
|
+
};
|
|
588
|
+
} else {
|
|
589
|
+
cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
const currentSheets = shadowRoot.adoptedStyleSheets || [];
|
|
593
|
+
if (!currentSheets.includes(cachedStyle)) {
|
|
594
|
+
shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
const generalStylingWrapperCss = ":host{display:block}";
|
|
600
|
+
const GeneralStylingWrapperStyle0 = generalStylingWrapperCss;
|
|
601
|
+
|
|
602
|
+
const GeneralStylingWrapper = class {
|
|
603
|
+
constructor(hostRef) {
|
|
604
|
+
registerInstance(this, hostRef);
|
|
605
|
+
this.stylingAppends = false;
|
|
606
|
+
this.clientStyling = '';
|
|
607
|
+
this.clientStylingUrl = '';
|
|
608
|
+
this.mbSource = undefined;
|
|
609
|
+
this.translationUrl = '';
|
|
610
|
+
this.targetTranslations = undefined;
|
|
611
|
+
}
|
|
612
|
+
componentDidLoad() {
|
|
613
|
+
if (this.el) {
|
|
614
|
+
if (this.mbSource)
|
|
615
|
+
setStreamStyling(this.el, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
616
|
+
if (this.clientStyling)
|
|
617
|
+
setClientStyling(this.el, this.clientStyling);
|
|
618
|
+
if (this.clientStylingUrl)
|
|
619
|
+
setClientStylingURL(this.el, this.clientStylingUrl);
|
|
620
|
+
this.stylingAppends = true;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
disconnectedCallback() {
|
|
624
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
625
|
+
}
|
|
626
|
+
handleMbSourceChange(newValue, oldValue) {
|
|
627
|
+
if (newValue != oldValue) {
|
|
628
|
+
setStreamStyling(this.el, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
handleClientStylingChange(newValue, oldValue) {
|
|
632
|
+
if (newValue != oldValue) {
|
|
633
|
+
setClientStyling(this.el, this.clientStyling);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
handleClientStylingUrlChange(newValue, oldValue) {
|
|
637
|
+
if (newValue != oldValue) {
|
|
638
|
+
if (this.clientStylingUrl)
|
|
639
|
+
setClientStylingURL(this.el, this.clientStylingUrl);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
componentDidRender() {
|
|
643
|
+
// start custom styling area
|
|
644
|
+
if (!this.stylingAppends) {
|
|
645
|
+
if (this.clientStyling)
|
|
646
|
+
setClientStyling(this.el, this.clientStyling);
|
|
647
|
+
if (this.clientStylingUrl)
|
|
648
|
+
setClientStylingURL(this.el, this.clientStylingUrl);
|
|
649
|
+
this.stylingAppends = true;
|
|
650
|
+
}
|
|
651
|
+
// end custom styling area
|
|
652
|
+
}
|
|
653
|
+
async componentWillLoad() {
|
|
654
|
+
const promises = [];
|
|
655
|
+
if (this.translationUrl) {
|
|
656
|
+
const translationPromise = mergeTranslations(this.translationUrl, this.targetTranslations);
|
|
657
|
+
promises.push(translationPromise);
|
|
658
|
+
}
|
|
659
|
+
return await Promise.all(promises);
|
|
660
|
+
}
|
|
661
|
+
render() {
|
|
662
|
+
return (h("div", { key: 'e660ceb69f5e848c788c3924fc814c0fa7a777a2', class: "StyleShell" }, h("slot", { key: '35014b6c0c32532af11e6a629ba9b13942504d21', name: "mainContent" })));
|
|
663
|
+
}
|
|
664
|
+
get el() { return getElement(this); }
|
|
665
|
+
static get watchers() { return {
|
|
666
|
+
"mbSource": ["handleMbSourceChange"],
|
|
667
|
+
"clientStyling": ["handleClientStylingChange"],
|
|
668
|
+
"clientStylingUrl": ["handleClientStylingUrlChange"]
|
|
669
|
+
}; }
|
|
670
|
+
};
|
|
671
|
+
GeneralStylingWrapper.style = GeneralStylingWrapperStyle0;
|
|
672
|
+
|
|
673
|
+
const uiImageCss = ".HostContainer{display:block}.UiContainer{height:100%;width:100%;border-radius:inherit;object-fit:inherit}.UiContainer .Image{border-radius:inherit}.Hidden{opacity:0;transition:opacity 0.5s ease-in-out}.Visible{opacity:1;border-radius:var(--emw--border-radius-medium, 10px);transition:opacity 0.5s ease-in-out}";
|
|
674
|
+
const UiImageStyle0 = uiImageCss;
|
|
675
|
+
|
|
676
|
+
const UiImage = class {
|
|
677
|
+
constructor(hostRef) {
|
|
678
|
+
registerInstance(this, hostRef);
|
|
679
|
+
this.src = undefined;
|
|
680
|
+
this.width = undefined;
|
|
681
|
+
this.height = undefined;
|
|
682
|
+
this.alt = undefined;
|
|
683
|
+
this.styles = undefined;
|
|
684
|
+
this.detectDistance = '200px';
|
|
685
|
+
this.imgLoaded = false;
|
|
686
|
+
this.shouldLoad = false;
|
|
687
|
+
}
|
|
688
|
+
handleSrc() {
|
|
689
|
+
if (!this.shouldLoad) {
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
692
|
+
const preloadedImage = new Image();
|
|
693
|
+
preloadedImage.onload = () => {
|
|
694
|
+
if (this.image) {
|
|
695
|
+
this.image.src = this.src;
|
|
696
|
+
this.imgLoaded = true;
|
|
697
|
+
preloadedImage.onload = null;
|
|
698
|
+
}
|
|
699
|
+
};
|
|
700
|
+
preloadedImage.src = this.src;
|
|
701
|
+
}
|
|
702
|
+
componentDidLoad() {
|
|
703
|
+
if ('IntersectionObserver' in window) {
|
|
704
|
+
this.el.__uxComponent = this;
|
|
705
|
+
if (!window.EMUxObserver) {
|
|
706
|
+
window.EMUxObserver = new IntersectionObserver((entries) => {
|
|
707
|
+
entries.forEach(entry => {
|
|
708
|
+
if (entry.isIntersecting) {
|
|
709
|
+
const comp = entry.target.__uxComponent;
|
|
710
|
+
if (comp) {
|
|
711
|
+
comp.shouldLoad = true;
|
|
712
|
+
comp.handleSrc();
|
|
713
|
+
}
|
|
714
|
+
window.EMUxObserver.unobserve(entry.target);
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
}, { rootMargin: this.detectDistance });
|
|
718
|
+
}
|
|
719
|
+
window.EMUxObserver.observe(this.el);
|
|
720
|
+
}
|
|
721
|
+
else {
|
|
722
|
+
this.shouldLoad = true;
|
|
723
|
+
this.handleSrc();
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
render() {
|
|
727
|
+
return (h(Host, { key: 'f506ba73852f257ad80bf59ca177d2065a5f365e', class: "HostContainer" }, !this.imgLoaded && (h("ui-skeleton", { key: '564ebfab701f827ddc2debccb7615926dbc9e876', class: "UiContainer", structure: "image", width: "100%", height: "100%" })), h("img", { key: '2188ca4494c10587f064acc5459ffc468948f497', ref: (el) => (this.image = el), src: this.shouldLoad ? this.src : undefined, onLoad: () => (this.imgLoaded = true), style: this.styles, class: `UiContainer ${this.imgLoaded ? 'Visible' : 'Hidden'}`, alt: this.alt, width: this.width, height: this.height, loading: "lazy" })));
|
|
728
|
+
}
|
|
729
|
+
get el() { return getElement(this); }
|
|
730
|
+
static get watchers() { return {
|
|
731
|
+
"src": ["handleSrc"]
|
|
732
|
+
}; }
|
|
733
|
+
};
|
|
734
|
+
UiImage.style = UiImageStyle0;
|
|
735
|
+
|
|
736
|
+
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)}}";
|
|
737
|
+
const UiSkeletonStyle0 = uiSkeletonCss;
|
|
738
|
+
|
|
739
|
+
const UiSkeleton = class {
|
|
740
|
+
constructor(hostRef) {
|
|
741
|
+
registerInstance(this, hostRef);
|
|
742
|
+
this.stylingValue = {
|
|
743
|
+
width: this.handleStylingProps(this.width),
|
|
744
|
+
height: this.handleStylingProps(this.height),
|
|
745
|
+
borderRadius: this.handleStylingProps(this.borderRadius),
|
|
746
|
+
marginBottom: this.handleStylingProps(this.marginBottom),
|
|
747
|
+
marginTop: this.handleStylingProps(this.marginTop),
|
|
748
|
+
marginLeft: this.handleStylingProps(this.marginLeft),
|
|
749
|
+
marginRight: this.handleStylingProps(this.marginRight),
|
|
750
|
+
size: this.handleStylingProps(this.size),
|
|
751
|
+
};
|
|
752
|
+
this.structure = undefined;
|
|
753
|
+
this.width = 'unset';
|
|
754
|
+
this.height = 'unset';
|
|
755
|
+
this.borderRadius = 'unset';
|
|
756
|
+
this.marginBottom = 'unset';
|
|
757
|
+
this.marginTop = 'unset';
|
|
758
|
+
this.marginLeft = 'unset';
|
|
759
|
+
this.marginRight = 'unset';
|
|
760
|
+
this.animation = true;
|
|
761
|
+
this.rows = 0;
|
|
762
|
+
this.size = '100%';
|
|
763
|
+
}
|
|
764
|
+
handleStructureChange(newValue, oldValue) {
|
|
765
|
+
if (oldValue !== newValue) {
|
|
766
|
+
this.handleStructure(newValue);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
handleStylingProps(value) {
|
|
770
|
+
switch (typeof value) {
|
|
771
|
+
case 'number':
|
|
772
|
+
return value === 0 ? 0 : `${value}px`;
|
|
773
|
+
case 'undefined':
|
|
774
|
+
return 'unset';
|
|
775
|
+
case 'string':
|
|
776
|
+
if (['auto', 'unset', 'none', 'inherit', 'initial'].includes(value) ||
|
|
777
|
+
value.endsWith('px') ||
|
|
778
|
+
value.endsWith('%')) {
|
|
779
|
+
return value;
|
|
780
|
+
}
|
|
781
|
+
else {
|
|
782
|
+
return 'unset';
|
|
783
|
+
}
|
|
784
|
+
default:
|
|
785
|
+
return 'unset';
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
handleStructure(structure) {
|
|
789
|
+
switch (structure) {
|
|
790
|
+
case 'logo':
|
|
791
|
+
return this.renderLogo();
|
|
792
|
+
case 'image':
|
|
793
|
+
return this.renderImage();
|
|
794
|
+
case 'title':
|
|
795
|
+
return this.renderTitle();
|
|
796
|
+
case 'text':
|
|
797
|
+
return this.renderText();
|
|
798
|
+
case 'rectangle':
|
|
799
|
+
return this.renderRectangle();
|
|
800
|
+
case 'circle':
|
|
801
|
+
return this.renderCircle();
|
|
802
|
+
default:
|
|
803
|
+
return null;
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
renderLogo() {
|
|
807
|
+
return (h("div", { class: "SkeletonContainer" }, h("div", { class: 'SkeletonLogo ' + (this.animation ? 'Skeleton' : '') })));
|
|
808
|
+
}
|
|
809
|
+
renderImage() {
|
|
810
|
+
return h("div", { class: 'SkeletonImage ' + (this.animation ? 'Skeleton' : '') });
|
|
811
|
+
}
|
|
812
|
+
renderTitle() {
|
|
813
|
+
return (h("div", { class: "SkeletonContainer" }, h("div", { class: 'SkeletonTitle ' + (this.animation ? 'Skeleton' : '') })));
|
|
814
|
+
}
|
|
815
|
+
renderText() {
|
|
816
|
+
return (h("div", { class: "SkeletonContainer" }, Array.from({ length: this.rows > 0 ? this.rows : 1 }).map((_, index) => (h("div", { key: index, class: 'SkeletonText ' + (this.animation ? 'Skeleton' : '') })))));
|
|
817
|
+
}
|
|
818
|
+
renderRectangle() {
|
|
819
|
+
return (h("div", { class: "SkeletonContainer" }, h("div", { class: 'SkeletonRectangle ' + (this.animation ? 'Skeleton' : '') })));
|
|
820
|
+
}
|
|
821
|
+
renderCircle() {
|
|
822
|
+
return (h("div", { class: "SkeletonContainer" }, h("div", { class: 'SkeletonCircle ' + (this.animation ? 'Skeleton' : '') })));
|
|
823
|
+
}
|
|
824
|
+
render() {
|
|
825
|
+
let styleBlock = '';
|
|
826
|
+
switch (this.structure) {
|
|
827
|
+
case 'logo':
|
|
828
|
+
styleBlock = `
|
|
829
|
+
:host {
|
|
830
|
+
--emw-skeleton-logo-width: ${this.stylingValue.width};
|
|
831
|
+
--emw-skeleton-logo-height: ${this.stylingValue.height};
|
|
832
|
+
--emw-skeleton-logo-border-radius: ${this.stylingValue.borderRadius};
|
|
833
|
+
--emw-skeleton-logo-margin-bottom: ${this.stylingValue.marginBottom};
|
|
834
|
+
--emw-skeleton-logo-margin-top: ${this.stylingValue.marginTop};
|
|
835
|
+
--emw-skeleton-logo-margin-left: ${this.stylingValue.marginLeft};
|
|
836
|
+
--emw-skeleton-logo-margin-right: ${this.stylingValue.marginRight};
|
|
837
|
+
}
|
|
838
|
+
`;
|
|
839
|
+
break;
|
|
840
|
+
case 'image':
|
|
841
|
+
styleBlock = `
|
|
842
|
+
:host {
|
|
843
|
+
--emw-skeleton-image-width: ${this.stylingValue.width};
|
|
844
|
+
--emw-skeleton-image-height: ${this.stylingValue.height};
|
|
845
|
+
--emw-skeleton-image-border-radius: ${this.stylingValue.borderRadius};
|
|
846
|
+
--emw-skeleton-image-margin-bottom: ${this.stylingValue.marginBottom};
|
|
847
|
+
--emw-skeleton-image-margin-top: ${this.stylingValue.marginTop};
|
|
848
|
+
--emw-skeleton-image-margin-left: ${this.stylingValue.marginLeft};
|
|
849
|
+
--emw-skeleton-image-margin-right: ${this.stylingValue.marginRight};
|
|
850
|
+
}
|
|
851
|
+
`;
|
|
852
|
+
break;
|
|
853
|
+
case 'title':
|
|
854
|
+
styleBlock = `
|
|
855
|
+
:host {
|
|
856
|
+
--emw-skeleton-title-width: ${this.stylingValue.width};
|
|
857
|
+
--emw-skeleton-title-height: ${this.stylingValue.height};
|
|
858
|
+
--emw-skeleton-title-border-radius: ${this.stylingValue.borderRadius};
|
|
859
|
+
--emw-skeleton-title-margin-bottom: ${this.stylingValue.marginBottom};
|
|
860
|
+
--emw-skeleton-title-margin-top: ${this.stylingValue.marginTop};
|
|
861
|
+
--emw-skeleton-title-margin-left: ${this.stylingValue.marginLeft};
|
|
862
|
+
--emw-skeleton-title-margin-right: ${this.stylingValue.marginRight};
|
|
863
|
+
}
|
|
864
|
+
`;
|
|
865
|
+
break;
|
|
866
|
+
case 'text':
|
|
867
|
+
styleBlock = `
|
|
868
|
+
:host {
|
|
869
|
+
--emw-skeleton-text-width: ${this.stylingValue.width};
|
|
870
|
+
--emw-skeleton-text-height: ${this.stylingValue.height};
|
|
871
|
+
--emw-skeleton-text-border-radius: ${this.stylingValue.borderRadius};
|
|
872
|
+
--emw-skeleton-text-margin-bottom: ${this.stylingValue.marginBottom};
|
|
873
|
+
--emw-skeleton-text-margin-top: ${this.stylingValue.marginTop};
|
|
874
|
+
--emw-skeleton-text-margin-left: ${this.stylingValue.marginLeft};
|
|
875
|
+
--emw-skeleton-text-margin-right: ${this.stylingValue.marginRight};
|
|
876
|
+
}
|
|
877
|
+
`;
|
|
878
|
+
break;
|
|
879
|
+
case 'rectangle':
|
|
880
|
+
styleBlock = `
|
|
881
|
+
:host {
|
|
882
|
+
--emw-skeleton-rectangle-width: ${this.stylingValue.width};
|
|
883
|
+
--emw-skeleton-rectangle-height: ${this.stylingValue.height};
|
|
884
|
+
--emw-skeleton-rectangle-border-radius: ${this.stylingValue.borderRadius};
|
|
885
|
+
--emw-skeleton-rectangle-margin-bottom: ${this.stylingValue.marginBottom};
|
|
886
|
+
--emw-skeleton-rectangle-margin-top: ${this.stylingValue.marginTop};
|
|
887
|
+
--emw-skeleton-rectangle-margin-left: ${this.stylingValue.marginLeft};
|
|
888
|
+
--emw-skeleton-rectangle-margin-right: ${this.stylingValue.marginRight};
|
|
889
|
+
}
|
|
890
|
+
`;
|
|
891
|
+
break;
|
|
892
|
+
case 'circle':
|
|
893
|
+
styleBlock = `
|
|
894
|
+
:host {
|
|
895
|
+
--emw-skeleton-circle-size: ${this.stylingValue.size};
|
|
896
|
+
}
|
|
897
|
+
`;
|
|
898
|
+
break;
|
|
899
|
+
default:
|
|
900
|
+
styleBlock = '';
|
|
901
|
+
}
|
|
902
|
+
return (h(Host, { key: 'c2a2650acd416962a2bc4e1a7ee18bc6d8e2def8' }, h("style", { key: '9bd7fc1f9e9ed9f17735a7b72fce6f09696f5e19' }, styleBlock), this.handleStructure(this.structure)));
|
|
903
|
+
}
|
|
904
|
+
static get watchers() { return {
|
|
905
|
+
"structure": ["handleStructureChange"]
|
|
906
|
+
}; }
|
|
907
|
+
};
|
|
908
|
+
UiSkeleton.style = UiSkeletonStyle0;
|
|
909
|
+
|
|
910
|
+
export { BonusElevateShopAssetsSlider as bonus_elevate_shop_assets_slider, BonusElevateShopItem as bonus_elevate_shop_item, GeneralStylingWrapper as general_styling_wrapper, UiImage as ui_image, UiSkeleton as ui_skeleton };
|