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