@everymatrix/bonus-elevate-shop-item 1.94.51 → 1.94.53

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.
Files changed (22) hide show
  1. package/dist/bonus-elevate-shop-item/bonus-elevate-shop-assets-slider_5.entry.js +1 -0
  2. package/dist/bonus-elevate-shop-item/bonus-elevate-shop-item.esm.js +1 -1
  3. package/dist/cjs/bonus-elevate-shop-assets-slider_5.cjs.entry.js +918 -0
  4. package/dist/cjs/bonus-elevate-shop-item.cjs.js +1 -1
  5. package/dist/cjs/index-ad2fddb6.js +2 -2
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/collection/collection-manifest.json +12 -0
  8. package/dist/collection/components/bonus-elevate-shop-item/bonus-elevate-shop-assets-slider.js +5 -5
  9. package/dist/collection/components/bonus-elevate-shop-item/bonus-elevate-shop-item.css +92 -1
  10. package/dist/collection/components/bonus-elevate-shop-item/bonus-elevate-shop-item.js +85 -4
  11. package/dist/collection/utils/locale.utils.js +1 -0
  12. package/dist/esm/bonus-elevate-shop-assets-slider_5.entry.js +910 -0
  13. package/dist/esm/bonus-elevate-shop-item.js +1 -1
  14. package/dist/esm/index-fca048d8.js +2 -2
  15. package/dist/esm/loader.js +1 -1
  16. 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
  17. package/dist/types/components/bonus-elevate-shop-item/bonus-elevate-shop-item.d.ts +11 -0
  18. package/dist/types/models/bonus-elevate-shop-item.d.ts +1 -0
  19. package/package.json +1 -1
  20. package/dist/bonus-elevate-shop-item/bonus-elevate-shop-assets-slider_3.entry.js +0 -1
  21. package/dist/cjs/bonus-elevate-shop-assets-slider_3.cjs.entry.js +0 -600
  22. package/dist/esm/bonus-elevate-shop-assets-slider_3.entry.js +0 -594
