@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,403 @@
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 { renderTabs } from "../../renders/renderTabs";
8
+ import "../../../../../general-styling-wrapper/dist/types/index";
9
+ import "../../../../../../svelte/general-animation-loading/es2015/general-animation-loading";
10
+ import "../../../../../player-elevate-card/dist/types/index";
11
+ import "../../../../../bonus-pagination-limits/dist/types/index";
12
+ import "../../../../../bonus-pagination-nav/dist/types/index";
13
+ export class PlayerElevatePointsHistory {
14
+ constructor() {
15
+ this.playerAvatarUrl = undefined;
16
+ this.session = undefined;
17
+ this.endpoint = undefined;
18
+ this.limit = undefined;
19
+ this.secondaryArrowsActive = true;
20
+ this.displayPageNumbers = false;
21
+ this.pageLimitOptions = '10,25,50';
22
+ this.language = 'en';
23
+ this.clientStyling = '';
24
+ this.clientStylingUrl = '';
25
+ this.translationUrl = '';
26
+ this.locale = translation['en'];
27
+ this.type = WalletType.spendable;
28
+ this.pageSetting = undefined;
29
+ this.pointsWallets = {};
30
+ }
31
+ switchTab(type) {
32
+ var _a, _b;
33
+ this.type = type;
34
+ if (this.pointsWallets[type] || !((_a = this.pointsWallets[type]) === null || _a === void 0 ? void 0 : _a.isLoadFailed)) {
35
+ return;
36
+ }
37
+ this.paginationReset.emit({ limit: ((_b = this.pointsWallets[type]) === null || _b === void 0 ? void 0 : _b.pageSetting.limit) || this.limit, tableId: this.type });
38
+ }
39
+ getPageSettingByType(type) {
40
+ return this.pointsWallets[type] ? this.pointsWallets[type].pageSetting : {
41
+ limit: this.limit, total: 0, offset: 0, tableId: type,
42
+ secondaryArrowsActive: this.secondaryArrowsActive,
43
+ displayPageNumbers: this.displayPageNumbers,
44
+ pageLimitOptions: this.pageLimitOptions || undefined
45
+ };
46
+ }
47
+ loadWallets(renderer) {
48
+ if (!this.pointsWallets[this.type] || this.pointsWallets[this.type].isLoading) {
49
+ return h("general-animation-loading", null);
50
+ }
51
+ else {
52
+ if (this.pointsWallets[this.type].wallets.length === 0) {
53
+ return (h("div", { class: "NoContent" }, this.locale.noContent));
54
+ }
55
+ else {
56
+ return renderer();
57
+ }
58
+ }
59
+ }
60
+ render() {
61
+ var _a, _b;
62
+ const pageSetting = this.getPageSettingByType(this.type);
63
+ return (h("main", { key: 'a92c0b154fec4d3ce8b8e919b9af5ebd80f1d125' }, h("general-styling-wrapper", { key: '5095ab265d71f9e74f6f049b7b0b212ae11bc4da', clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl,
64
+ // @ts-ignore
65
+ targetTranslations: translation, translationUrl: this.translationUrl }), h("player-elevate-pointcard", { key: 'c471ddeccbe8e18e15935c9d106bf8c52c80a6fb', playerAvatarUrl: this.playerAvatarUrl, endpoint: this.endpoint, session: this.session, language: this.language, clientStylingUrl: this.clientStylingUrl, clientStyling: this.clientStyling, translationUrl: this.translationUrl }), h("div", { key: '5fa700aaa6e0cffe6d3d9dd8366bf9a95bba3a14', class: "PlayerElevatePointsDetaisContainer" }, [
66
+ renderTopBar(this.locale, this.type, pageSetting),
67
+ renderTabs(this.locale, this.type, (type) => this.switchTab(type)),
68
+ ((_a = this.pointsWallets[this.type]) === null || _a === void 0 ? void 0 : _a.isLoadFailed)
69
+ ? h("div", { class: 'ReloadMsg' }, this.locale['reloadMsgWhenError'], h("a", { class: 'Reload', onClick: () => { this.updateWallets(); } }, this.locale['reload']))
70
+ : this.loadWallets(renderWallets.bind(this, this.locale, ((_b = this.pointsWallets[this.type]) === null || _b === void 0 ? void 0 : _b.wallets) || [], pageSetting))
71
+ ])));
72
+ }
73
+ walletTypeChangedHandler() {
74
+ //do not reload when loaded tab switched back
75
+ if (this.pointsWallets[this.type]) {
76
+ return;
77
+ }
78
+ this.updateWallets();
79
+ }
80
+ async updateWallets() {
81
+ let pageSetting = this.pointsWallets[this.type]
82
+ ? this.pointsWallets[this.type].pageSetting
83
+ : this.getPageSettingByType(this.type);
84
+ try {
85
+ const walletsDetail = await getWallets(this.endpoint, this.language, this.type, this.session, pageSetting);
86
+ const wallets = walletsDetail.data || [];
87
+ if (walletsDetail.success) {
88
+ pageSetting.total = walletsDetail.total;
89
+ this.pointsWallets[this.type] = Object.assign(Object.assign({}, this.pointsWallets[this.type]), { wallets,
90
+ pageSetting });
91
+ this.pointsWallets = Object.assign({}, this.pointsWallets);
92
+ }
93
+ else {
94
+ console.error(walletsDetail);
95
+ this.pointsWallets[this.type].isLoadFailed = true;
96
+ //pageSetting.total = 0;
97
+ }
98
+ }
99
+ catch (e) {
100
+ console.error(e);
101
+ this.pointsWallets[this.type].isLoadFailed = true;
102
+ }
103
+ }
104
+ reloadPageByTypeHandler(event) {
105
+ if (event.detail.tableId != this.type) {
106
+ return;
107
+ }
108
+ //reset all wallets when limit changed
109
+ //otherwise fetch new data with new offset when offset changed
110
+ if (this.limit != event.detail.limit) {
111
+ this.pointsWallets = {};
112
+ this.limit = event.detail.limit;
113
+ }
114
+ else {
115
+ let pageSetting = this.pointsWallets[this.type].pageSetting || this.getPageSettingByType(this.type);
116
+ pageSetting.offset = event.detail.offset;
117
+ this.pointsWallets[this.type].pageSetting = pageSetting;
118
+ }
119
+ this.updateWallets();
120
+ }
121
+ setLimit() {
122
+ try {
123
+ const pageLimits = this.pageLimitOptions.split(',').map((item) => {
124
+ return parseInt(item);
125
+ });
126
+ if (pageLimits.includes(this.limit)) {
127
+ //do nothing
128
+ }
129
+ else {
130
+ this.limit = pageLimits[0];
131
+ }
132
+ }
133
+ catch (e) {
134
+ console.error('Error when parse PageLimitOptions', e);
135
+ this.limit = 10;
136
+ }
137
+ }
138
+ async componentWillLoad() {
139
+ this.setLimit();
140
+ this.updateWallets();
141
+ }
142
+ static get is() { return "player-elevate-points-history"; }
143
+ static get encapsulation() { return "shadow"; }
144
+ static get originalStyleUrls() {
145
+ return {
146
+ "$": ["player-elevate-points-history.scss"]
147
+ };
148
+ }
149
+ static get styleUrls() {
150
+ return {
151
+ "$": ["player-elevate-points-history.css"]
152
+ };
153
+ }
154
+ static get assetsDirs() { return ["static"]; }
155
+ static get properties() {
156
+ return {
157
+ "playerAvatarUrl": {
158
+ "type": "string",
159
+ "mutable": false,
160
+ "complexType": {
161
+ "original": "string",
162
+ "resolved": "string",
163
+ "references": {}
164
+ },
165
+ "required": false,
166
+ "optional": false,
167
+ "docs": {
168
+ "tags": [],
169
+ "text": "player avatar url"
170
+ },
171
+ "attribute": "player-avatar-url",
172
+ "reflect": true
173
+ },
174
+ "session": {
175
+ "type": "string",
176
+ "mutable": false,
177
+ "complexType": {
178
+ "original": "string",
179
+ "resolved": "string",
180
+ "references": {}
181
+ },
182
+ "required": false,
183
+ "optional": false,
184
+ "docs": {
185
+ "tags": [],
186
+ "text": "User Session"
187
+ },
188
+ "attribute": "session",
189
+ "reflect": true
190
+ },
191
+ "endpoint": {
192
+ "type": "string",
193
+ "mutable": false,
194
+ "complexType": {
195
+ "original": "string",
196
+ "resolved": "string",
197
+ "references": {}
198
+ },
199
+ "required": false,
200
+ "optional": false,
201
+ "docs": {
202
+ "tags": [],
203
+ "text": "Endpoint URL for the source of data"
204
+ },
205
+ "attribute": "endpoint",
206
+ "reflect": true
207
+ },
208
+ "limit": {
209
+ "type": "number",
210
+ "mutable": true,
211
+ "complexType": {
212
+ "original": "number",
213
+ "resolved": "number",
214
+ "references": {}
215
+ },
216
+ "required": false,
217
+ "optional": false,
218
+ "docs": {
219
+ "tags": [],
220
+ "text": "User Session"
221
+ },
222
+ "attribute": "limit",
223
+ "reflect": true
224
+ },
225
+ "secondaryArrowsActive": {
226
+ "type": "boolean",
227
+ "mutable": true,
228
+ "complexType": {
229
+ "original": "boolean",
230
+ "resolved": "boolean",
231
+ "references": {}
232
+ },
233
+ "required": false,
234
+ "optional": false,
235
+ "docs": {
236
+ "tags": [],
237
+ "text": "Customize pagination: Activate pagination secondary arrows"
238
+ },
239
+ "attribute": "secondary-arrows-active",
240
+ "reflect": true,
241
+ "defaultValue": "true"
242
+ },
243
+ "displayPageNumbers": {
244
+ "type": "boolean",
245
+ "mutable": true,
246
+ "complexType": {
247
+ "original": "boolean",
248
+ "resolved": "boolean",
249
+ "references": {}
250
+ },
251
+ "required": false,
252
+ "optional": false,
253
+ "docs": {
254
+ "tags": [],
255
+ "text": "Customize pagination: Activate pagination numbered navigation"
256
+ },
257
+ "attribute": "display-page-numbers",
258
+ "reflect": true,
259
+ "defaultValue": "false"
260
+ },
261
+ "pageLimitOptions": {
262
+ "type": "string",
263
+ "mutable": true,
264
+ "complexType": {
265
+ "original": "string",
266
+ "resolved": "string",
267
+ "references": {}
268
+ },
269
+ "required": false,
270
+ "optional": false,
271
+ "docs": {
272
+ "tags": [],
273
+ "text": "Customize page list options, default: 10,25,50"
274
+ },
275
+ "attribute": "page-limit-options",
276
+ "reflect": true,
277
+ "defaultValue": "'10,25,50'"
278
+ },
279
+ "language": {
280
+ "type": "string",
281
+ "mutable": false,
282
+ "complexType": {
283
+ "original": "string",
284
+ "resolved": "string",
285
+ "references": {}
286
+ },
287
+ "required": false,
288
+ "optional": false,
289
+ "docs": {
290
+ "tags": [],
291
+ "text": "Language of the widget"
292
+ },
293
+ "attribute": "language",
294
+ "reflect": true,
295
+ "defaultValue": "'en'"
296
+ },
297
+ "clientStyling": {
298
+ "type": "string",
299
+ "mutable": false,
300
+ "complexType": {
301
+ "original": "string",
302
+ "resolved": "string",
303
+ "references": {}
304
+ },
305
+ "required": false,
306
+ "optional": false,
307
+ "docs": {
308
+ "tags": [],
309
+ "text": "Client custom styling via string"
310
+ },
311
+ "attribute": "client-styling",
312
+ "reflect": true,
313
+ "defaultValue": "''"
314
+ },
315
+ "clientStylingUrl": {
316
+ "type": "string",
317
+ "mutable": false,
318
+ "complexType": {
319
+ "original": "string",
320
+ "resolved": "string",
321
+ "references": {}
322
+ },
323
+ "required": false,
324
+ "optional": false,
325
+ "docs": {
326
+ "tags": [],
327
+ "text": "Client custom styling via url"
328
+ },
329
+ "attribute": "client-styling-url",
330
+ "reflect": true,
331
+ "defaultValue": "''"
332
+ },
333
+ "translationUrl": {
334
+ "type": "string",
335
+ "mutable": false,
336
+ "complexType": {
337
+ "original": "string",
338
+ "resolved": "string",
339
+ "references": {}
340
+ },
341
+ "required": false,
342
+ "optional": false,
343
+ "docs": {
344
+ "tags": [],
345
+ "text": "translation via url"
346
+ },
347
+ "attribute": "translation-url",
348
+ "reflect": true,
349
+ "defaultValue": "''"
350
+ }
351
+ };
352
+ }
353
+ static get states() {
354
+ return {
355
+ "locale": {},
356
+ "type": {},
357
+ "pageSetting": {},
358
+ "pointsWallets": {}
359
+ };
360
+ }
361
+ static get events() {
362
+ return [{
363
+ "method": "paginationReset",
364
+ "name": "paginationReset",
365
+ "bubbles": true,
366
+ "cancelable": true,
367
+ "composed": true,
368
+ "docs": {
369
+ "tags": [],
370
+ "text": ""
371
+ },
372
+ "complexType": {
373
+ "original": "any",
374
+ "resolved": "any",
375
+ "references": {}
376
+ }
377
+ }];
378
+ }
379
+ static get watchers() {
380
+ return [{
381
+ "propName": "type",
382
+ "methodName": "walletTypeChangedHandler"
383
+ }, {
384
+ "propName": "endpoint",
385
+ "methodName": "updateWallets"
386
+ }, {
387
+ "propName": "language",
388
+ "methodName": "updateWallets"
389
+ }, {
390
+ "propName": "session",
391
+ "methodName": "updateWallets"
392
+ }];
393
+ }
394
+ static get listeners() {
395
+ return [{
396
+ "name": "reloadPageByType",
397
+ "method": "reloadPageByTypeHandler",
398
+ "target": undefined,
399
+ "capture": false,
400
+ "passive": false
401
+ }];
402
+ }
403
+ }
@@ -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,33 @@
1
+ import { Fragment, h } from "@stencil/core";
2
+ export const renderWallets = (locale, wallets, pageSetting) => wallets && (h(Fragment, null, h("div", { class: "Records" }, wallets.map(wallet => (h("div", { class: "RecordContainer" }, h("div", { class: "Row" }, h("div", { class: "Title" }, locale.pointType[wallet.pointType] || wallet.pointType), h("div", { class: `Amount ${getAmountConfig(wallet.points).class}` }, getAmountConfig(wallet.points).symbol, wallet.points)), wallet.payload && wallet.payload.displayName &&
3
+ h("div", { class: "Row Desc", innerHTML: wallet.payload.displayName['*'] }), h("div", { class: "Row" }, h("div", { class: "DateTime" }, formatDate(new Date(wallet.modified)))))))), 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 }))));
4
+ const getAmountConfig = (amount) => {
5
+ if (amount > 0) {
6
+ return {
7
+ class: 'Positive',
8
+ symbol: '+'
9
+ };
10
+ }
11
+ else {
12
+ return {
13
+ class: 'Negative',
14
+ symbol: ''
15
+ };
16
+ }
17
+ };
18
+ const padTo2Digits = (num) => {
19
+ return num.toString().padStart(2, '0');
20
+ };
21
+ const formatDate = (date) => {
22
+ return ([
23
+ date.getFullYear(),
24
+ padTo2Digits(date.getMonth() + 1),
25
+ padTo2Digits(date.getDate()),
26
+ ].join('-') +
27
+ ' ' +
28
+ [
29
+ padTo2Digits(date.getHours()),
30
+ padTo2Digits(date.getMinutes()),
31
+ padTo2Digits(date.getSeconds()),
32
+ ].join(':'));
33
+ };
@@ -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,36 @@
1
+ import { WalletType } from "./types";
2
+ export const translation = {
3
+ en: {
4
+ tabTitle: {
5
+ [WalletType.spendable]: 'Coins',
6
+ [WalletType.loyalty]: 'XP',
7
+ [WalletType.history]: 'Conversion History'
8
+ },
9
+ barTitle: {
10
+ [WalletType.spendable]: 'Coins History',
11
+ [WalletType.loyalty]: 'Experience Points History',
12
+ [WalletType.history]: 'Conversion History'
13
+ },
14
+ bonus: 'Bonus',
15
+ noContent: 'No Content',
16
+ redeem: 'Redeem',
17
+ reload: 'Reload',
18
+ reloadMsgWhenError: 'Network Problem, please ',
19
+ pointType: {
20
+ registration: 'Registration',
21
+ cancelledRegistration: 'Cancelled Registration',
22
+ expiredRegistration: 'Expired Registration',
23
+ manual: 'Manual',
24
+ cancelledManual: 'Cancelled Manual',
25
+ expiredManual: 'Expired Manual',
26
+ wageringByRealMoney: 'Real Money Wager',
27
+ wageringByBonusMoney: 'Bonus Money Wager',
28
+ cancelledWageringByRealMoney: 'Cancelled Real Money Wager',
29
+ cancelledWageringByBonusMoney: 'Cancelled Bonus Money Wager',
30
+ expiredWageringByRealMoney: 'Expired Real Money Wager',
31
+ expiredWageringByBonusMoney: 'Expired Bonus Money Wager',
32
+ levelExpired: 'Level Expiration',
33
+ bonus: 'Bonus Redeem',
34
+ }
35
+ }
36
+ };
@@ -0,0 +1,6 @@
1
+ export var WalletType;
2
+ (function (WalletType) {
3
+ WalletType["spendable"] = "spendable";
4
+ WalletType["loyalty"] = "loyalty";
5
+ WalletType["history"] = "history";
6
+ })(WalletType || (WalletType = {}));
@@ -0,0 +1,16 @@
1
+ function padTo2Digits(num) {
2
+ return num.toString().padStart(2, '0');
3
+ }
4
+ export function formatDate(date) {
5
+ return ([
6
+ date.getFullYear(),
7
+ padTo2Digits(date.getMonth() + 1),
8
+ padTo2Digits(date.getDate()),
9
+ ].join('-') +
10
+ ' ' +
11
+ [
12
+ padTo2Digits(date.getHours()),
13
+ padTo2Digits(date.getMinutes()),
14
+ padTo2Digits(date.getSeconds()),
15
+ ].join(':'));
16
+ }
@@ -0,0 +1,3 @@
1
+ export function format(first, middle, last) {
2
+ return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');
3
+ }
@@ -0,0 +1,3 @@
1
+ const globalScripts = () => {};
2
+
3
+ export { globalScripts as g };