@everymatrix/player-elevate-points-history-jojogroup 1.80.2

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 (100) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/bonus-pagination-limits_6.cjs.entry.js +6293 -0
  3. package/dist/cjs/index-7eb04064.js +1637 -0
  4. package/dist/cjs/index.cjs.js +2 -0
  5. package/dist/cjs/loader.cjs.js +15 -0
  6. package/dist/cjs/locale.utils-6b4c0dbd.js +230 -0
  7. package/dist/cjs/player-elevate-card-items-30bf53bc.js +2334 -0
  8. package/dist/cjs/player-elevate-card.cjs.entry.js +76 -0
  9. package/dist/cjs/player-elevate-loyaltycard.cjs.entry.js +89 -0
  10. package/dist/cjs/player-elevate-points-history-jojogroup.cjs.js +25 -0
  11. package/dist/cjs/player-rakeback-card.cjs.entry.js +163 -0
  12. package/dist/collection/collection-manifest.json +41 -0
  13. package/dist/collection/components/player-elevate-points-history-jojogroup/index.js +1 -0
  14. package/dist/collection/components/player-elevate-points-history-jojogroup/player-elevate-points-history-jojogroup.css +185 -0
  15. package/dist/collection/components/player-elevate-points-history-jojogroup/player-elevate-points-history-jojogroup.js +479 -0
  16. package/dist/collection/index.js +1 -0
  17. package/dist/collection/renders/renderTabs.js +9 -0
  18. package/dist/collection/renders/renderTopBar.js +4 -0
  19. package/dist/collection/renders/renderWallets.js +43 -0
  20. package/dist/collection/static/back.svg +3 -0
  21. package/dist/collection/static/menu.svg +5 -0
  22. package/dist/collection/utils/business.js +17 -0
  23. package/dist/collection/utils/fetch.js +17 -0
  24. package/dist/collection/utils/translation.js +62 -0
  25. package/dist/collection/utils/types.js +7 -0
  26. package/dist/collection/utils/util.js +16 -0
  27. package/dist/collection/utils/utils.js +3 -0
  28. package/dist/esm/app-globals-0f993ce5.js +3 -0
  29. package/dist/esm/bonus-pagination-limits_6.entry.js +6284 -0
  30. package/dist/esm/index-028fbb06.js +1607 -0
  31. package/dist/esm/index.js +1 -0
  32. package/dist/esm/loader.js +11 -0
  33. package/dist/esm/locale.utils-34e6f004.js +226 -0
  34. package/dist/esm/player-elevate-card-items-fa32ea6b.js +2323 -0
  35. package/dist/esm/player-elevate-card.entry.js +72 -0
  36. package/dist/esm/player-elevate-loyaltycard.entry.js +85 -0
  37. package/dist/esm/player-elevate-points-history-jojogroup.js +20 -0
  38. package/dist/esm/player-rakeback-card.entry.js +159 -0
  39. package/dist/index.cjs.js +1 -0
  40. package/dist/index.js +1 -0
  41. package/dist/player-elevate-points-history-jojogroup/app-globals-0f993ce5.js +1 -0
  42. package/dist/player-elevate-points-history-jojogroup/bonus-pagination-limits_6.entry.js +9 -0
  43. package/dist/player-elevate-points-history-jojogroup/index-028fbb06.js +2 -0
  44. package/dist/player-elevate-points-history-jojogroup/index.esm.js +0 -0
  45. package/dist/player-elevate-points-history-jojogroup/locale.utils-34e6f004.js +1 -0
  46. package/dist/player-elevate-points-history-jojogroup/player-elevate-card-items-fa32ea6b.js +1 -0
  47. package/dist/player-elevate-points-history-jojogroup/player-elevate-card.entry.js +1 -0
  48. package/dist/player-elevate-points-history-jojogroup/player-elevate-loyaltycard.entry.js +1 -0
  49. package/dist/player-elevate-points-history-jojogroup/player-elevate-points-history-jojogroup.esm.js +1 -0
  50. package/dist/player-elevate-points-history-jojogroup/player-rakeback-card.entry.js +1 -0
  51. package/dist/static/button-default.svg +42 -0
  52. package/dist/static/button-disabled.svg +4 -0
  53. package/dist/static/button-hover.svg +4 -0
  54. package/dist/static/button-level.svg +27 -0
  55. package/dist/static/button-pressed.svg +18 -0
  56. package/dist/static/button-redeem.svg +36 -0
  57. package/dist/static/card-ground-over.png +0 -0
  58. package/dist/static/card-ground-over.svg +903 -0
  59. package/dist/static/card-ground.png +0 -0
  60. package/dist/static/card-ground.svg +34 -0
  61. package/dist/static/info.svg +4 -0
  62. package/dist/static/level-badge.png +0 -0
  63. package/dist/static/level-percent.svg +80 -0
  64. package/dist/static/tips-info.svg +21 -0
  65. package/dist/static/user.svg +3 -0
  66. package/dist/stencil.config.dev.js +18 -0
  67. package/dist/stencil.config.js +20 -0
  68. package/dist/storybook/main.js +47 -0
  69. package/dist/storybook/preview.js +9 -0
  70. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/player-elevate-points-history-jojogroup/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
  71. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/player-elevate-points-history-jojogroup/.stencil/packages/stencil/player-elevate-points-history-jojogroup/stencil.config.d.ts +2 -0
  72. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/player-elevate-points-history-jojogroup/.stencil/packages/stencil/player-elevate-points-history-jojogroup/stencil.config.dev.d.ts +2 -0
  73. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/player-elevate-points-history-jojogroup/.stencil/packages/stencil/player-elevate-points-history-jojogroup/storybook/main.d.ts +3 -0
  74. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/player-elevate-points-history-jojogroup/.stencil/packages/stencil/player-elevate-points-history-jojogroup/storybook/preview.d.ts +70 -0
  75. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/player-elevate-points-history-jojogroup/.stencil/tools/plugins/index.d.ts +4 -0
  76. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/player-elevate-points-history-jojogroup/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
  77. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/player-elevate-points-history-jojogroup/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
  78. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/player-elevate-points-history-jojogroup/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  79. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/player-elevate-points-history-jojogroup/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  80. package/dist/types/components/player-elevate-points-history-jojogroup/index.d.ts +1 -0
  81. package/dist/types/components/player-elevate-points-history-jojogroup/player-elevate-points-history-jojogroup.d.ts +80 -0
  82. package/dist/types/components.d.ts +165 -0
  83. package/dist/types/index.d.ts +1 -0
  84. package/dist/types/renders/renderTabs.d.ts +3 -0
  85. package/dist/types/renders/renderTopBar.d.ts +3 -0
  86. package/dist/types/renders/renderWallets.d.ts +12 -0
  87. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  88. package/dist/types/utils/business.d.ts +2 -0
  89. package/dist/types/utils/fetch.d.ts +2 -0
  90. package/dist/types/utils/translation.d.ts +63 -0
  91. package/dist/types/utils/types.d.ts +50 -0
  92. package/dist/types/utils/util.d.ts +1 -0
  93. package/dist/types/utils/utils.d.ts +1 -0
  94. package/loader/cdn.js +1 -0
  95. package/loader/index.cjs.js +1 -0
  96. package/loader/index.d.ts +24 -0
  97. package/loader/index.es2017.js +1 -0
  98. package/loader/index.js +2 -0
  99. package/loader/package.json +11 -0
  100. package/package.json +26 -0
