@everymatrix/bonus-elevate-shop-item 1.43.4 → 1.45.0
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-item.esm.js +1 -1
- package/dist/bonus-elevate-shop-item/p-961d6b9a.entry.js +1 -0
- package/dist/bonus-elevate-shop-item/p-e1255160.js +1 -0
- package/dist/bonus-elevate-shop-item/p-ec5f179f.js +2 -0
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/bonus-elevate-shop-assets-slider_3.cjs.entry.js +377 -406
- package/dist/cjs/bonus-elevate-shop-item.cjs.js +16 -10
- package/dist/cjs/index-1035f878.js +1591 -0
- package/dist/cjs/loader.cjs.js +6 -12
- package/dist/collection/collection-manifest.json +4 -4
- package/dist/collection/components/bonus-elevate-shop-item/bonus-elevate-shop-assets-slider.js +207 -222
- package/dist/collection/components/bonus-elevate-shop-item/bonus-elevate-shop-item.css +5 -5
- package/dist/collection/components/bonus-elevate-shop-item/bonus-elevate-shop-item.js +332 -362
- package/dist/collection/components/bonus-elevate-shop-item/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +54 -54
- package/dist/collection/utils/utils.js +26 -26
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/bonus-elevate-shop-assets-slider_3.entry.js +377 -406
- package/dist/esm/bonus-elevate-shop-item.js +13 -10
- package/dist/esm/index-fa394550.js +1561 -0
- package/dist/esm/loader.js +6 -12
- package/dist/stencil.config.dev.js +17 -0
- package/dist/stencil.config.js +14 -21
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/bonus-elevate-shop-item/.stencil/packages/stencil/bonus-elevate-shop-item/stencil.config.d.ts +2 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/bonus-elevate-shop-item/.stencil/packages/stencil/bonus-elevate-shop-item/stencil.config.dev.d.ts +2 -0
- package/dist/types/components/bonus-elevate-shop-item/bonus-elevate-shop-assets-slider.d.ts +35 -35
- package/dist/types/components/bonus-elevate-shop-item/bonus-elevate-shop-item.d.ts +56 -56
- package/dist/types/components/bonus-elevate-shop-item/index.d.ts +1 -0
- package/dist/types/components.d.ts +17 -1
- package/dist/types/models/bonus-elevate-shop-item.d.ts +12 -12
- package/dist/types/stencil-public-runtime.d.ts +142 -33
- package/loader/cdn.js +1 -3
- package/loader/index.cjs.js +1 -3
- package/loader/index.d.ts +13 -1
- package/loader/index.es2017.js +1 -3
- package/loader/index.js +1 -3
- package/loader/package.json +1 -0
- package/package.json +12 -5
- package/dist/bonus-elevate-shop-item/p-3d8363a3.js +0 -1
- package/dist/bonus-elevate-shop-item/p-9546c5ba.entry.js +0 -1
- package/dist/cjs/index-355d8ffb.js +0 -1653
- package/dist/components/bonus-elevate-shop-assets-slider.d.ts +0 -11
- package/dist/components/bonus-elevate-shop-assets-slider.js +0 -6
- package/dist/components/bonus-elevate-shop-assets-slider2.js +0 -158
- package/dist/components/bonus-elevate-shop-item.d.ts +0 -11
- package/dist/components/bonus-elevate-shop-item.js +0 -278
- package/dist/components/general-styling-wrapper.js +0 -6
- package/dist/components/general-styling-wrapper2.js +0 -103
- package/dist/components/index.d.ts +0 -26
- package/dist/components/index.js +0 -1
- package/dist/esm/index-4927ce96.js +0 -1624
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/bonus-elevate-shop-item/.stencil/packages/bonus-elevate-shop-item/stencil.config.d.ts +0 -2
|
@@ -2,205 +2,196 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-1035f878.js');
|
|
6
6
|
|
|
7
7
|
const BonusElevateShopAssetsSlider = class {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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 });
|
|
28
102
|
this.recalculateItemsPerPage();
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
this.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
this.move(-1);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
for (let i = 0; i > diff; i--) {
|
|
62
|
-
this.move(1);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
handleTouchStart(evt) {
|
|
67
|
-
const firstTouch = this.getTouches(evt)[0];
|
|
68
|
-
this.xDown = firstTouch.clientX;
|
|
69
|
-
this.yDown = firstTouch.clientY;
|
|
70
|
-
}
|
|
71
|
-
getTouches(evt) {
|
|
72
|
-
return evt.touches || evt.originalEvent.touches;
|
|
73
|
-
}
|
|
74
|
-
handleTouchMove(evt) {
|
|
75
|
-
if (!this.xDown || !this.yDown)
|
|
76
|
-
return;
|
|
77
|
-
let xUp = evt.touches[0].clientX;
|
|
78
|
-
let yUp = evt.touches[0].clientY;
|
|
79
|
-
let xDiff = this.xDown - xUp;
|
|
80
|
-
let yDiff = this.yDown - yUp;
|
|
81
|
-
if (Math.abs(xDiff) > Math.abs(yDiff)) {
|
|
82
|
-
if (xDiff > 0) {
|
|
83
|
-
this.move(1);
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
this.move(-1);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
this.xDown = null;
|
|
90
|
-
this.yDown = null;
|
|
91
|
-
}
|
|
92
|
-
;
|
|
93
|
-
recalculateItemsPerPage() {
|
|
94
|
-
if (!this.sliderItemsElement)
|
|
95
|
-
return;
|
|
96
|
-
this.itemElementWidth = this.sliderItemsElement.clientWidth;
|
|
97
|
-
this.sliderItemsElementWidth = (this.sliderItems.length - 1) * this.itemElementWidth;
|
|
98
|
-
}
|
|
99
|
-
;
|
|
100
|
-
renderDots() {
|
|
101
|
-
var _a;
|
|
102
|
-
const dots = [];
|
|
103
|
-
for (let index$1 = 0; index$1 < ((_a = this.sliderItems) === null || _a === void 0 ? void 0 : _a.length) / this.itemsPerPage; index$1++) {
|
|
104
|
-
dots.push(index.h("li", { class: index$1 == this.activeIndex ? 'active' : 'default', onClick: () => { this.goTo(index$1); this.setActive(index$1); } }));
|
|
105
|
-
}
|
|
106
|
-
return dots;
|
|
107
|
-
}
|
|
108
|
-
componentDidRender() {
|
|
109
|
-
this.el.addEventListener('touchstart', this.handleTouchStart.bind(this), { passive: true });
|
|
110
|
-
this.el.addEventListener('touchmove', this.handleTouchMove.bind(this), { passive: true });
|
|
111
|
-
this.recalculateItemsPerPage();
|
|
112
|
-
}
|
|
113
|
-
componentDidUpdate() {
|
|
114
|
-
this.recalculateItemsPerPage();
|
|
115
|
-
}
|
|
116
|
-
connectedCallback() {
|
|
117
|
-
window.screen.orientation.addEventListener('change', this.orientationChangeHandler);
|
|
118
|
-
}
|
|
119
|
-
disconnectedCallback() {
|
|
120
|
-
this.el.removeEventListener('touchstart', this.handleTouchStart);
|
|
121
|
-
this.el.removeEventListener('touchmove', this.handleTouchMove);
|
|
122
|
-
window.screen.orientation.removeEventListener('change', this.orientationChangeHandler);
|
|
123
|
-
window.removeEventListener('resize', this.resizeHandler);
|
|
124
|
-
}
|
|
125
|
-
render() {
|
|
126
|
-
var _a;
|
|
127
|
-
const styles = {
|
|
128
|
-
transform: `translate(${(this.sliderItemsElementWidth / (((_a = this.sliderItems) === null || _a === void 0 ? void 0 : _a.length) - 1) * this.activeIndex) * -1}px, 0px)`
|
|
129
|
-
};
|
|
130
|
-
const itemStyle = {
|
|
131
|
-
width: `${this.itemElementWidth / this.itemsPerPage}px`
|
|
132
|
-
};
|
|
133
|
-
return index.h("div", { class: "SliderWrapper" }, index.h("div", { class: 'MainContent ' }, this.showSliderArrows &&
|
|
134
|
-
index.h("div", { class: `SliderNavButton LeftArrow ${this.activeIndex === 0 ? 'DisabledArrow ' : ''} ${this.sliderItems.length === 1 ? 'HiddenArrow ' : ''}`, onClick: () => this.move(-1) }, index.h("svg", { fill: "none", stroke: "var(--emfe-w-color-secondary, #FD2839)", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M15 19l-7-7 7-7" }))), index.h("div", { class: 'ItemsWrapper', ref: (el) => this.sliderItemsElement = el }, index.h("div", { 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 &&
|
|
135
|
-
index.h("div", { class: `SliderNavButton RightArrow ${this.sliderItems.length === 1 ? 'HiddenArrow ' : ''}
|
|
136
|
-
${(this.activeIndex === (this.sliderItems.length - 1) || this.itemsPerPage == this.sliderItems.length) ? 'DisabledArrow' : ''}`, onClick: () => this.move(1) }, index.h("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M9 5l7 7-7 7" })))), this.showSliderDots && this.sliderItems.length > 1 &&
|
|
137
|
-
index.h("div", { class: "DotsWrapper" }, index.h("ul", { class: "Dots" }, this.renderDots())));
|
|
138
|
-
}
|
|
139
|
-
get el() { return index.getElement(this); }
|
|
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: '210d648ae90dd04e350c0cddb2047061f5989bd8', class: "SliderWrapper" }, index.h("div", { key: '240a214bc772890145b8317bfda32f6099150726', class: 'MainContent ' }, this.showSliderArrows &&
|
|
125
|
+
index.h("div", { key: 'e8e144fbc2906ee0c5e77cc00c33fb1e89ced29f', class: `SliderNavButton LeftArrow ${this.activeIndex === 0 ? 'DisabledArrow ' : ''} ${this.sliderItems.length === 1 ? 'HiddenArrow ' : ''}`, onClick: () => this.move(-1) }, index.h("svg", { key: '068a669fa96d11532199f2f2eb44e3a4c3f31e10', fill: "none", stroke: "var(--emfe-w-color-secondary, #FD2839)", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { key: '2789bb8d91ce4ec7f0fd7c3c6b9f3c7b7e682088', "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M15 19l-7-7 7-7" }))), index.h("div", { key: '034ef81e4d9a8dea56fd42791e8a08940dfa4af6', class: 'ItemsWrapper', ref: (el) => this.sliderItemsElement = el }, index.h("div", { key: 'f412b5f0978348e4d9e0af682d151a1880f6e86d', 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: '0f8549f8a5bcf2f1cfcde601930610fe5cc98427', 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: '5758a9a73af5f7fa4618ae1b4bb30d838b509d9f', fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { key: '720c5f0f496e8817fc9017ec4e8706cb9644e9ef', "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: '9c1b9c57b1871d7463569ea9566b28e925870d59', class: "DotsWrapper" }, index.h("ul", { key: '548d1d0f2c46170e07aa7ed4019dc3469e2e3950', class: "Dots" }, this.renderDots())));
|
|
129
|
+
}
|
|
130
|
+
get el() { return index.getElement(this); }
|
|
140
131
|
};
|
|
141
132
|
|
|
142
133
|
const DEFAULT_LANGUAGE = 'en';
|
|
143
134
|
const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hu'];
|
|
144
135
|
const TRANSLATIONS = {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
136
|
+
en: {
|
|
137
|
+
coins: 'Coins',
|
|
138
|
+
noGiftPresentation: 'No description',
|
|
139
|
+
redeem: 'Redeem',
|
|
140
|
+
noDataFound: 'No data found',
|
|
141
|
+
error4003: 'Invalid Session',
|
|
142
|
+
redeemFailed: 'Failed to redeem'
|
|
143
|
+
},
|
|
144
|
+
ro: {
|
|
145
|
+
coins: 'Coins',
|
|
146
|
+
noGiftPresentation: 'No description',
|
|
147
|
+
redeem: 'Redeem',
|
|
148
|
+
noDataFound: 'No data found',
|
|
149
|
+
error4003: 'Invalid Session',
|
|
150
|
+
redeemFailed: 'Failed to redeem'
|
|
151
|
+
},
|
|
152
|
+
fr: {
|
|
153
|
+
coins: 'Coins',
|
|
154
|
+
noGiftPresentation: 'No description',
|
|
155
|
+
redeem: 'Redeem',
|
|
156
|
+
noDataFound: 'No data found',
|
|
157
|
+
error4003: 'Invalid Session',
|
|
158
|
+
redeemFailed: 'Failed to redeem',
|
|
159
|
+
},
|
|
160
|
+
ar: {
|
|
161
|
+
coins: 'Coins',
|
|
162
|
+
noGiftPresentation: 'No description',
|
|
163
|
+
redeem: 'Redeem',
|
|
164
|
+
noDataFound: 'No data found',
|
|
165
|
+
error4003: 'Invalid Session',
|
|
166
|
+
redeemFailed: 'Failed to redeem',
|
|
167
|
+
},
|
|
168
|
+
hu: {
|
|
169
|
+
coins: 'Coins',
|
|
170
|
+
noGiftPresentation: 'No description',
|
|
171
|
+
redeem: 'Redeem',
|
|
172
|
+
noDataFound: 'No data found',
|
|
173
|
+
error4003: 'Invalid Session',
|
|
174
|
+
redeemFailed: 'Failed to redeem',
|
|
175
|
+
}
|
|
185
176
|
};
|
|
186
177
|
const translate = (key, customLang) => {
|
|
187
|
-
|
|
188
|
-
|
|
178
|
+
const lang = customLang;
|
|
179
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
189
180
|
};
|
|
190
181
|
const getTranslations = (url) => {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
182
|
+
// fetch url, get the data, replace the TRANSLATIONS content
|
|
183
|
+
return new Promise((resolve) => {
|
|
184
|
+
fetch(url)
|
|
185
|
+
.then((res) => res.json())
|
|
186
|
+
.then((data) => {
|
|
187
|
+
Object.keys(data).forEach((item) => {
|
|
188
|
+
for (let key in data[item]) {
|
|
189
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
resolve(true);
|
|
193
|
+
});
|
|
202
194
|
});
|
|
203
|
-
});
|
|
204
195
|
};
|
|
205
196
|
|
|
206
197
|
/**
|
|
@@ -210,246 +201,226 @@ const getTranslations = (url) => {
|
|
|
210
201
|
* @returns {Boolean} true or false
|
|
211
202
|
*/
|
|
212
203
|
const getDevice = () => {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
|
|
221
|
-
return 'iPad';
|
|
222
|
-
}
|
|
223
|
-
return 'PC';
|
|
224
|
-
};
|
|
225
|
-
const getDevicePlatform = () => {
|
|
226
|
-
const device = getDevice();
|
|
227
|
-
if (device) {
|
|
228
|
-
if (device === 'PC') {
|
|
229
|
-
return 'dk';
|
|
204
|
+
let userAgent = window.navigator.userAgent;
|
|
205
|
+
if (userAgent.toLowerCase().match(/android/i)) {
|
|
206
|
+
return 'Android';
|
|
207
|
+
}
|
|
208
|
+
if (userAgent.toLowerCase().match(/iphone/i)) {
|
|
209
|
+
return 'iPhone';
|
|
230
210
|
}
|
|
231
|
-
|
|
232
|
-
|
|
211
|
+
if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
|
|
212
|
+
return 'iPad';
|
|
233
213
|
}
|
|
234
|
-
|
|
235
|
-
|
|
214
|
+
return 'PC';
|
|
215
|
+
};
|
|
216
|
+
const getDevicePlatform = () => {
|
|
217
|
+
const device = getDevice();
|
|
218
|
+
if (device) {
|
|
219
|
+
if (device === 'PC') {
|
|
220
|
+
return 'dk';
|
|
221
|
+
}
|
|
222
|
+
else if (device === 'iPad' || device === 'iPhone') {
|
|
223
|
+
return 'ios';
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
return 'mtWeb';
|
|
227
|
+
}
|
|
236
228
|
}
|
|
237
|
-
}
|
|
238
229
|
};
|
|
239
230
|
|
|
240
|
-
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(--emfe-w-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:20px;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
|
|
231
|
+
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(--emfe-w-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:20px;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(--emfe-w-color-gray-300, rgb(78, 90, 55));font-weight:400;line-height:29px;letter-spacing:0.04em;text-align:left}.ElevateDetails .RedeemButton:hover{font-weight:800;border:2px solid var(--emfe-w-color-gray-300, rgb(229, 231, 213))}.ElevateDetails .RedeemButton.Disabled:hover{font-weight:normal;border:2px solid transparent}.ElevateDetails .RedeemButton{margin-top:50px;color:#f1f1f1;font-size:20px;padding:16px 25px 16px 25px;border-radius:18px;text-align:center;cursor:pointer;background:linear-gradient(0deg, #26CC37, #26CC37), linear-gradient(283.85deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 33.47%), linear-gradient(117.99deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 33.89%), linear-gradient(268.18deg, rgba(255, 255, 255, 0.6) -17.36%, rgba(239, 239, 239, 0) 15.78%);border:2px solid;border-image-source:linear-gradient(283.85deg, rgba(190, 40, 40, 0.5) 0%, rgba(56, 64, 179, 0) 33.47%);box-shadow:0px 4px 4px 0px rgba(0, 0, 0, 0.25)}.ElevateDetails .RedeemButton.DkButton{width:80px;padding:8px;font-size:16px;border-radius:5px}.ElevateDetails .RedeemButton.Disabled{background:linear-gradient(0deg, #b8c4b9, #9eb0a0), linear-gradient(283.85deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 33.47%), linear-gradient(117.99deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 33.89%), linear-gradient(268.18deg, rgba(255, 255, 255, 0.6) -17.36%, rgba(239, 239, 239, 0) 15.78%)}.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(--emfe-w-color-secondary, #FD2839);background:var(--emfe-w-color-secondary, #FD2839)}.ElevateDetails .SliderWrapper .DotsWrapper ul.Dots li.default{border:solid 1px var(--emfe-w-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(--emfe-w-color-secondary, #FD2839)}.ElevateDetails .DisabledArrow svg{opacity:0.2;stroke:var(--emfe-w-color-secondary, #FD2839);pointer-events:none}";
|
|
232
|
+
const BonusElevateShopItemStyle0 = bonusElevateShopItemCss;
|
|
241
233
|
|
|
242
234
|
const BonusElevateShopItem = class {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
.
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
235
|
+
constructor(hostRef) {
|
|
236
|
+
index.registerInstance(this, hostRef);
|
|
237
|
+
this.redeemGiftButton = index.createEvent(this, "redeemGiftButton", 7);
|
|
238
|
+
this.bindedHandler = this.handleMessage.bind(this);
|
|
239
|
+
this.deviceType = getDevicePlatform();
|
|
240
|
+
this.endpoint = undefined;
|
|
241
|
+
this.language = 'en';
|
|
242
|
+
this.itemId = undefined;
|
|
243
|
+
this.elevateGift = undefined;
|
|
244
|
+
this.session = undefined;
|
|
245
|
+
this.clientStyling = '';
|
|
246
|
+
this.clientStylingUrl = '';
|
|
247
|
+
this.translationUrl = '';
|
|
248
|
+
this.showSliderDots = false;
|
|
249
|
+
this.showSliderArrows = true;
|
|
250
|
+
this.isGiftNotFound = false;
|
|
251
|
+
this.redeemErrorMsg = '';
|
|
252
|
+
this.isRedeeming = false;
|
|
253
|
+
}
|
|
254
|
+
redeemGiftConfirm() {
|
|
255
|
+
window.postMessage({ type: 'BEERedeemConfirm', shopItem: this.elevateGift }, window.location.href);
|
|
256
|
+
}
|
|
257
|
+
handleMessage(message) {
|
|
258
|
+
if (message.data && message.data.type === "bee-redeem-confirmed" &&
|
|
259
|
+
message.data.id == this.elevateGift.id) {
|
|
260
|
+
this.redeemGift();
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
onBackClicked() {
|
|
264
|
+
window.postMessage({ type: 'OnGiftDetailsBackButtonClicked' }, window.location.href);
|
|
265
|
+
}
|
|
266
|
+
redeemGift() {
|
|
267
|
+
if (this.elevateGift.available.toLowerCase() === 'false') {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
let url = new URL(`${this.endpoint}/v1/elevate/redeem`);
|
|
271
|
+
let claimGiftOptions = {
|
|
272
|
+
method: 'PUT',
|
|
273
|
+
headers: {
|
|
274
|
+
'x-SessionId': this.session,
|
|
275
|
+
'Content-Type': 'application/json-patch+json',
|
|
276
|
+
},
|
|
277
|
+
body: JSON.stringify({ giftId: this.elevateGift.id }),
|
|
278
|
+
};
|
|
279
|
+
this.redeemErrorMsg = '';
|
|
280
|
+
this.isRedeeming = true;
|
|
281
|
+
fetch(url.toString(), claimGiftOptions)
|
|
282
|
+
.then((res) => res.json())
|
|
283
|
+
.then((res) => {
|
|
284
|
+
if (res.success) {
|
|
285
|
+
this.redeemGiftButton.emit();
|
|
286
|
+
window.postMessage({ type: 'BEEGiftRedeem', itemId: this.elevateGift.id }, window.location.href);
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
let translatedError = translate(`error${res.errorCode}`, this.language);
|
|
290
|
+
this.redeemErrorMsg = translatedError ? translatedError : translate('redeemFailed', this.language);
|
|
291
|
+
window.postMessage({ type: 'BEEGiftRedeemFailed', itemId: this.elevateGift.id, res }, window.location.href);
|
|
292
|
+
}
|
|
293
|
+
})
|
|
294
|
+
.catch((err) => {
|
|
295
|
+
window.postMessage({ type: 'BEEGiftClaimFailed', itemId: this.elevateGift.id, err }, window.location.href);
|
|
296
|
+
}).finally(() => {
|
|
297
|
+
this.isRedeeming = false;
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
async loadElevateGift() {
|
|
301
|
+
let url = new URL(`${this.endpoint}/v1/elevate/shop?language=${this.language}&filter=id=${this.itemId}`);
|
|
302
|
+
let options = {
|
|
303
|
+
headers: {
|
|
304
|
+
'Content-Type': 'application/json',
|
|
305
|
+
'x-SessionId': this.session,
|
|
306
|
+
},
|
|
307
|
+
method: 'GET',
|
|
308
|
+
};
|
|
309
|
+
await new Promise((resolve) => {
|
|
310
|
+
fetch(url.href, options)
|
|
311
|
+
.then((res) => res.json())
|
|
312
|
+
.then((data) => {
|
|
313
|
+
let filteredGifts = data.data;
|
|
314
|
+
if (filteredGifts && filteredGifts.length == 1) {
|
|
315
|
+
this.elevateGift = filteredGifts[0];
|
|
316
|
+
this.isGiftNotFound = false;
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
this.isGiftNotFound = true;
|
|
320
|
+
}
|
|
321
|
+
resolve(true);
|
|
322
|
+
});
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
disconnectedCallback() {
|
|
326
|
+
window.removeEventListener('message', this.bindedHandler, false);
|
|
327
|
+
}
|
|
328
|
+
componentDidLoad() {
|
|
329
|
+
window.addEventListener('message', this.bindedHandler, false);
|
|
330
|
+
}
|
|
331
|
+
async componentWillLoad() {
|
|
332
|
+
if (this.translationUrl.length > 2) {
|
|
333
|
+
await getTranslations(this.translationUrl);
|
|
334
|
+
}
|
|
335
|
+
if (this.elevateGift) {
|
|
336
|
+
this.isGiftNotFound = false;
|
|
339
337
|
}
|
|
340
338
|
else {
|
|
341
|
-
|
|
339
|
+
await this.loadElevateGift();
|
|
342
340
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
componentDidLoad() {
|
|
351
|
-
window.addEventListener('message', this.bindedHandler, false);
|
|
352
|
-
}
|
|
353
|
-
async componentWillLoad() {
|
|
354
|
-
if (this.translationUrl.length > 2) {
|
|
355
|
-
await getTranslations(this.translationUrl);
|
|
356
|
-
}
|
|
357
|
-
if (this.elevateGift) {
|
|
358
|
-
this.isGiftNotFound = false;
|
|
359
|
-
}
|
|
360
|
-
else {
|
|
361
|
-
await this.loadElevateGift();
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
render() {
|
|
365
|
-
return (index.h(index.Host, null, index.h("general-styling-wrapper", { clientStylingUrl: this.clientStylingUrl, clientStyling: this.clientStyling }), index.h("div", { class: 'ElevateDetails' }, this.isGiftNotFound && (index.h(index.Fragment, null, index.h("div", { class: "Row ThumbnailRow" }, index.h("div", { class: "BackButton", onClick: () => {
|
|
366
|
-
this.onBackClicked();
|
|
367
|
-
} }, '<')), index.h("div", { class: "Thumnails GiftNotFound" }, translate('noDataFound', this.language), "."))), this.elevateGift && index.h(index.Fragment, null, index.h("div", { class: "ThumbnailRow" }, index.h("div", { class: 'Row' }, index.h("div", { class: "BackButton", onClick: () => { this.onBackClicked(); } }, '<'), index.h("bonus-elevate-shop-assets-slider", { class: 'Thumbnails', itemsPerPage: 1, sliderItems: this.elevateGift.presentation.assets, showSliderDots: this.showSliderDots })), index.h("div", { class: 'Col Details' }, index.h("h3", { class: "GiftName" }, this.elevateGift.presentation.displayName || this.elevateGift.displayName), index.h("div", { class: "GiftPoints" }, index.h("span", { class: "Points" }, this.elevateGift.points, " "), index.h("span", { class: " PointsLabel" }, translate('coins', this.language))))), index.h("div", { class: 'ShopItemDetail Details' }, index.h("div", { class: "GiftPresentation" }, index.h("p", null, this.elevateGift.presentation.description ? this.elevateGift.presentation.description : translate('noGiftPresentation', this.language))), index.h("div", { class: `RedeemButton ${this.elevateGift.available === 'false' || this.isRedeeming ? 'Disabled' : ''}
|
|
368
|
-
${this.deviceType == 'dk' ? 'DkButton' : ''}`, onClick: this.redeemGiftConfirm.bind(this) }, translate('redeem', this.language)), index.h("span", { class: 'RedeemError Error' }, " ", this.redeemErrorMsg, " "))))));
|
|
369
|
-
}
|
|
341
|
+
}
|
|
342
|
+
render() {
|
|
343
|
+
return (index.h(index.Host, { key: '6f28f64d3413dd82bc81fc6fd975baa992d06289' }, index.h("general-styling-wrapper", { key: '88dedbfb25562fbe95a69748649ed9c14a2c42f6', clientStylingUrl: this.clientStylingUrl, clientStyling: this.clientStyling }), index.h("div", { key: '9f2a66f9d48882220ab5d3850f343e995ffe9a6b', class: 'ElevateDetails' }, this.isGiftNotFound && (index.h(index.Fragment, { key: '91f4079bf7af7e4d61b1681a9848c72c9a2249d5' }, index.h("div", { key: 'e0427680e0d7e94e51644f12a2430a6a42e3d340', class: "Row ThumbnailRow" }, index.h("div", { key: '4fd78968b2fdf281b7c22596351b366058cfcec3', class: "BackButton", onClick: () => {
|
|
344
|
+
this.onBackClicked();
|
|
345
|
+
} }, '<')), index.h("div", { key: 'eeb8cbc40429cf1ebf7a5f0de3d5b8226a40437b', class: "Thumnails GiftNotFound" }, translate('noDataFound', this.language), "."))), this.elevateGift && index.h(index.Fragment, { key: '45380d051b279d9c7fcd580f06252911763073e0' }, index.h("div", { key: 'c440d72501fb91601106fbf74a866887bc02ee43', class: "ThumbnailRow" }, index.h("div", { key: '005f436acbc51372d013e1931d54b71738f2e0fc', class: 'Row' }, index.h("div", { key: 'a9ace30abf1c50d639c31bb047d7b7d7cb6b27b8', class: "BackButton", onClick: () => { this.onBackClicked(); } }, '<'), index.h("bonus-elevate-shop-assets-slider", { key: '8c4121e66a3fae912e72fc10c6a81354a7b36e9f', class: 'Thumbnails', itemsPerPage: 1, sliderItems: this.elevateGift.presentation.assets, showSliderDots: this.showSliderDots })), index.h("div", { key: 'c6a207dfe14402e4d1890e7b787bf4b5a2247160', class: 'Col Details' }, index.h("h3", { key: 'c190b88ab4d1e13885593b9d6b9c62b161bdff23', class: "GiftName" }, this.elevateGift.presentation.displayName || this.elevateGift.displayName), index.h("div", { key: 'befddb7b8dff3bb73377da4bfb30ce003dcccb7b', class: "GiftPoints" }, index.h("span", { key: '4e879d150709e670b2c7c90f0034c75c4ba30386', class: "Points" }, this.elevateGift.points, " "), index.h("span", { key: 'a7d28d964b41126a76f9988d0f4fc05653787066', class: " PointsLabel" }, translate('coins', this.language))))), index.h("div", { key: '14d2374d40825ac91b275fda81ca22d40f21c0be', class: 'ShopItemDetail Details' }, index.h("div", { key: '197bb9c0089173f8c4f180e115068f6204a6f7ea', class: "GiftPresentation" }, index.h("p", { key: '30be8dbec63f8f4d2bc3687d7e992d73c534a20f' }, this.elevateGift.presentation.description ? this.elevateGift.presentation.description : translate('noGiftPresentation', this.language))), index.h("div", { key: '7e0a9e4d03f338137649c9477a44c7036aea1609', class: `RedeemButton ${this.elevateGift.available === 'false' || this.isRedeeming ? 'Disabled' : ''}
|
|
346
|
+
${this.deviceType == 'dk' ? 'DkButton' : ''}`, onClick: this.redeemGiftConfirm.bind(this) }, translate('redeem', this.language)), index.h("span", { key: '89b70f02565437ed28b175c65d0767354b6c9d6b', class: 'RedeemError Error' }, " ", this.redeemErrorMsg, " "))))));
|
|
347
|
+
}
|
|
370
348
|
};
|
|
371
|
-
BonusElevateShopItem.style =
|
|
349
|
+
BonusElevateShopItem.style = BonusElevateShopItemStyle0;
|
|
372
350
|
|
|
373
351
|
const mergeTranslations = (url, target) => {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
352
|
+
return new Promise((resolve) => {
|
|
353
|
+
fetch(url)
|
|
354
|
+
.then((res) => res.json())
|
|
355
|
+
.then((data) => {
|
|
356
|
+
Object.keys(data).forEach((item) => {
|
|
357
|
+
target[item] = target[item] ? target[item] : {};
|
|
358
|
+
for (let key in data[item]) {
|
|
359
|
+
target[item][key] = data[item][key];
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
resolve(true);
|
|
363
|
+
});
|
|
385
364
|
});
|
|
386
|
-
});
|
|
387
365
|
};
|
|
388
366
|
|
|
389
367
|
const generalStylingWrapperCss = ":host{display:block}";
|
|
368
|
+
const GeneralStylingWrapperStyle0 = generalStylingWrapperCss;
|
|
390
369
|
|
|
391
370
|
const GeneralStylingWrapper = class {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
.
|
|
417
|
-
.
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
promises.push(translationPromise);
|
|
444
|
-
}
|
|
445
|
-
return await Promise.all(promises);
|
|
446
|
-
}
|
|
447
|
-
render() {
|
|
448
|
-
return (index.h("div", { class: "StyleShell" }, index.h("slot", { name: "mainContent" })));
|
|
449
|
-
}
|
|
450
|
-
get el() { return index.getElement(this); }
|
|
371
|
+
constructor(hostRef) {
|
|
372
|
+
index.registerInstance(this, hostRef);
|
|
373
|
+
this.stylingAppends = false;
|
|
374
|
+
this.setClientStyling = () => {
|
|
375
|
+
let sheet = document.createElement('style');
|
|
376
|
+
sheet.innerHTML = this.clientStyling;
|
|
377
|
+
this.el.prepend(sheet);
|
|
378
|
+
};
|
|
379
|
+
this.setClientStylingURL = () => {
|
|
380
|
+
let url = new URL(this.clientStylingUrl);
|
|
381
|
+
let cssFile = document.createElement('style');
|
|
382
|
+
fetch(url.href)
|
|
383
|
+
.then((res) => res.text())
|
|
384
|
+
.then((data) => {
|
|
385
|
+
cssFile.innerHTML = data;
|
|
386
|
+
setTimeout(() => {
|
|
387
|
+
this.el.prepend(cssFile);
|
|
388
|
+
}, 1);
|
|
389
|
+
})
|
|
390
|
+
.catch((err) => {
|
|
391
|
+
console.log('error ', err);
|
|
392
|
+
});
|
|
393
|
+
};
|
|
394
|
+
this.clientStyling = '';
|
|
395
|
+
this.clientStylingUrl = '';
|
|
396
|
+
this.translationUrl = '';
|
|
397
|
+
this.targetTranslations = undefined;
|
|
398
|
+
}
|
|
399
|
+
componentDidRender() {
|
|
400
|
+
// start custom styling area
|
|
401
|
+
if (!this.stylingAppends) {
|
|
402
|
+
if (this.clientStyling)
|
|
403
|
+
this.setClientStyling();
|
|
404
|
+
if (this.clientStylingUrl)
|
|
405
|
+
this.setClientStylingURL();
|
|
406
|
+
this.stylingAppends = true;
|
|
407
|
+
}
|
|
408
|
+
// end custom styling area
|
|
409
|
+
}
|
|
410
|
+
async componentWillLoad() {
|
|
411
|
+
const promises = [];
|
|
412
|
+
if (this.translationUrl) {
|
|
413
|
+
const translationPromise = mergeTranslations(this.translationUrl, this.targetTranslations);
|
|
414
|
+
promises.push(translationPromise);
|
|
415
|
+
}
|
|
416
|
+
return await Promise.all(promises);
|
|
417
|
+
}
|
|
418
|
+
render() {
|
|
419
|
+
return (index.h("div", { key: '4d3414408c7662f88331dbe655966237f74d6958', class: "StyleShell" }, index.h("slot", { key: '1d004644d84602c4314bdf5dfc26b55b160f57df', name: "mainContent" })));
|
|
420
|
+
}
|
|
421
|
+
get el() { return index.getElement(this); }
|
|
451
422
|
};
|
|
452
|
-
GeneralStylingWrapper.style =
|
|
423
|
+
GeneralStylingWrapper.style = GeneralStylingWrapperStyle0;
|
|
453
424
|
|
|
454
425
|
exports.bonus_elevate_shop_assets_slider = BonusElevateShopAssetsSlider;
|
|
455
426
|
exports.bonus_elevate_shop_item = BonusElevateShopItem;
|