@everymatrix/bonus-elevate-shop 1.31.2
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/assets/avaliable.false.svg +47 -0
- package/dist/assets/avaliable.true.svg +47 -0
- package/dist/bonus-elevate-shop/bonus-elevate-shop.esm.js +1 -0
- package/dist/bonus-elevate-shop/index.esm.js +0 -0
- package/dist/bonus-elevate-shop/p-6410647b.entry.js +1 -0
- package/dist/bonus-elevate-shop/p-75b51599.js +1 -0
- package/dist/bonus-elevate-shop/p-a76542bd.entry.js +1 -0
- package/dist/bonus-elevate-shop/p-d4f6c446.entry.js +1 -0
- package/dist/bonus-elevate-shop/p-e2f63c46.js +1 -0
- package/dist/cjs/bonus-elevate-shop.cjs.js +19 -0
- package/dist/cjs/bonus-elevate-shop_4.cjs.entry.js +787 -0
- package/dist/cjs/index-ec3ffb89.js +1680 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/player-elevate-card-items-8154b78f.js +2477 -0
- package/dist/cjs/player-elevate-card.cjs.entry.js +77 -0
- package/dist/cjs/player-elevate-loyaltycard.cjs.entry.js +84 -0
- package/dist/collection/collection-manifest.json +28 -0
- package/dist/collection/components/bonus-elevate-shop/bonus-elevate-shop.css +84 -0
- package/dist/collection/components/bonus-elevate-shop/bonus-elevate-shop.js +186 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/renders/renderGifts.js +41 -0
- package/dist/collection/static/avaliable.false.svg +47 -0
- package/dist/collection/static/avaliable.true.svg +47 -0
- package/dist/collection/utils/fetch.js +29 -0
- package/dist/collection/utils/translation.js +6 -0
- package/dist/collection/utils/types.js +1 -0
- package/dist/components/bonus-elevate-shop.d.ts +11 -0
- package/dist/components/bonus-elevate-shop.js +279 -0
- package/dist/components/general-styling-wrapper.js +6 -0
- package/dist/components/general-styling-wrapper2.js +103 -0
- package/dist/components/index.d.ts +26 -0
- package/dist/components/index.js +1 -0
- package/dist/components/player-elevate-card-data.js +6 -0
- package/dist/components/player-elevate-card-data2.js +624 -0
- package/dist/components/player-elevate-card-items.js +2250 -0
- package/dist/components/player-elevate-card.js +118 -0
- package/dist/components/player-elevate-loyaltycard.js +124 -0
- package/dist/components/player-elevate-pointcard.js +6 -0
- package/dist/components/player-elevate-pointcard2.js +124 -0
- package/dist/esm/bonus-elevate-shop.js +17 -0
- package/dist/esm/bonus-elevate-shop_4.entry.js +780 -0
- package/dist/esm/index-2b126a46.js +1651 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/player-elevate-card-items-88f5a140.js +2464 -0
- package/dist/esm/player-elevate-card.entry.js +73 -0
- package/dist/esm/player-elevate-loyaltycard.entry.js +80 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/static/button-default.svg +42 -0
- package/dist/static/button-disabled.svg +4 -0
- package/dist/static/button-hover.svg +4 -0
- package/dist/static/button-level.svg +27 -0
- package/dist/static/button-pressed.svg +18 -0
- package/dist/static/button-redeem.svg +36 -0
- package/dist/static/card-ground-over.png +0 -0
- package/dist/static/card-ground-over.svg +903 -0
- package/dist/static/card-ground.png +0 -0
- package/dist/static/card-ground.svg +34 -0
- package/dist/static/info.svg +4 -0
- package/dist/static/level-badge.png +0 -0
- package/dist/static/level-percent.svg +80 -0
- package/dist/static/tips-info.svg +21 -0
- package/dist/static/user.svg +3 -0
- package/dist/stencil.config.js +34 -0
- package/dist/types/Users/dragos.bodea/Documents/everymatrix-prjs/emfe-widgets/widgets-stencil/packages/bonus-elevate-shop/.stencil/packages/bonus-elevate-shop/stencil.config.d.ts +2 -0
- package/dist/types/components/bonus-elevate-shop/bonus-elevate-shop.d.ts +36 -0
- package/dist/types/components.d.ts +85 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/renders/renderGifts.d.ts +3 -0
- package/dist/types/stencil-public-runtime.d.ts +1565 -0
- package/dist/types/utils/fetch.d.ts +3 -0
- package/dist/types/utils/translation.d.ts +7 -0
- package/dist/types/utils/types.d.ts +12 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +27 -0
|
@@ -0,0 +1,787 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-ec3ffb89.js');
|
|
6
|
+
const playerElevateCardItems = require('./player-elevate-card-items-8154b78f.js');
|
|
7
|
+
|
|
8
|
+
const getUrl = (path, params = {}) => {
|
|
9
|
+
return path + '?' + Object.keys(params).map(key => `${key}=${params[key]}`).join('&');
|
|
10
|
+
};
|
|
11
|
+
const fetcher = async (input, init = {}) => {
|
|
12
|
+
let res;
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
res = await fetch(input, init);
|
|
15
|
+
res = await res.text();
|
|
16
|
+
try {
|
|
17
|
+
res = JSON.parse(res);
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
console.error(e);
|
|
21
|
+
}
|
|
22
|
+
return res;
|
|
23
|
+
};
|
|
24
|
+
async function fetchNorwayApi(path, params = {}, init = {}) {
|
|
25
|
+
const { endpoint, language, session } = this;
|
|
26
|
+
const fetchParams = params;
|
|
27
|
+
if (!init.method || init.method === 'GET') {
|
|
28
|
+
fetchParams.language = language;
|
|
29
|
+
}
|
|
30
|
+
const url = getUrl(`${endpoint}${path}`, fetchParams);
|
|
31
|
+
if (!init.headers)
|
|
32
|
+
init.headers = {};
|
|
33
|
+
init.headers['x-SessionId'] = session;
|
|
34
|
+
const res = await fetcher(url, init);
|
|
35
|
+
return res;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const translation = {
|
|
39
|
+
en: {
|
|
40
|
+
Points: 'Points',
|
|
41
|
+
Point: 'Point',
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const avaliableTrueSvg = `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
46
|
+
<g filter="url(#filter0_bd_179_6145)">
|
|
47
|
+
<circle cx="23" cy="19" r="19" style="fill: var(--emfe-w-elevate-avaliable-button-enabled-color, #53B65C);" />
|
|
48
|
+
<circle cx="23" cy="19" r="18" stroke="url(#paint0_linear_179_6145)" stroke-opacity="0.6" stroke-width="2"/>
|
|
49
|
+
<circle cx="23" cy="19" r="18" stroke="url(#paint1_linear_179_6145)" stroke-width="2"/>
|
|
50
|
+
<circle cx="23" cy="19" r="18" stroke="url(#paint2_linear_179_6145)" stroke-width="2"/>
|
|
51
|
+
</g>
|
|
52
|
+
<g filter="url(#filter1_d_179_6145)">
|
|
53
|
+
<path d="M31.1977 11C31.7015 11 32.1279 11.1777 32.4767 11.5332C32.8256 11.8887 33 12.3203 33 12.8281V18.9102C33 20.2852 32.7364 21.5977 32.2093 22.8477C31.6822 24.0977 30.9748 25.1719 30.0872 26.0703C29.1996 26.9688 28.1376 27.6816 26.9012 28.209C25.6647 28.7363 24.3682 29 23.0116 29C21.6473 29 20.3469 28.7363 19.1105 28.209C17.874 27.6816 16.8101 26.9688 15.9186 26.0703C15.0271 25.1719 14.3178 24.0977 13.7907 22.8477C13.2636 21.5977 13 20.2852 13 18.9102V12.8281C13 12.3281 13.1783 11.8984 13.5349 11.5391C13.8915 11.1797 14.3178 11 14.814 11H31.1977ZM23.0116 23.4688C23.376 23.4688 23.6938 23.3398 23.9651 23.082L28.6628 18.5352C28.9496 18.2617 29.093 17.9297 29.093 17.5391C29.093 17.1562 28.9593 16.8301 28.6919 16.5605C28.4244 16.291 28.1008 16.1562 27.7209 16.1562C27.3566 16.1562 27.0388 16.2852 26.7674 16.543L23.0116 20.1758L19.2558 16.543C18.9845 16.2852 18.6705 16.1562 18.314 16.1562C17.9341 16.1562 17.6105 16.291 17.343 16.5605C17.0756 16.8301 16.9419 17.1562 16.9419 17.5391C16.9419 17.9375 17.0814 18.2695 17.3605 18.5352L22.0698 23.082C22.3256 23.3398 22.6395 23.4688 23.0116 23.4688Z" fill="white"/>
|
|
54
|
+
</g>
|
|
55
|
+
<defs>
|
|
56
|
+
<filter id="filter0_bd_179_6145" x="-36" y="-40" width="118" height="118" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
57
|
+
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
58
|
+
<feGaussianBlur in="BackgroundImageFix" stdDeviation="20"/>
|
|
59
|
+
<feComposite in2="SourceAlpha" operator="in" result="effect1_backgroundBlur_179_6145"/>
|
|
60
|
+
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
61
|
+
<feOffset dy="4"/>
|
|
62
|
+
<feGaussianBlur stdDeviation="2"/>
|
|
63
|
+
<feComposite in2="hardAlpha" operator="out"/>
|
|
64
|
+
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
|
|
65
|
+
<feBlend mode="normal" in2="effect1_backgroundBlur_179_6145" result="effect2_dropShadow_179_6145"/>
|
|
66
|
+
<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_179_6145" result="shape"/>
|
|
67
|
+
</filter>
|
|
68
|
+
<filter id="filter1_d_179_6145" x="11" y="10" width="24" height="22" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
69
|
+
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
70
|
+
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
71
|
+
<feOffset dy="1"/>
|
|
72
|
+
<feGaussianBlur stdDeviation="1"/>
|
|
73
|
+
<feComposite in2="hardAlpha" operator="out"/>
|
|
74
|
+
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
|
|
75
|
+
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_179_6145"/>
|
|
76
|
+
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_179_6145" result="shape"/>
|
|
77
|
+
</filter>
|
|
78
|
+
<linearGradient id="paint0_linear_179_6145" x1="49.2869" y1="15.1911" x2="36.3103" y2="15.603" gradientUnits="userSpaceOnUse">
|
|
79
|
+
<stop stop-color="white"/>
|
|
80
|
+
<stop offset="1" stop-color="#EFEFEF" stop-opacity="0"/>
|
|
81
|
+
</linearGradient>
|
|
82
|
+
<linearGradient id="paint1_linear_179_6145" x1="4" y1="0" x2="19.3776" y2="8.17396" gradientUnits="userSpaceOnUse">
|
|
83
|
+
<stop stop-color="white" stop-opacity="0.5"/>
|
|
84
|
+
<stop offset="1" stop-color="white" stop-opacity="0"/>
|
|
85
|
+
</linearGradient>
|
|
86
|
+
<linearGradient id="paint2_linear_179_6145" x1="42" y1="38" x2="27.0558" y2="34.3156" gradientUnits="userSpaceOnUse">
|
|
87
|
+
<stop stop-color="white" stop-opacity="0.5"/>
|
|
88
|
+
<stop offset="1" stop-color="white" stop-opacity="0"/>
|
|
89
|
+
</linearGradient>
|
|
90
|
+
</defs>
|
|
91
|
+
</svg>
|
|
92
|
+
`;
|
|
93
|
+
|
|
94
|
+
const avaliableFalseSvg = `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
95
|
+
<g filter="url(#filter0_bd_183_6497)">
|
|
96
|
+
<circle cx="23" cy="19" r="19" style="fill: var(--emfe-w-elevate-avaliable-button-disabled-color, #B7B7B7);" />
|
|
97
|
+
<circle cx="23" cy="19" r="18" stroke="url(#paint0_linear_183_6497)" stroke-opacity="0.6" stroke-width="2"/>
|
|
98
|
+
<circle cx="23" cy="19" r="18" stroke="url(#paint1_linear_183_6497)" stroke-width="2"/>
|
|
99
|
+
<circle cx="23" cy="19" r="18" stroke="url(#paint2_linear_183_6497)" stroke-width="2"/>
|
|
100
|
+
</g>
|
|
101
|
+
<g filter="url(#filter1_d_183_6497)">
|
|
102
|
+
<path d="M31.1977 11C31.7015 11 32.1279 11.1777 32.4767 11.5332C32.8256 11.8887 33 12.3203 33 12.8281V18.9102C33 20.2852 32.7364 21.5977 32.2093 22.8477C31.6822 24.0977 30.9748 25.1719 30.0872 26.0703C29.1996 26.9688 28.1376 27.6816 26.9012 28.209C25.6647 28.7363 24.3682 29 23.0116 29C21.6473 29 20.3469 28.7363 19.1105 28.209C17.874 27.6816 16.8101 26.9688 15.9186 26.0703C15.0271 25.1719 14.3178 24.0977 13.7907 22.8477C13.2636 21.5977 13 20.2852 13 18.9102V12.8281C13 12.3281 13.1783 11.8984 13.5349 11.5391C13.8915 11.1797 14.3178 11 14.814 11H31.1977ZM23.0116 23.4688C23.376 23.4688 23.6938 23.3398 23.9651 23.082L28.6628 18.5352C28.9496 18.2617 29.093 17.9297 29.093 17.5391C29.093 17.1562 28.9593 16.8301 28.6919 16.5605C28.4244 16.291 28.1008 16.1562 27.7209 16.1562C27.3566 16.1562 27.0388 16.2852 26.7674 16.543L23.0116 20.1758L19.2558 16.543C18.9845 16.2852 18.6705 16.1562 18.314 16.1562C17.9341 16.1562 17.6105 16.291 17.343 16.5605C17.0756 16.8301 16.9419 17.1562 16.9419 17.5391C16.9419 17.9375 17.0814 18.2695 17.3605 18.5352L22.0698 23.082C22.3256 23.3398 22.6395 23.4688 23.0116 23.4688Z" fill="#F0F0F0"/>
|
|
103
|
+
</g>
|
|
104
|
+
<defs>
|
|
105
|
+
<filter id="filter0_bd_183_6497" x="-36" y="-40" width="118" height="118" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
106
|
+
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
107
|
+
<feGaussianBlur in="BackgroundImageFix" stdDeviation="20"/>
|
|
108
|
+
<feComposite in2="SourceAlpha" operator="in" result="effect1_backgroundBlur_183_6497"/>
|
|
109
|
+
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
110
|
+
<feOffset dy="4"/>
|
|
111
|
+
<feGaussianBlur stdDeviation="2"/>
|
|
112
|
+
<feComposite in2="hardAlpha" operator="out"/>
|
|
113
|
+
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
|
|
114
|
+
<feBlend mode="normal" in2="effect1_backgroundBlur_183_6497" result="effect2_dropShadow_183_6497"/>
|
|
115
|
+
<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_183_6497" result="shape"/>
|
|
116
|
+
</filter>
|
|
117
|
+
<filter id="filter1_d_183_6497" x="11" y="10" width="24" height="22" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
118
|
+
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
119
|
+
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
120
|
+
<feOffset dy="1"/>
|
|
121
|
+
<feGaussianBlur stdDeviation="1"/>
|
|
122
|
+
<feComposite in2="hardAlpha" operator="out"/>
|
|
123
|
+
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
|
|
124
|
+
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_183_6497"/>
|
|
125
|
+
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_183_6497" result="shape"/>
|
|
126
|
+
</filter>
|
|
127
|
+
<linearGradient id="paint0_linear_183_6497" x1="49.2869" y1="15.1911" x2="36.3103" y2="15.603" gradientUnits="userSpaceOnUse">
|
|
128
|
+
<stop stop-color="white"/>
|
|
129
|
+
<stop offset="1" stop-color="#EFEFEF" stop-opacity="0"/>
|
|
130
|
+
</linearGradient>
|
|
131
|
+
<linearGradient id="paint1_linear_183_6497" x1="4" y1="0" x2="19.3776" y2="8.17396" gradientUnits="userSpaceOnUse">
|
|
132
|
+
<stop stop-color="white" stop-opacity="0.5"/>
|
|
133
|
+
<stop offset="1" stop-color="white" stop-opacity="0"/>
|
|
134
|
+
</linearGradient>
|
|
135
|
+
<linearGradient id="paint2_linear_183_6497" x1="42" y1="38" x2="27.0558" y2="34.3156" gradientUnits="userSpaceOnUse">
|
|
136
|
+
<stop stop-color="white" stop-opacity="0.5"/>
|
|
137
|
+
<stop offset="1" stop-color="white" stop-opacity="0"/>
|
|
138
|
+
</linearGradient>
|
|
139
|
+
</defs>
|
|
140
|
+
</svg>
|
|
141
|
+
`;
|
|
142
|
+
|
|
143
|
+
const getStatusData = (gift, redeem) => {
|
|
144
|
+
switch (gift.available) {
|
|
145
|
+
case "true":
|
|
146
|
+
return {
|
|
147
|
+
extraClass: ' active',
|
|
148
|
+
onClick: () => redeem(gift.id),
|
|
149
|
+
icon: avaliableTrueSvg
|
|
150
|
+
};
|
|
151
|
+
case "false":
|
|
152
|
+
return {
|
|
153
|
+
extraClass: ' deactive',
|
|
154
|
+
onClick: () => { },
|
|
155
|
+
icon: avaliableFalseSvg
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
const renderGifts = (gifts, locale, redeem) => {
|
|
160
|
+
return (index.h("div", { class: "Gifts FlexLayout" }, gifts.map(gift => {
|
|
161
|
+
var _a;
|
|
162
|
+
const statusData = getStatusData(gift, redeem);
|
|
163
|
+
const presentation = gift.presentation;
|
|
164
|
+
const getPropForBackgroundImage = (asset) => asset ?
|
|
165
|
+
{ backgroundImage: `url('${asset}')` } :
|
|
166
|
+
{};
|
|
167
|
+
return (index.h("div", { class: "Gift" },
|
|
168
|
+
index.h("div", { class: "ImgContainer", onClick: () => window.postMessage({ type: 'BEEShopImgClicked', itemId: gift.id }, window.location.href), style: Object.assign({}, getPropForBackgroundImage(((_a = presentation.assets) === null || _a === void 0 ? void 0 : _a.length) > 0 ? presentation.assets[0] : '')) }),
|
|
169
|
+
index.h("div", { class: "InfoContainer" },
|
|
170
|
+
index.h("div", null,
|
|
171
|
+
index.h("div", { class: "Point" },
|
|
172
|
+
gift.points,
|
|
173
|
+
" ",
|
|
174
|
+
gift.points === 1 ? locale.Point : locale.Points),
|
|
175
|
+
index.h("div", { class: "Title" }, (presentation === null || presentation === void 0 ? void 0 : presentation.displayName) || gift.displayName),
|
|
176
|
+
index.h("div", { class: "Description" }, (presentation === null || presentation === void 0 ? void 0 : presentation.description) || '')),
|
|
177
|
+
index.h("div", { class: "AvaliableWrap" + statusData.extraClass, onClick: () => statusData.onClick() },
|
|
178
|
+
index.h("span", { innerHTML: statusData.icon })))));
|
|
179
|
+
})));
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const bonusElevateShopCss = ":host{display:block}svg circle{shape-rendering:crispEdges}.MainContainer{max-width:420px}.MainContainer player-elevate-pointcard{width:100%;height:220px}.Gifts{display:flex;justify-content:space-between;padding:15px;padding-left:-8px;padding-right:-8px;flex:0 0 45.1282051282%;flex-wrap:wrap;justify-content:flex-start;background:var(--emfe-w-color-white, #FFFFFF);color:var(--emfe-w-color-black-150, #000000);font-weight:500;gap:10px;margin-top:-100px;position:relative;min-height:200px}.InfoContainer{display:flex;margin-top:17px;justify-content:space-between}.Gift{display:block;margin-bottom:10px;padding:8px;box-shadow:0px 18px 45px 0px var(--emfe-w-color-black-150, #A7A7A733);border-radius:11px;background:var(--emfe-w-color-white, #FFFFFF)}.Gift .ImgContainer{width:160px;height:107px;border-radius:11px;box-shadow:0px 2px 6px 0px var(--emfe-w-color-black-200, #00000040);cursor:pointer;background-size:cover;background-position:center center;background-repeat:no-repeat}.Gift .Point{font-size:20px}.Gift .Title,.Gift .Description{padding-left:3px}.Gift .Title{font-size:14px;margin-top:10px}.Gift .Description{font-size:12px;color:var(--emfe-w-color-black-100, #767171)}.Gift .AvaliableWrap{align-self:self-end}.Gift .AvaliableWrap.active{cursor:pointer}.Gift .AvaliableWrap.deactive{cursor:not-allowed}.Gift .AvaliableWrap span svg{width:var(--emfe-w-elevate-avaliable-button-size, 46px)}";
|
|
183
|
+
|
|
184
|
+
const BonusElevateShop = class {
|
|
185
|
+
constructor(hostRef) {
|
|
186
|
+
index.registerInstance(this, hostRef);
|
|
187
|
+
/**
|
|
188
|
+
* Language of the widget
|
|
189
|
+
*/
|
|
190
|
+
this.language = 'en';
|
|
191
|
+
/**
|
|
192
|
+
* Client custom styling via string
|
|
193
|
+
*/
|
|
194
|
+
this.clientStyling = '';
|
|
195
|
+
/**
|
|
196
|
+
* Client custom styling via url
|
|
197
|
+
*/
|
|
198
|
+
this.clientStylingUrl = '';
|
|
199
|
+
/**
|
|
200
|
+
* translation via url
|
|
201
|
+
*/
|
|
202
|
+
this.translationUrl = '';
|
|
203
|
+
this.locale = translation['en'];
|
|
204
|
+
this.gifts = [];
|
|
205
|
+
}
|
|
206
|
+
async updateGifts() {
|
|
207
|
+
const res = await fetchNorwayApi.bind(this, '/v1/elevate/shop', {}).call();
|
|
208
|
+
this.gifts = res.data || [];
|
|
209
|
+
}
|
|
210
|
+
async redeemGift(id) {
|
|
211
|
+
if (!confirm('Are you sure to redeem this gift?'))
|
|
212
|
+
return;
|
|
213
|
+
const res = await fetchNorwayApi.bind(this, '/v1/elevate/redeem', {}, {
|
|
214
|
+
method: 'PUT',
|
|
215
|
+
body: JSON.stringify({ giftID: id }),
|
|
216
|
+
headers: {
|
|
217
|
+
'Content-Type': 'application/json-patch+json',
|
|
218
|
+
}
|
|
219
|
+
}).call();
|
|
220
|
+
if (res.success) {
|
|
221
|
+
window.postMessage({ type: 'BEEGiftRedeem', itemId: id }, window.location.href);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
render() {
|
|
225
|
+
return (index.h("main", { class: "MainContainer" }, index.h("general-styling-wrapper", { clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, targetTranslations: translation, translationUrl: this.translationUrl }), index.h("player-elevate-pointcard", { endpoint: this.endpoint, session: this.session, language: this.language, clientStylingUrl: this.clientStylingUrl, clientStyling: this.clientStyling, translationUrl: this.translationUrl }), renderGifts(this.gifts, this.locale, this.redeemGift.bind(this))));
|
|
226
|
+
}
|
|
227
|
+
async componentDidLoad() {
|
|
228
|
+
this.updateGifts();
|
|
229
|
+
}
|
|
230
|
+
static get assetsDirs() { return ["static"]; }
|
|
231
|
+
static get watchers() { return {
|
|
232
|
+
"endpoint": ["updateGifts"],
|
|
233
|
+
"language": ["updateGifts"],
|
|
234
|
+
"session": ["updateGifts"]
|
|
235
|
+
}; }
|
|
236
|
+
};
|
|
237
|
+
BonusElevateShop.style = bonusElevateShopCss;
|
|
238
|
+
|
|
239
|
+
const mergeTranslations = (url, target) => {
|
|
240
|
+
return new Promise((resolve) => {
|
|
241
|
+
fetch(url)
|
|
242
|
+
.then((res) => res.json())
|
|
243
|
+
.then((data) => {
|
|
244
|
+
Object.keys(data).forEach((item) => {
|
|
245
|
+
target[item] = target[item] ? target[item] : {};
|
|
246
|
+
for (let key in data[item]) {
|
|
247
|
+
target[item][key] = data[item][key];
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
resolve(true);
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
const generalStylingWrapperCss = ":host{display:block}";
|
|
256
|
+
|
|
257
|
+
const GeneralStylingWrapper = class {
|
|
258
|
+
constructor(hostRef) {
|
|
259
|
+
index.registerInstance(this, hostRef);
|
|
260
|
+
/**
|
|
261
|
+
* Client custom styling via inline styles
|
|
262
|
+
*/
|
|
263
|
+
this.clientStyling = '';
|
|
264
|
+
/**
|
|
265
|
+
* Client custom styling via url
|
|
266
|
+
*/
|
|
267
|
+
this.clientStylingUrl = '';
|
|
268
|
+
/**
|
|
269
|
+
* Translation via url
|
|
270
|
+
*/
|
|
271
|
+
this.translationUrl = '';
|
|
272
|
+
this.stylingAppends = false;
|
|
273
|
+
this.setClientStyling = () => {
|
|
274
|
+
let sheet = document.createElement('style');
|
|
275
|
+
sheet.innerHTML = this.clientStyling;
|
|
276
|
+
this.el.prepend(sheet);
|
|
277
|
+
};
|
|
278
|
+
this.setClientStylingURL = () => {
|
|
279
|
+
let url = new URL(this.clientStylingUrl);
|
|
280
|
+
let cssFile = document.createElement('style');
|
|
281
|
+
fetch(url.href)
|
|
282
|
+
.then((res) => res.text())
|
|
283
|
+
.then((data) => {
|
|
284
|
+
cssFile.innerHTML = data;
|
|
285
|
+
setTimeout(() => {
|
|
286
|
+
this.el.prepend(cssFile);
|
|
287
|
+
}, 1);
|
|
288
|
+
})
|
|
289
|
+
.catch((err) => {
|
|
290
|
+
console.log('error ', err);
|
|
291
|
+
});
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
componentDidRender() {
|
|
295
|
+
// start custom styling area
|
|
296
|
+
if (!this.stylingAppends) {
|
|
297
|
+
if (this.clientStyling)
|
|
298
|
+
this.setClientStyling();
|
|
299
|
+
if (this.clientStylingUrl)
|
|
300
|
+
this.setClientStylingURL();
|
|
301
|
+
this.stylingAppends = true;
|
|
302
|
+
}
|
|
303
|
+
// end custom styling area
|
|
304
|
+
}
|
|
305
|
+
async componentWillLoad() {
|
|
306
|
+
const promises = [];
|
|
307
|
+
if (this.translationUrl) {
|
|
308
|
+
const translationPromise = mergeTranslations(this.translationUrl, this.targetTranslations);
|
|
309
|
+
promises.push(translationPromise);
|
|
310
|
+
}
|
|
311
|
+
return await Promise.all(promises);
|
|
312
|
+
}
|
|
313
|
+
render() {
|
|
314
|
+
return (index.h("div", { class: "StyleShell" }, index.h("slot", { name: "mainContent" })));
|
|
315
|
+
}
|
|
316
|
+
get el() { return index.getElement(this); }
|
|
317
|
+
};
|
|
318
|
+
GeneralStylingWrapper.style = generalStylingWrapperCss;
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* @name startOfDay
|
|
322
|
+
* @category Day Helpers
|
|
323
|
+
* @summary Return the start of a day for the given date.
|
|
324
|
+
*
|
|
325
|
+
* @description
|
|
326
|
+
* Return the start of a day for the given date.
|
|
327
|
+
* The result will be in the local timezone.
|
|
328
|
+
*
|
|
329
|
+
* @param {Date|Number} date - the original date
|
|
330
|
+
* @returns {Date} the start of a day
|
|
331
|
+
* @throws {TypeError} 1 argument required
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* // The start of a day for 2 September 2014 11:55:00:
|
|
335
|
+
* const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
|
|
336
|
+
* //=> Tue Sep 02 2014 00:00:00
|
|
337
|
+
*/
|
|
338
|
+
function startOfDay(dirtyDate) {
|
|
339
|
+
playerElevateCardItems.requiredArgs(1, arguments);
|
|
340
|
+
var date = playerElevateCardItems.toDate(dirtyDate);
|
|
341
|
+
date.setHours(0, 0, 0, 0);
|
|
342
|
+
return date;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
var MILLISECONDS_IN_DAY = 86400000;
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* @name differenceInCalendarDays
|
|
349
|
+
* @category Day Helpers
|
|
350
|
+
* @summary Get the number of calendar days between the given dates.
|
|
351
|
+
*
|
|
352
|
+
* @description
|
|
353
|
+
* Get the number of calendar days between the given dates. This means that the times are removed
|
|
354
|
+
* from the dates and then the difference in days is calculated.
|
|
355
|
+
*
|
|
356
|
+
* @param {Date|Number} dateLeft - the later date
|
|
357
|
+
* @param {Date|Number} dateRight - the earlier date
|
|
358
|
+
* @returns {Number} the number of calendar days
|
|
359
|
+
* @throws {TypeError} 2 arguments required
|
|
360
|
+
*
|
|
361
|
+
* @example
|
|
362
|
+
* // How many calendar days are between
|
|
363
|
+
* // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
|
|
364
|
+
* const result = differenceInCalendarDays(
|
|
365
|
+
* new Date(2012, 6, 2, 0, 0),
|
|
366
|
+
* new Date(2011, 6, 2, 23, 0)
|
|
367
|
+
* )
|
|
368
|
+
* //=> 366
|
|
369
|
+
* // How many calendar days are between
|
|
370
|
+
* // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
|
|
371
|
+
* const result = differenceInCalendarDays(
|
|
372
|
+
* new Date(2011, 6, 3, 0, 1),
|
|
373
|
+
* new Date(2011, 6, 2, 23, 59)
|
|
374
|
+
* )
|
|
375
|
+
* //=> 1
|
|
376
|
+
*/
|
|
377
|
+
function differenceInCalendarDays(dirtyDateLeft, dirtyDateRight) {
|
|
378
|
+
playerElevateCardItems.requiredArgs(2, arguments);
|
|
379
|
+
var startOfDayLeft = startOfDay(dirtyDateLeft);
|
|
380
|
+
var startOfDayRight = startOfDay(dirtyDateRight);
|
|
381
|
+
var timestampLeft = startOfDayLeft.getTime() - playerElevateCardItems.getTimezoneOffsetInMilliseconds(startOfDayLeft);
|
|
382
|
+
var timestampRight = startOfDayRight.getTime() - playerElevateCardItems.getTimezoneOffsetInMilliseconds(startOfDayRight);
|
|
383
|
+
|
|
384
|
+
// Round the number of days to the nearest integer
|
|
385
|
+
// because the number of milliseconds in a day is not constant
|
|
386
|
+
// (e.g. it's different in the day of the daylight saving time clock shift)
|
|
387
|
+
return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Days in 1 week.
|
|
392
|
+
*
|
|
393
|
+
* @name daysInWeek
|
|
394
|
+
* @constant
|
|
395
|
+
* @type {number}
|
|
396
|
+
* @default
|
|
397
|
+
*/
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Milliseconds in 1 hour
|
|
401
|
+
*
|
|
402
|
+
* @name millisecondsInHour
|
|
403
|
+
* @constant
|
|
404
|
+
* @type {number}
|
|
405
|
+
* @default
|
|
406
|
+
*/
|
|
407
|
+
var millisecondsInHour = 3600000;
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* @name differenceInMilliseconds
|
|
411
|
+
* @category Millisecond Helpers
|
|
412
|
+
* @summary Get the number of milliseconds between the given dates.
|
|
413
|
+
*
|
|
414
|
+
* @description
|
|
415
|
+
* Get the number of milliseconds between the given dates.
|
|
416
|
+
*
|
|
417
|
+
* @param {Date|Number} dateLeft - the later date
|
|
418
|
+
* @param {Date|Number} dateRight - the earlier date
|
|
419
|
+
* @returns {Number} the number of milliseconds
|
|
420
|
+
* @throws {TypeError} 2 arguments required
|
|
421
|
+
*
|
|
422
|
+
* @example
|
|
423
|
+
* // How many milliseconds are between
|
|
424
|
+
* // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?
|
|
425
|
+
* const result = differenceInMilliseconds(
|
|
426
|
+
* new Date(2014, 6, 2, 12, 30, 21, 700),
|
|
427
|
+
* new Date(2014, 6, 2, 12, 30, 20, 600)
|
|
428
|
+
* )
|
|
429
|
+
* //=> 1100
|
|
430
|
+
*/
|
|
431
|
+
function differenceInMilliseconds(dateLeft, dateRight) {
|
|
432
|
+
playerElevateCardItems.requiredArgs(2, arguments);
|
|
433
|
+
return playerElevateCardItems.toDate(dateLeft).getTime() - playerElevateCardItems.toDate(dateRight).getTime();
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
var roundingMap = {
|
|
437
|
+
ceil: Math.ceil,
|
|
438
|
+
round: Math.round,
|
|
439
|
+
floor: Math.floor,
|
|
440
|
+
trunc: function trunc(value) {
|
|
441
|
+
return value < 0 ? Math.ceil(value) : Math.floor(value);
|
|
442
|
+
} // Math.trunc is not supported by IE
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
var defaultRoundingMethod = 'trunc';
|
|
446
|
+
function getRoundingMethod(method) {
|
|
447
|
+
return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* @name differenceInHours
|
|
452
|
+
* @category Hour Helpers
|
|
453
|
+
* @summary Get the number of hours between the given dates.
|
|
454
|
+
*
|
|
455
|
+
* @description
|
|
456
|
+
* Get the number of hours between the given dates.
|
|
457
|
+
*
|
|
458
|
+
* @param {Date|Number} dateLeft - the later date
|
|
459
|
+
* @param {Date|Number} dateRight - the earlier date
|
|
460
|
+
* @param {Object} [options] - an object with options.
|
|
461
|
+
* @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)
|
|
462
|
+
* @returns {Number} the number of hours
|
|
463
|
+
* @throws {TypeError} 2 arguments required
|
|
464
|
+
*
|
|
465
|
+
* @example
|
|
466
|
+
* // How many hours are between 2 July 2014 06:50:00 and 2 July 2014 19:00:00?
|
|
467
|
+
* const result = differenceInHours(
|
|
468
|
+
* new Date(2014, 6, 2, 19, 0),
|
|
469
|
+
* new Date(2014, 6, 2, 6, 50)
|
|
470
|
+
* )
|
|
471
|
+
* //=> 12
|
|
472
|
+
*/
|
|
473
|
+
function differenceInHours(dateLeft, dateRight, options) {
|
|
474
|
+
playerElevateCardItems.requiredArgs(2, arguments);
|
|
475
|
+
var diff = differenceInMilliseconds(dateLeft, dateRight) / millisecondsInHour;
|
|
476
|
+
return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* @name isBefore
|
|
481
|
+
* @category Common Helpers
|
|
482
|
+
* @summary Is the first date before the second one?
|
|
483
|
+
*
|
|
484
|
+
* @description
|
|
485
|
+
* Is the first date before the second one?
|
|
486
|
+
*
|
|
487
|
+
* @param {Date|Number} date - the date that should be before the other one to return true
|
|
488
|
+
* @param {Date|Number} dateToCompare - the date to compare with
|
|
489
|
+
* @returns {Boolean} the first date is before the second date
|
|
490
|
+
* @throws {TypeError} 2 arguments required
|
|
491
|
+
*
|
|
492
|
+
* @example
|
|
493
|
+
* // Is 10 July 1989 before 11 February 1987?
|
|
494
|
+
* const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
|
|
495
|
+
* //=> false
|
|
496
|
+
*/
|
|
497
|
+
function isBefore(dirtyDate, dirtyDateToCompare) {
|
|
498
|
+
playerElevateCardItems.requiredArgs(2, arguments);
|
|
499
|
+
var date = playerElevateCardItems.toDate(dirtyDate);
|
|
500
|
+
var dateToCompare = playerElevateCardItems.toDate(dirtyDateToCompare);
|
|
501
|
+
return date.getTime() < dateToCompare.getTime();
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
function updateProgressSvg(progressElementRef, percent) {
|
|
505
|
+
const svgElement = progressElementRef.querySelector('#total_level');
|
|
506
|
+
const endLockWidth = 15;
|
|
507
|
+
const barWidth = svgElement.getBBox().width;
|
|
508
|
+
const widthOnBar = percent * barWidth - endLockWidth < 0 ? 0 : percent * barWidth - endLockWidth;
|
|
509
|
+
//update bar's width, widthOnBar
|
|
510
|
+
const levelBar = progressElementRef.querySelector('#current_level');
|
|
511
|
+
//update filters, x = widthOnBar
|
|
512
|
+
const levelFilter = progressElementRef.querySelector('#filter_current_level');
|
|
513
|
+
//update circle, widthOnBar+10
|
|
514
|
+
const levelCircle = progressElementRef.querySelector('#circle_current_level');
|
|
515
|
+
svgElement.setAttribute('viewbox', `0 0 ${widthOnBar} 28`);
|
|
516
|
+
levelBar.setAttribute('width', `${widthOnBar}`);
|
|
517
|
+
levelCircle.setAttribute('cx', `${widthOnBar + 3}`);
|
|
518
|
+
levelFilter.setAttribute('x', `${widthOnBar - 4}`);
|
|
519
|
+
//update lock location
|
|
520
|
+
const endLockElement = progressElementRef.querySelector('#lock');
|
|
521
|
+
// wrapper of endLock, include ball and heatfilter1_d_305_23
|
|
522
|
+
const filter1 = progressElementRef.querySelector('#filter_heart_ball');
|
|
523
|
+
// ball in endlockfilter2_i_305_23
|
|
524
|
+
const filter2 = progressElementRef.querySelector('#filter_ball');
|
|
525
|
+
// heart in endlockfilter3_d_305_23
|
|
526
|
+
const filter3 = progressElementRef.querySelector('#filter_heart');
|
|
527
|
+
//wrapper of lockfilter4_d_305_23
|
|
528
|
+
const filterLock = progressElementRef.querySelector('#filter_lock');
|
|
529
|
+
// shadow of ball paint0_linear_305_23
|
|
530
|
+
const paint0 = progressElementRef.querySelector('#paint0_linear_ball');
|
|
531
|
+
//paint in lockpaint1_linear_305_23
|
|
532
|
+
const paint1 = progressElementRef.querySelector('#paint1_linear_lock');
|
|
533
|
+
// box of lock and heart, for move position dynamically
|
|
534
|
+
const lockBox = progressElementRef.querySelector('#lock_box');
|
|
535
|
+
const heartBox = progressElementRef.querySelector('#heart_box');
|
|
536
|
+
const rightPaddingOfLockWidth = 10, cxOfEndLockEle = barWidth - rightPaddingOfLockWidth;
|
|
537
|
+
//set cx of lockElement
|
|
538
|
+
endLockElement.setAttribute('cx', `${cxOfEndLockEle}`);
|
|
539
|
+
//set cx of sub Elements
|
|
540
|
+
paint1.setAttribute('x1', `${cxOfEndLockEle}`);
|
|
541
|
+
paint1.setAttribute('x2', `${cxOfEndLockEle}`);
|
|
542
|
+
paint0.setAttribute('x1', `${cxOfEndLockEle - 6}`);
|
|
543
|
+
paint0.setAttribute('x2', `${cxOfEndLockEle - 6 + 11.2}`);
|
|
544
|
+
filterLock.setAttribute('x', `${cxOfEndLockEle - 6}`);
|
|
545
|
+
filter3.setAttribute('x', `${cxOfEndLockEle - 6 - 2}`);
|
|
546
|
+
filter2.setAttribute('x', `${cxOfEndLockEle - 6 - 2 - 2}`);
|
|
547
|
+
filter1.setAttribute('x', `${cxOfEndLockEle - 6 - 2 - 2 - 4}`);
|
|
548
|
+
lockBox.setAttribute('x', `${cxOfEndLockEle - 6}`);
|
|
549
|
+
heartBox.setAttribute('x', `${cxOfEndLockEle - 6}`);
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
const playerElevateCardDataCss = ":host {\n display: block;\n width: 360px;\n height: 230px;\n}\n\n.ElevateCardWrapper {\n contain: layout inline-size;\n width: 100%;\n height: fit-content;\n min-height: 218px;\n}\n\n.Outer {\n container-type: inline-size;\n font-size: 12px;\n background-size: cover;\n background-repeat: no-repeat;\n line-height: initial;\n width: 100%;\n height: 100%;\n}\n\n.Dark {\n color: var(--emfe-w-color-gray150, #efefef);\n}\n\n.Light {\n color: var(--emfe-w-color-black, #0e0e0e);\n}\n\n@container (min-width: 381px) {\n .Outer {\n background-size: cover;\n }\n .Outer .OuterCover {\n min-height: 190px;\n }\n}\n@container (min-width: 260px) {\n .Outer {\n background-size: contain;\n }\n}\n.OuterCover {\n width: 100%;\n height: 100%;\n content: \"\";\n background-repeat: no-repeat;\n background-size: cover;\n border-radius: 15px;\n}\n\n.Inner {\n display: flex;\n flex-direction: column;\n min-height: 158px;\n}\n.Inner .Content {\n padding: 15px;\n flex-wrap: wrap;\n gap: 8px;\n}\n.Inner .Row {\n display: flex;\n flex-direction: row;\n}\n.Inner .CardCell {\n display: flex;\n}\n.Inner .LevelInfo {\n display: flex;\n flex-direction: column;\n}\n.Inner .LevelInfo .ElevateLevel .LevelName {\n height: 28px;\n border-radius: 5px;\n line-height: 28px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.Inner .LevelInfo.Level0 .ElevateLevel .LevelName {\n box-shadow: -2px -2px 7px 0px var(--emfe-w-elevate-color-level0button-shadow, rgba(191, 84, 6, 0.75));\n background: linear-gradient(180deg, var(--emfe-w-elevate-color-level0-bg0, #E2792C) 0%, var(--emfe-w-elevate-color-level0-bg1, rgba(242, 151, 99, 0)) 100%);\n}\n.Inner .LevelInfo.Level1 .ElevateLevel .LevelName {\n box-shadow: -2px -2px 7px 0px var(--emfe-w-elevate-color-level1button-shadow, rgba(151, 151, 151, 0.75));\n background: linear-gradient(180deg, var(--emfe-w-elevate-color-level1-bg0, #BEBFED) 0%, var(--emfe-w-elevate-color-level1-bg1, rgba(216, 217, 233, 0)) 100%);\n}\n.Inner .LevelInfo.Level2 .ElevateLevel .LevelName {\n box-shadow: -2px -2px 7px 0px var(--emfe-w-elevate-color-level2button-shadow, rgba(191, 120, 6, 0.75));\n background: linear-gradient(180deg, var(--emfe-w-elevate-color-level2-bg0, #FCC410) 0%, var(--emfe-w-elevate-color-level2-bg1, rgba(255, 189, 43, 0)) 100%);\n}\n.Inner .LevelInfo.Level3 .ElevateLevel .LevelName {\n box-shadow: -2px -2px 7px 0px var(--emfe-w-elevate-color-level3button-shadow, rgba(65, 6, 191, 0.75));\n background: linear-gradient(180deg, var(--emfe-w-elevate-color-level3-bg0, #B1A2DB) 0%, var(--emfe-w-elevate-color-level3-bg1, rgba(203, 202, 245, 0)) 100%);\n}\n.Inner .LevelInfo.Level4 .ElevateLevel .LevelName {\n box-shadow: -2px -2px 7px 0px var(--emfe-w-elevate-color-level4button-shadow, rgba(65, 6, 191, 0.75));\n background: linear-gradient(180deg, var(--emfe-w-elevate-color-level4-bg0, #B1A2DB) 0%, var(--emfe-w-elevate-color-level4-bg1, rgba(203, 202, 245, 0)) 100%);\n}\n.Inner .LevelInfo .ElevateLevel {\n display: flex;\n}\n.Inner .LevelInfo {\n flex: 1;\n flex-grow: 1;\n min-width: 150px;\n}\n.Inner .PlayerImg {\n width: 29%;\n margin: auto;\n max-width: 100px;\n min-width: 30px;\n order: 0;\n}\n.Inner .PlayerAvatar {\n max-width: 100px;\n flex-basis: 100px;\n height: auto;\n margin: auto;\n padding-top: 10px;\n}\n.Inner .PlayerAvatar .Avatar, .Inner .PlayerAvatar .Badge {\n width: 100%;\n height: 100%;\n}\n.Inner .PlayerAvatar .Avatar {\n border-radius: 50%;\n background-size: contain;\n background-repeat: no-repeat;\n}\n.Inner .ElevateLevel .ExpirationDate {\n max-width: 138px;\n min-width: 118px;\n}\n.Inner .PlayerName, .Inner .RedeemButton, .Inner .ElevateLevel {\n text-transform: capitalize;\n width: 100%;\n}\n.Inner .PlayerName {\n font-size: 16px;\n}\n.Inner .Row .PointsInfo {\n display: table;\n font-weight: 600;\n}\n.Inner .Row .Redeem {\n justify-content: flex-end;\n margin-left: auto;\n}\n.Inner .Row .Redeem:hover {\n color: var(--emfe-w-elevate-color-redeem-hover, #00ABA4);\n cursor: pointer;\n}\n.Inner .Row .RedeemButton:hover span {\n color: var(emfe-w-elevate-color-redeem-text-hover, #f1f1f1);\n font-weight: bold;\n}\n.Inner .Row .RedeemButton {\n width: 95px;\n height: 35px;\n display: flex;\n align-items: center;\n border-radius: 10px;\n background: var(--emfe-w-elevate-color-redeem-bg, linear-gradient(0deg, #26CC37, #26CC37)), linear-gradient(117.99deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 33.89%), linear-gradient(283.85deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 33.47%), linear-gradient(268.18deg, rgba(255, 255, 255, 0.6) -17.36%, rgba(239, 239, 239, 0) 15.78%);\n box-shadow: 0px 4px 4px 0px #00000040;\n}\n.Inner .Row .RedeemButton span {\n color: var(--emfe-w-color-white, #fff);\n line-height: 18px;\n font-size: 15px;\n text-align: center;\n width: 100%;\n}\n.Inner .Row .Points {\n font-size: large;\n vertical-align: middle;\n}\n.Inner .Row .Points .XP {\n font-size: x-small;\n}\n.Inner .Row .ExpirationPoints {\n font-size: small;\n text-align: right;\n font-weight: bold;\n color: var(--emfe-w-color-red, #9e595f);\n}";
|
|
553
|
+
|
|
554
|
+
const PlayerElevateCardData = class {
|
|
555
|
+
constructor(hostRef) {
|
|
556
|
+
index.registerInstance(this, hostRef);
|
|
557
|
+
this.playerElevateLeveLoaded = index.createEvent(this, "playerElevateLeveLoaded", 7);
|
|
558
|
+
}
|
|
559
|
+
handleWindowResizs() {
|
|
560
|
+
this.initLevelProgressbar();
|
|
561
|
+
}
|
|
562
|
+
onRedeemClick() {
|
|
563
|
+
window.postMessage({ type: 'BEERedeemClicked' }, window.location.href);
|
|
564
|
+
}
|
|
565
|
+
loadLevels() {
|
|
566
|
+
let url = new URL(`${this.params.endpoint}/v1/elevate/levels?language=${this.params.language}`);
|
|
567
|
+
return new Promise((resolve, reject) => {
|
|
568
|
+
return fetch(url.href, {
|
|
569
|
+
method: 'GET',
|
|
570
|
+
})
|
|
571
|
+
.then((res) => res.json())
|
|
572
|
+
.then((res) => {
|
|
573
|
+
this.levels = res.data;
|
|
574
|
+
resolve(true);
|
|
575
|
+
})
|
|
576
|
+
.catch((err) => {
|
|
577
|
+
reject(err);
|
|
578
|
+
});
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
calcuatePointsToBeExpired(walletTotalInfo) {
|
|
582
|
+
let pointExpireInfoAsString = '';
|
|
583
|
+
if (!walletTotalInfo || !walletTotalInfo.aboutToExpire ||
|
|
584
|
+
walletTotalInfo.aboutToExpire.length == 0 ||
|
|
585
|
+
walletTotalInfo.aboutToExpire[0].points <= 0) {
|
|
586
|
+
return pointExpireInfoAsString;
|
|
587
|
+
}
|
|
588
|
+
walletTotalInfo.aboutToExpire.sort((expire1, expire2) => {
|
|
589
|
+
return isBefore(new Date(expire1.expireTime), new Date(expire2.expireTime))
|
|
590
|
+
? -1
|
|
591
|
+
: 1;
|
|
592
|
+
});
|
|
593
|
+
const aboutToExpire = walletTotalInfo.aboutToExpire[0];
|
|
594
|
+
const daysToExpried = differenceInCalendarDays(new Date(aboutToExpire.expireTime), new Date());
|
|
595
|
+
let hoursToExpired = 0, expiredTranslationKey = daysToExpried === 0 ? 'pointsToBeExpiredDay' : 'pointsToBeExpired';
|
|
596
|
+
if (daysToExpried == 0) {
|
|
597
|
+
hoursToExpired = differenceInHours(new Date(aboutToExpire.expireTime), new Date());
|
|
598
|
+
expiredTranslationKey = hoursToExpired > 1 ? 'pointsToBeExpiredHours' : 'pointsToBeExpiredHour';
|
|
599
|
+
}
|
|
600
|
+
pointExpireInfoAsString = playerElevateCardItems.translateWithParams(expiredTranslationKey, {
|
|
601
|
+
expirationPoints: aboutToExpire.points,
|
|
602
|
+
expireDay: daysToExpried,
|
|
603
|
+
});
|
|
604
|
+
return pointExpireInfoAsString;
|
|
605
|
+
}
|
|
606
|
+
loadPlayerLevelInfo() {
|
|
607
|
+
let url = new URL(`${this.params.endpoint}/v1/elevate/playerInfo?language=${this.params.language}`);
|
|
608
|
+
return new Promise((resolve, reject) => {
|
|
609
|
+
return fetch(url.href, {
|
|
610
|
+
method: 'GET',
|
|
611
|
+
headers: {
|
|
612
|
+
'X-Sessionid': this.params.session,
|
|
613
|
+
'Content-Type': 'application/json',
|
|
614
|
+
},
|
|
615
|
+
})
|
|
616
|
+
.then((res) => res.json())
|
|
617
|
+
.then((res) => {
|
|
618
|
+
var _a, _b, _c;
|
|
619
|
+
if (!res.success) {
|
|
620
|
+
console.error('Exception when fetch user elevateinfo, ', res.errorCode, res.errorMessage);
|
|
621
|
+
reject(true);
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
let playerElevateInfo = res.data;
|
|
625
|
+
this.playerElevateLevel = playerElevateInfo.level;
|
|
626
|
+
this.playerElevateLevel.name = this.playerElevateLevel.presentation.displayName || this.playerElevateLevel.name;
|
|
627
|
+
this.playerElevateLevel.spendablePoints = ((_a = playerElevateInfo.spendableWallet) === null || _a === void 0 ? void 0 : _a.total.points) || 0;
|
|
628
|
+
this.playerElevateLeveLoaded.emit({ elevateLevel: this.playerElevateLevel });
|
|
629
|
+
const spendableTotal = (_b = res.data.spendableWallet) === null || _b === void 0 ? void 0 : _b.total;
|
|
630
|
+
const loyaltyWalletTotal = (_c = res.data.loyaltyWallet) === null || _c === void 0 ? void 0 : _c.total;
|
|
631
|
+
this.playerElevateLeveLoaded.emit({
|
|
632
|
+
elevateLevelWalletTotal: spendableTotal,
|
|
633
|
+
loyaltyWalletTotal
|
|
634
|
+
});
|
|
635
|
+
let spExpireInfoAsString = this.calcuatePointsToBeExpired(spendableTotal);
|
|
636
|
+
let xpExpireInfoAsString = this.calcuatePointsToBeExpired(loyaltyWalletTotal);
|
|
637
|
+
if (spExpireInfoAsString || xpExpireInfoAsString) {
|
|
638
|
+
this.playerElevateLeveLoaded.emit({
|
|
639
|
+
pointExpireString: spExpireInfoAsString,
|
|
640
|
+
xpExpireString: xpExpireInfoAsString
|
|
641
|
+
});
|
|
642
|
+
}
|
|
643
|
+
resolve(this.playerElevateLevel);
|
|
644
|
+
})
|
|
645
|
+
.catch((err) => {
|
|
646
|
+
console.log('error ', err);
|
|
647
|
+
reject(true);
|
|
648
|
+
});
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
setLoyaltyProgress(percent) {
|
|
652
|
+
updateProgressSvg(this.loyaltyProgressEle, percent);
|
|
653
|
+
}
|
|
654
|
+
initLevelProgressbar() {
|
|
655
|
+
setTimeout(() => {
|
|
656
|
+
this.loyaltyProgressEle =
|
|
657
|
+
this.elevateCardRef.parentElement.querySelector('#LevelProgress');
|
|
658
|
+
if (!this.loyaltyProgressEle) {
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
this.setLoyaltyProgress(!this.playerElevateLevel.nextLevel
|
|
662
|
+
? 1
|
|
663
|
+
: (this.playerElevateLevel.loyaltyPoints -
|
|
664
|
+
this.playerElevateLevel.entryPoints) /
|
|
665
|
+
(this.playerElevateLevel.nextLevel.entryPoints -
|
|
666
|
+
this.playerElevateLevel.loyaltyPoints));
|
|
667
|
+
this.params['playerElevateLevel'] = this.playerElevateLevel;
|
|
668
|
+
}, 80);
|
|
669
|
+
}
|
|
670
|
+
componentWillRender() { }
|
|
671
|
+
componentDidRender() {
|
|
672
|
+
this.initLevelProgressbar();
|
|
673
|
+
}
|
|
674
|
+
componentWillLoad() {
|
|
675
|
+
if (!this.params.endpoint || !this.params.session) {
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
const promises = [];
|
|
679
|
+
promises.push(this.loadPlayerLevelInfo());
|
|
680
|
+
if (this.params.calculateLevelFlag) {
|
|
681
|
+
promises.push(this.loadLevels());
|
|
682
|
+
}
|
|
683
|
+
Promise.all(promises).then((res) => {
|
|
684
|
+
console.log('elevate-init', res);
|
|
685
|
+
this.initLevelProgressbar();
|
|
686
|
+
if (!this.levels) {
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
this.levels.sort((level1, level2) => {
|
|
690
|
+
return level1.firstEntryPoints > level2.firstEntryPoints ? 1 : -1;
|
|
691
|
+
});
|
|
692
|
+
const playerPoints = this.playerElevateLevel.loyaltyPoints;
|
|
693
|
+
let playerLevelNumber = 0;
|
|
694
|
+
this.levels.forEach((elevateLevel, idx) => {
|
|
695
|
+
if (playerPoints > elevateLevel.firstEntryPoints) {
|
|
696
|
+
playerLevelNumber = idx;
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
this.playerElevateLeveLoaded.emit({
|
|
700
|
+
calculatedLevelFlag: playerLevelNumber,
|
|
701
|
+
});
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
get elevateCardRef() { return index.getElement(this); }
|
|
705
|
+
};
|
|
706
|
+
PlayerElevateCardData.style = playerElevateCardDataCss;
|
|
707
|
+
|
|
708
|
+
const playerElevatePointcardCss = ":host{display:block}.PointsCard .Inner .Row .ExpirationPoints{text-align:left}.PointsCard .Inner .PlayerAvatar .Avatar{display:none}.PointsCard .Inner .PlayerAvatar .Badge{border-radius:50%;background-size:contain;width:100%;height:100%;position:inherit}.PointsCard .Inner .PointsTxt{display:flex;flex-direction:row;justify-content:space-between}.PointsCard .Inner .DetailButton{background: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%), linear-gradient(0deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.6));border-radius:5px;box-shadow:0px 4px 4px 0px rgba(0, 0, 0, 0.25);border:2px solid;font-size:11px;width:108px;padding:4px;cursor:pointer;margin-top:5px;height:16px;min-width:45px;text-align:center}.PointsCard .Inner .DetailButton span{color:var(--emfe-w-color-gray-150, #6D6D6D)}.PointsCard .Inner .DetailButton span{display:inline-block;vertical-align:middle}.PointsCard .Inner .DetailButton:hover span{color:var(--emfe-w-color-gray-150, #6D6D6D)}.PointsCard .Inner .LevelInfo{gap:15px;width:70%}.PointsCard .Inner .LevelInfo .PointsTxt{font-size:15px}.PointsCard .Inner .LevelInfo .PointsTxt.Label{display:none}.PointsCard .Inner .LevelInfo .PointsTxt.SPPoints{padding-top:15px}.PointsCard .Inner .LevelInfo .PointsTxt .TC{font-size:x-small;color:var(--emw--color-gray-300, #58586B);display:flex;align-content:center;height:100%;flex-wrap:wrap;text-decoration:underline;cursor:pointer;display:none}";
|
|
709
|
+
|
|
710
|
+
const PlayerElevatePointcard = class {
|
|
711
|
+
constructor(hostRef) {
|
|
712
|
+
index.registerInstance(this, hostRef);
|
|
713
|
+
/**
|
|
714
|
+
* The style that widget shows,available value: Dark, Light
|
|
715
|
+
* Default: Dark
|
|
716
|
+
*/
|
|
717
|
+
this.theme = 'Dark';
|
|
718
|
+
/**
|
|
719
|
+
* Widget Language to show
|
|
720
|
+
*/
|
|
721
|
+
this.language = 'en';
|
|
722
|
+
/**
|
|
723
|
+
* Check if the card used in points details widget, default: 'earningRule'
|
|
724
|
+
* value: 'details'/'earningRule'
|
|
725
|
+
* It effected the button in card
|
|
726
|
+
* 'earningRule': button text, 'earning rules', post 'BEEPointRulesClicked' when clicked
|
|
727
|
+
* 'details': button text, 'details', post 'BEEDetailsClicked' when clicked
|
|
728
|
+
*/
|
|
729
|
+
this.buttonType = 'earningRule';
|
|
730
|
+
/**
|
|
731
|
+
* datePattern
|
|
732
|
+
*/
|
|
733
|
+
this.dateFormat = 'yyyy-MM-dd';
|
|
734
|
+
/**
|
|
735
|
+
* Client custom styling via inline styles
|
|
736
|
+
*/
|
|
737
|
+
this.clientStyling = '';
|
|
738
|
+
/**
|
|
739
|
+
* Client custom styling via url
|
|
740
|
+
*/
|
|
741
|
+
this.clientStylingUrl = '';
|
|
742
|
+
/**
|
|
743
|
+
* Translation via url
|
|
744
|
+
*/
|
|
745
|
+
this.translationUrl = '';
|
|
746
|
+
this.isPointDetailCard = this.buttonType === 'earningRule';
|
|
747
|
+
}
|
|
748
|
+
playerElevateLeveLoadedHandler(event) {
|
|
749
|
+
if (!event.detail) {
|
|
750
|
+
return;
|
|
751
|
+
}
|
|
752
|
+
if (event.detail['elevateLevelWalletTotal']) {
|
|
753
|
+
this.elevateWalletTotal = event.detail['elevateLevelWalletTotal'];
|
|
754
|
+
this.elevateSPTotal = event.detail['loyaltyWalletTotal'];
|
|
755
|
+
}
|
|
756
|
+
if (event.detail['elevateLevel']) {
|
|
757
|
+
this.playerElevateLevel = event.detail['elevateLevel'];
|
|
758
|
+
}
|
|
759
|
+
if (event.detail['pointExpireString']) {
|
|
760
|
+
this.pointExpireString = event.detail.pointExpireString;
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
onDetailsClick() {
|
|
764
|
+
window.postMessage({ type: this.isPointDetailCard ? 'BEEPointRulesClicked' : 'BEEDetailsClicked',
|
|
765
|
+
path: this.isPointDetailCard ? 'player-elevate-level' : 'player-elevate-point-details' }, window.location.href);
|
|
766
|
+
}
|
|
767
|
+
componentWillLoad() {
|
|
768
|
+
this.paramProxy = {
|
|
769
|
+
endpoint: this.endpoint,
|
|
770
|
+
session: this.session,
|
|
771
|
+
language: this.language,
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
render() {
|
|
775
|
+
const backgroundOuterImagePath = index.getAssetPath('../static/card-ground.svg');
|
|
776
|
+
const backgroundInnerImagePath = index.getAssetPath('../static/card-ground-over.svg');
|
|
777
|
+
return (index.h("div", { class: `ElevateCardWrapper ${this.theme}` }, index.h("div", { class: "PointsCard Outer ", style: { 'backgroundImage': `url(${backgroundOuterImagePath}` } }, index.h("general-styling-wrapper", { clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, targetTranslations: playerElevateCardItems.TRANSLATIONS, translationUrl: this.translationUrl }), index.h("player-elevate-card-data", { params: this.paramProxy }), index.h("div", { class: 'OuterCover Inner', style: { 'backgroundImage': `url(${backgroundInnerImagePath}` } }, index.h("div", { class: 'Content Row' }, this.playerElevateLevel && (index.h(index.Fragment, null, index.h("div", { class: "PlayerImg" }, index.h(playerElevateCardItems.PlayerAvatar, { onlyBadge: true, loyaltyIconUrl: this.playerElevateLevel.presentation.asset })), index.h("div", { class: `LevelInfo ${this.playerElevateLevel.name}` }, index.h("div", { class: "PointsTxt Label" }, this.cardTitle ? this.cardTitle : playerElevateCardItems.translate('spendablePoints')), index.h("div", { class: 'PointsTxt SPPoints' }, index.h(playerElevateCardItems.PlayerPoints, { spendablePoints: this.playerElevateLevel.spendablePoints, language: this.language }), index.h("a", { class: "TC", onClick: () => {
|
|
778
|
+
this.onDetailsClick();
|
|
779
|
+
} }, playerElevateCardItems.translate('termAndConditions', this.language))), this.pointExpireString && (index.h("div", { class: 'ExpirationPoints' }, this.pointExpireString, " "))))))))));
|
|
780
|
+
}
|
|
781
|
+
};
|
|
782
|
+
PlayerElevatePointcard.style = playerElevatePointcardCss;
|
|
783
|
+
|
|
784
|
+
exports.bonus_elevate_shop = BonusElevateShop;
|
|
785
|
+
exports.general_styling_wrapper = GeneralStylingWrapper;
|
|
786
|
+
exports.player_elevate_card_data = PlayerElevateCardData;
|
|
787
|
+
exports.player_elevate_pointcard = PlayerElevatePointcard;
|