@@ -0,0 +1,479 @@
1
+ import { h } from "@stencil/core";
2
+ import { WalletType } from "../../utils/types";
3
+ import { translation } from "../../utils/translation";
4
+ import { getWallets } from "../../utils/business";
5
+ import { renderWallets } from "../../renders/renderWallets";
6
+ import { renderTopBar } from "../../renders/renderTopBar";
7
+ import Decimal from "decimal.js";
8
+ import "../../../../../general-styling-wrapper/dist/types/index";
9
+ import "../../../../../player-elevate-card/dist/types/index";
10
+ import "../../../../../bonus-pagination-limits/dist/types/index";
11
+ import "../../../../../bonus-pagination-nav/dist/types/index";
12
+ export class PlayerElevatePointsHistory {
13
+ constructor() {
14
+ this.playerAvatarUrl = undefined;
15
+ this.session = undefined;
16
+ this.endpoint = undefined;
17
+ this.limit = undefined;
18
+ this.secondaryArrowsActive = true;
19
+ this.displayPageNumbers = false;
20
+ this.pageLimitOptions = '10,25,50';
21
+ this.currencyPrecision = 2;
22
+ this.enableRakeback = true;
23
+ this.language = 'en';
24
+ this.mbSource = undefined;
25
+ this.clientStyling = '';
26
+ this.clientStylingUrl = '';
27
+ this.translationUrl = '';
28
+ this.locale = translation['en'];
29
+ this.type = WalletType.spendable;
30
+ this.pageSetting = undefined;
31
+ this.pointsWallets = {};
32
+ this.validWallets = [];
33
+ }
34
+ switchTab(type) {
35
+ var _a, _b;
36
+ this.type = type;
37
+ if (this.pointsWallets[type] || !((_a = this.pointsWallets[type]) === null || _a === void 0 ? void 0 : _a.isLoadFailed)) {
38
+ return;
39
+ }
40
+ this.paginationReset.emit({ limit: ((_b = this.pointsWallets[type]) === null || _b === void 0 ? void 0 : _b.pageSetting.limit) || this.limit, tableId: this.type });
41
+ }
42
+ getPageSettingByType(type) {
43
+ return this.pointsWallets[type] ? this.pointsWallets[type].pageSetting : {
44
+ limit: this.limit, total: 0, offset: 0, tableId: type,
45
+ secondaryArrowsActive: this.secondaryArrowsActive,
46
+ displayPageNumbers: this.displayPageNumbers,
47
+ pageLimitOptions: this.pageLimitOptions || undefined
48
+ };
49
+ }
50
+ loadWallets(renderer) {
51
+ if (!this.pointsWallets[this.type] || this.pointsWallets[this.type].isLoading) {
52
+ return h("div", { class: "Loading" }, this.locale.loading);
53
+ }
54
+ else {
55
+ if (this.pointsWallets[this.type].wallets.length === 0) {
56
+ return (h("div", { class: "NoContent" }, this.locale.noContent));
57
+ }
58
+ else {
59
+ return renderer();
60
+ }
61
+ }
62
+ }
63
+ componentWillRender() {
64
+ this.locale = Object.assign(Object.assign({}, translation['en']), translation[this.language]);
65
+ }
66
+ render() {
67
+ var _a, _b;
68
+ const pageSetting = this.getPageSettingByType(this.type);
69
+ return (h("main", { key: '6d07a23636d52d8cfd22fa49fd48dc57c2eba8fa' }, h("general-styling-wrapper", { key: 'b541bad336a3867e9d2c8f8d6867c9af53395496', clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl,
70
+ // @ts-ignore
71
+ targetTranslations: translation, translationUrl: this.translationUrl, mbSource: this.mbSource }), h("player-elevate-pointcard", { key: '048ec444b3cd9644b4c0850ec3e358fcee24eeea', playerAvatarUrl: this.playerAvatarUrl, endpoint: this.endpoint, session: this.session, language: this.language, clientStylingUrl: this.clientStylingUrl, clientStyling: this.clientStyling, translationUrl: this.translationUrl }), h("div", { key: 'cce18463a5accaaef56cfd2e4e8efed5347662b8', class: "PlayerElevatePointsDetaisContainer" }, [
72
+ renderTopBar(this.locale, this.type, pageSetting),
73
+ h("div", { key: 'd68123e5cbbf6a8925edb96d7598c621b102e6cc', class: "Tabs Row" }, (this.validWallets || []).map(key => (h("div", { class: "tab" }, h("div", { class: `TabText ${key === this.type ? 'active' : ''}`, onClick: this.switchTab.bind(this, key) }, this.locale.tabTitle[key]), h("div", { class: `TabBorderBottom ${key === this.type ? 'active' : ''}` }))))),
74
+ ((_a = this.pointsWallets[this.type]) === null || _a === void 0 ? void 0 : _a.isLoadFailed)
75
+ ? h("div", { class: "ReloadMsg" }, this.locale['reloadMsgWhenError'], h("a", { class: "Reload", onClick: this.updateWallets }, this.locale['reload']))
76
+ : this.loadWallets(renderWallets.bind(this, this.locale, ((_b = this.pointsWallets[this.type]) === null || _b === void 0 ? void 0 : _b.wallets) || [], pageSetting))
77
+ ])));
78
+ }
79
+ walletTypeChangedHandler() {
80
+ //do not reload when loaded tab switched back
81
+ if (this.pointsWallets[this.type]) {
82
+ return;
83
+ }
84
+ this.updateWallets();
85
+ }
86
+ async updateWallets() {
87
+ if (!this.endpoint || !this.session || this.session === 'undefined') {
88
+ return;
89
+ }
90
+ let pageSetting = this.pointsWallets[this.type]
91
+ ? this.pointsWallets[this.type].pageSetting
92
+ : this.getPageSettingByType(this.type);
93
+ try {
94
+ const walletsDetail = await getWallets(this.endpoint, this.language, this.type, this.session, pageSetting);
95
+ const wallets = walletsDetail.data || [];
96
+ if (walletsDetail.success) {
97
+ pageSetting.total = walletsDetail.total;
98
+ if (this.type === WalletType.rakeback) {
99
+ this.formatRakebackWalletPoints(wallets);
100
+ }
101
+ this.pointsWallets[this.type] = Object.assign(Object.assign({}, this.pointsWallets[this.type]), { wallets,
102
+ pageSetting });
103
+ this.pointsWallets = Object.assign({}, this.pointsWallets);
104
+ }
105
+ else {
106
+ console.error(walletsDetail);
107
+ this.pointsWallets[this.type].isLoadFailed = true;
108
+ //pageSetting.total = 0;
109
+ }
110
+ }
111
+ catch (e) {
112
+ console.error(e);
113
+ this.pointsWallets[this.type].isLoadFailed = true;
114
+ }
115
+ }
116
+ formatRakebackWalletPoints(wallets) {
117
+ wallets.forEach(wallet => {
118
+ const newValue = new Decimal(wallet.points || 0);
119
+ wallet.pointAsString = newValue.toFixed(this.currencyPrecision, newValue.greaterThan(0)
120
+ ? Decimal.ROUND_DOWN : Decimal.ROUND_CEIL);
121
+ });
122
+ }
123
+ reloadPageByTypeHandler(event) {
124
+ if (event.detail.tableId != this.type) {
125
+ return;
126
+ }
127
+ //reset all wallets when limit changed
128
+ //otherwise fetch new data with new offset when offset changed
129
+ if (this.limit != event.detail.limit) {
130
+ this.pointsWallets = {};
131
+ this.limit = event.detail.limit;
132
+ }
133
+ else {
134
+ let pageSetting = this.pointsWallets[this.type].pageSetting || this.getPageSettingByType(this.type);
135
+ pageSetting.offset = event.detail.offset;
136
+ this.pointsWallets[this.type].pageSetting = pageSetting;
137
+ }
138
+ this.updateWallets();
139
+ }
140
+ setLimit() {
141
+ try {
142
+ const pageLimits = this.pageLimitOptions.split(',').map((item) => {
143
+ return parseInt(item);
144
+ });
145
+ if (pageLimits.includes(this.limit)) {
146
+ //do nothing
147
+ }
148
+ else {
149
+ this.limit = pageLimits[0];
150
+ }
151
+ }
152
+ catch (e) {
153
+ console.error('Error when parse PageLimitOptions', e);
154
+ this.limit = 10;
155
+ }
156
+ }
157
+ async componentWillLoad() {
158
+ this.setLimit();
159
+ this.updateWallets();
160
+ // only show rakeback tab
161
+ this.validWallets = this.enableRakeback ? [WalletType.rakeback] : [];
162
+ this.type = WalletType.rakeback;
163
+ }
164
+ static get is() { return "player-elevate-points-history-jojogroup"; }
165
+ static get encapsulation() { return "shadow"; }
166
+ static get originalStyleUrls() {
167
+ return {
168
+ "$": ["player-elevate-points-history-jojogroup.scss"]
169
+ };
170
+ }
171
+ static get styleUrls() {
172
+ return {
173
+ "$": ["player-elevate-points-history-jojogroup.css"]
174
+ };
175
+ }
176
+ static get assetsDirs() { return ["static"]; }
177
+ static get properties() {
178
+ return {
179
+ "playerAvatarUrl": {
180
+ "type": "string",
181
+ "mutable": false,
182
+ "complexType": {
183
+ "original": "string",
184
+ "resolved": "string",
185
+ "references": {}
186
+ },
187
+ "required": false,
188
+ "optional": false,
189
+ "docs": {
190
+ "tags": [],
191
+ "text": "player avatar url"
192
+ },
193
+ "attribute": "player-avatar-url",
194
+ "reflect": true
195
+ },
196
+ "session": {
197
+ "type": "string",
198
+ "mutable": false,
199
+ "complexType": {
200
+ "original": "string",
201
+ "resolved": "string",
202
+ "references": {}
203
+ },
204
+ "required": false,
205
+ "optional": false,
206
+ "docs": {
207
+ "tags": [],
208
+ "text": "User Session"
209
+ },
210
+ "attribute": "session",
211
+ "reflect": true
212
+ },
213
+ "endpoint": {
214
+ "type": "string",
215
+ "mutable": false,
216
+ "complexType": {
217
+ "original": "string",
218
+ "resolved": "string",
219
+ "references": {}
220
+ },
221
+ "required": false,
222
+ "optional": false,
223
+ "docs": {
224
+ "tags": [],
225
+ "text": "Endpoint URL for the source of data"
226
+ },
227
+ "attribute": "endpoint",
228
+ "reflect": true
229
+ },
230
+ "limit": {
231
+ "type": "number",
232
+ "mutable": true,
233
+ "complexType": {
234
+ "original": "number",
235
+ "resolved": "number",
236
+ "references": {}
237
+ },
238
+ "required": false,
239
+ "optional": false,
240
+ "docs": {
241
+ "tags": [],
242
+ "text": "User Session"
243
+ },
244
+ "attribute": "limit",
245
+ "reflect": true
246
+ },
247
+ "secondaryArrowsActive": {
248
+ "type": "boolean",
249
+ "mutable": true,
250
+ "complexType": {
251
+ "original": "boolean",
252
+ "resolved": "boolean",
253
+ "references": {}
254
+ },
255
+ "required": false,
256
+ "optional": false,
257
+ "docs": {
258
+ "tags": [],
259
+ "text": "Customize pagination: Activate pagination secondary arrows"
260
+ },
261
+ "attribute": "secondary-arrows-active",
262
+ "reflect": true,
263
+ "defaultValue": "true"
264
+ },
265
+ "displayPageNumbers": {
266
+ "type": "boolean",
267
+ "mutable": true,
268
+ "complexType": {
269
+ "original": "boolean",
270
+ "resolved": "boolean",
271
+ "references": {}
272
+ },
273
+ "required": false,
274
+ "optional": false,
275
+ "docs": {
276
+ "tags": [],
277
+ "text": "Customize pagination: Activate pagination numbered navigation"
278
+ },
279
+ "attribute": "display-page-numbers",
280
+ "reflect": true,
281
+ "defaultValue": "false"
282
+ },
283
+ "pageLimitOptions": {
284
+ "type": "string",
285
+ "mutable": true,
286
+ "complexType": {
287
+ "original": "string",
288
+ "resolved": "string",
289
+ "references": {}
290
+ },
291
+ "required": false,
292
+ "optional": false,
293
+ "docs": {
294
+ "tags": [],
295
+ "text": "Customize page list options, default: 10,25,50"
296
+ },
297
+ "attribute": "page-limit-options",
298
+ "reflect": true,
299
+ "defaultValue": "'10,25,50'"
300
+ },
301
+ "currencyPrecision": {
302
+ "type": "number",
303
+ "mutable": true,
304
+ "complexType": {
305
+ "original": "number",
306
+ "resolved": "number",
307
+ "references": {}
308
+ },
309
+ "required": false,
310
+ "optional": false,
311
+ "docs": {
312
+ "tags": [],
313
+ "text": "Customize currency precision for rakeback, default: 2"
314
+ },
315
+ "attribute": "currency-precision",
316
+ "reflect": true,
317
+ "defaultValue": "2"
318
+ },
319
+ "enableRakeback": {
320
+ "type": "boolean",
321
+ "mutable": true,
322
+ "complexType": {
323
+ "original": "boolean",
324
+ "resolved": "boolean",
325
+ "references": {}
326
+ },
327
+ "required": false,
328
+ "optional": false,
329
+ "docs": {
330
+ "tags": [],
331
+ "text": "Customize if show the rakeback tab"
332
+ },
333
+ "attribute": "enable-rakeback",
334
+ "reflect": true,
335
+ "defaultValue": "true"
336
+ },
337
+ "language": {
338
+ "type": "string",
339
+ "mutable": false,
340
+ "complexType": {
341
+ "original": "string",
342
+ "resolved": "string",
343
+ "references": {}
344
+ },
345
+ "required": false,
346
+ "optional": false,
347
+ "docs": {
348
+ "tags": [],
349
+ "text": "Language of the widget"
350
+ },
351
+ "attribute": "language",
352
+ "reflect": true,
353
+ "defaultValue": "'en'"
354
+ },
355
+ "mbSource": {
356
+ "type": "string",
357
+ "mutable": false,
358
+ "complexType": {
359
+ "original": "string",
360
+ "resolved": "string",
361
+ "references": {}
362
+ },
363
+ "required": false,
364
+ "optional": false,
365
+ "docs": {
366
+ "tags": [],
367
+ "text": "Client custom styling via streamStyling"
368
+ },
369
+ "attribute": "mb-source",
370
+ "reflect": true
371
+ },
372
+ "clientStyling": {
373
+ "type": "string",
374
+ "mutable": false,
375
+ "complexType": {
376
+ "original": "string",
377
+ "resolved": "string",
378
+ "references": {}
379
+ },
380
+ "required": false,
381
+ "optional": false,
382
+ "docs": {
383
+ "tags": [],
384
+ "text": "Client custom styling via string"
385
+ },
386
+ "attribute": "client-styling",
387
+ "reflect": true,
388
+ "defaultValue": "''"
389
+ },
390
+ "clientStylingUrl": {
391
+ "type": "string",
392
+ "mutable": false,
393
+ "complexType": {
394
+ "original": "string",
395
+ "resolved": "string",
396
+ "references": {}
397
+ },
398
+ "required": false,
399
+ "optional": false,
400
+ "docs": {
401
+ "tags": [],
402
+ "text": "Client custom styling via url"
403
+ },
404
+ "attribute": "client-styling-url",
405
+ "reflect": true,
406
+ "defaultValue": "''"
407
+ },
408
+ "translationUrl": {
409
+ "type": "string",
410
+ "mutable": false,
411
+ "complexType": {
412
+ "original": "string",
413
+ "resolved": "string",
414
+ "references": {}
415
+ },
416
+ "required": false,
417
+ "optional": false,
418
+ "docs": {
419
+ "tags": [],
420
+ "text": "translation via url"
421
+ },
422
+ "attribute": "translation-url",
423
+ "reflect": true,
424
+ "defaultValue": "''"
425
+ }
426
+ };
427
+ }
428
+ static get states() {
429
+ return {
430
+ "locale": {},
431
+ "type": {},
432
+ "pageSetting": {},
433
+ "pointsWallets": {},
434
+ "validWallets": {}
435
+ };
436
+ }
437
+ static get events() {
438
+ return [{
439
+ "method": "paginationReset",
440
+ "name": "paginationReset",
441
+ "bubbles": true,
442
+ "cancelable": true,
443
+ "composed": true,
444
+ "docs": {
445
+ "tags": [],
446
+ "text": ""
447
+ },
448
+ "complexType": {
449
+ "original": "any",
450
+ "resolved": "any",
451
+ "references": {}
452
+ }
453
+ }];
454
+ }
455
+ static get watchers() {
456
+ return [{
457
+ "propName": "type",
458
+ "methodName": "walletTypeChangedHandler"
459
+ }, {
460
+ "propName": "endpoint",
461
+ "methodName": "updateWallets"
462
+ }, {
463
+ "propName": "language",
464
+ "methodName": "updateWallets"
465
+ }, {
466
+ "propName": "session",
467
+ "methodName": "updateWallets"
468
+ }];
469
+ }
470
+ static get listeners() {
471
+ return [{
472
+ "name": "reloadPageByType",
473
+ "method": "reloadPageByTypeHandler",
474
+ "target": undefined,
475
+ "capture": false,
476
+ "passive": false
477
+ }];
478
+ }
479
+ }
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,9 @@
1
+ import { h } from "@stencil/core";
2
+ import { WalletType } from "../utils/types";
3
+ export const renderTabs = (locale, type, onChangeTab) => h("div", { class: "Tabs Row" }, Object.keys(WalletType).map(key => {
4
+ const isActive = key === type;
5
+ const cssActive = isActive ? 'active' : '';
6
+ return (h("div", null, h("div", { class: `TabText ${cssActive}`, onClick: () => {
7
+ onChangeTab(key);
8
+ } }, locale.tabTitle[key]), h("div", { class: `TabBorderBottom ${cssActive}` })));
9
+ }));
@@ -0,0 +1,4 @@
1
+ import { h } from "@stencil/core";
2
+ import backSvg from "../static/back.svg";
3
+ import menuSvg from "../static/menu.svg";
4
+ export const renderTopBar = (locale, type, pageSetting) => h("div", { class: "TopBarContainer" }, h("div", { class: "BackImageContainer" }, h("span", { class: "BackImage", innerHTML: backSvg })), h("div", { class: "TitleContainer" }, h("div", { class: "Title", title: locale.barTitle[type] }, locale.barTitle[type]), h("div", { class: 'Limits' }, h("bonus-pagination-limits", { pageLimitOptions: pageSetting.pageLimitOptions, limit: pageSetting.limit }))), h("div", null, h("span", { class: "MenuImage", innerHTML: menuSvg })));
@@ -0,0 +1,43 @@
1
+ import { Fragment, h } from "@stencil/core";
2
+ import { WalletType } from "../utils/types";
3
+ export const WalletItem = ({ locale, wallet, walletType, isRakeback }) => {
4
+ if (walletType === WalletType.history) {
5
+ return h("div", { class: "RecordContainer" }, wallet.payload &&
6
+ h("div", { class: "Row" }, h("div", { class: "Title" }, wallet.payload.displayName), h("div", { class: `Amount ${getAmountConfig(wallet.points).class}` }, h("span", { class: "HistoryPoints" }, Math.abs(wallet.points), " ", locale.coins))), h("div", { class: "Row" }, h("div", { class: wallet.payload ? 'PointType' : 'Title' }, locale.pointType[wallet.pointType] || wallet.pointType), !wallet.payload &&
7
+ h("div", { class: `Amount ${getAmountConfig(wallet.points).class}` }, h("span", { class: "HistoryPoints" }, Math.abs(wallet.points), " ", locale.coins))), h("div", { class: "Row" }, h("div", { class: "DateTime" }, formatDate(new Date(wallet.modified)))));
8
+ }
9
+ else {
10
+ return (h("div", { class: "RecordContainer" }, h("div", { class: `Row ${wallet.pointType}` }, h("div", { class: "Title" }, (isRakeback ? locale.rakebackPointType[wallet.pointType] : locale.pointType[wallet.pointType]) || wallet.pointType), h("div", { class: `Amount ${getAmountConfig(wallet.points).class}` }, h("span", { class: "Points" }, getAmountConfig(wallet.points).symbol, " ", isRakeback ? wallet.pointAsString : wallet.points, " "), isRakeback && h("span", null, " ", wallet.currency))), h("div", { class: "Row" }, h("div", { class: "DateTime" }, formatDate(new Date(wallet.modified))))));
11
+ }
12
+ };
13
+ export const renderWallets = (locale, wallets, pageSetting) => wallets && (h(Fragment, null, h("div", { class: "Records" }, wallets.map(wallet => h(WalletItem, { locale: locale, wallet: wallet, walletType: pageSetting.tableId, isRakeback: pageSetting.tableId === WalletType.rakeback }))), h("div", { class: "PaginationContainer" }, h("bonus-pagination-nav", { offset: pageSetting.offset, limit: pageSetting.limit, displayPageNumbers: pageSetting.displayPageNumbers, tableId: pageSetting.tableId, secondaryArrowsActive: pageSetting.secondaryArrowsActive, total: pageSetting.total }))));
14
+ const getAmountConfig = (amount) => {
15
+ if (amount > 0) {
16
+ return {
17
+ class: 'Positive',
18
+ symbol: '+'
19
+ };
20
+ }
21
+ else {
22
+ return {
23
+ class: 'Negative',
24
+ symbol: ''
25
+ };
26
+ }
27
+ };
28
+ const padTo2Digits = (num) => {
29
+ return num.toString().padStart(2, '0');
30
+ };
31
+ const formatDate = (date) => {
32
+ return ([
33
+ date.getFullYear(),
34
+ padTo2Digits(date.getMonth() + 1),
35
+ padTo2Digits(date.getDate()),
36
+ ].join('-') +
37
+ ' ' +
38
+ [
39
+ padTo2Digits(date.getHours()),
40
+ padTo2Digits(date.getMinutes()),
41
+ padTo2Digits(date.getSeconds()),
42
+ ].join(':'));
43
+ };
@@ -0,0 +1,3 @@
1
+ <svg width="9" height="15" viewBox="0 0 9 15" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M7.75 1L1.25 7.5L7.75 14" stroke="#242424" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>
@@ -0,0 +1,5 @@
1
+ <svg width="30" height="8" viewBox="0 0 30 8" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <circle cx="4" cy="4" r="4" fill="black"/>
3
+ <circle cx="15" cy="4" r="4" fill="black"/>
4
+ <circle cx="26" cy="4" r="4" fill="black"/>
5
+ </svg>
@@ -0,0 +1,17 @@
1
+ import { fetcher, getUrl } from "./fetch";
2
+ import { WalletType } from "./types";
3
+ export const getWallets = async (endpoint, language, type, session, pageSetting) => {
4
+ const params = {
5
+ type,
6
+ language,
7
+ pagination: `offset=${pageSetting.offset},limit=${pageSetting.limit}`
8
+ };
9
+ const url = getUrl(endpoint + getUriByWalletType(params.type), params);
10
+ const res = await fetcher(url, {
11
+ headers: {
12
+ 'x-SessionId': session
13
+ }
14
+ });
15
+ return res;
16
+ };
17
+ const getUriByWalletType = (type) => `/v1/elevate/${type == WalletType.history ? 'redeemHistory' : 'pointsHistory'}`;
@@ -0,0 +1,17 @@
1
+ export const getUrl = (path, params = {}) => {
2
+ return path + '?' + Object.keys(params).map(key => `${key}=${params[key]}`).join('&');
3
+ };
4
+ export const fetcher = async (input, init = {}) => {
5
+ let res;
6
+ // @ts-ignore
7
+ res = await fetch(input, init);
8
+ res = await res.text();
9
+ try {
10
+ res = JSON.parse(res);
11
+ }
12
+ catch (e) {
13
+ console.error(e);
14
+ throw e;
15
+ }
16
+ return res;
17
+ };
@@ -0,0 +1,62 @@
1
+ export const translation = {
2
+ "en": {
3
+ "tabTitle": {
4
+ "spendable": "Coins",
5
+ "loyalty": "XP",
6
+ "history": "Shop Purchases",
7
+ "rakeback": "Rakeback"
8
+ },
9
+ "barTitle": {
10
+ "spendable": "Coins History",
11
+ "loyalty": "Experience Points History",
12
+ "history": "Shop Purchases",
13
+ "rakeback": "Rakebake History"
14
+ },
15
+ "bonus": "Bonus",
16
+ "coins": "Coins",
17
+ "noContent": "No Content",
18
+ "loading": "Loading",
19
+ "redeem": "Redeem",
20
+ "reload": "Reload",
21
+ "reloadMsgWhenError": "Network Problem, please ",
22
+ "rakebackPointType": {
23
+ "wageringByRealMoney": "Rakeback Casino Real Wager",
24
+ "bonus": "Rakeback Claim",
25
+ "vendor2User": "Rakeback Claim",
26
+ "cancelledWageringByRealMoney": "Cancelled Rakeback Casino Real Wager"
27
+ },
28
+ "pointType": {
29
+ "registration": "Registration",
30
+ "cancelledRegistration": "Cancelled Registration",
31
+ "expiredRegistration": "Expired Registration",
32
+ "manual": "Manual",
33
+ "cancelledManual": "Cancelled Manual",
34
+ "expiredManual": "Expired Manual",
35
+ "wageringByRealMoney": "Real Money Wager",
36
+ "wageringByBonusMoney": "Bonus Money Wager",
37
+ "cancelledWageringByRealMoney": "Cancelled Real Money Wager",
38
+ "cancelledWageringByBonusMoney": "Cancelled Bonus Money Wager",
39
+ "expiredWageringByRealMoney": "Expired Real Money Wager",
40
+ "expiredWageringByBonusMoney": "Expired Bonus Money Wager",
41
+ "levelExpired": "Level Expiration",
42
+ "bonus": "Bonus Redeem",
43
+ "manualByTournament": "Reward from Tournaments",
44
+ "manualByPrizeEngine": "Reward from PrizeEngine",
45
+ "manualByMission": "Reward from Mission",
46
+ "manualByChallenge": "Reward from Challenge",
47
+ "cancelledManualByTournament": "Cancelled Reward from Tournaments",
48
+ "cancelledManualByMission": "Cancelled Reward from Mission",
49
+ "cancelledManualByChallenge": "Cancelled Reward from Challenge",
50
+ "expiredManualByTournament": "Expired Reward from Tournaments",
51
+ "expiredManualByMission": "Expired Reward from Mission",
52
+ "expiredManualByChallenge": "Expired Reward from Challenge",
53
+ "cancelledManualByPrizeEngine": "Cancelled Reward from PrizeEngine",
54
+ "expiredManualByPrizeEngine": "Expired Reward from PrizeEngine",
55
+ "prizeEngine": "PrizeEngine Redeem",
56
+ "tournamentTicket": "Tournament Ticket Redeem",
57
+ "physicalItem": "Custom Reward Redeem",
58
+ "role": "Role Assignment Redeem"
59
+ },
60
+ "tr": {}
61
+ }
62
+ };
@@ -0,0 +1,7 @@
1
+ export var WalletType;
2
+ (function (WalletType) {
3
+ WalletType["spendable"] = "spendable";
4
+ WalletType["loyalty"] = "loyalty";
5
+ WalletType["history"] = "history";
6
+ WalletType["rakeback"] = "rakeback";
7
+ })(WalletType || (WalletType = {}));