@everymatrix/gamification-dropdown 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/gamification-dropdown-b0044320.js +173 -0
  3. package/dist/cjs/gamification-dropdown.cjs.js +25 -0
  4. package/dist/cjs/gamification-dropdown_4.cjs.entry.js +559 -0
  5. package/dist/cjs/index-1c31b1d6.js +1675 -0
  6. package/dist/cjs/index.cjs.js +10 -0
  7. package/dist/cjs/loader.cjs.js +15 -0
  8. package/dist/cjs/player-elevate-card-items-77750a62.js +2364 -0
  9. package/dist/cjs/player-elevate-card.cjs.entry.js +74 -0
  10. package/dist/cjs/player-elevate-pointcard.cjs.entry.js +76 -0
  11. package/dist/collection/collection-manifest.json +28 -0
  12. package/dist/collection/components/gamification-dropdown/gamification-dropdown.css +57 -0
  13. package/dist/collection/components/gamification-dropdown/gamification-dropdown.js +256 -0
  14. package/dist/collection/components/gamification-dropdown/index.js +1 -0
  15. package/dist/collection/index.js +1 -0
  16. package/dist/collection/utils/locale.utils.js +42 -0
  17. package/dist/collection/utils/utils.js +3 -0
  18. package/dist/esm/app-globals-0f993ce5.js +3 -0
  19. package/dist/esm/gamification-dropdown-498ae904.js +171 -0
  20. package/dist/esm/gamification-dropdown.js +20 -0
  21. package/dist/esm/gamification-dropdown_4.entry.js +552 -0
  22. package/dist/esm/index-0ad2daf0.js +1645 -0
  23. package/dist/esm/index.js +2 -0
  24. package/dist/esm/loader.js +11 -0
  25. package/dist/esm/player-elevate-card-items-50dbfe39.js +2351 -0
  26. package/dist/esm/player-elevate-card.entry.js +70 -0
  27. package/dist/esm/player-elevate-pointcard.entry.js +72 -0
  28. package/dist/gamification-dropdown/gamification-dropdown.esm.js +1 -0
  29. package/dist/gamification-dropdown/index.esm.js +1 -0
  30. package/dist/gamification-dropdown/p-09730cb4.entry.js +1 -0
  31. package/dist/gamification-dropdown/p-58a784a0.js +1 -0
  32. package/dist/gamification-dropdown/p-72844c24.js +1 -0
  33. package/dist/gamification-dropdown/p-95a21693.js +2 -0
  34. package/dist/gamification-dropdown/p-be2f5b0a.entry.js +1 -0
  35. package/dist/gamification-dropdown/p-d1603dd0.entry.js +1 -0
  36. package/dist/gamification-dropdown/p-e1255160.js +1 -0
  37. package/dist/index.cjs.js +1 -0
  38. package/dist/index.js +1 -0
  39. package/dist/static/button-default.svg +42 -0
  40. package/dist/static/button-disabled.svg +4 -0
  41. package/dist/static/button-hover.svg +4 -0
  42. package/dist/static/button-level.svg +27 -0
  43. package/dist/static/button-pressed.svg +18 -0
  44. package/dist/static/button-redeem.svg +36 -0
  45. package/dist/static/card-ground-over.png +0 -0
  46. package/dist/static/card-ground-over.svg +903 -0
  47. package/dist/static/card-ground.png +0 -0
  48. package/dist/static/card-ground.svg +34 -0
  49. package/dist/static/info.svg +4 -0
  50. package/dist/static/level-badge.png +0 -0
  51. package/dist/static/level-percent.svg +80 -0
  52. package/dist/static/tips-info.svg +21 -0
  53. package/dist/static/user.svg +3 -0
  54. package/dist/stencil.config.dev.js +15 -0
  55. package/dist/stencil.config.js +17 -0
  56. package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/gamification-dropdown/.stencil/packages/stencil/gamification-dropdown/stencil.config.d.ts +2 -0
  57. package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/gamification-dropdown/.stencil/packages/stencil/gamification-dropdown/stencil.config.dev.d.ts +2 -0
  58. package/dist/types/components/gamification-dropdown/gamification-dropdown.d.ts +43 -0
  59. package/dist/types/components/gamification-dropdown/index.d.ts +1 -0
  60. package/dist/types/components.d.ts +85 -0
  61. package/dist/types/index.d.ts +1 -0
  62. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  63. package/dist/types/utils/locale.utils.d.ts +2 -0
  64. package/dist/types/utils/utils.d.ts +1 -0
  65. package/loader/cdn.js +1 -0
  66. package/loader/index.cjs.js +1 -0
  67. package/loader/index.d.ts +24 -0
  68. package/loader/index.es2017.js +1 -0
  69. package/loader/index.js +2 -0
  70. package/loader/package.json +11 -0
  71. package/package.json +29 -0
