@everymatrix/player-elevate-points-history 1.0.69

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 (84) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/bonus-pagination-limits_6.cjs.entry.js +1080 -0
  3. package/dist/cjs/index-c769d3e9.js +1651 -0
  4. package/dist/cjs/index.cjs.js +2 -0
  5. package/dist/cjs/loader.cjs.js +15 -0
  6. package/dist/cjs/player-elevate-card-items-e7f7d092.js +2364 -0
  7. package/dist/cjs/player-elevate-card.cjs.entry.js +74 -0
  8. package/dist/cjs/player-elevate-loyaltycard.cjs.entry.js +81 -0
  9. package/dist/cjs/player-elevate-points-history.cjs.js +25 -0
  10. package/dist/collection/collection-manifest.json +40 -0
  11. package/dist/collection/components/player-elevate-points-history/index.js +1 -0
  12. package/dist/collection/components/player-elevate-points-history/player-elevate-points-history.css +182 -0
  13. package/dist/collection/components/player-elevate-points-history/player-elevate-points-history.js +403 -0
  14. package/dist/collection/index.js +1 -0
  15. package/dist/collection/renders/renderTabs.js +9 -0
  16. package/dist/collection/renders/renderTopBar.js +4 -0
  17. package/dist/collection/renders/renderWallets.js +33 -0
  18. package/dist/collection/static/back.svg +3 -0
  19. package/dist/collection/static/menu.svg +5 -0
  20. package/dist/collection/utils/business.js +17 -0
  21. package/dist/collection/utils/fetch.js +17 -0
  22. package/dist/collection/utils/translation.js +36 -0
  23. package/dist/collection/utils/types.js +6 -0
  24. package/dist/collection/utils/util.js +16 -0
  25. package/dist/collection/utils/utils.js +3 -0
  26. package/dist/esm/app-globals-0f993ce5.js +3 -0
  27. package/dist/esm/bonus-pagination-limits_6.entry.js +1071 -0
  28. package/dist/esm/index-e7bde614.js +1621 -0
  29. package/dist/esm/index.js +1 -0
  30. package/dist/esm/loader.js +11 -0
  31. package/dist/esm/player-elevate-card-items-4cabbcc6.js +2351 -0
  32. package/dist/esm/player-elevate-card.entry.js +70 -0
  33. package/dist/esm/player-elevate-loyaltycard.entry.js +77 -0
  34. package/dist/esm/player-elevate-points-history.js +20 -0
  35. package/dist/index.cjs.js +1 -0
  36. package/dist/index.js +1 -0
  37. package/dist/player-elevate-points-history/index.esm.js +0 -0
  38. package/dist/player-elevate-points-history/p-0f3449ca.entry.js +1 -0
  39. package/dist/player-elevate-points-history/p-212a0bb7.entry.js +1 -0
  40. package/dist/player-elevate-points-history/p-409b8855.entry.js +1 -0
  41. package/dist/player-elevate-points-history/p-8a361039.js +1 -0
  42. package/dist/player-elevate-points-history/p-e1255160.js +1 -0
  43. package/dist/player-elevate-points-history/p-f547f5dc.js +2 -0
  44. package/dist/player-elevate-points-history/player-elevate-points-history.esm.js +1 -0
  45. package/dist/static/button-default.svg +42 -0
  46. package/dist/static/button-disabled.svg +4 -0
  47. package/dist/static/button-hover.svg +4 -0
  48. package/dist/static/button-level.svg +27 -0
  49. package/dist/static/button-pressed.svg +18 -0
  50. package/dist/static/button-redeem.svg +36 -0
  51. package/dist/static/card-ground-over.png +0 -0
  52. package/dist/static/card-ground-over.svg +903 -0
  53. package/dist/static/card-ground.png +0 -0
  54. package/dist/static/card-ground.svg +34 -0
  55. package/dist/static/info.svg +4 -0
  56. package/dist/static/level-badge.png +0 -0
  57. package/dist/static/level-percent.svg +80 -0
  58. package/dist/static/tips-info.svg +21 -0
  59. package/dist/static/user.svg +3 -0
  60. package/dist/stencil.config.dev.js +17 -0
  61. package/dist/stencil.config.js +17 -0
  62. package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/player-elevate-points-history/.stencil/packages/stencil/player-elevate-points-history/stencil.config.d.ts +2 -0
  63. package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/player-elevate-points-history/.stencil/packages/stencil/player-elevate-points-history/stencil.config.dev.d.ts +2 -0
  64. package/dist/types/components/player-elevate-points-history/index.d.ts +1 -0
  65. package/dist/types/components/player-elevate-points-history/player-elevate-points-history.d.ts +68 -0
  66. package/dist/types/components.d.ts +141 -0
  67. package/dist/types/index.d.ts +1 -0
  68. package/dist/types/renders/renderTabs.d.ts +3 -0
  69. package/dist/types/renders/renderTopBar.d.ts +3 -0
  70. package/dist/types/renders/renderWallets.d.ts +3 -0
  71. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  72. package/dist/types/utils/business.d.ts +2 -0
  73. package/dist/types/utils/fetch.d.ts +2 -0
  74. package/dist/types/utils/translation.d.ts +36 -0
  75. package/dist/types/utils/types.d.ts +42 -0
  76. package/dist/types/utils/util.d.ts +1 -0
  77. package/dist/types/utils/utils.d.ts +1 -0
  78. package/loader/cdn.js +1 -0
  79. package/loader/index.cjs.js +1 -0
  80. package/loader/index.d.ts +24 -0
  81. package/loader/index.es2017.js +1 -0
  82. package/loader/index.js +2 -0
  83. package/loader/package.json +11 -0
  84. package/package.json +33 -0
