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