@everymatrix/bonus-elevate-shop 1.47.2 → 1.48.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.
Files changed (36) hide show
  1. package/dist/bonus-elevate-shop/bonus-elevate-shop.esm.js +1 -1
  2. package/dist/bonus-elevate-shop/p-135a1cfb.entry.js +1 -0
  3. package/dist/bonus-elevate-shop/p-2c8cdf05.entry.js +1 -0
  4. package/dist/bonus-elevate-shop/p-67465a46.js +2 -0
  5. package/dist/bonus-elevate-shop/p-cfc8ddec.js +1 -0
  6. package/dist/bonus-elevate-shop/p-eaad379c.entry.js +5431 -0
  7. package/dist/cjs/bonus-elevate-shop.cjs.js +2 -2
  8. package/dist/cjs/bonus-elevate-shop_17.cjs.entry.js +37263 -0
  9. package/dist/cjs/{index-950597be.js → index-69a0dfb7.js} +35 -6
  10. package/dist/cjs/loader.cjs.js +2 -2
  11. package/dist/cjs/{player-elevate-card-items-5a947e18.js → player-elevate-card-items-0d4d7d6e.js} +131 -104
  12. package/dist/cjs/player-elevate-card.cjs.entry.js +2 -2
  13. package/dist/cjs/player-elevate-loyaltycard.cjs.entry.js +9 -4
  14. package/dist/collection/collection-manifest.json +23 -0
  15. package/dist/collection/components/bonus-elevate-shop/bonus-elevate-shop.css +28 -0
  16. package/dist/collection/components/bonus-elevate-shop/bonus-elevate-shop.js +133 -6
  17. package/dist/collection/renders/renderGifts.js +2 -5
  18. package/dist/collection/utils/translation.js +2 -0
  19. package/dist/esm/bonus-elevate-shop.js +3 -3
  20. package/dist/esm/bonus-elevate-shop_17.entry.js +37243 -0
  21. package/dist/esm/{index-a343bbd8.js → index-73211e60.js} +35 -7
  22. package/dist/esm/loader.js +3 -3
  23. package/dist/esm/{player-elevate-card-items-f8f33075.js → player-elevate-card-items-f80657b8.js} +117 -105
  24. package/dist/esm/player-elevate-card.entry.js +2 -2
  25. package/dist/esm/player-elevate-loyaltycard.entry.js +9 -4
  26. package/dist/types/components/bonus-elevate-shop/bonus-elevate-shop.d.ts +23 -0
  27. package/dist/types/components.d.ts +24 -0
  28. package/dist/types/utils/translation.d.ts +2 -0
  29. package/package.json +4 -2
  30. package/dist/bonus-elevate-shop/p-248310cb.js +0 -2
  31. package/dist/bonus-elevate-shop/p-55bd3db5.js +0 -1
  32. package/dist/bonus-elevate-shop/p-60765cf8.entry.js +0 -1
  33. package/dist/bonus-elevate-shop/p-87af6879.entry.js +0 -1
  34. package/dist/bonus-elevate-shop/p-d6e4c7cf.entry.js +0 -1
  35. package/dist/cjs/bonus-elevate-shop_4.cjs.entry.js +0 -824
  36. package/dist/esm/bonus-elevate-shop_4.entry.js +0 -817