@@ -0,0 +1,1071 @@
1
+ import { r as registerInstance, c as createEvent, h, g as getElement, a as getAssetPath, F as Fragment } from './index-e7bde614.js';
2
+ import { r as requiredArgs, t as toDate, g as getTimezoneOffsetInMilliseconds, a as translateWithParams, T as TRANSLATIONS$2, P as PlayerAvatar, b as translate$2, c as PlayerPoints } from './player-elevate-card-items-4cabbcc6.js';
3
+
4
+ const DEFAULT_LANGUAGE$1 = 'en';
5
+ const SUPPORTED_LANGUAGES$1 = ['pt-br', 'en', 'es-mx', 'hu', 'hr'];
6
+ const TRANSLATIONS$1 = {
7
+ en: {
8
+ "pageLimitLabel": 'Show',
9
+ },
10
+ hu: {
11
+ "pageLimitLabel": 'Show',
12
+ },
13
+ hr: {
14
+ "pageLimitLabel": 'Show',
15
+ },
16
+ "pt-br": {
17
+ "pageLimitLabel": 'Show',
18
+ },
19
+ "es-mx": {
20
+ "pageLimitLabel": 'Show',
21
+ }
22
+ };
23
+ const translate$1 = (key, customLang) => {
24
+ const lang = customLang;
25
+ return TRANSLATIONS$1[lang !== undefined && SUPPORTED_LANGUAGES$1.includes(lang) ? lang : DEFAULT_LANGUAGE$1][key];
26
+ };
27
+
28
+ const bonusPaginationLimitsCss = ":host{display:block}.NoOfItemsToDisplayMessage{display:inline-block;margin:0.1rem;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:var(--emfe-w-color-primary, #191a19);line-height:1.8}.PaginationWrapper{display:flex;flex-direction:row}ul.PaginationArea{margin-block:5px;display:flex;flex-direction:row;padding:0px}ul.PaginationArea li.Item.Active:hover{color:var(--emfe-w-color-primary, #eaefea);background-color:var(--emfe-w-color-secondary, #191a19)}ul.PaginationArea li.Item.Active,ul.PaginationArea li.Item:hover{background-color:var(--emfe-w-color-primary, rgba(169, 171, 169, 0.7));font-weight:bold;border-radius:0.3rem}ul.PaginationArea li.Item{padding-inline-start:0px;list-style:none;padding:5px 6px;margin:2px;cursor:pointer;display:inline-block}";
29
+ const BonusPaginationLimitsStyle0 = bonusPaginationLimitsCss;
30
+
31
+ const BonusPaginationLimits = class {
32
+ constructor(hostRef) {
33
+ registerInstance(this, hostRef);
34
+ this.pageLimitChanged = createEvent(this, "pageLimitChanged", 7);
35
+ this.language = 'en';
36
+ this.translationUrl = '';
37
+ this.pageLimitOptions = undefined;
38
+ this.limit = 10;
39
+ this.pageLimits = [10, 25, 50];
40
+ }
41
+ onPageLimitClicked(pageLimit) {
42
+ this.limit = pageLimit;
43
+ this.pageLimitChanged.emit({ limit: this.limit });
44
+ }
45
+ componentWillLoad() {
46
+ if (!this.pageLimitOptions) {
47
+ return;
48
+ }
49
+ try {
50
+ this.pageLimits = this.pageLimitOptions.split(',').map((item) => {
51
+ return parseInt(item);
52
+ });
53
+ // if there is an array of custom limits provided (string to array - e.g. [5, 10, 15])
54
+ // and the value for the custom set limit (e.g. 8) isn't part of the provided array,
55
+ // then ignore the set the custom set limit and make the limit equal to the first value of the array
56
+ // (as part of the example so far, this would be 5)
57
+ if (!this.pageLimits.includes(this.limit)) {
58
+ this.limit = this.pageLimits[0];
59
+ }
60
+ }
61
+ catch (e) {
62
+ console.error('Error when parse PageLimitOptions', e);
63
+ }
64
+ }
65
+ renderStylingWrapper() {
66
+ return h("general-styling-wrapper", { targetTranslations: TRANSLATIONS$1, translationUrl: this.translationUrl });
67
+ }
68
+ render() {
69
+ return h("div", { key: '57f5e61ee287f72d0427a2e4f646e37c6b9358b9', class: 'PaginationWrapper' }, h("span", { key: '5f82b19fcf269086659b3faa475d9967b2af57fa', class: 'NoOfItemsToDisplayMessage' }, translate$1('pageLimitLabel', this.language)), h("ul", { key: '559c2d5378a352691583567579a8e681d092ddd3', class: 'PaginationArea' }, this.pageLimits.map((pageLimit) => {
70
+ return (h("li", { class: `${this.limit == pageLimit ? 'Active' : ''} PageSize Item`, onClick: () => {
71
+ this.onPageLimitClicked(pageLimit);
72
+ } }, pageLimit));
73
+ })), h("general-styling-wrapper", { key: 'a8b9632e7421318e330f33b9c1cc9eb7121e35e9', targetTranslations: TRANSLATIONS$1, translationUrl: this.translationUrl }), this.renderStylingWrapper());
74
+ }
75
+ };
76
+ BonusPaginationLimits.style = BonusPaginationLimitsStyle0;
77
+
78
+ const DEFAULT_LANGUAGE = 'en';
79
+ const SUPPORTED_LANGUAGES = ['pt-br', 'en', 'es-mx', 'hu', 'hr'];
80
+ const TRANSLATIONS = {
81
+ "en": {
82
+ "firstPage": '|<',
83
+ "lastPage": '>|',
84
+ "prePage": '<',
85
+ "nextPage": '>',
86
+ "pageOfTotal": '{start}-{end} of {total}',
87
+ },
88
+ "hu": {
89
+ "firstPage": 'First',
90
+ "lastPage": 'Last',
91
+ "prePage": '<',
92
+ "nextPage": '>',
93
+ "pageOfTotal": '{start}-{end} of {total}',
94
+ },
95
+ "hr": {
96
+ "firstPage": 'First',
97
+ "lastPage": 'Last',
98
+ "prePage": '<',
99
+ "nextPage": '>',
100
+ "pageOfTotal": '{start}-{end} of {total}',
101
+ },
102
+ "pt-br": {
103
+ "firstPage": 'First',
104
+ "lastPage": 'Last',
105
+ "prePage": '<',
106
+ "nextPage": '>',
107
+ "pageOfTotal": '{start}-{end} of {total}',
108
+ },
109
+ "es-mx": {
110
+ "firstPage": 'First',
111
+ "lastPage": 'Last',
112
+ "prePage": '<',
113
+ "nextPage": '>',
114
+ "pageOfTotal": '{start}-{end} of {total}',
115
+ }
116
+ };
117
+ const translate = (key, customLang, values) => {
118
+ const lang = customLang;
119
+ let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
120
+ if (values !== undefined) {
121
+ for (const [key, value] of Object.entries(values.values)) {
122
+ const regex = new RegExp(`{${key}}`, 'g');
123
+ translation = translation.replace(regex, value);
124
+ }
125
+ }
126
+ return translation;
127
+ };
128
+
129
+ const bonusPaginationNavCss = ":host{display:block}.PageNavigationWrapper{display:flex;flex-direction:row}.PageNavigationWrapper .PageOfMessage{margin:5px;padding:5px 6px;margin:2px}.PageNavigation{display:flex;flex-direction:row;align-items:center}.PageNavigation .PageArrow{color:var(--emfe-w-color-primary, #777676);padding:6px 5px;cursor:pointer;font-weight:bold;width:1.2rem;text-align:center}.PageNavigation .PageArrow.Disabled{color:var(--emfe-w-color-gray-100, #e0e0e0)}ul.PaginationArea{list-style:none;padding:0px;margin:0px;display:flex}ul.PaginationArea li.PageItem{cursor:pointer;padding:5px 6px;margin:2px;width:0.9rem;text-align:center}ul.PaginationArea li.PageItem.Active,ul.PaginationArea li.PageItem:hover{font-weight:bold;color:var(--emfe-w-color-primary, #f5f1f1);background-color:var(--emfe-w-color-secondary, #8c8989);border-radius:0.3rem}";
130
+ const BonusPaginationNavStyle0 = bonusPaginationNavCss;
131
+
132
+ const BonusPaginationNav = class {
133
+ constructor(hostRef) {
134
+ registerInstance(this, hostRef);
135
+ this.reloadPageEmitter = createEvent(this, "reloadPageByType", 7);
136
+ this.total = 1;
137
+ this.limit = 10;
138
+ this.offset = 0;
139
+ this.tableId = 'default';
140
+ this.language = 'en';
141
+ this.translationUrl = '';
142
+ this.arrowsActive = true;
143
+ this.secondaryArrowsActive = true;
144
+ this.displayPageNumbers = true;
145
+ this.displayRangeOfTotal = undefined;
146
+ this.endPageIndex = 0;
147
+ this.pagesArray = undefined;
148
+ this.currentPage = 1;
149
+ }
150
+ pageLimitChangedHandler(event) {
151
+ this.limit = event.detail.limit ? event.detail.limit : this.limit;
152
+ //reset offset = 0, this.currentPage = 1 when page limit changed
153
+ this.currentPage = 1;
154
+ this.offset = 0;
155
+ this.updatePageStatus();
156
+ if (event.type == 'pageLimitChanged') {
157
+ this.reloadPageEmitter.emit({ offset: 0, limit: this.limit, tableId: this.tableId });
158
+ }
159
+ }
160
+ goTo(step) {
161
+ if (step == '...' || step == 0 || parseInt(step.toString(), 10) > (this.endPageIndex + 1)) {
162
+ return;
163
+ }
164
+ this.currentPage = step;
165
+ let offset = (this.currentPage - 1) * this.limit;
166
+ this.reloadPageEmitter.emit({ offset, limit: this.limit, tableId: this.tableId });
167
+ }
168
+ renderPageList() {
169
+ return h("ul", { class: 'PaginationArea' }, this.pagesArray.map((page) => {
170
+ return (h("li", { class: `PageItem ${this.currentPage == page ? 'Active' : ''}`, onClick: () => {
171
+ this.goTo(page);
172
+ } }, page));
173
+ }));
174
+ }
175
+ renderStylingWrapper() {
176
+ return h("general-styling-wrapper", { targetTranslations: TRANSLATIONS, translationUrl: this.translationUrl });
177
+ }
178
+ updatePageStatus() {
179
+ this.endPageIndex = (Math.ceil(this.total / this.limit) - 1);
180
+ this.endPageIndex = this.endPageIndex < 0 ? this.endPageIndex = 0 : this.endPageIndex;
181
+ this.pagesArray = [];
182
+ if (this.endPageIndex < 5) {
183
+ this.pagesArray = Array.from({ length: this.endPageIndex + 1 }, (_, i) => i + 1);
184
+ }
185
+ else {
186
+ /**
187
+ * Construct numbered navigation area based on current page position
188
+ */
189
+ if (this.currentPage == 1 || this.currentPage == 2) {
190
+ this.pagesArray = Array.from({ length: 4 }, (_, i) => i + 1);
191
+ this.pagesArray.push('...');
192
+ }
193
+ else if (this.currentPage >= 3 && ((this.endPageIndex - this.currentPage) >= 2)) {
194
+ this.pagesArray = Array.from({ length: 3 }, (_, i) => this.currentPage + i - 1);
195
+ this.pagesArray.push('...');
196
+ this.pagesArray.unshift('...');
197
+ }
198
+ else if ((this.endPageIndex - this.currentPage) < 3) {
199
+ this.pagesArray = Array.from({ length: 4 }, (_, i) => this.endPageIndex - 2 + i);
200
+ this.pagesArray.unshift('...');
201
+ }
202
+ }
203
+ }
204
+ componentWillRender() {
205
+ this.currentPage = Math.floor(this.offset / this.limit) + 1;
206
+ this.updatePageStatus();
207
+ }
208
+ render() {
209
+ const startOffset = (this.currentPage - 1) * this.limit + 1;
210
+ const endOffset = this.currentPage * this.limit > this.total ? this.total : this.currentPage * this.limit;
211
+ return h("div", { key: 'a6817c12f1e1e9960f8e91cfd5c5e2fa1ea72f7f', class: 'PageNavigationWrapper' }, this.displayRangeOfTotal && this.total > 0 && h("span", { key: '8f7a16c5835147e2a83808f882a66a2463e3998e', class: 'PageOfMessage' }, translate('pageOfTotal', this.language, {
212
+ values: {
213
+ start: startOffset,
214
+ end: endOffset,
215
+ total: this.total
216
+ }
217
+ })), h("div", { key: 'ddc20a86777c2fde667ad8b75ab86f3bc72ccfdb', class: 'PageNavigation' }, this.arrowsActive &&
218
+ h("div", { key: 'ce2a45b8c0d6e32cfa3f1c5cc8b3c9ac58acc409', class: `PageArrow FirstPage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
219
+ this.goTo(1);
220
+ } }, translate('firstPage', this.language)), this.secondaryArrowsActive &&
221
+ h("span", { key: '82dce028e4283dcac511b3b62823e87f2085f4b5', class: `PageArrow PrePage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
222
+ this.goTo(this.currentPage - 1);
223
+ } }, translate('prePage', this.language)), this.displayPageNumbers && this.renderPageList(), this.secondaryArrowsActive &&
224
+ h("span", { key: 'a6ed748ce3e2555ac3d9d4bae174ad5bad0fabec', class: `PageArrow NextPage ${this.currentPage == (this.endPageIndex + 1) ? 'Disabled' : ''}`, onClick: () => {
225
+ this.goTo(this.currentPage + 1);
226
+ } }, translate('nextPage', this.language)), this.arrowsActive &&
227
+ h("div", { key: '60a81a86f11e2bb07ee93b61d6f367a11b0e2b6c', class: `PageArrow LastPage ${this.currentPage == this.endPageIndex + 1 ? 'Disabled' : ''}`, onClick: () => {
228
+ this.goTo(this.endPageIndex + 1);
229
+ } }, " ", translate('lastPage', this.language), " "), this.renderStylingWrapper()));
230
+ }
231
+ };
232
+ BonusPaginationNav.style = BonusPaginationNavStyle0;
233
+
234
+ const mergeTranslations = (url, target) => {
235
+ return new Promise((resolve) => {
236
+ fetch(url)
237
+ .then((res) => res.json())
238
+ .then((data) => {
239
+ Object.keys(data).forEach((item) => {
240
+ target[item] = target[item] ? target[item] : {};
241
+ for (let key in data[item]) {
242
+ target[item][key] = data[item][key];
243
+ }
244
+ });
245
+ resolve(true);
246
+ });
247
+ });
248
+ };
249
+
250
+ const generalStylingWrapperCss = ":host{display:block}";
251
+ const GeneralStylingWrapperStyle0 = generalStylingWrapperCss;
252
+
253
+ const GeneralStylingWrapper = class {
254
+ constructor(hostRef) {
255
+ registerInstance(this, hostRef);
256
+ this.stylingAppends = false;
257
+ this.setClientStyling = () => {
258
+ let sheet = document.createElement('style');
259
+ sheet.innerHTML = this.clientStyling;
260
+ this.el.prepend(sheet);
261
+ };
262
+ this.setClientStylingURL = () => {
263
+ let url = new URL(this.clientStylingUrl);
264
+ let cssFile = document.createElement('style');
265
+ fetch(url.href)
266
+ .then((res) => res.text())
267
+ .then((data) => {
268
+ cssFile.innerHTML = data;
269
+ setTimeout(() => {
270
+ this.el.prepend(cssFile);
271
+ }, 1);
272
+ })
273
+ .catch((err) => {
274
+ console.log('error ', err);
275
+ });
276
+ };
277
+ this.clientStyling = '';
278
+ this.clientStylingUrl = '';
279
+ this.translationUrl = '';
280
+ this.targetTranslations = undefined;
281
+ }
282
+ componentDidRender() {
283
+ // start custom styling area
284
+ if (!this.stylingAppends) {
285
+ if (this.clientStyling)
286
+ this.setClientStyling();
287
+ if (this.clientStylingUrl)
288
+ this.setClientStylingURL();
289
+ this.stylingAppends = true;
290
+ }
291
+ // end custom styling area
292
+ }
293
+ async componentWillLoad() {
294
+ const promises = [];
295
+ if (this.translationUrl) {
296
+ const translationPromise = mergeTranslations(this.translationUrl, this.targetTranslations);
297
+ promises.push(translationPromise);
298
+ }
299
+ return await Promise.all(promises);
300
+ }
301
+ render() {
302
+ return (h("div", { key: '4d3414408c7662f88331dbe655966237f74d6958', class: "StyleShell" }, h("slot", { key: '1d004644d84602c4314bdf5dfc26b55b160f57df', name: "mainContent" })));
303
+ }
304
+ get el() { return getElement(this); }
305
+ };
306
+ GeneralStylingWrapper.style = GeneralStylingWrapperStyle0;
307
+
308
+ /**
309
+ * @name startOfDay
310
+ * @category Day Helpers
311
+ * @summary Return the start of a day for the given date.
312
+ *
313
+ * @description
314
+ * Return the start of a day for the given date.
315
+ * The result will be in the local timezone.
316
+ *
317
+ * @param {Date|Number} date - the original date
318
+ * @returns {Date} the start of a day
319
+ * @throws {TypeError} 1 argument required
320
+ *
321
+ * @example
322
+ * // The start of a day for 2 September 2014 11:55:00:
323
+ * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
324
+ * //=> Tue Sep 02 2014 00:00:00
325
+ */
326
+ function startOfDay(dirtyDate) {
327
+ requiredArgs(1, arguments);
328
+ var date = toDate(dirtyDate);
329
+ date.setHours(0, 0, 0, 0);
330
+ return date;
331
+ }
332
+
333
+ var MILLISECONDS_IN_DAY = 86400000;
334
+
335
+ /**
336
+ * @name differenceInCalendarDays
337
+ * @category Day Helpers
338
+ * @summary Get the number of calendar days between the given dates.
339
+ *
340
+ * @description
341
+ * Get the number of calendar days between the given dates. This means that the times are removed
342
+ * from the dates and then the difference in days is calculated.
343
+ *
344
+ * @param {Date|Number} dateLeft - the later date
345
+ * @param {Date|Number} dateRight - the earlier date
346
+ * @returns {Number} the number of calendar days
347
+ * @throws {TypeError} 2 arguments required
348
+ *
349
+ * @example
350
+ * // How many calendar days are between
351
+ * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
352
+ * const result = differenceInCalendarDays(
353
+ * new Date(2012, 6, 2, 0, 0),
354
+ * new Date(2011, 6, 2, 23, 0)
355
+ * )
356
+ * //=> 366
357
+ * // How many calendar days are between
358
+ * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
359
+ * const result = differenceInCalendarDays(
360
+ * new Date(2011, 6, 3, 0, 1),
361
+ * new Date(2011, 6, 2, 23, 59)
362
+ * )
363
+ * //=> 1
364
+ */
365
+ function differenceInCalendarDays(dirtyDateLeft, dirtyDateRight) {
366
+ requiredArgs(2, arguments);
367
+ var startOfDayLeft = startOfDay(dirtyDateLeft);
368
+ var startOfDayRight = startOfDay(dirtyDateRight);
369
+ var timestampLeft = startOfDayLeft.getTime() - getTimezoneOffsetInMilliseconds(startOfDayLeft);
370
+ var timestampRight = startOfDayRight.getTime() - getTimezoneOffsetInMilliseconds(startOfDayRight);
371
+
372
+ // Round the number of days to the nearest integer
373
+ // because the number of milliseconds in a day is not constant
374
+ // (e.g. it's different in the day of the daylight saving time clock shift)
375
+ return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY);
376
+ }
377
+
378
+ /**
379
+ * Days in 1 week.
380
+ *
381
+ * @name daysInWeek
382
+ * @constant
383
+ * @type {number}
384
+ * @default
385
+ */
386
+
387
+ /**
388
+ * Milliseconds in 1 hour
389
+ *
390
+ * @name millisecondsInHour
391
+ * @constant
392
+ * @type {number}
393
+ * @default
394
+ */
395
+ var millisecondsInHour = 3600000;
396
+
397
+ /**
398
+ * @name differenceInMilliseconds
399
+ * @category Millisecond Helpers
400
+ * @summary Get the number of milliseconds between the given dates.
401
+ *
402
+ * @description
403
+ * Get the number of milliseconds between the given dates.
404
+ *
405
+ * @param {Date|Number} dateLeft - the later date
406
+ * @param {Date|Number} dateRight - the earlier date
407
+ * @returns {Number} the number of milliseconds
408
+ * @throws {TypeError} 2 arguments required
409
+ *
410
+ * @example
411
+ * // How many milliseconds are between
412
+ * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?
413
+ * const result = differenceInMilliseconds(
414
+ * new Date(2014, 6, 2, 12, 30, 21, 700),
415
+ * new Date(2014, 6, 2, 12, 30, 20, 600)
416
+ * )
417
+ * //=> 1100
418
+ */
419
+ function differenceInMilliseconds(dateLeft, dateRight) {
420
+ requiredArgs(2, arguments);
421
+ return toDate(dateLeft).getTime() - toDate(dateRight).getTime();
422
+ }
423
+
424
+ var roundingMap = {
425
+ ceil: Math.ceil,
426
+ round: Math.round,
427
+ floor: Math.floor,
428
+ trunc: function trunc(value) {
429
+ return value < 0 ? Math.ceil(value) : Math.floor(value);
430
+ } // Math.trunc is not supported by IE
431
+ };
432
+
433
+ var defaultRoundingMethod = 'trunc';
434
+ function getRoundingMethod(method) {
435
+ return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];
436
+ }
437
+
438
+ /**
439
+ * @name differenceInHours
440
+ * @category Hour Helpers
441
+ * @summary Get the number of hours between the given dates.
442
+ *
443
+ * @description
444
+ * Get the number of hours between the given dates.
445
+ *
446
+ * @param {Date|Number} dateLeft - the later date
447
+ * @param {Date|Number} dateRight - the earlier date
448
+ * @param {Object} [options] - an object with options.
449
+ * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)
450
+ * @returns {Number} the number of hours
451
+ * @throws {TypeError} 2 arguments required
452
+ *
453
+ * @example
454
+ * // How many hours are between 2 July 2014 06:50:00 and 2 July 2014 19:00:00?
455
+ * const result = differenceInHours(
456
+ * new Date(2014, 6, 2, 19, 0),
457
+ * new Date(2014, 6, 2, 6, 50)
458
+ * )
459
+ * //=> 12
460
+ */
461
+ function differenceInHours(dateLeft, dateRight, options) {
462
+ requiredArgs(2, arguments);
463
+ var diff = differenceInMilliseconds(dateLeft, dateRight) / millisecondsInHour;
464
+ return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
465
+ }
466
+
467
+ /**
468
+ * @name isBefore
469
+ * @category Common Helpers
470
+ * @summary Is the first date before the second one?
471
+ *
472
+ * @description
473
+ * Is the first date before the second one?
474
+ *
475
+ * @param {Date|Number} date - the date that should be before the other one to return true
476
+ * @param {Date|Number} dateToCompare - the date to compare with
477
+ * @returns {Boolean} the first date is before the second date
478
+ * @throws {TypeError} 2 arguments required
479
+ *
480
+ * @example
481
+ * // Is 10 July 1989 before 11 February 1987?
482
+ * const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
483
+ * //=> false
484
+ */
485
+ function isBefore(dirtyDate, dirtyDateToCompare) {
486
+ requiredArgs(2, arguments);
487
+ var date = toDate(dirtyDate);
488
+ var dateToCompare = toDate(dirtyDateToCompare);
489
+ return date.getTime() < dateToCompare.getTime();
490
+ }
491
+
492
+ function updateProgressSvg(progressElementRef, percent) {
493
+ const svgElement = progressElementRef.querySelector('#total_level');
494
+ const endLockWidth = 17, pointR = 6.5;
495
+ //Total Widget of the progress
496
+ const barWidth = svgElement.getBBox().width;
497
+ //The filled width according to current progress
498
+ const levelPercent = percent > 1 ? 1 : percent;
499
+ const widthOnBar = (levelPercent * barWidth - endLockWidth) < 0 ? 0 : levelPercent * barWidth - endLockWidth;
500
+ //update bar's width, widthOnBar
501
+ const levelBar = progressElementRef.querySelector('#current_level');
502
+ //update filters, x = widthOnBar
503
+ const levelFilter = progressElementRef.querySelector('#filter_current_level');
504
+ //update circle, widthOnBar+10
505
+ const levelCircle = progressElementRef.querySelector('#circle_current_level');
506
+ svgElement.setAttribute('viewbox', `0 0 ${widthOnBar} 28`);
507
+ levelBar.setAttribute('width', `${widthOnBar}`);
508
+ levelCircle.setAttribute('cx', `${(widthOnBar < pointR ? pointR : widthOnBar)}`);
509
+ levelFilter.setAttribute('x', `${widthOnBar - 8}`);
510
+ //update lock location
511
+ const endLockElement = progressElementRef.querySelector('#lock');
512
+ // wrapper of endLock, include ball and heatfilter1_d_305_23
513
+ const filter1 = progressElementRef.querySelector('#filter_heart_ball');
514
+ // ball in endlockfilter2_i_305_23
515
+ const filter2 = progressElementRef.querySelector('#filter_ball');
516
+ // heart in endlockfilter3_d_305_23
517
+ const filter3 = progressElementRef.querySelector('#filter_heart');
518
+ //wrapper of lockfilter4_d_305_23
519
+ const filterLock = progressElementRef.querySelector('#filter_lock');
520
+ // shadow of ball paint0_linear_305_23
521
+ const paint0 = progressElementRef.querySelector('#paint0_linear_ball');
522
+ //paint in lockpaint1_linear_305_23
523
+ const paint1 = progressElementRef.querySelector('#paint1_linear_lock');
524
+ // box of lock and heart, for move position dynamically
525
+ const lockBox = progressElementRef.querySelector('#lock_box');
526
+ const heartBox = progressElementRef.querySelector('#heart_box');
527
+ const rightPaddingOfLockWidth = 10, cxOfEndLockEle = barWidth - rightPaddingOfLockWidth;
528
+ //set cx of lockElement
529
+ endLockElement.setAttribute('cx', `${cxOfEndLockEle}`);
530
+ //set cx of sub Elements
531
+ paint1.setAttribute('x1', `${cxOfEndLockEle}`);
532
+ paint1.setAttribute('x2', `${cxOfEndLockEle}`);
533
+ paint0.setAttribute('x1', `${cxOfEndLockEle - 6}`);
534
+ paint0.setAttribute('x2', `${cxOfEndLockEle - 6 + 11.2}`);
535
+ filterLock.setAttribute('x', `${cxOfEndLockEle - 6}`);
536
+ filter3.setAttribute('x', `${cxOfEndLockEle - 6 - 2}`);
537
+ filter2.setAttribute('x', `${cxOfEndLockEle - 6 - 2 - 2}`);
538
+ filter1.setAttribute('x', `${cxOfEndLockEle - 6 - 2 - 2 - 4}`);
539
+ lockBox.setAttribute('x', `${cxOfEndLockEle - 6}`);
540
+ heartBox.setAttribute('x', `${cxOfEndLockEle - 6}`);
541
+ svgElement.parentElement.style.opacity = '1';
542
+ }
543
+
544
+ 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}";
545
+ const PlayerElevateCardDataStyle0 = playerElevateCardDataCss;
546
+
547
+ const PlayerElevateCardData = class {
548
+ constructor(hostRef) {
549
+ registerInstance(this, hostRef);
550
+ this.playerElevateLeveLoaded = createEvent(this, "playerElevateLeveLoaded", 7);
551
+ this.params = undefined;
552
+ this.playerElevateLevel = undefined;
553
+ this.pointExpireString = undefined;
554
+ }
555
+ handleWindowResizs() {
556
+ this.initLevelProgressbar();
557
+ }
558
+ onParamsChanged() {
559
+ this.loadElevateInfo();
560
+ }
561
+ onRedeemClick() {
562
+ window.postMessage({ type: 'BEERedeemClicked' }, window.location.href);
563
+ }
564
+ loadLevels() {
565
+ let url = new URL(`${this.params.endpoint}/v1/elevate/levels?language=${this.params.language}`);
566
+ return new Promise((resolve, reject) => {
567
+ return fetch(url.href, {
568
+ method: 'GET',
569
+ })
570
+ .then((res) => res.json())
571
+ .then((res) => {
572
+ this.levels = res.data;
573
+ resolve(true);
574
+ })
575
+ .catch((err) => {
576
+ reject(err);
577
+ });
578
+ });
579
+ }
580
+ calcuatePointsToBeExpired(walletTotalInfo) {
581
+ let pointExpireInfoAsString = '';
582
+ if (!walletTotalInfo || !walletTotalInfo.aboutToExpire ||
583
+ walletTotalInfo.aboutToExpire.length == 0 ||
584
+ walletTotalInfo.aboutToExpire[0].points <= 0) {
585
+ return pointExpireInfoAsString;
586
+ }
587
+ walletTotalInfo.aboutToExpire.sort((expire1, expire2) => {
588
+ return isBefore(new Date(expire1.expireTime), new Date(expire2.expireTime))
589
+ ? -1
590
+ : 1;
591
+ });
592
+ const aboutToExpire = walletTotalInfo.aboutToExpire[0];
593
+ const daysToExpried = differenceInCalendarDays(new Date(aboutToExpire.expireTime), new Date());
594
+ let hoursToExpired = 0, expiredTranslationKey = daysToExpried === 0 ? 'pointsToBeExpiredDay' : 'pointsToBeExpired';
595
+ if (daysToExpried == 0) {
596
+ hoursToExpired = differenceInHours(new Date(aboutToExpire.expireTime), new Date());
597
+ expiredTranslationKey = hoursToExpired > 1 ? 'pointsToBeExpiredHours' : 'pointsToBeExpiredHour';
598
+ }
599
+ pointExpireInfoAsString = translateWithParams(expiredTranslationKey, {
600
+ expirationPoints: aboutToExpire.points,
601
+ expireDay: daysToExpried,
602
+ });
603
+ return pointExpireInfoAsString;
604
+ }
605
+ loadPlayerLevelInfo() {
606
+ let url = new URL(`${this.params.endpoint}/v1/elevate/playerInfo?language=${this.params.language}`);
607
+ return new Promise((resolve, reject) => {
608
+ return fetch(url.href, {
609
+ method: 'GET',
610
+ headers: {
611
+ 'X-Sessionid': this.params.session,
612
+ 'Content-Type': 'application/json',
613
+ },
614
+ })
615
+ .then((res) => res.json())
616
+ .then((res) => {
617
+ var _a, _b, _c;
618
+ if (!res.success) {
619
+ console.error('Exception when fetch user elevateinfo, ', res.errorCode, res.errorMessage);
620
+ reject(true);
621
+ return;
622
+ }
623
+ let playerElevateInfo = res.data;
624
+ this.playerElevateLevel = playerElevateInfo.level;
625
+ this.playerElevateLevel.name = this.playerElevateLevel.presentation.displayName || this.playerElevateLevel.name;
626
+ this.playerElevateLevel.spendablePoints = ((_a = playerElevateInfo.spendableWallet) === null || _a === void 0 ? void 0 : _a.total.points) || 0;
627
+ this.playerElevateLeveLoaded.emit({ elevateLevel: this.playerElevateLevel });
628
+ const spendableTotal = (_b = res.data.spendableWallet) === null || _b === void 0 ? void 0 : _b.total;
629
+ const loyaltyWalletTotal = (_c = res.data.loyaltyWallet) === null || _c === void 0 ? void 0 : _c.total;
630
+ this.playerElevateLeveLoaded.emit({
631
+ elevateLevelWalletTotal: spendableTotal,
632
+ loyaltyWalletTotal
633
+ });
634
+ let spExpireInfoAsString = this.calcuatePointsToBeExpired(spendableTotal);
635
+ let xpExpireInfoAsString = this.calcuatePointsToBeExpired(loyaltyWalletTotal);
636
+ if (spExpireInfoAsString || xpExpireInfoAsString) {
637
+ this.playerElevateLeveLoaded.emit({
638
+ pointExpireString: spExpireInfoAsString,
639
+ xpExpireString: xpExpireInfoAsString
640
+ });
641
+ }
642
+ resolve(this.playerElevateLevel);
643
+ })
644
+ .catch((err) => {
645
+ console.log('error ', err);
646
+ reject(true);
647
+ });
648
+ });
649
+ }
650
+ setLoyaltyProgress(percent) {
651
+ updateProgressSvg(this.loyaltyProgressEle, percent);
652
+ }
653
+ initLevelProgressbar() {
654
+ setTimeout(() => {
655
+ this.loyaltyProgressEle =
656
+ this.elevateCardRef.parentElement.querySelector('#LevelProgress');
657
+ if (!this.loyaltyProgressEle) {
658
+ return;
659
+ }
660
+ this.setLoyaltyProgress(!this.playerElevateLevel.nextLevel
661
+ ? 1 : (this.playerElevateLevel.loyaltyPoints / this.playerElevateLevel.nextLevel.entryPoints));
662
+ this.params['playerElevateLevel'] = this.playerElevateLevel;
663
+ }, 80);
664
+ }
665
+ componentDidRender() {
666
+ this.initLevelProgressbar();
667
+ }
668
+ loadElevateInfo() {
669
+ if (!this.params.endpoint || !this.params.session) {
670
+ return;
671
+ }
672
+ const promises = [];
673
+ promises.push(this.loadPlayerLevelInfo());
674
+ if (this.params.calculateLevelFlag) {
675
+ promises.push(this.loadLevels());
676
+ }
677
+ Promise.all(promises).then((res) => {
678
+ console.log('elevate-init', res);
679
+ this.initLevelProgressbar();
680
+ if (!this.levels) {
681
+ return;
682
+ }
683
+ this.levels.sort((level1, level2) => {
684
+ return level1.firstEntryPoints > level2.firstEntryPoints ? 1 : -1;
685
+ });
686
+ const playerPoints = this.playerElevateLevel.loyaltyPoints;
687
+ let playerLevelNumber = 0;
688
+ this.levels.forEach((elevateLevel, idx) => {
689
+ if (playerPoints > elevateLevel.firstEntryPoints) {
690
+ playerLevelNumber = idx;
691
+ }
692
+ });
693
+ this.playerElevateLeveLoaded.emit({
694
+ calculatedLevelFlag: playerLevelNumber,
695
+ });
696
+ });
697
+ }
698
+ componentWillLoad() {
699
+ this.loadElevateInfo();
700
+ }
701
+ get elevateCardRef() { return getElement(this); }
702
+ static get watchers() { return {
703
+ "params": ["onParamsChanged"]
704
+ }; }
705
+ };
706
+ PlayerElevateCardData.style = PlayerElevateCardDataStyle0;
707
+
708
+ const playerElevatePointcardCss = ":host{display:block}.PointsCard .Inner .Row .ExpirationPoints{text-align:left}.PointsCard .Inner .PlayerAvatar .Avatar{display:none}.PointsCard .Inner .PlayerAvatar .Badge{border-radius:50%;background-size:contain;width:100%;height:100%;position:inherit}.PointsCard .Inner .PointsTxt{display:flex;flex-direction:row;justify-content:space-between}.PointsCard .Inner .DetailButton{background:linear-gradient(283.85deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 33.47%), linear-gradient(117.99deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 33.89%), linear-gradient(268.18deg, rgba(255, 255, 255, 0.6) -17.36%, rgba(239, 239, 239, 0) 15.78%), linear-gradient(0deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.6));border-radius:5px;box-shadow:0px 4px 4px 0px rgba(0, 0, 0, 0.25);border:2px solid;font-size:11px;width:108px;padding:4px;cursor:pointer;margin-top:5px;height:16px;min-width:45px;text-align:center}.PointsCard .Inner .DetailButton span{color:var(--emfe-w-color-gray-150, #6D6D6D)}.PointsCard .Inner .DetailButton span{display:inline-block;vertical-align:middle}.PointsCard .Inner .DetailButton:hover span{color:var(--emfe-w-color-gray-150, #6D6D6D)}.PointsCard .Inner .LevelInfo{gap:15px;width:70%}.PointsCard .Inner .LevelInfo .PointsTxt{font-size:15px}.PointsCard .Inner .LevelInfo .PointsTxt.Label{display:none}.PointsCard .Inner .LevelInfo .PointsTxt.SPPoints{padding-top:15px}.PointsCard .Inner .LevelInfo .PointsTxt .TC{font-size:x-small;color:var(--emw--color-gray-300, #58586B);display:flex;align-content:center;height:100%;flex-wrap:wrap;text-decoration:underline;cursor:pointer;display:none}";
709
+ const PlayerElevatePointcardStyle0 = playerElevatePointcardCss;
710
+
711
+ const PlayerElevatePointcard = class {
712
+ constructor(hostRef) {
713
+ registerInstance(this, hostRef);
714
+ this.isPointDetailCard = this.buttonType === 'earningRule';
715
+ this.endpoint = undefined;
716
+ this.theme = 'Dark';
717
+ this.session = undefined;
718
+ this.playerAvatarUrl = undefined;
719
+ this.language = 'en';
720
+ this.playerName = undefined;
721
+ this.cardTitle = undefined;
722
+ this.buttonType = 'earningRule';
723
+ this.dateFormat = 'yyyy-MM-dd';
724
+ this.clientStyling = '';
725
+ this.clientStylingUrl = '';
726
+ this.translationUrl = '';
727
+ this.pointExpireString = undefined;
728
+ this.playerElevateLevel = undefined;
729
+ this.elevateWalletTotal = undefined;
730
+ this.elevateSPTotal = undefined;
731
+ }
732
+ onSessionOrEndpointChange() {
733
+ this.paramProxy = Object.assign(Object.assign({}, this.paramProxy), { session: this.session, endpoint: this.endpoint, language: this.language });
734
+ }
735
+ playerElevateLeveLoadedHandler(event) {
736
+ if (!event.detail) {
737
+ return;
738
+ }
739
+ if (event.detail['elevateLevelWalletTotal']) {
740
+ this.elevateWalletTotal = event.detail['elevateLevelWalletTotal'];
741
+ this.elevateSPTotal = event.detail['loyaltyWalletTotal'];
742
+ }
743
+ if (event.detail['elevateLevel']) {
744
+ this.playerElevateLevel = event.detail['elevateLevel'];
745
+ }
746
+ if (event.detail['pointExpireString']) {
747
+ this.pointExpireString = event.detail.pointExpireString;
748
+ }
749
+ }
750
+ onDetailsClick() {
751
+ window.postMessage({ type: this.isPointDetailCard ? 'BEEPointRulesClicked' : 'BEEDetailsClicked',
752
+ path: this.isPointDetailCard ? 'player-elevate-level' : 'player-elevate-point-details' }, window.location.href);
753
+ }
754
+ componentWillLoad() {
755
+ this.paramProxy = {
756
+ endpoint: this.endpoint,
757
+ session: this.session,
758
+ language: this.language,
759
+ };
760
+ }
761
+ render() {
762
+ const backgroundOuterImagePath = getAssetPath('../static/card-ground.svg');
763
+ const backgroundInnerImagePath = getAssetPath('../static/card-ground-over.svg');
764
+ 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$2, 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$2('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: () => {
765
+ this.onDetailsClick();
766
+ } }, translate$2('termAndConditions', this.language))), this.pointExpireString && (h("div", { key: '45c3267d390995fabe34974913adf97b112cf8c2', class: 'ExpirationPoints' }, this.pointExpireString, " "))))))))));
767
+ }
768
+ static get watchers() { return {
769
+ "session": ["onSessionOrEndpointChange"],
770
+ "endpoint": ["onSessionOrEndpointChange"],
771
+ "language": ["onSessionOrEndpointChange"]
772
+ }; }
773
+ };
774
+ PlayerElevatePointcard.style = PlayerElevatePointcardStyle0;
775
+
776
+ var WalletType;
777
+ (function (WalletType) {
778
+ WalletType["spendable"] = "spendable";
779
+ WalletType["loyalty"] = "loyalty";
780
+ WalletType["history"] = "history";
781
+ })(WalletType || (WalletType = {}));
782
+
783
+ const translation = {
784
+ en: {
785
+ tabTitle: {
786
+ [WalletType.spendable]: 'Coins',
787
+ [WalletType.loyalty]: 'XP',
788
+ [WalletType.history]: 'Conversion History'
789
+ },
790
+ barTitle: {
791
+ [WalletType.spendable]: 'Coins History',
792
+ [WalletType.loyalty]: 'Experience Points History',
793
+ [WalletType.history]: 'Conversion History'
794
+ },
795
+ bonus: 'Bonus',
796
+ noContent: 'No Content',
797
+ redeem: 'Redeem',
798
+ reload: 'Reload',
799
+ reloadMsgWhenError: 'Network Problem, please ',
800
+ pointType: {
801
+ registration: 'Registration',
802
+ cancelledRegistration: 'Cancelled Registration',
803
+ expiredRegistration: 'Expired Registration',
804
+ manual: 'Manual',
805
+ cancelledManual: 'Cancelled Manual',
806
+ expiredManual: 'Expired Manual',
807
+ wageringByRealMoney: 'Real Money Wager',
808
+ wageringByBonusMoney: 'Bonus Money Wager',
809
+ cancelledWageringByRealMoney: 'Cancelled Real Money Wager',
810
+ cancelledWageringByBonusMoney: 'Cancelled Bonus Money Wager',
811
+ expiredWageringByRealMoney: 'Expired Real Money Wager',
812
+ expiredWageringByBonusMoney: 'Expired Bonus Money Wager',
813
+ levelExpired: 'Level Expiration',
814
+ bonus: 'Bonus Redeem',
815
+ }
816
+ }
817
+ };
818
+
819
+ const getUrl = (path, params = {}) => {
820
+ return path + '?' + Object.keys(params).map(key => `${key}=${params[key]}`).join('&');
821
+ };
822
+ const fetcher = async (input, init = {}) => {
823
+ let res;
824
+ // @ts-ignore
825
+ res = await fetch(input, init);
826
+ res = await res.text();
827
+ try {
828
+ res = JSON.parse(res);
829
+ }
830
+ catch (e) {
831
+ console.error(e);
832
+ throw e;
833
+ }
834
+ return res;
835
+ };
836
+
837
+ const getWallets = async (endpoint, language, type, session, pageSetting) => {
838
+ const params = {
839
+ type,
840
+ language,
841
+ pagination: `offset=${pageSetting.offset},limit=${pageSetting.limit}`
842
+ };
843
+ const url = getUrl(endpoint + getUriByWalletType(params.type), params);
844
+ const res = await fetcher(url, {
845
+ headers: {
846
+ 'x-SessionId': session
847
+ }
848
+ });
849
+ return res;
850
+ };
851
+ const getUriByWalletType = (type) => `/v1/elevate/${type == WalletType.history ? 'redeemHistory' : 'pointsHistory'}`;
852
+
853
+ const renderWallets = (locale, wallets, pageSetting) => wallets && (h(Fragment, null,
854
+ h("div", { class: "Records" }, wallets.map(wallet => (h("div", { class: "RecordContainer" },
855
+ h("div", { class: "Row" },
856
+ h("div", { class: "Title" }, locale.pointType[wallet.pointType] || wallet.pointType),
857
+ h("div", { class: `Amount ${getAmountConfig(wallet.points).class}` },
858
+ getAmountConfig(wallet.points).symbol,
859
+ wallet.points)),
860
+ wallet.payload && wallet.payload.displayName &&
861
+ h("div", { class: "Row Desc", innerHTML: wallet.payload.displayName['*'] }),
862
+ h("div", { class: "Row" },
863
+ h("div", { class: "DateTime" }, formatDate(new Date(wallet.modified)))))))),
864
+ h("div", { class: "PaginationContainer" },
865
+ h("bonus-pagination-nav", { offset: pageSetting.offset, limit: pageSetting.limit, displayPageNumbers: pageSetting.displayPageNumbers, tableId: pageSetting.tableId, secondaryArrowsActive: pageSetting.secondaryArrowsActive, total: pageSetting.total }))));
866
+ const getAmountConfig = (amount) => {
867
+ if (amount > 0) {
868
+ return {
869
+ class: 'Positive',
870
+ symbol: '+'
871
+ };
872
+ }
873
+ else {
874
+ return {
875
+ class: 'Negative',
876
+ symbol: ''
877
+ };
878
+ }
879
+ };
880
+ const padTo2Digits = (num) => {
881
+ return num.toString().padStart(2, '0');
882
+ };
883
+ const formatDate = (date) => {
884
+ return ([
885
+ date.getFullYear(),
886
+ padTo2Digits(date.getMonth() + 1),
887
+ padTo2Digits(date.getDate()),
888
+ ].join('-') +
889
+ ' ' +
890
+ [
891
+ padTo2Digits(date.getHours()),
892
+ padTo2Digits(date.getMinutes()),
893
+ padTo2Digits(date.getSeconds()),
894
+ ].join(':'));
895
+ };
896
+
897
+ const backSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOSIgaGVpZ2h0PSIxNSIgdmlld0JveD0iMCAwIDkgMTUiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik03Ljc1IDFMMS4yNSA3LjVMNy43NSAxNCIgc3Ryb2tlPSIjMjQyNDI0IiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjwvc3ZnPgo=';
898
+
899
+ const menuSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzAiIGhlaWdodD0iOCIgdmlld0JveD0iMCAwIDMwIDgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxjaXJjbGUgY3g9IjQiIGN5PSI0IiByPSI0IiBmaWxsPSJibGFjayIvPgo8Y2lyY2xlIGN4PSIxNSIgY3k9IjQiIHI9IjQiIGZpbGw9ImJsYWNrIi8+CjxjaXJjbGUgY3g9IjI2IiBjeT0iNCIgcj0iNCIgZmlsbD0iYmxhY2siLz4KPC9zdmc+Cg==';
900
+
901
+ const renderTopBar = (locale, type, pageSetting) => h("div", { class: "TopBarContainer" },
902
+ h("div", { class: "BackImageContainer" },
903
+ h("span", { class: "BackImage", innerHTML: backSvg })),
904
+ h("div", { class: "TitleContainer" },
905
+ h("div", { class: "Title", title: locale.barTitle[type] }, locale.barTitle[type]),
906
+ h("div", { class: 'Limits' },
907
+ h("bonus-pagination-limits", { pageLimitOptions: pageSetting.pageLimitOptions, limit: pageSetting.limit }))),
908
+ h("div", null,
909
+ h("span", { class: "MenuImage", innerHTML: menuSvg })));
910
+
911
+ const renderTabs = (locale, type, onChangeTab) => h("div", { class: "Tabs Row" }, Object.keys(WalletType).map(key => {
912
+ const isActive = key === type;
913
+ const cssActive = isActive ? 'active' : '';
914
+ return (h("div", null,
915
+ h("div", { class: `TabText ${cssActive}`, onClick: () => {
916
+ onChangeTab(key);
917
+ } }, locale.tabTitle[key]),
918
+ h("div", { class: `TabBorderBottom ${cssActive}` })));
919
+ }));
920
+
921
+ var GeneralAnimationLoadingVIKkNY2X = {};
922
+
923
+ (function (exports) {
924
+ 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 v=(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)&&v(e,n,t[n]);if(N)for(var n of N(t))q.call(t,n)&&v(e,n,t[n]);return e},M=(e,t)=>z(e,F(t));var $=(e,t,n)=>v(e,typeof t!="symbol"?t+"":t,n);var T=(e,t,n)=>new Promise((i,l)=>{var s=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?i(o.value):Promise.resolve(o.value).then(s,c);u((n=n.apply(e,t)).next());});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function g(){}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 i=Y(e);if(!i.getElementById(t)){const l=L("style");l.id=t,l.textContent=n,Z(i,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 _(e){j=e;}const h=[],w=[];let m=[];const R=[],st=Promise.resolve();let k=!1;function it(){k||(k=!0,st.then(y));}function E(e){m.push(e);}const x=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++,_(t),rt(t.$$);}}catch(t){throw h.length=0,a=0,t}for(_(null),h.length=0,a=0;w.length;)w.pop()();for(let t=0;t<m.length;t+=1){const n=m[t];x.has(n)||(x.add(n),n());}m.length=0;}while(h.length);for(;R.length;)R.pop()();k=!1,x.clear(),_(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=[];m.forEach(i=>e.indexOf(i)===-1?t.push(i):n.push(i)),n.forEach(i=>i()),m=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:i,after_update:l}=e.$$;i&&i.m(t,n),E(()=>{const s=e.$$.on_mount.map(H).filter(I);e.$$.on_destroy?e.$$.on_destroy.push(...s):b(s),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),it(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31;}function ft(e,t,n,i,l,s,c=null,u=[-1]){const o=j;_(e);const r=e.$$={fragment:null,ctx:[],props:s,update:g,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=i?i(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();}_(o);}let D;typeof HTMLElement=="function"&&(D=class extends HTMLElement{constructor(t,n,i){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,i&&this.attachShadow({mode:"open"});}addEventListener(t,n,i){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,i);}removeEventListener(t,n,i){if(super.removeEventListener(t,n,i),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(s){return ()=>{let c;return {c:function(){c=L("slot"),s!=="default"&&tt(c,"name",s);},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={},i=nt(this);for(const s of this.$$s)s in i&&(n[s]=[t(s)]);for(const s of this.attributes){const c=this.$$g_p(s.name);c in this.$$d||(this.$$d[c]=p(c,s.value,this.$$p_d,"toProp"));}for(const s in this.$$p_d)!(s in this.$$d)&&this[s]!==void 0&&(this.$$d[s]=this[s],delete this[s]);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 s in this.$$p_d)if(this.$$d[s]=this.$$c.$$.ctx[this.$$c.$$.props[s]],this.$$p_d[s].reflect){const c=p(s,this.$$d[s],this.$$p_d,"toAttribute");c==null?this.removeAttribute(this.$$p_d[s].attribute||s):this.setAttribute(this.$$p_d[s].attribute||s,c);}this.$$r=!1;};this.$$c.$$.after_update.push(l),l();for(const s in this.$$l)for(const c of this.$$l[s]){const u=this.$$c.$on(s,c);this.$$l_u.set(c,u);}this.$$l={};}})}attributeChangedCallback(t,n,i){var l;this.$$r||(t=this.$$g_p(t),this.$$d[t]=p(t,i,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 p(e,t,n,i){var s;const l=(s=n[e])==null?void 0:s.type;if(t=l==="Boolean"&&typeof t!="boolean"?t!=null:t,!i||!n[e])return t;if(i==="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,i,l,s){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=p(u,o,t),this.$$d[u]=o,(r=this.$$c)==null||r.$set({[u]:o});}});}),i.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=g;}$on(t,n){if(!I(n))return g;const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const l=i.indexOf(n);l!==-1&&i.splice(l,1);}}$set(t){this.$$set&&!Q(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1);}}const gt="4";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(gt);function mt(e){X(e,"svelte-g6m3er",".LoaderContainer.svelte-g6m3er.svelte-g6m3er{display:flex;justify-content:center}.lds-ellipsis.svelte-g6m3er.svelte-g6m3er{display:inline-block;position:relative;width:80px;height:80px}.lds-ellipsis.svelte-g6m3er div.svelte-g6m3er{position:absolute;top:33px;width:13px;height:13px;border-radius:50%;background:#d1d1d1;animation-timing-function:cubic-bezier(0, 1, 1, 0)}.lds-ellipsis.svelte-g6m3er div.svelte-g6m3er:nth-child(1){left:8px;animation:svelte-g6m3er-lds-ellipsis1 0.6s infinite}.lds-ellipsis.svelte-g6m3er div.svelte-g6m3er:nth-child(2){left:8px;animation:svelte-g6m3er-lds-ellipsis2 0.6s infinite}.lds-ellipsis.svelte-g6m3er div.svelte-g6m3er:nth-child(3){left:32px;animation:svelte-g6m3er-lds-ellipsis2 0.6s infinite}.lds-ellipsis.svelte-g6m3er div.svelte-g6m3er:nth-child(4){left:56px;animation:svelte-g6m3er-lds-ellipsis3 0.6s infinite}@keyframes svelte-g6m3er-lds-ellipsis1{0%{transform:scale(0)}100%{transform:scale(1)}}@keyframes svelte-g6m3er-lds-ellipsis3{0%{transform:scale(1)}100%{transform:scale(0)}}@keyframes svelte-g6m3er-lds-ellipsis2{0%{transform:translate(0, 0)}100%{transform:translate(24px, 0)}}");}function _t(e){let t;return {c(){t=L("div"),t.innerHTML='<section class="LoaderContainer svelte-g6m3er" part="LoaderContainer"><div class="lds-ellipsis svelte-g6m3er"><div class="svelte-g6m3er"></div><div class="svelte-g6m3er"></div><div class="svelte-g6m3er"></div><div class="svelte-g6m3er"></div></div></section>';},m(n,i){U(n,t,i),e[3](t);},p:g,i:g,o:g,d(n){n&&C(t),e[3](null);}}}function pt(e,t,n){let{clientstyling:i=""}=t,{clientstylingurl:l=""}=t,s;const c=()=>{let r=document.createElement("style");r.innerHTML=i,s.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(()=>{s.appendChild(f);},1),setTimeout(()=>{},500);});};function o(r){w[r?"unshift":"push"](()=>{s=r,n(0,s);});}return e.$$set=r=>{"clientstyling"in r&&n(1,i=r.clientstyling),"clientstylingurl"in r&&n(2,l=r.clientstylingurl);},e.$$.update=()=>{e.$$.dirty&3&&i&&s&&c(),e.$$.dirty&5&&l&&s&&u();},[s,i,l,o]}class J extends ht{constructor(t){super(),ft(this,t,pt,_t,K,{clientstyling:1,clientstylingurl:2},mt);}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;
925
+ }(GeneralAnimationLoadingVIKkNY2X));
926
+
927
+ 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(()=>GeneralAnimationLoadingVIKkNY2X).then(({default:t})=>{!customElements.get("general-animation-loading")&&customElements.define("general-animation-loading",t.element);});}
928
+
929
+ const playerElevatePointsHistoryCss = ":host{display:block}main{max-width:420px}main player-elevate-pointcard{width:100%;height:220px}.PlayerElevatePointsDetaisContainer{background:#FFFFFF;padding:20px 10px 0;margin-top:-100px;position:relative;min-height:360px}.PlayerElevatePointsDetaisContainer .ReloadMsg{padding:20px}.PlayerElevatePointsDetaisContainer .ReloadMsg a.Reload{cursor:pointer}.TitleContainer{font-size:20px;font-weight:500;line-height:25px;letter-spacing:0em;text-align:left;display:flex;justify-content:space-between}.TopBarContainer{display:flex;align-items:center;justify-content:space-between}.TopBarContainer .TitleContainer{width:100%}.TopBarContainer .Title{background:#303030;padding:5px 16px;color:#FFFFFF;box-shadow:0px 4px 13px 0px rgba(0, 0, 0, 0.2509803922);border-radius:8px;width:fit-content;margin-left:7px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.PaginationContainer{display:flex;justify-content:center}.MonthStat{margin-top:25px;display:none;font-size:16px;font-weight:500;line-height:19px;letter-spacing:0px;text-align:left;color:#242424}.MonthStat .Amount{color:#53B65A}.BackImageContainer{width:35px;height:35px;flex:0 0 35px;border-radius:6px;text-align:center;line-height:35px;box-shadow:0px 4px 40px 0px rgba(138, 149, 158, 0.2);display:none}.Records{margin-top:16px}.MenuImage,.BackImage{cursor:pointer;display:none}.Row{display:flex;justify-content:space-between;align-items:center}.Row:nth-child(n+2){margin-top:3px}.Tabs.Row{justify-content:space-around;margin-top:20px}.Tabs.Row .TabText{font-size:16px;margin:10px 15px;color:#9C9C9C;cursor:pointer}.Tabs.Row .TabText.active{color:#242424;font-weight:600}.Tabs.Row .TabBorderBottom{height:5px;border-radius:4px;background:transparent}.Tabs.Row .TabBorderBottom.active{background:#242424}.RecordContainer{margin:5px 0;padding:10px;box-shadow:0px 0px 8px 0px rgba(0, 0, 0, 0.1019607843);border-radius:5px}.RecordContainer .Title{color:#242424;font-size:16px;font-weight:600;line-height:19px;letter-spacing:0px;text-align:left}.RecordContainer .Amount{font-size:16px;font-weight:600;line-height:19px;letter-spacing:0px;text-align:left}.RecordContainer .Amount.Positive{color:#53B65A}.RecordContainer .Amount.Negative{color:#B41E2D}.RecordContainer .DateTime{color:#9C9C9C;font-size:16px;font-weight:400;line-height:19px;letter-spacing:0px;text-align:left}.RecordContainer .Tag{font-size:12px;font-weight:500;line-height:14px;letter-spacing:0em;text-align:center;color:#767171;padding:8px 30px;border-radius:8px;box-shadow:0px 2px 4px 0px rgba(0, 0, 0, 0.2509803922)}.NoContent{font-size:16px;color:var(--emfe-w-color-black-100, #afafaf);text-align:center;height:120px;line-height:120px}";
930
+ const PlayerElevatePointsHistoryStyle0 = playerElevatePointsHistoryCss;
931
+
932
+ const PlayerElevatePointsHistory = class {
933
+ constructor(hostRef) {
934
+ registerInstance(this, hostRef);
935
+ this.paginationReset = createEvent(this, "paginationReset", 7);
936
+ this.playerAvatarUrl = undefined;
937
+ this.session = undefined;
938
+ this.endpoint = undefined;
939
+ this.limit = undefined;
940
+ this.secondaryArrowsActive = true;
941
+ this.displayPageNumbers = false;
942
+ this.pageLimitOptions = '10,25,50';
943
+ this.language = 'en';
944
+ this.clientStyling = '';
945
+ this.clientStylingUrl = '';
946
+ this.translationUrl = '';
947
+ this.locale = translation['en'];
948
+ this.type = WalletType.spendable;
949
+ this.pageSetting = undefined;
950
+ this.pointsWallets = {};
951
+ }
952
+ switchTab(type) {
953
+ var _a, _b;
954
+ this.type = type;
955
+ if (this.pointsWallets[type] || !((_a = this.pointsWallets[type]) === null || _a === void 0 ? void 0 : _a.isLoadFailed)) {
956
+ return;
957
+ }
958
+ this.paginationReset.emit({ limit: ((_b = this.pointsWallets[type]) === null || _b === void 0 ? void 0 : _b.pageSetting.limit) || this.limit, tableId: this.type });
959
+ }
960
+ getPageSettingByType(type) {
961
+ return this.pointsWallets[type] ? this.pointsWallets[type].pageSetting : {
962
+ limit: this.limit, total: 0, offset: 0, tableId: type,
963
+ secondaryArrowsActive: this.secondaryArrowsActive,
964
+ displayPageNumbers: this.displayPageNumbers,
965
+ pageLimitOptions: this.pageLimitOptions || undefined
966
+ };
967
+ }
968
+ loadWallets(renderer) {
969
+ if (!this.pointsWallets[this.type] || this.pointsWallets[this.type].isLoading) {
970
+ return h("general-animation-loading", null);
971
+ }
972
+ else {
973
+ if (this.pointsWallets[this.type].wallets.length === 0) {
974
+ return (h("div", { class: "NoContent" }, this.locale.noContent));
975
+ }
976
+ else {
977
+ return renderer();
978
+ }
979
+ }
980
+ }
981
+ render() {
982
+ var _a, _b;
983
+ const pageSetting = this.getPageSettingByType(this.type);
984
+ return (h("main", { key: 'a92c0b154fec4d3ce8b8e919b9af5ebd80f1d125' }, h("general-styling-wrapper", { key: '5095ab265d71f9e74f6f049b7b0b212ae11bc4da', clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl,
985
+ // @ts-ignore
986
+ targetTranslations: translation, translationUrl: this.translationUrl }), h("player-elevate-pointcard", { key: 'c471ddeccbe8e18e15935c9d106bf8c52c80a6fb', playerAvatarUrl: this.playerAvatarUrl, endpoint: this.endpoint, session: this.session, language: this.language, clientStylingUrl: this.clientStylingUrl, clientStyling: this.clientStyling, translationUrl: this.translationUrl }), h("div", { key: '5fa700aaa6e0cffe6d3d9dd8366bf9a95bba3a14', class: "PlayerElevatePointsDetaisContainer" }, [
987
+ renderTopBar(this.locale, this.type, pageSetting),
988
+ renderTabs(this.locale, this.type, (type) => this.switchTab(type)),
989
+ ((_a = this.pointsWallets[this.type]) === null || _a === void 0 ? void 0 : _a.isLoadFailed)
990
+ ? h("div", { class: 'ReloadMsg' }, this.locale['reloadMsgWhenError'], h("a", { class: 'Reload', onClick: () => { this.updateWallets(); } }, this.locale['reload']))
991
+ : this.loadWallets(renderWallets.bind(this, this.locale, ((_b = this.pointsWallets[this.type]) === null || _b === void 0 ? void 0 : _b.wallets) || [], pageSetting))
992
+ ])));
993
+ }
994
+ walletTypeChangedHandler() {
995
+ //do not reload when loaded tab switched back
996
+ if (this.pointsWallets[this.type]) {
997
+ return;
998
+ }
999
+ this.updateWallets();
1000
+ }
1001
+ async updateWallets() {
1002
+ let pageSetting = this.pointsWallets[this.type]
1003
+ ? this.pointsWallets[this.type].pageSetting
1004
+ : this.getPageSettingByType(this.type);
1005
+ try {
1006
+ const walletsDetail = await getWallets(this.endpoint, this.language, this.type, this.session, pageSetting);
1007
+ const wallets = walletsDetail.data || [];
1008
+ if (walletsDetail.success) {
1009
+ pageSetting.total = walletsDetail.total;
1010
+ this.pointsWallets[this.type] = Object.assign(Object.assign({}, this.pointsWallets[this.type]), { wallets,
1011
+ pageSetting });
1012
+ this.pointsWallets = Object.assign({}, this.pointsWallets);
1013
+ }
1014
+ else {
1015
+ console.error(walletsDetail);
1016
+ this.pointsWallets[this.type].isLoadFailed = true;
1017
+ //pageSetting.total = 0;
1018
+ }
1019
+ }
1020
+ catch (e) {
1021
+ console.error(e);
1022
+ this.pointsWallets[this.type].isLoadFailed = true;
1023
+ }
1024
+ }
1025
+ reloadPageByTypeHandler(event) {
1026
+ if (event.detail.tableId != this.type) {
1027
+ return;
1028
+ }
1029
+ //reset all wallets when limit changed
1030
+ //otherwise fetch new data with new offset when offset changed
1031
+ if (this.limit != event.detail.limit) {
1032
+ this.pointsWallets = {};
1033
+ this.limit = event.detail.limit;
1034
+ }
1035
+ else {
1036
+ let pageSetting = this.pointsWallets[this.type].pageSetting || this.getPageSettingByType(this.type);
1037
+ pageSetting.offset = event.detail.offset;
1038
+ this.pointsWallets[this.type].pageSetting = pageSetting;
1039
+ }
1040
+ this.updateWallets();
1041
+ }
1042
+ setLimit() {
1043
+ try {
1044
+ const pageLimits = this.pageLimitOptions.split(',').map((item) => {
1045
+ return parseInt(item);
1046
+ });
1047
+ if (pageLimits.includes(this.limit)) ;
1048
+ else {
1049
+ this.limit = pageLimits[0];
1050
+ }
1051
+ }
1052
+ catch (e) {
1053
+ console.error('Error when parse PageLimitOptions', e);
1054
+ this.limit = 10;
1055
+ }
1056
+ }
1057
+ async componentWillLoad() {
1058
+ this.setLimit();
1059
+ this.updateWallets();
1060
+ }
1061
+ static get assetsDirs() { return ["static"]; }
1062
+ static get watchers() { return {
1063
+ "type": ["walletTypeChangedHandler"],
1064
+ "endpoint": ["updateWallets"],
1065
+ "language": ["updateWallets"],
1066
+ "session": ["updateWallets"]
1067
+ }; }
1068
+ };
1069
+ PlayerElevatePointsHistory.style = PlayerElevatePointsHistoryStyle0;
1070
+
1071
+ export { BonusPaginationLimits as bonus_pagination_limits, BonusPaginationNav as bonus_pagination_nav, GeneralStylingWrapper as general_styling_wrapper, PlayerElevateCardData as player_elevate_card_data, PlayerElevatePointcard as player_elevate_pointcard, PlayerElevatePointsHistory as player_elevate_points_history };