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