@@ -1,594 +0,0 @@
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: '3740bd5b367f4e24f0b4391dc7f25c63ccb12958', class: "SliderWrapper" }, h("div", { key: '6aac842f54de59cea8b2f2655e8408a8778702d4', class: 'MainContent ' }, this.showSliderArrows &&
121
- h("div", { key: '94de38b6a631824bbe15964d70377639af769917', class: `SliderNavButton LeftArrow ${this.activeIndex === 0 ? 'DisabledArrow ' : ''} ${this.sliderItems.length === 1 ? 'HiddenArrow ' : ''}`, onClick: () => this.move(-1) }, h("svg", { key: '382d3d0c54932b359b2be4b9ed8c3db3c6da49ec', fill: "none", stroke: "var(--emw--color-secondary, #FD2839)", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, h("path", { key: '9b4d592aa650ddff2fbd8625a8b0a5d1b604c723', "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M15 19l-7-7 7-7" }))), h("div", { key: 'b3ec493624a11931eb48e44eb620373b2613d0a8', class: 'ItemsWrapper', ref: (el) => this.sliderItemsElement = el }, h("div", { key: '724e11f1b3899c0f4bb179fff9b60f40c363e7f1', 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: '2791a14781f73619c122401a97a9833e33787282', 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: '3810b14f2a0fc436601186335a01b7af90aabab5', fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, h("path", { key: '18178c52a74cf77c856f65b6f377a350fc672db8', "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: '83964fb11e6728adb065958ebfbf17902e301b2e', class: "DotsWrapper" }, h("ul", { key: 'cafab68d463e25a0847306314c64041bc3f107f7', 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
- },
140
- tr: {
141
- coins: 'Coin',
142
- noGiftPresentation: 'Açıklama yok',
143
- redeemGift: 'Hediye Al',
144
- noDataFound: 'Veri bulunamadı',
145
- error4003: 'Geçersiz Oturum',
146
- redeemFailed: 'Kullanım başarısız',
147
- back: 'Geri',
148
- },
149
- ro: {
150
- coins: 'Coins',
151
- noGiftPresentation: 'No description',
152
- redeemGift: 'Redeem Gift',
153
- noDataFound: 'No data found',
154
- error4003: 'Invalid Session',
155
- redeemFailed: 'Failed to redeem',
156
- back: 'Back',
157
- },
158
- fr: {
159
- coins: 'Coins',
160
- noGiftPresentation: 'No description',
161
- redeemGift: 'Redeem Gift',
162
- noDataFound: 'No data found',
163
- error4003: 'Invalid Session',
164
- redeemFailed: 'Failed to redeem',
165
- back: 'Back',
166
- },
167
- ar: {
168
- coins: 'Coins',
169
- noGiftPresentation: 'No description',
170
- redeemGift: 'Redeem Gift',
171
- noDataFound: 'No data found',
172
- error4003: 'Invalid Session',
173
- redeemFailed: 'Failed to redeem',
174
- back: 'Back',
175
- },
176
- hu: {
177
- coins: 'Coins',
178
- noGiftPresentation: 'No description',
179
- redeemGift: 'Redeem Gift',
180
- noDataFound: 'No data found',
181
- error4003: 'Invalid Session',
182
- redeemFailed: 'Failed to redeem',
183
- back: 'Back',
184
- }
185
- };
186
- const translate = (key, customLang) => {
187
- const lang = customLang ? customLang : DEFAULT_LANGUAGE;
188
- return TRANSLATIONS[lang][key] || TRANSLATIONS[DEFAULT_LANGUAGE][key];
189
- };
190
- const getTranslations = (url) => {
191
- // fetch url, get the data, replace the TRANSLATIONS content
192
- return new Promise((resolve) => {
193
- fetch(url)
194
- .then((res) => res.json())
195
- .then((data) => {
196
- Object.keys(data).forEach((item) => {
197
- TRANSLATIONS[item] = TRANSLATIONS[item] || {};
198
- for (let key in data[item]) {
199
- TRANSLATIONS[item][key] = data[item][key];
200
- }
201
- });
202
- resolve(true);
203
- }).catch((err) => {
204
- console.error("Failed to load translations:", err);
205
- resolve(false);
206
- });
207
- });
208
- };
209
-
210
- /**
211
- * @name isMobile
212
- * @description A method that returns if the browser used to access the app is from a mobile device or not
213
- * @param {String} userAgent window.navigator.userAgent
214
- * @returns {Boolean} true or false
215
- */
216
- const getDevice = () => {
217
- let userAgent = window.navigator.userAgent;
218
- if (userAgent.toLowerCase().match(/android/i)) {
219
- return 'Android';
220
- }
221
- if (userAgent.toLowerCase().match(/iphone/i)) {
222
- return 'iPhone';
223
- }
224
- if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
225
- return 'iPad';
226
- }
227
- return 'PC';
228
- };
229
- const getDevicePlatform = () => {
230
- const device = getDevice();
231
- if (device) {
232
- if (device === 'PC') {
233
- return 'dk';
234
- }
235
- else if (device === 'iPad' || device === 'iPhone') {
236
- return 'ios';
237
- }
238
- else {
239
- return 'mtWeb';
240
- }
241
- }
242
- };
243
-
244
- const bonusElevateShopItemCss = ":host{display:block}.ElevateDetails{display:flex;flex-direction:row;flex-wrap:wrap;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}.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}";
245
- const BonusElevateShopItemStyle0 = bonusElevateShopItemCss;
246
-
247
- const BonusElevateShopItem = class {
248
- constructor(hostRef) {
249
- registerInstance(this, hostRef);
250
- this.redeemGiftButton = createEvent(this, "redeemGiftButton", 7);
251
- this.bindedHandler = this.handleMessage.bind(this);
252
- this.deviceType = getDevicePlatform();
253
- this.endpoint = undefined;
254
- this.language = 'en';
255
- this.itemId = undefined;
256
- this.elevateGift = undefined;
257
- this.session = undefined;
258
- this.mbSource = undefined;
259
- this.clientStyling = '';
260
- this.clientStylingUrl = '';
261
- this.translationUrl = '';
262
- this.showSliderDots = false;
263
- this.showSliderArrows = true;
264
- this.isGiftNotFound = false;
265
- this.redeemErrorMsg = '';
266
- this.isRedeeming = false;
267
- }
268
- redeemGiftConfirm() {
269
- if (this.isRedeeming || this.elevateGift.available != 'true') {
270
- return;
271
- }
272
- window.postMessage({ type: 'BEERedeemConfirm', shopItem: this.elevateGift }, window.location.href);
273
- }
274
- handleMessage(message) {
275
- if (message.data && message.data.type === "bee-redeem-confirmed" &&
276
- message.data.id == this.elevateGift.id) {
277
- this.redeemGift();
278
- }
279
- }
280
- onBackClicked() {
281
- window.postMessage({ type: 'OnGiftDetailsBackButtonClicked' }, window.location.href);
282
- }
283
- redeemGift() {
284
- if (this.elevateGift.available.toLowerCase() === 'false' || this.isRedeeming) {
285
- return;
286
- }
287
- let url = new URL(`${this.endpoint}/v1/elevate/redeem`);
288
- let claimGiftOptions = {
289
- method: 'PUT',
290
- headers: {
291
- 'x-SessionId': this.session,
292
- 'Content-Type': 'application/json-patch+json',
293
- },
294
- body: JSON.stringify({ giftId: this.elevateGift.id }),
295
- };
296
- this.redeemErrorMsg = '';
297
- this.isRedeeming = true;
298
- fetch(url.toString(), claimGiftOptions)
299
- .then((res) => res.json())
300
- .then((res) => {
301
- if (res.success) {
302
- this.redeemGiftButton.emit();
303
- window.postMessage({ type: 'BEEGiftRedeem', itemId: this.elevateGift.id }, window.location.href);
304
- }
305
- else {
306
- let translatedError = translate(`error${res.errorCode}`, this.language);
307
- this.redeemErrorMsg = translatedError ? translatedError : translate('redeemFailed', this.language);
308
- window.postMessage({ type: 'BEEGiftRedeemFailed', itemId: this.elevateGift.id, res }, window.location.href);
309
- }
310
- })
311
- .catch((err) => {
312
- window.postMessage({ type: 'BEEGiftClaimFailed', itemId: this.elevateGift.id, err }, window.location.href);
313
- }).finally(() => {
314
- this.isRedeeming = false;
315
- });
316
- }
317
- async loadElevateGift() {
318
- let url = new URL(`${this.endpoint}/v1/elevate/shop?language=${this.language}&filter=id=${this.itemId}`);
319
- let options = {
320
- headers: {
321
- 'Content-Type': 'application/json',
322
- 'x-SessionId': this.session,
323
- },
324
- method: 'GET',
325
- };
326
- await new Promise((resolve) => {
327
- fetch(url.href, options)
328
- .then((res) => res.json())
329
- .then((data) => {
330
- let filteredGifts = data.data;
331
- if (filteredGifts && filteredGifts.length == 1) {
332
- this.elevateGift = filteredGifts[0];
333
- this.isGiftNotFound = false;
334
- }
335
- else {
336
- this.isGiftNotFound = true;
337
- }
338
- resolve(true);
339
- });
340
- });
341
- }
342
- disconnectedCallback() {
343
- window.removeEventListener('message', this.bindedHandler, false);
344
- }
345
- componentDidLoad() {
346
- window.addEventListener('message', this.bindedHandler, false);
347
- }
348
- async componentWillLoad() {
349
- if (this.translationUrl.length > 2) {
350
- await getTranslations(this.translationUrl);
351
- }
352
- if (this.elevateGift) {
353
- this.isGiftNotFound = false;
354
- }
355
- else {
356
- await this.loadElevateGift();
357
- }
358
- }
359
- render() {
360
- return (h(Host, { key: '059f0eb449e36b30ce271306a9faf85b79197f36' }, h("general-styling-wrapper", { key: '4b857c7d532d288c660fc9b9cfc28c17ba80c400', clientStylingUrl: this.clientStylingUrl, clientStyling: this.clientStyling, mbSource: this.mbSource }), h("div", { key: 'b400e365431afc6af40c11010b708a72525d4af6', class: 'ElevateDetails' }, this.isGiftNotFound && (h(Fragment, { key: '93a532a9d25137fe02aca600c98237f08dbc5347' }, h("div", { key: 'b423b7b20c4e6829ecd5cf53ab860b909ac639d5', class: "Row ThumbnailRow" }, h("div", { key: 'eaafe445f831699a1f4a22bc951a68e211bc1eb1', class: "BackButton", onClick: () => {
361
- this.onBackClicked();
362
- } }, h("span", { key: '70105de7173a933b921bd4a78c62c4d6e5cf847e', class: "BackArrow", innerHTML: "<" }), h("span", { key: 'd695e223a899ae130355d5ee083a622b7cf131dd', class: "BackTxt" }, " ", translate('back', this.language), " "))), h("div", { key: 'f9624e689b03b06c0937f81821ff4e00c0911851', class: "Thumnails GiftNotFound" }, translate('noDataFound', this.language), "."))), this.elevateGift && h(Fragment, { key: '5c104bba7cd29706418cffa9ffdd20d13714bf2a' }, h("div", { key: 'c100262b2d4547e1a81108426fa07e6a66e8f560', class: "ThumbnailRow" }, h("div", { key: 'bf573c9685c7afe71239faced77bfaef4fab2a37', class: 'Row' }, h("div", { key: '10ff56e0df5eca9792428fc5279a79d79f619c56', class: "BackButton", onClick: () => { this.onBackClicked(); } }, h("span", { key: '899bbe9f1288b49743d51f4afec8b9237052b7f1', class: "BackArrow", innerHTML: "<" }), h("span", { key: 'f4dd1b849114f4fd9743b6726394aacf444a6e7b', class: "BackTxt" }, " ", translate('back', this.language), " ")), h("bonus-elevate-shop-assets-slider", { key: 'b11de8226e28e3038e70615093e07dd7ae896730', class: 'Thumbnails', itemsPerPage: 1, sliderItems: this.elevateGift.presentation.assets, showSliderDots: this.showSliderDots })), h("div", { key: '4084bea351593009e0a3a9dd3e3cb70b9d1a864c', class: 'Col Details' }, h("h3", { key: '2346e29ead91d6ace97f99fa768c46db704d1ab9', class: "GiftName" }, this.elevateGift.presentation.displayName || this.elevateGift.displayName), h("div", { key: '835a0b059b2c0399cdb442a8376b0ef8ddf1c9e2', class: "GiftPoints" }, h("span", { key: '73afb596b3b493736e67c3b62207b2dc7dbc27d9', class: "Points" }, this.elevateGift.points, " "), h("span", { key: '7a484d65195a5e6e32b079ca31410eefd239a240', class: " PointsLabel" }, translate('coins', this.language))))), h("div", { key: 'f318deaf612752dc61b49e57b5751755800291ea', class: 'ShopItemDetail Details' }, h("div", { key: '2a7b77649b74baad93816eabf8413d0b45930f83', class: "GiftPresentation" }, h("p", { key: '3ce1a1a6adb36127b3526e005a3ac49349349bfd' }, this.elevateGift.presentation.description ? this.elevateGift.presentation.description : translate('noGiftPresentation', this.language))), h("div", { key: 'e8f61acba748c582288e2053f61c7efc754bb8f9', class: `RedeemButton ${this.elevateGift.available === 'false' || this.isRedeeming ? 'Disabled deactive' : ' active '}
363
- ${this.deviceType == 'dk' ? 'DkButton' : ''}`, onClick: this.redeemGiftConfirm.bind(this) }, translate('redeemGift', this.language)), h("span", { key: '8cfe770fbbe29d1aebab26826146590cc1ecd177', class: 'RedeemError Error' }, " ", this.redeemErrorMsg, " "))))));
364
- }
365
- };
366
- BonusElevateShopItem.style = BonusElevateShopItemStyle0;
367
-
368
- const mergeTranslations = (url, target) => {
369
- return new Promise((resolve) => {
370
- fetch(url)
371
- .then((res) => res.json())
372
- .then((data) => {
373
- Object.keys(data).forEach((item) => {
374
- target[item] = target[item] || {};
375
- Object.keys(data[item]).forEach((key) => {
376
- //if there is no key in target, do nothing
377
- if (!target['en'][key]) {
378
- return;
379
- }
380
- const defaultTranslation = target['en'][key];
381
- if (typeof data[item][key] === 'object') {
382
- // if the key is not in target, then take from en
383
- target[item][key] = target[item][key] || Object.assign({}, defaultTranslation);
384
- Object.keys(data[item][key]).forEach((subKey) => {
385
- target[item][key][subKey] = data[item][key][subKey];
386
- });
387
- }
388
- else {
389
- target[item][key] = data[item][key] || Object.assign({}, defaultTranslation);
390
- }
391
- });
392
- });
393
- resolve(true);
394
- })
395
- .catch(err => {
396
- console.error("Failed to load translations:", err);
397
- resolve(false);
398
- });
399
- });
400
- };
401
-
402
- const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
403
-
404
- /**
405
- * @name setClientStyling
406
- * @description Method used to create and append to the passed element of the widget a style element with the content received
407
- * @param {HTMLElement} stylingContainer The reference element of the widget
408
- * @param {string} clientStyling The style content
409
- */
410
- function setClientStyling(stylingContainer, clientStyling) {
411
- if (stylingContainer) {
412
- const sheet = document.createElement('style');
413
- sheet.innerHTML = clientStyling;
414
- stylingContainer.appendChild(sheet);
415
- }
416
- }
417
-
418
- /**
419
- * @name setClientStylingURL
420
- * @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
421
- * @param {HTMLElement} stylingContainer The reference element of the widget
422
- * @param {string} clientStylingUrl The URL of the style content
423
- */
424
- function setClientStylingURL(stylingContainer, clientStylingUrl) {
425
- if (!stylingContainer || !clientStylingUrl) return;
426
-
427
- const url = new URL(clientStylingUrl);
428
-
429
- fetch(url.href)
430
- .then((res) => res.text())
431
- .then((data) => {
432
- const cssFile = document.createElement('style');
433
- cssFile.innerHTML = data;
434
- if (stylingContainer) {
435
- stylingContainer.appendChild(cssFile);
436
- }
437
- })
438
- .catch((err) => {
439
- console.error('There was an error while trying to load client styling from URL', err);
440
- });
441
- }
442
-
443
- /**
444
- * @name setStreamLibrary
445
- * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
446
- * @param {HTMLElement} stylingContainer The highest element of the widget
447
- * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
448
- * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
449
- * @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
450
- */
451
- function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
452
- if (!window.emMessageBus) return;
453
-
454
- const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
455
-
456
- if (!supportAdoptStyle || !useAdoptedStyleSheets) {
457
- subscription = getStyleTagSubscription(stylingContainer, domain);
458
-
459
- return subscription;
460
- }
461
-
462
- if (!window[StyleCacheKey]) {
463
- window[StyleCacheKey] = {};
464
- }
465
- subscription = getAdoptStyleSubscription(stylingContainer, domain);
466
-
467
- const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
468
- const wrappedUnsubscribe = () => {
469
- if (window[StyleCacheKey][domain]) {
470
- const cachedObject = window[StyleCacheKey][domain];
471
- cachedObject.refCount > 1
472
- ? (cachedObject.refCount = cachedObject.refCount - 1)
473
- : delete window[StyleCacheKey][domain];
474
- }
475
-
476
- originalUnsubscribe();
477
- };
478
- subscription.unsubscribe = wrappedUnsubscribe;
479
-
480
- return subscription;
481
- }
482
-
483
- function getStyleTagSubscription(stylingContainer, domain) {
484
- const sheet = document.createElement('style');
485
-
486
- return window.emMessageBus.subscribe(domain, (data) => {
487
- if (stylingContainer) {
488
- sheet.innerHTML = data;
489
- stylingContainer.appendChild(sheet);
490
- }
491
- });
492
- }
493
-
494
- function getAdoptStyleSubscription(stylingContainer, domain) {
495
- return window.emMessageBus.subscribe(domain, (data) => {
496
- if (!stylingContainer) return;
497
-
498
- const shadowRoot = stylingContainer.getRootNode();
499
- const cacheStyleObject = window[StyleCacheKey];
500
- let cachedStyle = cacheStyleObject[domain] && cacheStyleObject[domain].sheet;
501
-
502
- if (!cachedStyle) {
503
- cachedStyle = new CSSStyleSheet();
504
- cachedStyle.replaceSync(data);
505
- cacheStyleObject[domain] = {
506
- sheet: cachedStyle,
507
- refCount: 1
508
- };
509
- } else {
510
- cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
511
- }
512
-
513
- const currentSheets = shadowRoot.adoptedStyleSheets || [];
514
- if (!currentSheets.includes(cachedStyle)) {
515
- shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
516
- }
517
- });
518
- }
519
-
520
- const generalStylingWrapperCss = ":host{display:block}";
521
- const GeneralStylingWrapperStyle0 = generalStylingWrapperCss;
522
-
523
- const GeneralStylingWrapper = class {
524
- constructor(hostRef) {
525
- registerInstance(this, hostRef);
526
- this.stylingAppends = false;
527
- this.clientStyling = '';
528
- this.clientStylingUrl = '';
529
- this.mbSource = undefined;
530
- this.translationUrl = '';
531
- this.targetTranslations = undefined;
532
- }
533
- componentDidLoad() {
534
- if (this.el) {
535
- if (this.mbSource)
536
- setStreamStyling(this.el, `${this.mbSource}.Style`, this.stylingSubscription);
537
- if (this.clientStyling)
538
- setClientStyling(this.el, this.clientStyling);
539
- if (this.clientStylingUrl)
540
- setClientStylingURL(this.el, this.clientStylingUrl);
541
- this.stylingAppends = true;
542
- }
543
- }
544
- disconnectedCallback() {
545
- this.stylingSubscription && this.stylingSubscription.unsubscribe();
546
- }
547
- handleMbSourceChange(newValue, oldValue) {
548
- if (newValue != oldValue) {
549
- setStreamStyling(this.el, `${this.mbSource}.Style`, this.stylingSubscription);
550
- }
551
- }
552
- handleClientStylingChange(newValue, oldValue) {
553
- if (newValue != oldValue) {
554
- setClientStyling(this.el, this.clientStyling);
555
- }
556
- }
557
- handleClientStylingUrlChange(newValue, oldValue) {
558
- if (newValue != oldValue) {
559
- if (this.clientStylingUrl)
560
- setClientStylingURL(this.el, this.clientStylingUrl);
561
- }
562
- }
563
- componentDidRender() {
564
- // start custom styling area
565
- if (!this.stylingAppends) {
566
- if (this.clientStyling)
567
- setClientStyling(this.el, this.clientStyling);
568
- if (this.clientStylingUrl)
569
- setClientStylingURL(this.el, this.clientStylingUrl);
570
- this.stylingAppends = true;
571
- }
572
- // end custom styling area
573
- }
574
- async componentWillLoad() {
575
- const promises = [];
576
- if (this.translationUrl) {
577
- const translationPromise = mergeTranslations(this.translationUrl, this.targetTranslations);
578
- promises.push(translationPromise);
579
- }
580
- return await Promise.all(promises);
581
- }
582
- render() {
583
- return (h("div", { key: 'e660ceb69f5e848c788c3924fc814c0fa7a777a2', class: "StyleShell" }, h("slot", { key: '35014b6c0c32532af11e6a629ba9b13942504d21', name: "mainContent" })));
584
- }
585
- get el() { return getElement(this); }
586
- static get watchers() { return {
587
- "mbSource": ["handleMbSourceChange"],
588
- "clientStyling": ["handleClientStylingChange"],
589
- "clientStylingUrl": ["handleClientStylingUrlChange"]
590
- }; }
591
- };
592
- GeneralStylingWrapper.style = GeneralStylingWrapperStyle0;
593
-
594
- export { BonusElevateShopAssetsSlider as bonus_elevate_shop_assets_slider, BonusElevateShopItem as bonus_elevate_shop_item, GeneralStylingWrapper as general_styling_wrapper };