@@ -0,0 +1,559 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const gamificationDropdown = require('./gamification-dropdown-b0044320.js');
6
+ const index = require('./index-1c31b1d6.js');
7
+ const playerElevateCardItems = require('./player-elevate-card-items-77750a62.js');
8
+
9
+ const mergeTranslations = (url, target) => {
10
+ return new Promise((resolve) => {
11
+ fetch(url)
12
+ .then((res) => res.json())
13
+ .then((data) => {
14
+ Object.keys(data).forEach((item) => {
15
+ target[item] = target[item] ? target[item] : {};
16
+ for (let key in data[item]) {
17
+ target[item][key] = data[item][key];
18
+ }
19
+ });
20
+ resolve(true);
21
+ });
22
+ });
23
+ };
24
+
25
+ const generalStylingWrapperCss = ":host{display:block}";
26
+ const GeneralStylingWrapperStyle0 = generalStylingWrapperCss;
27
+
28
+ const GeneralStylingWrapper = class {
29
+ constructor(hostRef) {
30
+ index.registerInstance(this, hostRef);
31
+ this.stylingAppends = false;
32
+ this.setClientStyling = () => {
33
+ let sheet = document.createElement('style');
34
+ sheet.innerHTML = this.clientStyling;
35
+ this.el.prepend(sheet);
36
+ };
37
+ this.setClientStylingURL = () => {
38
+ let url = new URL(this.clientStylingUrl);
39
+ let cssFile = document.createElement('style');
40
+ fetch(url.href)
41
+ .then((res) => res.text())
42
+ .then((data) => {
43
+ cssFile.innerHTML = data;
44
+ setTimeout(() => {
45
+ this.el.prepend(cssFile);
46
+ }, 1);
47
+ })
48
+ .catch((err) => {
49
+ console.log('error ', err);
50
+ });
51
+ };
52
+ this.clientStyling = '';
53
+ this.clientStylingUrl = '';
54
+ this.translationUrl = '';
55
+ this.targetTranslations = undefined;
56
+ }
57
+ componentDidRender() {
58
+ // start custom styling area
59
+ if (!this.stylingAppends) {
60
+ if (this.clientStyling)
61
+ this.setClientStyling();
62
+ if (this.clientStylingUrl)
63
+ this.setClientStylingURL();
64
+ this.stylingAppends = true;
65
+ }
66
+ // end custom styling area
67
+ }
68
+ async componentWillLoad() {
69
+ const promises = [];
70
+ if (this.translationUrl) {
71
+ const translationPromise = mergeTranslations(this.translationUrl, this.targetTranslations);
72
+ promises.push(translationPromise);
73
+ }
74
+ return await Promise.all(promises);
75
+ }
76
+ render() {
77
+ return (index.h("div", { key: '4d3414408c7662f88331dbe655966237f74d6958', class: "StyleShell" }, index.h("slot", { key: '1d004644d84602c4314bdf5dfc26b55b160f57df', name: "mainContent" })));
78
+ }
79
+ get el() { return index.getElement(this); }
80
+ };
81
+ GeneralStylingWrapper.style = GeneralStylingWrapperStyle0;
82
+
83
+ /**
84
+ * @name startOfDay
85
+ * @category Day Helpers
86
+ * @summary Return the start of a day for the given date.
87
+ *
88
+ * @description
89
+ * Return the start of a day for the given date.
90
+ * The result will be in the local timezone.
91
+ *
92
+ * @param {Date|Number} date - the original date
93
+ * @returns {Date} the start of a day
94
+ * @throws {TypeError} 1 argument required
95
+ *
96
+ * @example
97
+ * // The start of a day for 2 September 2014 11:55:00:
98
+ * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
99
+ * //=> Tue Sep 02 2014 00:00:00
100
+ */
101
+ function startOfDay(dirtyDate) {
102
+ playerElevateCardItems.requiredArgs(1, arguments);
103
+ var date = playerElevateCardItems.toDate(dirtyDate);
104
+ date.setHours(0, 0, 0, 0);
105
+ return date;
106
+ }
107
+
108
+ var MILLISECONDS_IN_DAY = 86400000;
109
+
110
+ /**
111
+ * @name differenceInCalendarDays
112
+ * @category Day Helpers
113
+ * @summary Get the number of calendar days between the given dates.
114
+ *
115
+ * @description
116
+ * Get the number of calendar days between the given dates. This means that the times are removed
117
+ * from the dates and then the difference in days is calculated.
118
+ *
119
+ * @param {Date|Number} dateLeft - the later date
120
+ * @param {Date|Number} dateRight - the earlier date
121
+ * @returns {Number} the number of calendar days
122
+ * @throws {TypeError} 2 arguments required
123
+ *
124
+ * @example
125
+ * // How many calendar days are between
126
+ * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
127
+ * const result = differenceInCalendarDays(
128
+ * new Date(2012, 6, 2, 0, 0),
129
+ * new Date(2011, 6, 2, 23, 0)
130
+ * )
131
+ * //=> 366
132
+ * // How many calendar days are between
133
+ * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
134
+ * const result = differenceInCalendarDays(
135
+ * new Date(2011, 6, 3, 0, 1),
136
+ * new Date(2011, 6, 2, 23, 59)
137
+ * )
138
+ * //=> 1
139
+ */
140
+ function differenceInCalendarDays(dirtyDateLeft, dirtyDateRight) {
141
+ playerElevateCardItems.requiredArgs(2, arguments);
142
+ var startOfDayLeft = startOfDay(dirtyDateLeft);
143
+ var startOfDayRight = startOfDay(dirtyDateRight);
144
+ var timestampLeft = startOfDayLeft.getTime() - playerElevateCardItems.getTimezoneOffsetInMilliseconds(startOfDayLeft);
145
+ var timestampRight = startOfDayRight.getTime() - playerElevateCardItems.getTimezoneOffsetInMilliseconds(startOfDayRight);
146
+
147
+ // Round the number of days to the nearest integer
148
+ // because the number of milliseconds in a day is not constant
149
+ // (e.g. it's different in the day of the daylight saving time clock shift)
150
+ return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY);
151
+ }
152
+
153
+ /**
154
+ * Days in 1 week.
155
+ *
156
+ * @name daysInWeek
157
+ * @constant
158
+ * @type {number}
159
+ * @default
160
+ */
161
+
162
+ /**
163
+ * Milliseconds in 1 hour
164
+ *
165
+ * @name millisecondsInHour
166
+ * @constant
167
+ * @type {number}
168
+ * @default
169
+ */
170
+ var millisecondsInHour = 3600000;
171
+
172
+ /**
173
+ * @name differenceInMilliseconds
174
+ * @category Millisecond Helpers
175
+ * @summary Get the number of milliseconds between the given dates.
176
+ *
177
+ * @description
178
+ * Get the number of milliseconds between the given dates.
179
+ *
180
+ * @param {Date|Number} dateLeft - the later date
181
+ * @param {Date|Number} dateRight - the earlier date
182
+ * @returns {Number} the number of milliseconds
183
+ * @throws {TypeError} 2 arguments required
184
+ *
185
+ * @example
186
+ * // How many milliseconds are between
187
+ * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?
188
+ * const result = differenceInMilliseconds(
189
+ * new Date(2014, 6, 2, 12, 30, 21, 700),
190
+ * new Date(2014, 6, 2, 12, 30, 20, 600)
191
+ * )
192
+ * //=> 1100
193
+ */
194
+ function differenceInMilliseconds(dateLeft, dateRight) {
195
+ playerElevateCardItems.requiredArgs(2, arguments);
196
+ return playerElevateCardItems.toDate(dateLeft).getTime() - playerElevateCardItems.toDate(dateRight).getTime();
197
+ }
198
+
199
+ var roundingMap = {
200
+ ceil: Math.ceil,
201
+ round: Math.round,
202
+ floor: Math.floor,
203
+ trunc: function trunc(value) {
204
+ return value < 0 ? Math.ceil(value) : Math.floor(value);
205
+ } // Math.trunc is not supported by IE
206
+ };
207
+
208
+ var defaultRoundingMethod = 'trunc';
209
+ function getRoundingMethod(method) {
210
+ return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];
211
+ }
212
+
213
+ /**
214
+ * @name differenceInHours
215
+ * @category Hour Helpers
216
+ * @summary Get the number of hours between the given dates.
217
+ *
218
+ * @description
219
+ * Get the number of hours between the given dates.
220
+ *
221
+ * @param {Date|Number} dateLeft - the later date
222
+ * @param {Date|Number} dateRight - the earlier date
223
+ * @param {Object} [options] - an object with options.
224
+ * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)
225
+ * @returns {Number} the number of hours
226
+ * @throws {TypeError} 2 arguments required
227
+ *
228
+ * @example
229
+ * // How many hours are between 2 July 2014 06:50:00 and 2 July 2014 19:00:00?
230
+ * const result = differenceInHours(
231
+ * new Date(2014, 6, 2, 19, 0),
232
+ * new Date(2014, 6, 2, 6, 50)
233
+ * )
234
+ * //=> 12
235
+ */
236
+ function differenceInHours(dateLeft, dateRight, options) {
237
+ playerElevateCardItems.requiredArgs(2, arguments);
238
+ var diff = differenceInMilliseconds(dateLeft, dateRight) / millisecondsInHour;
239
+ return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
240
+ }
241
+
242
+ /**
243
+ * @name isBefore
244
+ * @category Common Helpers
245
+ * @summary Is the first date before the second one?
246
+ *
247
+ * @description
248
+ * Is the first date before the second one?
249
+ *
250
+ * @param {Date|Number} date - the date that should be before the other one to return true
251
+ * @param {Date|Number} dateToCompare - the date to compare with
252
+ * @returns {Boolean} the first date is before the second date
253
+ * @throws {TypeError} 2 arguments required
254
+ *
255
+ * @example
256
+ * // Is 10 July 1989 before 11 February 1987?
257
+ * const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
258
+ * //=> false
259
+ */
260
+ function isBefore(dirtyDate, dirtyDateToCompare) {
261
+ playerElevateCardItems.requiredArgs(2, arguments);
262
+ var date = playerElevateCardItems.toDate(dirtyDate);
263
+ var dateToCompare = playerElevateCardItems.toDate(dirtyDateToCompare);
264
+ return date.getTime() < dateToCompare.getTime();
265
+ }
266
+
267
+ function updateProgressSvg(progressElementRef, percent) {
268
+ const svgElement = progressElementRef.querySelector('#total_level');
269
+ const endLockWidth = 17, pointR = 6.5;
270
+ //Total Widget of the progress
271
+ const barWidth = svgElement.getBBox().width;
272
+ //The filled width according to current progress
273
+ const levelPercent = percent > 1 ? 1 : percent;
274
+ const widthOnBar = (levelPercent * barWidth - endLockWidth) < 0 ? 0 : levelPercent * barWidth - endLockWidth;
275
+ //update bar's width, widthOnBar
276
+ const levelBar = progressElementRef.querySelector('#current_level');
277
+ //update filters, x = widthOnBar
278
+ const levelFilter = progressElementRef.querySelector('#filter_current_level');
279
+ //update circle, widthOnBar+10
280
+ const levelCircle = progressElementRef.querySelector('#circle_current_level');
281
+ svgElement.setAttribute('viewbox', `0 0 ${widthOnBar} 28`);
282
+ levelBar.setAttribute('width', `${widthOnBar}`);
283
+ levelCircle.setAttribute('cx', `${(widthOnBar < pointR ? pointR : widthOnBar)}`);
284
+ levelFilter.setAttribute('x', `${widthOnBar - 8}`);
285
+ //update lock location
286
+ const endLockElement = progressElementRef.querySelector('#lock');
287
+ // wrapper of endLock, include ball and heatfilter1_d_305_23
288
+ const filter1 = progressElementRef.querySelector('#filter_heart_ball');
289
+ // ball in endlockfilter2_i_305_23
290
+ const filter2 = progressElementRef.querySelector('#filter_ball');
291
+ // heart in endlockfilter3_d_305_23
292
+ const filter3 = progressElementRef.querySelector('#filter_heart');
293
+ //wrapper of lockfilter4_d_305_23
294
+ const filterLock = progressElementRef.querySelector('#filter_lock');
295
+ // shadow of ball paint0_linear_305_23
296
+ const paint0 = progressElementRef.querySelector('#paint0_linear_ball');
297
+ //paint in lockpaint1_linear_305_23
298
+ const paint1 = progressElementRef.querySelector('#paint1_linear_lock');
299
+ // box of lock and heart, for move position dynamically
300
+ const lockBox = progressElementRef.querySelector('#lock_box');
301
+ const heartBox = progressElementRef.querySelector('#heart_box');
302
+ const rightPaddingOfLockWidth = 10, cxOfEndLockEle = barWidth - rightPaddingOfLockWidth;
303
+ //set cx of lockElement
304
+ endLockElement.setAttribute('cx', `${cxOfEndLockEle}`);
305
+ //set cx of sub Elements
306
+ paint1.setAttribute('x1', `${cxOfEndLockEle}`);
307
+ paint1.setAttribute('x2', `${cxOfEndLockEle}`);
308
+ paint0.setAttribute('x1', `${cxOfEndLockEle - 6}`);
309
+ paint0.setAttribute('x2', `${cxOfEndLockEle - 6 + 11.2}`);
310
+ filterLock.setAttribute('x', `${cxOfEndLockEle - 6}`);
311
+ filter3.setAttribute('x', `${cxOfEndLockEle - 6 - 2}`);
312
+ filter2.setAttribute('x', `${cxOfEndLockEle - 6 - 2 - 2}`);
313
+ filter1.setAttribute('x', `${cxOfEndLockEle - 6 - 2 - 2 - 4}`);
314
+ lockBox.setAttribute('x', `${cxOfEndLockEle - 6}`);
315
+ heartBox.setAttribute('x', `${cxOfEndLockEle - 6}`);
316
+ svgElement.parentElement.style.opacity = '1';
317
+ }
318
+
319
+ 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}";
320
+ const PlayerElevateCardDataStyle0 = playerElevateCardDataCss;
321
+
322
+ const PlayerElevateCardData = class {
323
+ constructor(hostRef) {
324
+ index.registerInstance(this, hostRef);
325
+ this.playerElevateLeveLoaded = index.createEvent(this, "playerElevateLeveLoaded", 7);
326
+ this.params = undefined;
327
+ this.playerElevateLevel = undefined;
328
+ this.pointExpireString = undefined;
329
+ }
330
+ handleWindowResizs() {
331
+ this.initLevelProgressbar();
332
+ }
333
+ onParamsChanged() {
334
+ this.loadElevateInfo();
335
+ }
336
+ onRedeemClick() {
337
+ window.postMessage({ type: 'BEERedeemClicked' }, window.location.href);
338
+ }
339
+ loadLevels() {
340
+ let url = new URL(`${this.params.endpoint}/v1/elevate/levels?language=${this.params.language}`);
341
+ return new Promise((resolve, reject) => {
342
+ return fetch(url.href, {
343
+ method: 'GET',
344
+ })
345
+ .then((res) => res.json())
346
+ .then((res) => {
347
+ this.levels = res.data;
348
+ resolve(true);
349
+ })
350
+ .catch((err) => {
351
+ reject(err);
352
+ });
353
+ });
354
+ }
355
+ calcuatePointsToBeExpired(walletTotalInfo) {
356
+ let pointExpireInfoAsString = '';
357
+ if (!walletTotalInfo || !walletTotalInfo.aboutToExpire ||
358
+ walletTotalInfo.aboutToExpire.length == 0 ||
359
+ walletTotalInfo.aboutToExpire[0].points <= 0) {
360
+ return pointExpireInfoAsString;
361
+ }
362
+ walletTotalInfo.aboutToExpire.sort((expire1, expire2) => {
363
+ return isBefore(new Date(expire1.expireTime), new Date(expire2.expireTime))
364
+ ? -1
365
+ : 1;
366
+ });
367
+ const aboutToExpire = walletTotalInfo.aboutToExpire[0];
368
+ const daysToExpried = differenceInCalendarDays(new Date(aboutToExpire.expireTime), new Date());
369
+ let hoursToExpired = 0, expiredTranslationKey = daysToExpried === 0 ? 'pointsToBeExpiredDay' : 'pointsToBeExpired';
370
+ if (daysToExpried == 0) {
371
+ hoursToExpired = differenceInHours(new Date(aboutToExpire.expireTime), new Date());
372
+ expiredTranslationKey = hoursToExpired > 1 ? 'pointsToBeExpiredHours' : 'pointsToBeExpiredHour';
373
+ }
374
+ pointExpireInfoAsString = playerElevateCardItems.translateWithParams(expiredTranslationKey, {
375
+ expirationPoints: aboutToExpire.points,
376
+ expireDay: daysToExpried,
377
+ });
378
+ return pointExpireInfoAsString;
379
+ }
380
+ loadPlayerLevelInfo() {
381
+ let url = new URL(`${this.params.endpoint}/v1/elevate/playerInfo?language=${this.params.language}`);
382
+ return new Promise((resolve, reject) => {
383
+ return fetch(url.href, {
384
+ method: 'GET',
385
+ headers: {
386
+ 'X-Sessionid': this.params.session,
387
+ 'Content-Type': 'application/json',
388
+ },
389
+ })
390
+ .then((res) => res.json())
391
+ .then((res) => {
392
+ var _a, _b, _c;
393
+ if (!res.success) {
394
+ console.error('Exception when fetch user elevateinfo, ', res.errorCode, res.errorMessage);
395
+ reject(true);
396
+ return;
397
+ }
398
+ let playerElevateInfo = res.data;
399
+ this.playerElevateLevel = playerElevateInfo.level;
400
+ this.playerElevateLevel.name = this.playerElevateLevel.presentation.displayName || this.playerElevateLevel.name;
401
+ this.playerElevateLevel.spendablePoints = ((_a = playerElevateInfo.spendableWallet) === null || _a === void 0 ? void 0 : _a.total.points) || 0;
402
+ this.playerElevateLeveLoaded.emit({ elevateLevel: this.playerElevateLevel });
403
+ const spendableTotal = (_b = res.data.spendableWallet) === null || _b === void 0 ? void 0 : _b.total;
404
+ const loyaltyWalletTotal = (_c = res.data.loyaltyWallet) === null || _c === void 0 ? void 0 : _c.total;
405
+ this.playerElevateLeveLoaded.emit({
406
+ elevateLevelWalletTotal: spendableTotal,
407
+ loyaltyWalletTotal
408
+ });
409
+ let spExpireInfoAsString = this.calcuatePointsToBeExpired(spendableTotal);
410
+ let xpExpireInfoAsString = this.calcuatePointsToBeExpired(loyaltyWalletTotal);
411
+ if (spExpireInfoAsString || xpExpireInfoAsString) {
412
+ this.playerElevateLeveLoaded.emit({
413
+ pointExpireString: spExpireInfoAsString,
414
+ xpExpireString: xpExpireInfoAsString
415
+ });
416
+ }
417
+ resolve(this.playerElevateLevel);
418
+ })
419
+ .catch((err) => {
420
+ console.log('error ', err);
421
+ reject(true);
422
+ });
423
+ });
424
+ }
425
+ setLoyaltyProgress(percent) {
426
+ updateProgressSvg(this.loyaltyProgressEle, percent);
427
+ }
428
+ initLevelProgressbar() {
429
+ setTimeout(() => {
430
+ this.loyaltyProgressEle =
431
+ this.elevateCardRef.parentElement.querySelector('#LevelProgress');
432
+ if (!this.loyaltyProgressEle) {
433
+ return;
434
+ }
435
+ this.setLoyaltyProgress(!this.playerElevateLevel.nextLevel
436
+ ? 1 : (this.playerElevateLevel.loyaltyPoints / this.playerElevateLevel.nextLevel.entryPoints));
437
+ this.params['playerElevateLevel'] = this.playerElevateLevel;
438
+ }, 80);
439
+ }
440
+ componentDidRender() {
441
+ this.initLevelProgressbar();
442
+ }
443
+ loadElevateInfo() {
444
+ if (!this.params.endpoint || !this.params.session) {
445
+ return;
446
+ }
447
+ const promises = [];
448
+ promises.push(this.loadPlayerLevelInfo());
449
+ if (this.params.calculateLevelFlag) {
450
+ promises.push(this.loadLevels());
451
+ }
452
+ Promise.all(promises).then((res) => {
453
+ console.log('elevate-init', res);
454
+ this.initLevelProgressbar();
455
+ if (!this.levels) {
456
+ return;
457
+ }
458
+ this.levels.sort((level1, level2) => {
459
+ return level1.firstEntryPoints > level2.firstEntryPoints ? 1 : -1;
460
+ });
461
+ const playerPoints = this.playerElevateLevel.loyaltyPoints;
462
+ let playerLevelNumber = 0;
463
+ this.levels.forEach((elevateLevel, idx) => {
464
+ if (playerPoints > elevateLevel.firstEntryPoints) {
465
+ playerLevelNumber = idx;
466
+ }
467
+ });
468
+ this.playerElevateLeveLoaded.emit({
469
+ calculatedLevelFlag: playerLevelNumber,
470
+ });
471
+ });
472
+ }
473
+ componentWillLoad() {
474
+ this.loadElevateInfo();
475
+ }
476
+ get elevateCardRef() { return index.getElement(this); }
477
+ static get watchers() { return {
478
+ "params": ["onParamsChanged"]
479
+ }; }
480
+ };
481
+ PlayerElevateCardData.style = PlayerElevateCardDataStyle0;
482
+
483
+ const playerElevateLoyaltycardCss = ":host{display:block}@media screen and (min-width: 501px){.LoyaltyCard .Inner .LevelInfo .ElevateLevel{flex-wrap:nowrap}.LoyaltyCard .Inner .LevelInfo .ElevateLevel .ExpirationDate{padding-top:11px;margin-left:5px}}@media screen and (max-width: 500px){.LoyaltyCard .Inner .LevelInfo .ElevateLevel{flex-wrap:wrap}.LoyaltyCard .Inner .LevelInfo .ElevateLevel .ExpirationDate{padding-top:0px;margin-left:0px}}.LoyaltyCard .Inner .LevelProgress{margin-left:0px}.LoyaltyCard .Inner .Row .PointsInfo{width:100%}.LoyaltyCard .Inner .Row .PointsInfo.ExpirationPoints{text-align:left;color:var(--emfe-w-color-red-50, red)}.LoyaltyCard .Inner .PlayerAvatar .Avatar{display:none}.LoyaltyCard .Inner .PlayerAvatar .Badge{border-radius:50%;background-size:contain;width:100%;height:100%}.LoyaltyCard .Inner .LevelInfo .ElevateLevel{display:flex;flex:1;align-items:center}.LoyaltyCard .Inner .LevelInfo .ElevateLevel .ExpirationDate{position:relative;padding-left:5px}.LoyaltyCard .Inner .LevelInfo .ElevateLevel .ExpirationDate .ExpireTime{margin-left:5px}.LoyaltyCard .Inner .LevelInfo .ElevateLevel .LevelName{padding-left:0;font-size:var(--emfe-w-elevate-fontsize-2xlarge, 21px);position:relative;width:auto;color:var(--emfe-w-elevate-color-levelname, #FFBD2B);font-weight:bold}.LoyaltyCard .NextLevelTip{text-align:right;font-size:11px;color:var(--emfe-w-color-black, #000);opacity:0.8;font-weight:bold}";
484
+ const PlayerElevateLoyaltycardStyle0 = playerElevateLoyaltycardCss;
485
+
486
+ const PlayerElevateLoyaltycard = class {
487
+ constructor(hostRef) {
488
+ index.registerInstance(this, hostRef);
489
+ this.endpoint = undefined;
490
+ this.theme = 'Dark';
491
+ this.session = undefined;
492
+ this.playerAvatarUrl = undefined;
493
+ this.language = 'en';
494
+ this.playerName = undefined;
495
+ this.dateFormat = 'yyyy-MM-dd';
496
+ this.clientStyling = '';
497
+ this.clientStylingUrl = '';
498
+ this.translationUrl = '';
499
+ this.pointExpireString = undefined;
500
+ this.playerElevateLevel = undefined;
501
+ this.elevateWalletTotal = undefined;
502
+ }
503
+ onSessionOrEndpointChange() {
504
+ this.paramProxy = Object.assign(Object.assign({}, this.paramProxy), { session: this.session, endpoint: this.endpoint, language: this.language });
505
+ }
506
+ playerElevateLeveLoadedHandler(event) {
507
+ if (!event.detail) {
508
+ return;
509
+ }
510
+ if (event.detail['elevateLevelWalletTotal']) {
511
+ this.elevateWalletTotal = event.detail['elevateLevelWalletTotal'];
512
+ }
513
+ if (event.detail['elevateLevel']) {
514
+ this.playerElevateLevel = event.detail['elevateLevel'];
515
+ }
516
+ if (event.detail['pointExpireString']) {
517
+ this.pointExpireString = event.detail.xpExpireString;
518
+ }
519
+ }
520
+ onRedeemClick() {
521
+ window.postMessage({ type: 'BEERedeemClicked' }, window.location.href);
522
+ }
523
+ componentWillLoad() {
524
+ this.paramProxy = {
525
+ endpoint: this.endpoint,
526
+ session: this.session,
527
+ language: this.language,
528
+ };
529
+ }
530
+ getNextLevelTips() {
531
+ var _a;
532
+ //need xx to reach Diamond
533
+ let nextLevel = (_a = this.playerElevateLevel) === null || _a === void 0 ? void 0 : _a.nextLevel;
534
+ if (this.playerElevateLevel && nextLevel) {
535
+ const pointsToReach = (nextLevel.entryPoints - this.playerElevateLevel.loyaltyPoints).toFixed(2);
536
+ return playerElevateCardItems.translateWithParams('tipsForNextLevel', {
537
+ pointsToReach,
538
+ levelName: nextLevel.name,
539
+ });
540
+ }
541
+ return '';
542
+ }
543
+ render() {
544
+ const backgroundOuterImagePath = index.getAssetPath('../static/card-ground.svg');
545
+ const backgroundInnerImagePath = index.getAssetPath('../static/card-ground-over.svg');
546
+ return (index.h("div", { key: 'd32d09786bf66e0abef026482e7ea04a53c051b1', class: `ElevateCardWrapper ${this.theme}` }, index.h("div", { key: 'dd2685eb840341b8823f24db9b72d0f6b7d340ae', class: "LoyaltyCard Outer", style: { 'backgroundImage': `url(${backgroundOuterImagePath}` } }, index.h("general-styling-wrapper", { key: '3e2a00d1697c89441a8254cb81c6dc72e5b9f534', clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, targetTranslations: playerElevateCardItems.TRANSLATIONS, translationUrl: this.translationUrl }), index.h("player-elevate-card-data", { key: '56221e6d50df3b09c4269000637818009807c994', params: this.paramProxy }), index.h("div", { key: 'f11201024b280d6beb2ce1978ebfa7f2c7c59678', class: 'OuterCover Inner', style: { 'backgroundImage': `url(${backgroundInnerImagePath}` } }, index.h("div", { key: '948a023268fad3945b5069686eb29312111042a2', class: 'Content Row' }, this.playerElevateLevel && (index.h(index.Fragment, { key: 'de7c52faa07386949ce1ca728968534922e9d880' }, index.h("div", { key: '7c1a0c6ea5dbe7ee2375813b3819efa61e283232', class: "PlayerImg" }, index.h(playerElevateCardItems.PlayerAvatar, { key: '70ae13ee168c6de7bf4618f6ab8761462c8812b2', onlyBadge: true, loyaltyIconUrl: this.playerElevateLevel.presentation.asset })), index.h("div", { key: 'c11f916999b52e43e04ee472b0f54691012409a5', class: `LevelInfo ${this.playerElevateLevel.name}` }, index.h(playerElevateCardItems.PlayerElevateLoyaltyLevel, { key: '6aa61d117b24f9abbee9c5d33e882d6f023f205b', hideInfo: true, level: this.playerElevateLevel.name, expireTime: this.playerElevateLevel.expireTime, dateFormat: this.dateFormat }), index.h(playerElevateCardItems.PlayerPoints, { key: '7cc02e34d4682c25095dbf6a3077b314410d8093', loyaltyPoints: this.playerElevateLevel.loyaltyPoints, language: this.language }), this.pointExpireString && (index.h("div", { key: '793e388644891e15b32e003ac8914e57e758e86b', class: 'PointsInfo ExpirationPoints' }, this.pointExpireString, " ")), index.h(playerElevateCardItems.PlayerLoyaltyProcess, { key: 'a4f6c3b9f9cd5e8c6a025c26154702f9495bbe5b' }), index.h("div", { key: 'd91eda0f963ba9ffd481237f4b16bd4ef638d25e', class: "NextLevelTip" }, this.getNextLevelTips())))))))));
547
+ }
548
+ static get watchers() { return {
549
+ "session": ["onSessionOrEndpointChange"],
550
+ "endpoint": ["onSessionOrEndpointChange"],
551
+ "language": ["onSessionOrEndpointChange"]
552
+ }; }
553
+ };
554
+ PlayerElevateLoyaltycard.style = PlayerElevateLoyaltycardStyle0;
555
+
556
+ exports.gamification_dropdown = gamificationDropdown.GamificationDropdown;
557
+ exports.general_styling_wrapper = GeneralStylingWrapper;
558
+ exports.player_elevate_card_data = PlayerElevateCardData;
559
+ exports.player_elevate_loyaltycard = PlayerElevateLoyaltycard;