@@ -1,817 +0,0 @@
1
- import { h, r as registerInstance, c as createEvent, g as getElement, a as getAssetPath, F as Fragment } from './index-a343bbd8.js';
2
- import { r as requiredArgs, t as toDate, g as getTimezoneOffsetInMilliseconds, a as translateWithParams, T as TRANSLATIONS, P as PlayerAvatar, b as translate, c as PlayerPoints } from './player-elevate-card-items-f8f33075.js';
3
-
4
- const getUrl = (path, params = {}) => {
5
- return path + '?' + Object.keys(params).map(key => `${key}=${params[key]}`).join('&');
6
- };
7
- const fetcher = async (input, init = {}) => {
8
- let res;
9
- // @ts-ignore
10
- res = await fetch(input, init);
11
- res = await res.text();
12
- try {
13
- res = JSON.parse(res);
14
- }
15
- catch (e) {
16
- console.error(e);
17
- }
18
- return res;
19
- };
20
- async function fetchNorwayApi(path, params = {}, init = {}) {
21
- const { endpoint, language, session } = this;
22
- const fetchParams = params;
23
- if (!init.method || init.method === 'GET') {
24
- fetchParams.language = language;
25
- }
26
- const url = getUrl(`${endpoint}${path}`, fetchParams);
27
- if (!init.headers)
28
- init.headers = {};
29
- init.headers['x-SessionId'] = session;
30
- const res = await fetcher(url, init);
31
- return res;
32
- }
33
-
34
- const translation = {
35
- en: {
36
- Points: 'Points',
37
- Point: 'Point',
38
- noContent: 'No Content',
39
- }
40
- };
41
-
42
- const avaliableTrueSvg = `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
43
- <g filter="url(#filter0_bd_179_6145)">
44
- <circle cx="23" cy="19" r="19" style="fill: var(--emfe-w-elevate-avaliable-button-enabled-color, #53B65C);" />
45
- <circle cx="23" cy="19" r="18" stroke="url(#paint0_linear_179_6145)" stroke-opacity="0.6" stroke-width="2"/>
46
- <circle cx="23" cy="19" r="18" stroke="url(#paint1_linear_179_6145)" stroke-width="2"/>
47
- <circle cx="23" cy="19" r="18" stroke="url(#paint2_linear_179_6145)" stroke-width="2"/>
48
- </g>
49
- <g filter="url(#filter1_d_179_6145)">
50
- <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"/>
51
- </g>
52
- <defs>
53
- <filter id="filter0_bd_179_6145" x="-36" y="-40" width="118" height="118" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
54
- <feFlood flood-opacity="0" result="BackgroundImageFix"/>
55
- <feGaussianBlur in="BackgroundImageFix" stdDeviation="20"/>
56
- <feComposite in2="SourceAlpha" operator="in" result="effect1_backgroundBlur_179_6145"/>
57
- <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"/>
58
- <feOffset dy="4"/>
59
- <feGaussianBlur stdDeviation="2"/>
60
- <feComposite in2="hardAlpha" operator="out"/>
61
- <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"/>
62
- <feBlend mode="normal" in2="effect1_backgroundBlur_179_6145" result="effect2_dropShadow_179_6145"/>
63
- <feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_179_6145" result="shape"/>
64
- </filter>
65
- <filter id="filter1_d_179_6145" x="11" y="10" width="24" height="22" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
66
- <feFlood flood-opacity="0" result="BackgroundImageFix"/>
67
- <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"/>
68
- <feOffset dy="1"/>
69
- <feGaussianBlur stdDeviation="1"/>
70
- <feComposite in2="hardAlpha" operator="out"/>
71
- <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"/>
72
- <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_179_6145"/>
73
- <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_179_6145" result="shape"/>
74
- </filter>
75
- <linearGradient id="paint0_linear_179_6145" x1="49.2869" y1="15.1911" x2="36.3103" y2="15.603" gradientUnits="userSpaceOnUse">
76
- <stop stop-color="white"/>
77
- <stop offset="1" stop-color="#EFEFEF" stop-opacity="0"/>
78
- </linearGradient>
79
- <linearGradient id="paint1_linear_179_6145" x1="4" y1="0" x2="19.3776" y2="8.17396" gradientUnits="userSpaceOnUse">
80
- <stop stop-color="white" stop-opacity="0.5"/>
81
- <stop offset="1" stop-color="white" stop-opacity="0"/>
82
- </linearGradient>
83
- <linearGradient id="paint2_linear_179_6145" x1="42" y1="38" x2="27.0558" y2="34.3156" gradientUnits="userSpaceOnUse">
84
- <stop stop-color="white" stop-opacity="0.5"/>
85
- <stop offset="1" stop-color="white" stop-opacity="0"/>
86
- </linearGradient>
87
- </defs>
88
- </svg>
89
- `;
90
-
91
- const avaliableFalseSvg = `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
92
- <g filter="url(#filter0_bd_183_6497)">
93
- <circle cx="23" cy="19" r="19" style="fill: var(--emfe-w-elevate-avaliable-button-disabled-color, #B7B7B7);" />
94
- <circle cx="23" cy="19" r="18" stroke="url(#paint0_linear_183_6497)" stroke-opacity="0.6" stroke-width="2"/>
95
- <circle cx="23" cy="19" r="18" stroke="url(#paint1_linear_183_6497)" stroke-width="2"/>
96
- <circle cx="23" cy="19" r="18" stroke="url(#paint2_linear_183_6497)" stroke-width="2"/>
97
- </g>
98
- <g filter="url(#filter1_d_183_6497)">
99
- <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"/>
100
- </g>
101
- <defs>
102
- <filter id="filter0_bd_183_6497" x="-36" y="-40" width="118" height="118" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
103
- <feFlood flood-opacity="0" result="BackgroundImageFix"/>
104
- <feGaussianBlur in="BackgroundImageFix" stdDeviation="20"/>
105
- <feComposite in2="SourceAlpha" operator="in" result="effect1_backgroundBlur_183_6497"/>
106
- <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"/>
107
- <feOffset dy="4"/>
108
- <feGaussianBlur stdDeviation="2"/>
109
- <feComposite in2="hardAlpha" operator="out"/>
110
- <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"/>
111
- <feBlend mode="normal" in2="effect1_backgroundBlur_183_6497" result="effect2_dropShadow_183_6497"/>
112
- <feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_183_6497" result="shape"/>
113
- </filter>
114
- <filter id="filter1_d_183_6497" x="11" y="10" width="24" height="22" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
115
- <feFlood flood-opacity="0" result="BackgroundImageFix"/>
116
- <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"/>
117
- <feOffset dy="1"/>
118
- <feGaussianBlur stdDeviation="1"/>
119
- <feComposite in2="hardAlpha" operator="out"/>
120
- <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"/>
121
- <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_183_6497"/>
122
- <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_183_6497" result="shape"/>
123
- </filter>
124
- <linearGradient id="paint0_linear_183_6497" x1="49.2869" y1="15.1911" x2="36.3103" y2="15.603" gradientUnits="userSpaceOnUse">
125
- <stop stop-color="white"/>
126
- <stop offset="1" stop-color="#EFEFEF" stop-opacity="0"/>
127
- </linearGradient>
128
- <linearGradient id="paint1_linear_183_6497" x1="4" y1="0" x2="19.3776" y2="8.17396" gradientUnits="userSpaceOnUse">
129
- <stop stop-color="white" stop-opacity="0.5"/>
130
- <stop offset="1" stop-color="white" stop-opacity="0"/>
131
- </linearGradient>
132
- <linearGradient id="paint2_linear_183_6497" x1="42" y1="38" x2="27.0558" y2="34.3156" gradientUnits="userSpaceOnUse">
133
- <stop stop-color="white" stop-opacity="0.5"/>
134
- <stop offset="1" stop-color="white" stop-opacity="0"/>
135
- </linearGradient>
136
- </defs>
137
- </svg>
138
- `;
139
-
140
- const getStatusData = (gift, redeem) => {
141
- switch (gift.available) {
142
- case "true":
143
- return {
144
- extraClass: ' active',
145
- onClick: () => redeem(gift.id),
146
- icon: avaliableTrueSvg
147
- };
148
- case "false":
149
- return {
150
- extraClass: ' deactive',
151
- onClick: () => { },
152
- icon: avaliableFalseSvg
153
- };
154
- }
155
- };
156
- const renderGifts = (gifts, locale, redeem) => {
157
- return (h("div", { class: "Gifts FlexLayout" }, gifts.map(gift => {
158
- var _a;
159
- const statusData = getStatusData(gift, redeem);
160
- const presentation = gift.presentation;
161
- const getPropForBackgroundImage = (asset) => asset ?
162
- { backgroundImage: `url('${asset}')` } :
163
- {};
164
- return (h("div", { class: "Gift" },
165
- 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] : '')) }),
166
- h("div", { class: "InfoContainer" },
167
- h("div", null,
168
- h("div", { class: "Point" },
169
- gift.points,
170
- " ",
171
- gift.points === 1 ? locale.Point : locale.Points),
172
- h("div", { class: "Title" }, (presentation === null || presentation === void 0 ? void 0 : presentation.displayName) || gift.displayName),
173
- h("div", { class: "Description" }, (presentation === null || presentation === void 0 ? void 0 : presentation.description) || '')),
174
- h("div", { class: "AvaliableWrap" + statusData.extraClass, onClick: () => statusData.onClick() },
175
- h("span", { innerHTML: statusData.icon })))));
176
- })));
177
- };
178
-
179
- var GeneralAnimationLoadingCczQRHih = {};
180
-
181
- (function (exports) {
182
- var V=Object.defineProperty,z=Object.defineProperties;var F=Object.getOwnPropertyDescriptors;var N=Object.getOwnPropertySymbols;var G=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var x=(e,t,n)=>t in e?V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,P=(e,t)=>{for(var n in t||(t={}))G.call(t,n)&&x(e,n,t[n]);if(N)for(var n of N(t))q.call(t,n)&&x(e,n,t[n]);return e},M=(e,t)=>z(e,F(t));var $=(e,t,n)=>x(e,typeof t!="symbol"?t+"":t,n);var T=(e,t,n)=>new Promise((s,l)=>{var i=o=>{try{u(n.next(o));}catch(r){l(r);}},c=o=>{try{u(n.throw(o));}catch(r){l(r);}},u=o=>o.done?s(o.value):Promise.resolve(o.value).then(i,c);u((n=n.apply(e,t)).next());});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function _(){}function H(e){return e()}function B(){return Object.create(null)}function b(e){e.forEach(H);}function I(e){return typeof e=="function"}function K(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Q(e){return Object.keys(e).length===0}function W(e,t){e.appendChild(t);}function X(e,t,n){const s=Y(e);if(!s.getElementById(t)){const l=L("style");l.id=t,l.textContent=n,Z(s,l);}}function Y(e){if(!e)return document;const t=e.getRootNode?e.getRootNode():e.ownerDocument;return t&&t.host?t:e.ownerDocument}function Z(e,t){return W(e.head||e,t),t.sheet}function U(e,t,n){e.insertBefore(t,n||null);}function C(e){e.parentNode&&e.parentNode.removeChild(e);}function L(e){return document.createElement(e)}function tt(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n);}function et(e){return Array.from(e.childNodes)}function nt(e){const t={};return e.childNodes.forEach(n=>{t[n.slot||"default"]=!0;}),t}let j;function g(e){j=e;}const h=[],k=[];let p=[];const R=[],it=Promise.resolve();let v=!1;function st(){v||(v=!0,it.then(y));}function E(e){p.push(e);}const w=new Set;let a=0;function y(){if(a!==0)return;const e=j;do{try{for(;a<h.length;){const t=h[a];a++,g(t),rt(t.$$);}}catch(t){throw h.length=0,a=0,t}for(g(null),h.length=0,a=0;k.length;)k.pop()();for(let t=0;t<p.length;t+=1){const n=p[t];w.has(n)||(w.add(n),n());}p.length=0;}while(h.length);for(;R.length;)R.pop()();v=!1,w.clear(),g(e);}function rt(e){if(e.fragment!==null){e.update(),b(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(E);}}function lt(e){const t=[],n=[];p.forEach(s=>e.indexOf(s)===-1?t.push(s):n.push(s)),n.forEach(s=>s()),p=t;}const ct=new Set;function ot(e,t){e&&e.i&&(ct.delete(e),e.i(t));}function ut(e,t,n){const{fragment:s,after_update:l}=e.$$;s&&s.m(t,n),E(()=>{const i=e.$$.on_mount.map(H).filter(I);e.$$.on_destroy?e.$$.on_destroy.push(...i):b(i),e.$$.on_mount=[];}),l.forEach(E);}function dt(e,t){const n=e.$$;n.fragment!==null&&(lt(n.after_update),b(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[]);}function $t(e,t){e.$$.dirty[0]===-1&&(h.push(e),st(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31;}function ft(e,t,n,s,l,i,c=null,u=[-1]){const o=j;g(e);const r=e.$$={fragment:null,ctx:[],props:i,update:_,not_equal:l,bound:B(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(o?o.$$.context:[])),callbacks:B(),dirty:u,skip_bound:!1,root:t.target||o.$$.root};c&&c(r.root);let f=!1;if(r.ctx=n?n(e,t.props||{},(d,O,...S)=>{const A=S.length?S[0]:O;return r.ctx&&l(r.ctx[d],r.ctx[d]=A)&&(!r.skip_bound&&r.bound[d]&&r.bound[d](A),f&&$t(e,d)),O}):[],r.update(),f=!0,b(r.before_update),r.fragment=s?s(r.ctx):!1,t.target){if(t.hydrate){const d=et(t.target);r.fragment&&r.fragment.l(d),d.forEach(C);}else r.fragment&&r.fragment.c();t.intro&&ot(e.$$.fragment),ut(e,t.target,t.anchor),y();}g(o);}let D;typeof HTMLElement=="function"&&(D=class extends HTMLElement{constructor(t,n,s){super();$(this,"$$ctor");$(this,"$$s");$(this,"$$c");$(this,"$$cn",!1);$(this,"$$d",{});$(this,"$$r",!1);$(this,"$$p_d",{});$(this,"$$l",{});$(this,"$$l_u",new Map);this.$$ctor=t,this.$$s=n,s&&this.attachShadow({mode:"open"});}addEventListener(t,n,s){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(n),this.$$c){const l=this.$$c.$on(t,n);this.$$l_u.set(n,l);}super.addEventListener(t,n,s);}removeEventListener(t,n,s){if(super.removeEventListener(t,n,s),this.$$c){const l=this.$$l_u.get(n);l&&(l(),this.$$l_u.delete(n));}}connectedCallback(){return T(this,null,function*(){if(this.$$cn=!0,!this.$$c){let t=function(i){return ()=>{let c;return {c:function(){c=L("slot"),i!=="default"&&tt(c,"name",i);},m:function(r,f){U(r,c,f);},d:function(r){r&&C(c);}}}};if(yield Promise.resolve(),!this.$$cn||this.$$c)return;const n={},s=nt(this);for(const i of this.$$s)i in s&&(n[i]=[t(i)]);for(const i of this.attributes){const c=this.$$g_p(i.name);c in this.$$d||(this.$$d[c]=m(c,i.value,this.$$p_d,"toProp"));}for(const i in this.$$p_d)!(i in this.$$d)&&this[i]!==void 0&&(this.$$d[i]=this[i],delete this[i]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:M(P({},this.$$d),{$$slots:n,$$scope:{ctx:[]}})});const l=()=>{this.$$r=!0;for(const i in this.$$p_d)if(this.$$d[i]=this.$$c.$$.ctx[this.$$c.$$.props[i]],this.$$p_d[i].reflect){const c=m(i,this.$$d[i],this.$$p_d,"toAttribute");c==null?this.removeAttribute(this.$$p_d[i].attribute||i):this.setAttribute(this.$$p_d[i].attribute||i,c);}this.$$r=!1;};this.$$c.$$.after_update.push(l),l();for(const i in this.$$l)for(const c of this.$$l[i]){const u=this.$$c.$on(i,c);this.$$l_u.set(c,u);}this.$$l={};}})}attributeChangedCallback(t,n,s){var l;this.$$r||(t=this.$$g_p(t),this.$$d[t]=m(t,s,this.$$p_d,"toProp"),(l=this.$$c)==null||l.$set({[t]:this.$$d[t]}));}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$c=void 0);});}$$g_p(t){return Object.keys(this.$$p_d).find(n=>this.$$p_d[n].attribute===t||!this.$$p_d[n].attribute&&n.toLowerCase()===t)||t}});function m(e,t,n,s){var i;const l=(i=n[e])==null?void 0:i.type;if(t=l==="Boolean"&&typeof t!="boolean"?t!=null:t,!s||!n[e])return t;if(s==="toAttribute")switch(l){case"Object":case"Array":return t==null?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t==null?null:t;default:return t}else switch(l){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function at(e,t,n,s,l,i){let c=class extends D{constructor(){super(e,n,l),this.$$p_d=t;}static get observedAttributes(){return Object.keys(t).map(u=>(t[u].attribute||u).toLowerCase())}};return Object.keys(t).forEach(u=>{Object.defineProperty(c.prototype,u,{get(){return this.$$c&&u in this.$$c?this.$$c[u]:this.$$d[u]},set(o){var r;o=m(u,o,t),this.$$d[u]=o,(r=this.$$c)==null||r.$set({[u]:o});}});}),s.forEach(u=>{Object.defineProperty(c.prototype,u,{get(){var o;return (o=this.$$c)==null?void 0:o[u]}});}),e.element=c,c}class ht{constructor(){$(this,"$$");$(this,"$$set");}$destroy(){dt(this,1),this.$destroy=_;}$on(t,n){if(!I(n))return _;const s=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return s.push(n),()=>{const l=s.indexOf(n);l!==-1&&s.splice(l,1);}}$set(t){this.$$set&&!Q(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1);}}const _t="4";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(_t);function pt(e){X(e,"svelte-gnt082",".LoaderContainer{display:flex;justify-content:center}.lds-ellipsis{display:inline-block;position:relative;width:80px;height:80px}.lds-ellipsis div{position:absolute;top:33px;width:13px;height:13px;border-radius:50%;background:#d1d1d1;animation-timing-function:cubic-bezier(0, 1, 1, 0)}.lds-ellipsis div:nth-child(1){left:8px;animation:lds-ellipsis1 0.6s infinite}.lds-ellipsis div:nth-child(2){left:8px;animation:lds-ellipsis2 0.6s infinite}.lds-ellipsis div:nth-child(3){left:32px;animation:lds-ellipsis2 0.6s infinite}.lds-ellipsis div:nth-child(4){left:56px;animation:lds-ellipsis3 0.6s infinite}@keyframes lds-ellipsis1{0%{transform:scale(0)}100%{transform:scale(1)}}@keyframes lds-ellipsis3{0%{transform:scale(1)}100%{transform:scale(0)}}@keyframes lds-ellipsis2{0%{transform:translate(0, 0)}100%{transform:translate(24px, 0)}}");}function gt(e){let t;return {c(){t=L("div"),t.innerHTML='<section class="LoaderContainer" part="LoaderContainer"><div class="lds-ellipsis"><div></div><div></div><div></div><div></div></div></section>';},m(n,s){U(n,t,s),e[3](t);},p:_,i:_,o:_,d(n){n&&C(t),e[3](null);}}}function mt(e,t,n){let{clientstyling:s=""}=t,{clientstylingurl:l=""}=t,i;const c=()=>{let r=document.createElement("style");r.innerHTML=s,i.appendChild(r);},u=()=>{let r=new URL(l),f=document.createElement("style");fetch(r.href).then(d=>d.text()).then(d=>{f.innerHTML=d,setTimeout(()=>{i.appendChild(f);},1),setTimeout(()=>{},500);});};function o(r){k[r?"unshift":"push"](()=>{i=r,n(0,i);});}return e.$$set=r=>{"clientstyling"in r&&n(1,s=r.clientstyling),"clientstylingurl"in r&&n(2,l=r.clientstylingurl);},e.$$.update=()=>{e.$$.dirty&3&&s&&i&&c(),e.$$.dirty&5&&l&&i&&u();},[i,s,l,o]}class J extends ht{constructor(t){super(),ft(this,t,mt,gt,K,{clientstyling:1,clientstylingurl:2},pt);}get clientstyling(){return this.$$.ctx[1]}set clientstyling(t){this.$$set({clientstyling:t}),y();}get clientstylingurl(){return this.$$.ctx[2]}set clientstylingurl(t){this.$$set({clientstylingurl:t}),y();}}at(J,{clientstyling:{},clientstylingurl:{}},[],[],!0);exports.default=J;
183
- }(GeneralAnimationLoadingCczQRHih));
184
-
185
- if(typeof window!="undefined"){let n=function(t){return function(...i){try{return t.apply(this,i)}catch(e){if(e instanceof DOMException&&e.message.includes("has already been used with this registry")||e.message.includes("Cannot define multiple custom elements with the same tag name"))return !1;throw e}}};customElements.define=n(customElements.define),Promise.resolve().then(()=>GeneralAnimationLoadingCczQRHih).then(({default:t})=>{!customElements.get("general-animation-loading")&&customElements.define("general-animation-loading",t.element);});}
186
-
187
- 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, rgba(167, 167, 167, 0.2));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, rgba(0, 0, 0, 0.2509803922));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)}.NoContent{font-size:16px;color:var(--emfe-w-color-black-100, #afafaf);text-align:center;height:120px;line-height:120px}";
188
- const BonusElevateShopStyle0 = bonusElevateShopCss;
189
-
190
- const BonusElevateShop = class {
191
- constructor(hostRef) {
192
- registerInstance(this, hostRef);
193
- this.redeemGiftButton = createEvent(this, "redeemGiftButton", 7);
194
- this.bindedHandler = this.handleMessage.bind(this);
195
- this.session = undefined;
196
- this.endpoint = undefined;
197
- this.language = 'en';
198
- this.clientStyling = '';
199
- this.clientStylingUrl = '';
200
- this.translationUrl = '';
201
- this.locale = translation['en'];
202
- this.gifts = [];
203
- this.isLoading = true;
204
- }
205
- async updateGifts() {
206
- this.isLoading = true;
207
- if (this.session) {
208
- const res = await fetchNorwayApi.bind(this, '/v1/elevate/shop', {}).call();
209
- this.gifts = res.data || [];
210
- }
211
- else {
212
- this.gifts = [];
213
- }
214
- this.isLoading = false;
215
- }
216
- redeemGiftConfirm(id) {
217
- const shopItem = this.gifts.filter((gift) => {
218
- return gift.id === id;
219
- })[0];
220
- window.postMessage({ type: 'BEERedeemConfirm', shopItem }, window.location.href);
221
- }
222
- disconnectedCallback() {
223
- window.removeEventListener('message', this.bindedHandler, false);
224
- }
225
- async redeemGift(id) {
226
- const res = await fetchNorwayApi.bind(this, '/v1/elevate/redeem', {}, {
227
- method: 'PUT',
228
- body: JSON.stringify({ giftID: id }),
229
- headers: {
230
- 'Content-Type': 'application/json-patch+json',
231
- }
232
- }).call();
233
- if (res.success) {
234
- this.redeemGiftButton.emit();
235
- window.postMessage({ type: 'BEEGiftRedeem', itemId: id }, window.location.href);
236
- }
237
- else {
238
- window.postMessage({ type: 'BEEGiftRedeemFailed', itemId: id, err: res }, window.location.href);
239
- }
240
- }
241
- loadGifts(renderer) {
242
- if (this.isLoading) {
243
- return h("general-animation-loading", null);
244
- }
245
- else {
246
- if (this.gifts.length === 0) {
247
- return (h("div", { class: "NoContent" }, this.locale.noContent));
248
- }
249
- else {
250
- return renderer();
251
- }
252
- }
253
- }
254
- render() {
255
- return (h("main", { key: 'd659585662c983efd2eeb69a3880ec8328ad8351', class: "MainContainer" }, h("general-styling-wrapper", { key: 'a9b2650455ecd27849e55553eb1679dddce7b7cd', clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, targetTranslations: translation, translationUrl: this.translationUrl }), h("player-elevate-pointcard", { key: 'f042fb5c3fcb5d5c03059507a1201d1e56dfd5d4', endpoint: this.endpoint, session: this.session, language: this.language, clientStylingUrl: this.clientStylingUrl, clientStyling: this.clientStyling, translationUrl: this.translationUrl }), this.loadGifts(renderGifts.bind(this, this.gifts, this.locale, this.redeemGiftConfirm.bind(this)))));
256
- }
257
- handleMessage(message) {
258
- if (message.data.type === "bee-redeem-confirmed" && message.data.id) {
259
- this.redeemGift(message.data.id);
260
- }
261
- }
262
- async componentDidLoad() {
263
- this.updateGifts();
264
- window.addEventListener('message', this.bindedHandler, false);
265
- }
266
- static get assetsDirs() { return ["static"]; }
267
- static get watchers() { return {
268
- "endpoint": ["updateGifts"],
269
- "language": ["updateGifts"],
270
- "session": ["updateGifts"]
271
- }; }
272
- };
273
- BonusElevateShop.style = BonusElevateShopStyle0;
274
-
275
- const mergeTranslations = (url, target) => {
276
- return new Promise((resolve) => {
277
- fetch(url)
278
- .then((res) => res.json())
279
- .then((data) => {
280
- Object.keys(data).forEach((item) => {
281
- target[item] = target[item] ? target[item] : {};
282
- for (let key in data[item]) {
283
- target[item][key] = data[item][key];
284
- }
285
- });
286
- resolve(true);
287
- });
288
- });
289
- };
290
-
291
- const generalStylingWrapperCss = ":host{display:block}";
292
- const GeneralStylingWrapperStyle0 = generalStylingWrapperCss;
293
-
294
- const GeneralStylingWrapper = class {
295
- constructor(hostRef) {
296
- registerInstance(this, hostRef);
297
- this.stylingAppends = false;
298
- this.setClientStyling = () => {
299
- let sheet = document.createElement('style');
300
- sheet.innerHTML = this.clientStyling;
301
- this.el.prepend(sheet);
302
- };
303
- this.setClientStylingURL = () => {
304
- let url = new URL(this.clientStylingUrl);
305
- let cssFile = document.createElement('style');
306
- fetch(url.href)
307
- .then((res) => res.text())
308
- .then((data) => {
309
- cssFile.innerHTML = data;
310
- setTimeout(() => {
311
- this.el.prepend(cssFile);
312
- }, 1);
313
- })
314
- .catch((err) => {
315
- console.log('error ', err);
316
- });
317
- };
318
- this.clientStyling = '';
319
- this.clientStylingUrl = '';
320
- this.translationUrl = '';
321
- this.targetTranslations = undefined;
322
- }
323
- componentDidRender() {
324
- // start custom styling area
325
- if (!this.stylingAppends) {
326
- if (this.clientStyling)
327
- this.setClientStyling();
328
- if (this.clientStylingUrl)
329
- this.setClientStylingURL();
330
- this.stylingAppends = true;
331
- }
332
- // end custom styling area
333
- }
334
- async componentWillLoad() {
335
- const promises = [];
336
- if (this.translationUrl) {
337
- const translationPromise = mergeTranslations(this.translationUrl, this.targetTranslations);
338
- promises.push(translationPromise);
339
- }
340
- return await Promise.all(promises);
341
- }
342
- render() {
343
- return (h("div", { key: '4d3414408c7662f88331dbe655966237f74d6958', class: "StyleShell" }, h("slot", { key: '1d004644d84602c4314bdf5dfc26b55b160f57df', name: "mainContent" })));
344
- }
345
- get el() { return getElement(this); }
346
- };
347
- GeneralStylingWrapper.style = GeneralStylingWrapperStyle0;
348
-
349
- /**
350
- * @name startOfDay
351
- * @category Day Helpers
352
- * @summary Return the start of a day for the given date.
353
- *
354
- * @description
355
- * Return the start of a day for the given date.
356
- * The result will be in the local timezone.
357
- *
358
- * @param {Date|Number} date - the original date
359
- * @returns {Date} the start of a day
360
- * @throws {TypeError} 1 argument required
361
- *
362
- * @example
363
- * // The start of a day for 2 September 2014 11:55:00:
364
- * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
365
- * //=> Tue Sep 02 2014 00:00:00
366
- */
367
- function startOfDay(dirtyDate) {
368
- requiredArgs(1, arguments);
369
- var date = toDate(dirtyDate);
370
- date.setHours(0, 0, 0, 0);
371
- return date;
372
- }
373
-
374
- var MILLISECONDS_IN_DAY = 86400000;
375
-
376
- /**
377
- * @name differenceInCalendarDays
378
- * @category Day Helpers
379
- * @summary Get the number of calendar days between the given dates.
380
- *
381
- * @description
382
- * Get the number of calendar days between the given dates. This means that the times are removed
383
- * from the dates and then the difference in days is calculated.
384
- *
385
- * @param {Date|Number} dateLeft - the later date
386
- * @param {Date|Number} dateRight - the earlier date
387
- * @returns {Number} the number of calendar days
388
- * @throws {TypeError} 2 arguments required
389
- *
390
- * @example
391
- * // How many calendar days are between
392
- * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
393
- * const result = differenceInCalendarDays(
394
- * new Date(2012, 6, 2, 0, 0),
395
- * new Date(2011, 6, 2, 23, 0)
396
- * )
397
- * //=> 366
398
- * // How many calendar days are between
399
- * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
400
- * const result = differenceInCalendarDays(
401
- * new Date(2011, 6, 3, 0, 1),
402
- * new Date(2011, 6, 2, 23, 59)
403
- * )
404
- * //=> 1
405
- */
406
- function differenceInCalendarDays(dirtyDateLeft, dirtyDateRight) {
407
- requiredArgs(2, arguments);
408
- var startOfDayLeft = startOfDay(dirtyDateLeft);
409
- var startOfDayRight = startOfDay(dirtyDateRight);
410
- var timestampLeft = startOfDayLeft.getTime() - getTimezoneOffsetInMilliseconds(startOfDayLeft);
411
- var timestampRight = startOfDayRight.getTime() - getTimezoneOffsetInMilliseconds(startOfDayRight);
412
-
413
- // Round the number of days to the nearest integer
414
- // because the number of milliseconds in a day is not constant
415
- // (e.g. it's different in the day of the daylight saving time clock shift)
416
- return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY);
417
- }
418
-
419
- /**
420
- * Days in 1 week.
421
- *
422
- * @name daysInWeek
423
- * @constant
424
- * @type {number}
425
- * @default
426
- */
427
-
428
- /**
429
- * Milliseconds in 1 hour
430
- *
431
- * @name millisecondsInHour
432
- * @constant
433
- * @type {number}
434
- * @default
435
- */
436
- var millisecondsInHour = 3600000;
437
-
438
- /**
439
- * @name differenceInMilliseconds
440
- * @category Millisecond Helpers
441
- * @summary Get the number of milliseconds between the given dates.
442
- *
443
- * @description
444
- * Get the number of milliseconds between the given dates.
445
- *
446
- * @param {Date|Number} dateLeft - the later date
447
- * @param {Date|Number} dateRight - the earlier date
448
- * @returns {Number} the number of milliseconds
449
- * @throws {TypeError} 2 arguments required
450
- *
451
- * @example
452
- * // How many milliseconds are between
453
- * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?
454
- * const result = differenceInMilliseconds(
455
- * new Date(2014, 6, 2, 12, 30, 21, 700),
456
- * new Date(2014, 6, 2, 12, 30, 20, 600)
457
- * )
458
- * //=> 1100
459
- */
460
- function differenceInMilliseconds(dateLeft, dateRight) {
461
- requiredArgs(2, arguments);
462
- return toDate(dateLeft).getTime() - toDate(dateRight).getTime();
463
- }
464
-
465
- var roundingMap = {
466
- ceil: Math.ceil,
467
- round: Math.round,
468
- floor: Math.floor,
469
- trunc: function trunc(value) {
470
- return value < 0 ? Math.ceil(value) : Math.floor(value);
471
- } // Math.trunc is not supported by IE
472
- };
473
-
474
- var defaultRoundingMethod = 'trunc';
475
- function getRoundingMethod(method) {
476
- return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];
477
- }
478
-
479
- /**
480
- * @name differenceInHours
481
- * @category Hour Helpers
482
- * @summary Get the number of hours between the given dates.
483
- *
484
- * @description
485
- * Get the number of hours between the given dates.
486
- *
487
- * @param {Date|Number} dateLeft - the later date
488
- * @param {Date|Number} dateRight - the earlier date
489
- * @param {Object} [options] - an object with options.
490
- * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)
491
- * @returns {Number} the number of hours
492
- * @throws {TypeError} 2 arguments required
493
- *
494
- * @example
495
- * // How many hours are between 2 July 2014 06:50:00 and 2 July 2014 19:00:00?
496
- * const result = differenceInHours(
497
- * new Date(2014, 6, 2, 19, 0),
498
- * new Date(2014, 6, 2, 6, 50)
499
- * )
500
- * //=> 12
501
- */
502
- function differenceInHours(dateLeft, dateRight, options) {
503
- requiredArgs(2, arguments);
504
- var diff = differenceInMilliseconds(dateLeft, dateRight) / millisecondsInHour;
505
- return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
506
- }
507
-
508
- /**
509
- * @name isBefore
510
- * @category Common Helpers
511
- * @summary Is the first date before the second one?
512
- *
513
- * @description
514
- * Is the first date before the second one?
515
- *
516
- * @param {Date|Number} date - the date that should be before the other one to return true
517
- * @param {Date|Number} dateToCompare - the date to compare with
518
- * @returns {Boolean} the first date is before the second date
519
- * @throws {TypeError} 2 arguments required
520
- *
521
- * @example
522
- * // Is 10 July 1989 before 11 February 1987?
523
- * const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
524
- * //=> false
525
- */
526
- function isBefore(dirtyDate, dirtyDateToCompare) {
527
- requiredArgs(2, arguments);
528
- var date = toDate(dirtyDate);
529
- var dateToCompare = toDate(dirtyDateToCompare);
530
- return date.getTime() < dateToCompare.getTime();
531
- }
532
-
533
- function updateProgressSvg(progressElementRef, percent) {
534
- const svgElement = progressElementRef.querySelector('#total_level');
535
- const endLockWidth = 17, pointR = 6.5;
536
- //Total Widget of the progress
537
- const barWidth = svgElement.getBBox().width;
538
- //The filled width according to current progress
539
- const levelPercent = percent > 1 ? 1 : percent;
540
- const widthOnBar = (levelPercent * barWidth - endLockWidth) < 0 ? 0 : levelPercent * barWidth - endLockWidth;
541
- //update bar's width, widthOnBar
542
- const levelBar = progressElementRef.querySelector('#current_level');
543
- //update filters, x = widthOnBar
544
- const levelFilter = progressElementRef.querySelector('#filter_current_level');
545
- //update circle, widthOnBar+10
546
- const levelCircle = progressElementRef.querySelector('#circle_current_level');
547
- svgElement.setAttribute('viewbox', `0 0 ${widthOnBar} 28`);
548
- levelBar.setAttribute('width', `${widthOnBar}`);
549
- levelCircle.setAttribute('cx', `${(widthOnBar < pointR ? pointR : widthOnBar)}`);
550
- levelFilter.setAttribute('x', `${widthOnBar - 8}`);
551
- //update lock location
552
- const endLockElement = progressElementRef.querySelector('#lock');
553
- // wrapper of endLock, include ball and heatfilter1_d_305_23
554
- const filter1 = progressElementRef.querySelector('#filter_heart_ball');
555
- // ball in endlockfilter2_i_305_23
556
- const filter2 = progressElementRef.querySelector('#filter_ball');
557
- // heart in endlockfilter3_d_305_23
558
- const filter3 = progressElementRef.querySelector('#filter_heart');
559
- //wrapper of lockfilter4_d_305_23
560
- const filterLock = progressElementRef.querySelector('#filter_lock');
561
- // shadow of ball paint0_linear_305_23
562
- const paint0 = progressElementRef.querySelector('#paint0_linear_ball');
563
- //paint in lockpaint1_linear_305_23
564
- const paint1 = progressElementRef.querySelector('#paint1_linear_lock');
565
- // box of lock and heart, for move position dynamically
566
- const lockBox = progressElementRef.querySelector('#lock_box');
567
- const heartBox = progressElementRef.querySelector('#heart_box');
568
- const rightPaddingOfLockWidth = 10, cxOfEndLockEle = barWidth - rightPaddingOfLockWidth;
569
- //set cx of lockElement
570
- endLockElement.setAttribute('cx', `${cxOfEndLockEle}`);
571
- //set cx of sub Elements
572
- paint1.setAttribute('x1', `${cxOfEndLockEle}`);
573
- paint1.setAttribute('x2', `${cxOfEndLockEle}`);
574
- paint0.setAttribute('x1', `${cxOfEndLockEle - 6}`);
575
- paint0.setAttribute('x2', `${cxOfEndLockEle - 6 + 11.2}`);
576
- filterLock.setAttribute('x', `${cxOfEndLockEle - 6}`);
577
- filter3.setAttribute('x', `${cxOfEndLockEle - 6 - 2}`);
578
- filter2.setAttribute('x', `${cxOfEndLockEle - 6 - 2 - 2}`);
579
- filter1.setAttribute('x', `${cxOfEndLockEle - 6 - 2 - 2 - 4}`);
580
- lockBox.setAttribute('x', `${cxOfEndLockEle - 6}`);
581
- heartBox.setAttribute('x', `${cxOfEndLockEle - 6}`);
582
- svgElement.parentElement.style.opacity = '1';
583
- }
584
-
585
- 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 .LevelProgress svg {\n transition: opacity 0.4s;\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 rgba(0, 0, 0, 0.2509803922);\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}";
586
- const PlayerElevateCardDataStyle0 = playerElevateCardDataCss;
587
-
588
- const PlayerElevateCardData = class {
589
- constructor(hostRef) {
590
- registerInstance(this, hostRef);
591
- this.playerElevateLeveLoaded = createEvent(this, "playerElevateLeveLoaded", 7);
592
- this.params = undefined;
593
- this.playerElevateLevel = undefined;
594
- this.pointExpireString = undefined;
595
- }
596
- handleWindowResizs() {
597
- this.initLevelProgressbar();
598
- }
599
- onParamsChanged() {
600
- this.loadElevateInfo();
601
- }
602
- onRedeemClick() {
603
- window.postMessage({ type: 'BEERedeemClicked' }, window.location.href);
604
- }
605
- loadLevels() {
606
- let url = new URL(`${this.params.endpoint}/v1/elevate/levels?language=${this.params.language}`);
607
- return new Promise((resolve, reject) => {
608
- return fetch(url.href, {
609
- method: 'GET',
610
- })
611
- .then((res) => res.json())
612
- .then((res) => {
613
- this.levels = res.data;
614
- resolve(true);
615
- })
616
- .catch((err) => {
617
- reject(err);
618
- });
619
- });
620
- }
621
- calcuatePointsToBeExpired(walletTotalInfo) {
622
- let pointExpireInfoAsString = '';
623
- if (!walletTotalInfo || !walletTotalInfo.aboutToExpire ||
624
- walletTotalInfo.aboutToExpire.length == 0 ||
625
- walletTotalInfo.aboutToExpire[0].points <= 0) {
626
- return pointExpireInfoAsString;
627
- }
628
- walletTotalInfo.aboutToExpire.sort((expire1, expire2) => {
629
- return isBefore(new Date(expire1.expireTime), new Date(expire2.expireTime))
630
- ? -1
631
- : 1;
632
- });
633
- const aboutToExpire = walletTotalInfo.aboutToExpire[0];
634
- const daysToExpried = differenceInCalendarDays(new Date(aboutToExpire.expireTime), new Date());
635
- let hoursToExpired = 0, expiredTranslationKey = daysToExpried === 0 ? 'pointsToBeExpiredDay' : 'pointsToBeExpired';
636
- if (daysToExpried == 0) {
637
- hoursToExpired = differenceInHours(new Date(aboutToExpire.expireTime), new Date());
638
- expiredTranslationKey = hoursToExpired > 1 ? 'pointsToBeExpiredHours' : 'pointsToBeExpiredHour';
639
- }
640
- pointExpireInfoAsString = translateWithParams(expiredTranslationKey, {
641
- expirationPoints: aboutToExpire.points,
642
- expireDay: daysToExpried,
643
- });
644
- return pointExpireInfoAsString;
645
- }
646
- loadPlayerLevelInfo() {
647
- let url = new URL(`${this.params.endpoint}/v1/elevate/playerInfo?language=${this.params.language}`);
648
- return new Promise((resolve, reject) => {
649
- return fetch(url.href, {
650
- method: 'GET',
651
- headers: {
652
- 'X-Sessionid': this.params.session,
653
- 'Content-Type': 'application/json',
654
- },
655
- })
656
- .then((res) => res.json())
657
- .then((res) => {
658
- var _a, _b, _c;
659
- if (!res.success) {
660
- console.error('Exception when fetch user elevateinfo, ', res.errorCode, res.errorMessage);
661
- reject(true);
662
- return;
663
- }
664
- let playerElevateInfo = res.data;
665
- this.playerElevateLevel = playerElevateInfo.level;
666
- this.playerElevateLevel.name = this.playerElevateLevel.presentation.displayName || this.playerElevateLevel.name;
667
- this.playerElevateLevel.spendablePoints = ((_a = playerElevateInfo.spendableWallet) === null || _a === void 0 ? void 0 : _a.total.points) || 0;
668
- this.playerElevateLeveLoaded.emit({ elevateLevel: this.playerElevateLevel });
669
- const spendableTotal = (_b = res.data.spendableWallet) === null || _b === void 0 ? void 0 : _b.total;
670
- const loyaltyWalletTotal = (_c = res.data.loyaltyWallet) === null || _c === void 0 ? void 0 : _c.total;
671
- this.playerElevateLeveLoaded.emit({
672
- elevateLevelWalletTotal: spendableTotal,
673
- loyaltyWalletTotal
674
- });
675
- let spExpireInfoAsString = this.calcuatePointsToBeExpired(spendableTotal);
676
- let xpExpireInfoAsString = this.calcuatePointsToBeExpired(loyaltyWalletTotal);
677
- if (spExpireInfoAsString || xpExpireInfoAsString) {
678
- this.playerElevateLeveLoaded.emit({
679
- pointExpireString: spExpireInfoAsString,
680
- xpExpireString: xpExpireInfoAsString
681
- });
682
- }
683
- resolve(this.playerElevateLevel);
684
- })
685
- .catch((err) => {
686
- console.log('error ', err);
687
- reject(true);
688
- });
689
- });
690
- }
691
- setLoyaltyProgress(percent) {
692
- updateProgressSvg(this.loyaltyProgressEle, percent);
693
- }
694
- initLevelProgressbar() {
695
- setTimeout(() => {
696
- this.loyaltyProgressEle =
697
- this.elevateCardRef.parentElement.querySelector('#LevelProgress');
698
- if (!this.loyaltyProgressEle) {
699
- return;
700
- }
701
- this.setLoyaltyProgress(!this.playerElevateLevel.nextLevel
702
- ? 1 : (this.playerElevateLevel.loyaltyPoints / this.playerElevateLevel.nextLevel.entryPoints));
703
- this.params['playerElevateLevel'] = this.playerElevateLevel;
704
- }, 80);
705
- }
706
- componentDidRender() {
707
- this.initLevelProgressbar();
708
- }
709
- loadElevateInfo() {
710
- if (!this.params.endpoint || !this.params.session) {
711
- return;
712
- }
713
- const promises = [];
714
- promises.push(this.loadPlayerLevelInfo());
715
- if (this.params.calculateLevelFlag) {
716
- promises.push(this.loadLevels());
717
- }
718
- Promise.all(promises).then((res) => {
719
- console.log('elevate-init', res);
720
- this.initLevelProgressbar();
721
- if (!this.levels) {
722
- return;
723
- }
724
- this.levels.sort((level1, level2) => {
725
- return level1.firstEntryPoints > level2.firstEntryPoints ? 1 : -1;
726
- });
727
- const playerPoints = this.playerElevateLevel.loyaltyPoints;
728
- let playerLevelNumber = 0;
729
- this.levels.forEach((elevateLevel, idx) => {
730
- if (playerPoints > elevateLevel.firstEntryPoints) {
731
- playerLevelNumber = idx;
732
- }
733
- });
734
- this.playerElevateLeveLoaded.emit({
735
- calculatedLevelFlag: playerLevelNumber,
736
- });
737
- });
738
- }
739
- componentWillLoad() {
740
- this.loadElevateInfo();
741
- }
742
- get elevateCardRef() { return getElement(this); }
743
- static get watchers() { return {
744
- "params": ["onParamsChanged"]
745
- }; }
746
- };
747
- PlayerElevateCardData.style = PlayerElevateCardDataStyle0;
748
-
749
- 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}";
750
- const PlayerElevatePointcardStyle0 = playerElevatePointcardCss;
751
-
752
- const PlayerElevatePointcard = class {
753
- constructor(hostRef) {
754
- registerInstance(this, hostRef);
755
- this.isPointDetailCard = this.buttonType === 'earningRule';
756
- this.endpoint = undefined;
757
- this.theme = 'Dark';
758
- this.session = undefined;
759
- this.playerAvatarUrl = undefined;
760
- this.language = 'en';
761
- this.playerName = undefined;
762
- this.cardTitle = undefined;
763
- this.buttonType = 'earningRule';
764
- this.dateFormat = 'yyyy-MM-dd';
765
- this.clientStyling = '';
766
- this.clientStylingUrl = '';
767
- this.translationUrl = '';
768
- this.pointExpireString = undefined;
769
- this.playerElevateLevel = undefined;
770
- this.elevateWalletTotal = undefined;
771
- this.elevateSPTotal = undefined;
772
- }
773
- onSessionOrEndpointChange() {
774
- this.paramProxy = Object.assign(Object.assign({}, this.paramProxy), { session: this.session, endpoint: this.endpoint, language: this.language });
775
- }
776
- playerElevateLeveLoadedHandler(event) {
777
- if (!event.detail) {
778
- return;
779
- }
780
- if (event.detail['elevateLevelWalletTotal']) {
781
- this.elevateWalletTotal = event.detail['elevateLevelWalletTotal'];
782
- this.elevateSPTotal = event.detail['loyaltyWalletTotal'];
783
- }
784
- if (event.detail['elevateLevel']) {
785
- this.playerElevateLevel = event.detail['elevateLevel'];
786
- }
787
- if (event.detail['pointExpireString']) {
788
- this.pointExpireString = event.detail.pointExpireString;
789
- }
790
- }
791
- onDetailsClick() {
792
- window.postMessage({ type: this.isPointDetailCard ? 'BEEPointRulesClicked' : 'BEEDetailsClicked',
793
- path: this.isPointDetailCard ? 'player-elevate-level' : 'player-elevate-point-details' }, window.location.href);
794
- }
795
- componentWillLoad() {
796
- this.paramProxy = {
797
- endpoint: this.endpoint,
798
- session: this.session,
799
- language: this.language,
800
- };
801
- }
802
- render() {
803
- const backgroundOuterImagePath = getAssetPath('../static/card-ground.svg');
804
- const backgroundInnerImagePath = getAssetPath('../static/card-ground-over.svg');
805
- return (h("div", { key: '13461fc9cf8b777337a539c15da4bb2781f5a837', class: `ElevateCardWrapper ${this.theme}` }, h("div", { key: '526e72c0ada871f74ba4a07f0a125bc25840c09c', class: "PointsCard Outer ", style: { 'backgroundImage': `url(${backgroundOuterImagePath}` } }, h("general-styling-wrapper", { key: '95e358ceb8fa3c247660f7ca15a4684b132874be', clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, targetTranslations: TRANSLATIONS, translationUrl: this.translationUrl }), h("player-elevate-card-data", { key: '24c765d743446ac597a9dcc9cd22515e7e39e6db', params: this.paramProxy }), h("div", { key: '309db4bbfc244a7fb97827774d9d4383109ca0d7', class: 'OuterCover Inner', style: { 'backgroundImage': `url(${backgroundInnerImagePath}` } }, h("div", { key: '9d5614ded2f73b505e60900675a7d95b3cfbcbc6', class: 'Content Row' }, this.playerElevateLevel && (h(Fragment, { key: '9a17e809083e61aad19f7ffef5d5ee5885ae8b4d' }, h("div", { key: '47068df3c0070ee2785b0d0201b08766fe0d71e8', class: "PlayerImg" }, h(PlayerAvatar, { key: '40115f8b190d871c85f9531fbf0bafb8fbd739e2', onlyBadge: true, loyaltyIconUrl: this.playerElevateLevel.presentation.asset })), h("div", { key: '278cd70c23ecb48655e90810af570ce5366d13d5', class: `LevelInfo ${this.playerElevateLevel.name}` }, h("div", { key: 'ce682ff881c5b12ed0b736ffcc67ad07b3713999', class: "PointsTxt Label" }, this.cardTitle ? this.cardTitle : translate('spendablePoints')), h("div", { key: 'eeebc5c468cf6e3d566f708fd47a19956ad9defe', class: 'PointsTxt SPPoints' }, h(PlayerPoints, { key: 'ad58990b7fa789cf2d5c524191447196e97c8a16', spendablePoints: this.playerElevateLevel.spendablePoints, language: this.language }), h("a", { key: '0dbdd6cd84e1cb43dac4485f4e3eec3130d6c65c', class: "TC", onClick: () => {
806
- this.onDetailsClick();
807
- } }, translate('termAndConditions', this.language))), this.pointExpireString && (h("div", { key: '45c3267d390995fabe34974913adf97b112cf8c2', class: 'ExpirationPoints' }, this.pointExpireString, " "))))))))));
808
- }
809
- static get watchers() { return {
810
- "session": ["onSessionOrEndpointChange"],
811
- "endpoint": ["onSessionOrEndpointChange"],
812
- "language": ["onSessionOrEndpointChange"]
813
- }; }
814
- };
815
- PlayerElevatePointcard.style = PlayerElevatePointcardStyle0;
816
-
817
- export { BonusElevateShop as bonus_elevate_shop, GeneralStylingWrapper as general_styling_wrapper, PlayerElevateCardData as player_elevate_card_data, PlayerElevatePointcard as player_elevate_pointcard };