@everymatrix/gamification-dropdown 1.43.4 → 1.54.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 (77) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/gamification-dropdown-0fd9c5b8.js +186 -0
  3. package/dist/cjs/gamification-dropdown.cjs.js +17 -11
  4. package/dist/cjs/gamification-dropdown_4.cjs.entry.js +408 -528
  5. package/dist/cjs/index-c535ed72.js +1796 -0
  6. package/dist/cjs/index.cjs.js +8 -0
  7. package/dist/cjs/loader.cjs.js +7 -13
  8. package/dist/cjs/{player-elevate-card-items-1cb6488c.js → player-elevate-card-items-42538012.js} +195 -180
  9. package/dist/cjs/player-elevate-card.cjs.entry.js +71 -70
  10. package/dist/cjs/player-elevate-pointcard.cjs.entry.js +79 -78
  11. package/dist/collection/collection-manifest.json +3 -3
  12. package/dist/collection/components/gamification-dropdown/gamification-dropdown.js +272 -257
  13. package/dist/collection/components/gamification-dropdown/index.js +1 -0
  14. package/dist/collection/index.js +1 -1
  15. package/dist/collection/utils/locale.utils.js +34 -34
  16. package/dist/collection/utils/utils.js +1 -1
  17. package/dist/esm/app-globals-0f993ce5.js +3 -0
  18. package/dist/esm/gamification-dropdown-ae7b7c69.js +184 -0
  19. package/dist/esm/gamification-dropdown.js +14 -11
  20. package/dist/esm/gamification-dropdown_4.entry.js +408 -528
  21. package/dist/esm/index-ea7720e4.js +1766 -0
  22. package/dist/esm/index.js +2 -1
  23. package/dist/esm/loader.js +7 -13
  24. package/dist/esm/{player-elevate-card-items-5bf07fe3.js → player-elevate-card-items-9d490a3b.js} +196 -180
  25. package/dist/esm/player-elevate-card.entry.js +71 -70
  26. package/dist/esm/player-elevate-pointcard.entry.js +79 -78
  27. package/dist/gamification-dropdown/gamification-dropdown.esm.js +1 -1
  28. package/dist/gamification-dropdown/index.esm.js +1 -0
  29. package/dist/gamification-dropdown/p-10486e5b.entry.js +1 -0
  30. package/dist/gamification-dropdown/p-21507480.js +1 -0
  31. package/dist/gamification-dropdown/p-3f7623db.js +2 -0
  32. package/dist/gamification-dropdown/p-422d11f7.entry.js +1 -0
  33. package/dist/gamification-dropdown/p-4b1d42b5.entry.js +1 -0
  34. package/dist/gamification-dropdown/p-c5998a81.js +1 -0
  35. package/dist/gamification-dropdown/p-e1255160.js +1 -0
  36. package/dist/stencil.config.dev.js +15 -0
  37. package/dist/stencil.config.js +14 -19
  38. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/gamification-dropdown/.stencil/packages/stencil/gamification-dropdown/stencil.config.d.ts +2 -0
  39. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/gamification-dropdown/.stencil/packages/stencil/gamification-dropdown/stencil.config.dev.d.ts +2 -0
  40. package/dist/types/components/gamification-dropdown/gamification-dropdown.d.ts +41 -41
  41. package/dist/types/components/gamification-dropdown/index.d.ts +1 -0
  42. package/dist/types/index.d.ts +1 -1
  43. package/dist/types/stencil-public-runtime.d.ts +148 -33
  44. package/loader/cdn.js +1 -3
  45. package/loader/index.cjs.js +1 -3
  46. package/loader/index.d.ts +13 -1
  47. package/loader/index.es2017.js +1 -3
  48. package/loader/index.js +1 -3
  49. package/loader/package.json +1 -0
  50. package/package.json +11 -4
  51. package/dist/cjs/index-4aa14dda.js +0 -1717
  52. package/dist/components/gamification-dropdown.d.ts +0 -11
  53. package/dist/components/gamification-dropdown.js +0 -230
  54. package/dist/components/general-styling-wrapper.js +0 -6
  55. package/dist/components/general-styling-wrapper2.js +0 -103
  56. package/dist/components/index.d.ts +0 -26
  57. package/dist/components/index.js +0 -1
  58. package/dist/components/player-elevate-card-data.js +0 -6
  59. package/dist/components/player-elevate-card-data2.js +0 -635
  60. package/dist/components/player-elevate-card-items.js +0 -2149
  61. package/dist/components/player-elevate-card.js +0 -126
  62. package/dist/components/player-elevate-loyaltycard.js +0 -6
  63. package/dist/components/player-elevate-loyaltycard2.js +0 -129
  64. package/dist/components/player-elevate-pointcard.js +0 -135
  65. package/dist/esm/index-a803f08b.js +0 -1688
  66. package/dist/esm/polyfills/core-js.js +0 -11
  67. package/dist/esm/polyfills/css-shim.js +0 -1
  68. package/dist/esm/polyfills/dom.js +0 -79
  69. package/dist/esm/polyfills/es5-html-element.js +0 -1
  70. package/dist/esm/polyfills/index.js +0 -34
  71. package/dist/esm/polyfills/system.js +0 -6
  72. package/dist/gamification-dropdown/p-118adbd3.entry.js +0 -1
  73. package/dist/gamification-dropdown/p-1bea1936.js +0 -1
  74. package/dist/gamification-dropdown/p-727c8663.js +0 -1
  75. package/dist/gamification-dropdown/p-bf29bfd4.entry.js +0 -1
  76. package/dist/gamification-dropdown/p-cdf41413.entry.js +0 -1
  77. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/gamification-dropdown/.stencil/packages/gamification-dropdown/stencil.config.d.ts +0 -2
@@ -1,266 +1,281 @@
1
- import { Component, h, State, Prop, Watch, Element } from '@stencil/core';
2
- import { getTranslations, translate } from '../../utils/locale.utils';
3
- import '@everymatrix/player-elevate-card';
1
+ import { h } from "@stencil/core";
2
+ import { getTranslations, translate } from "../../utils/locale.utils";
3
+ import "../../../../../player-elevate-card/dist/types/index";
4
4
  export class GamificationDropdown {
5
- constructor() {
6
- /**
7
- * Language of the widget
8
- */
9
- this.language = 'en';
10
- /**
11
- * Session of the user
12
- */
13
- this.session = '';
14
- /**
15
- * Client custom styling via string
16
- */
17
- this.clientStyling = '';
18
- /**
19
- * Client custom styling via url
20
- */
21
- this.clientStylingUrl = '';
22
- /**
23
- * Translations via URL
24
- */
25
- this.translationUrl = '';
26
- this.isOpen = false;
27
- this.isLoading = false;
28
- this.stylingAppends = false;
29
- this.setClientStyling = () => {
30
- let sheet = document.createElement('style');
31
- sheet.innerHTML = this.clientStyling;
32
- this.stylingContainer.prepend(sheet);
33
- };
34
- this.setClientStylingURL = () => {
35
- let url = new URL(this.clientStylingUrl);
36
- let cssFile = document.createElement('style');
37
- fetch(url.href)
38
- .then((res) => res.text())
39
- .then((data) => {
40
- cssFile.innerHTML = data;
41
- setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
42
- })
43
- .catch((err) => {
44
- console.log('error ', err);
45
- });
46
- };
47
- this.navigateToGamification = () => {
48
- window.postMessage({ type: 'NavigateToGamification' }, window.location.href);
49
- this.isOpen = false;
50
- };
51
- this.handleOutsideClick = (event) => {
52
- const path = event.composedPath();
53
- if (!path.includes(this.el)) {
5
+ constructor() {
6
+ /**
7
+ * Language of the widget
8
+ */
9
+ this.language = 'en';
10
+ /**
11
+ * Session of the user
12
+ */
13
+ this.session = '';
14
+ /**
15
+ * Client custom styling via string
16
+ */
17
+ this.clientStyling = '';
18
+ /**
19
+ * Client custom styling via url
20
+ */
21
+ this.clientStylingUrl = '';
22
+ /**
23
+ * Translations via URL
24
+ */
25
+ this.translationUrl = '';
54
26
  this.isOpen = false;
55
- document.removeEventListener('click', this.handleOutsideClick);
56
- }
57
- };
58
- this.handleDropdownClick = (event) => {
59
- event.stopPropagation();
60
- this.isOpen = !this.isOpen;
61
- if (this.isOpen) {
62
- document.addEventListener('click', this.handleOutsideClick);
63
- }
64
- else {
65
- document.removeEventListener('click', this.handleOutsideClick);
66
- }
67
- };
68
- }
69
- handleNewTranslations() {
70
- this.isLoading = true;
71
- getTranslations(this.translationUrl).then(() => {
72
- this.isLoading = false;
73
- });
74
- }
75
- async componentWillLoad() {
76
- if (this.translationUrl.length > 2) {
77
- await getTranslations(this.translationUrl);
27
+ this.isLoading = false;
28
+ this.stylingAppends = false;
29
+ this.setClientStyling = () => {
30
+ let sheet = document.createElement('style');
31
+ sheet.innerHTML = this.clientStyling;
32
+ this.stylingContainer.prepend(sheet);
33
+ };
34
+ this.setClientStylingURL = () => {
35
+ let url = new URL(this.clientStylingUrl);
36
+ let cssFile = document.createElement('style');
37
+ fetch(url.href)
38
+ .then((res) => res.text())
39
+ .then((data) => {
40
+ cssFile.innerHTML = data;
41
+ setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
42
+ })
43
+ .catch((err) => {
44
+ console.log('error ', err);
45
+ });
46
+ };
47
+ this.navigateToGamification = () => {
48
+ window.postMessage({ type: 'NavigateToGamification' }, window.location.href);
49
+ this.isOpen = false;
50
+ };
51
+ this.handleOutsideClick = (event) => {
52
+ const path = event.composedPath();
53
+ if (!path.includes(this.el)) {
54
+ this.isOpen = false;
55
+ document.removeEventListener('click', this.handleOutsideClick);
56
+ }
57
+ };
58
+ this.handleDropdownClick = (event) => {
59
+ event.stopPropagation();
60
+ this.isOpen = !this.isOpen;
61
+ if (this.isOpen) {
62
+ document.addEventListener('click', this.handleOutsideClick);
63
+ }
64
+ else {
65
+ document.removeEventListener('click', this.handleOutsideClick);
66
+ }
67
+ };
78
68
  }
79
- if (this.endpoint && this.language) {
80
- return this.fetchPointsData();
69
+ handleNewTranslations() {
70
+ this.isLoading = true;
71
+ getTranslations(this.translationUrl).then(() => {
72
+ this.isLoading = false;
73
+ });
81
74
  }
82
- }
83
- componentDidRender() {
84
- // start custom styling area
85
- if (!this.stylingAppends && this.stylingContainer) {
86
- if (this.clientStyling)
87
- this.setClientStyling();
88
- if (this.clientStylingUrl)
89
- this.setClientStylingURL();
90
- this.stylingAppends = true;
75
+ async componentWillLoad() {
76
+ if (this.translationUrl.length > 2) {
77
+ await getTranslations(this.translationUrl);
78
+ }
79
+ if (this.endpoint && this.language) {
80
+ return this.fetchPointsData();
81
+ }
91
82
  }
92
- // end custom styling area
93
- }
94
- fetchPointsData() {
95
- let url = new URL(`${this.endpoint}/v1/elevate/playerInfo`);
96
- url.searchParams.append('language', this.language);
97
- const headers = new Headers();
98
- headers.append('X-SessionId', this.session);
99
- const options = {
100
- method: 'GET',
101
- headers
102
- };
103
- return new Promise((resolve, reject) => {
104
- this.isLoading = true;
105
- fetch(url.href, options)
106
- .then((res) => res.json())
107
- .then((data) => {
108
- var _a, _b;
109
- this.loyaltyPoints = (_b = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.level) === null || _b === void 0 ? void 0 : _b.loyaltyPoints;
110
- resolve(true);
111
- }).catch((err) => {
112
- console.error(err);
113
- reject(err);
114
- }).finally(() => {
115
- this.isLoading = false;
116
- });
117
- });
118
- }
119
- render() {
120
- if (this.isLoading) {
121
- return null;
83
+ componentDidRender() {
84
+ // start custom styling area
85
+ if (!this.stylingAppends && this.stylingContainer) {
86
+ if (this.clientStyling)
87
+ this.setClientStyling();
88
+ if (this.clientStylingUrl)
89
+ this.setClientStylingURL();
90
+ this.stylingAppends = true;
91
+ }
92
+ // end custom styling area
93
+ }
94
+ fetchPointsData() {
95
+ let url = new URL(`${this.endpoint}/v1/elevate/playerInfo`);
96
+ url.searchParams.append('language', this.language);
97
+ const headers = new Headers();
98
+ headers.append('X-SessionId', this.session);
99
+ const options = {
100
+ method: 'GET',
101
+ headers
102
+ };
103
+ return new Promise((resolve, reject) => {
104
+ this.isLoading = true;
105
+ fetch(url.href, options)
106
+ .then((res) => res.json())
107
+ .then((data) => {
108
+ var _a, _b;
109
+ this.loyaltyPoints = (_b = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.level) === null || _b === void 0 ? void 0 : _b.loyaltyPoints;
110
+ resolve(true);
111
+ }).catch((err) => {
112
+ console.error(err);
113
+ reject(err);
114
+ }).finally(() => {
115
+ this.isLoading = false;
116
+ });
117
+ });
118
+ }
119
+ render() {
120
+ if (this.isLoading) {
121
+ return null;
122
+ }
123
+ else {
124
+ return (h("div", { ref: el => this.stylingContainer = el, class: "GamificationDropdownContainer" }, h("button", { class: `GamificationDropdownButton ${this.isOpen ? 'IsOpen' : ''}`, type: "button", onClick: (e) => this.handleDropdownClick(e), title: typeof this.loyaltyPoints === 'number'
125
+ ? String(this.loyaltyPoints)
126
+ : translate('gamificationNoPoints', this.language) }, typeof this.loyaltyPoints === 'number'
127
+ ? `${this.loyaltyPoints} XP`
128
+ : '...', h("span", { class: this.isOpen ? 'TriangleActive' : 'TriangleInactive' }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "14", height: "6.835", viewBox: "0 0 14 6.835" }, h("path", { id: "arrow", d: "M281.541,447.921a.488.488,0,0,0,.295-.122l6.5-5.851a.488.488,0,1,0-.65-.726l-6.176,5.556-6.176-5.556h0a.488.488,0,1,0-.65.726l6.5,5.851a.488.488,0,0,0,.355.122Z", transform: "translate(-274.511 -441.088)" })))), this.isOpen && (h("div", { class: "GamificationDropdown", onClick: this.navigateToGamification }, h("player-elevate-loyaltycard", { endpoint: this.endpoint, session: this.session, language: this.language, "client-styling-url": this.clientStylingUrl, "client-styling": this.clientStyling })))));
129
+ }
130
+ }
131
+ static get is() { return "gamification-dropdown"; }
132
+ static get encapsulation() { return "shadow"; }
133
+ static get originalStyleUrls() {
134
+ return {
135
+ "$": ["gamification-dropdown.scss"]
136
+ };
137
+ }
138
+ static get styleUrls() {
139
+ return {
140
+ "$": ["gamification-dropdown.css"]
141
+ };
142
+ }
143
+ static get properties() {
144
+ return {
145
+ "endpoint": {
146
+ "type": "string",
147
+ "mutable": false,
148
+ "complexType": {
149
+ "original": "string",
150
+ "resolved": "string",
151
+ "references": {}
152
+ },
153
+ "required": false,
154
+ "optional": false,
155
+ "docs": {
156
+ "tags": [],
157
+ "text": "Endpoint URL for the source of data"
158
+ },
159
+ "getter": false,
160
+ "setter": false,
161
+ "attribute": "endpoint",
162
+ "reflect": true
163
+ },
164
+ "language": {
165
+ "type": "string",
166
+ "mutable": false,
167
+ "complexType": {
168
+ "original": "string",
169
+ "resolved": "string",
170
+ "references": {}
171
+ },
172
+ "required": false,
173
+ "optional": false,
174
+ "docs": {
175
+ "tags": [],
176
+ "text": "Language of the widget"
177
+ },
178
+ "getter": false,
179
+ "setter": false,
180
+ "attribute": "language",
181
+ "reflect": true,
182
+ "defaultValue": "'en'"
183
+ },
184
+ "session": {
185
+ "type": "string",
186
+ "mutable": false,
187
+ "complexType": {
188
+ "original": "string",
189
+ "resolved": "string",
190
+ "references": {}
191
+ },
192
+ "required": false,
193
+ "optional": false,
194
+ "docs": {
195
+ "tags": [],
196
+ "text": "Session of the user"
197
+ },
198
+ "getter": false,
199
+ "setter": false,
200
+ "attribute": "session",
201
+ "reflect": true,
202
+ "defaultValue": "''"
203
+ },
204
+ "clientStyling": {
205
+ "type": "string",
206
+ "mutable": false,
207
+ "complexType": {
208
+ "original": "string",
209
+ "resolved": "string",
210
+ "references": {}
211
+ },
212
+ "required": false,
213
+ "optional": false,
214
+ "docs": {
215
+ "tags": [],
216
+ "text": "Client custom styling via string"
217
+ },
218
+ "getter": false,
219
+ "setter": false,
220
+ "attribute": "client-styling",
221
+ "reflect": true,
222
+ "defaultValue": "''"
223
+ },
224
+ "clientStylingUrl": {
225
+ "type": "string",
226
+ "mutable": false,
227
+ "complexType": {
228
+ "original": "string",
229
+ "resolved": "string",
230
+ "references": {}
231
+ },
232
+ "required": false,
233
+ "optional": false,
234
+ "docs": {
235
+ "tags": [],
236
+ "text": "Client custom styling via url"
237
+ },
238
+ "getter": false,
239
+ "setter": false,
240
+ "attribute": "client-styling-url",
241
+ "reflect": true,
242
+ "defaultValue": "''"
243
+ },
244
+ "translationUrl": {
245
+ "type": "string",
246
+ "mutable": false,
247
+ "complexType": {
248
+ "original": "string",
249
+ "resolved": "string",
250
+ "references": {}
251
+ },
252
+ "required": false,
253
+ "optional": false,
254
+ "docs": {
255
+ "tags": [],
256
+ "text": "Translations via URL"
257
+ },
258
+ "getter": false,
259
+ "setter": false,
260
+ "attribute": "translation-url",
261
+ "reflect": true,
262
+ "defaultValue": "''"
263
+ }
264
+ };
122
265
  }
123
- else {
124
- return (h("div", { ref: el => this.stylingContainer = el, class: "GamificationDropdownContainer" },
125
- h("button", { class: `GamificationDropdownButton ${this.isOpen ? 'IsOpen' : ''}`, type: "button", onClick: (e) => this.handleDropdownClick(e), title: typeof this.loyaltyPoints === 'number'
126
- ? String(this.loyaltyPoints)
127
- : translate('gamificationNoPoints', this.language) },
128
- typeof this.loyaltyPoints === 'number'
129
- ? `${this.loyaltyPoints} XP`
130
- : '...',
131
- h("span", { class: this.isOpen ? 'TriangleActive' : 'TriangleInactive' },
132
- h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "14", height: "6.835", viewBox: "0 0 14 6.835" },
133
- h("path", { id: "arrow", d: "M281.541,447.921a.488.488,0,0,0,.295-.122l6.5-5.851a.488.488,0,1,0-.65-.726l-6.176,5.556-6.176-5.556h0a.488.488,0,1,0-.65.726l6.5,5.851a.488.488,0,0,0,.355.122Z", transform: "translate(-274.511 -441.088)" })))),
134
- this.isOpen && (h("div", { class: "GamificationDropdown", onClick: this.navigateToGamification },
135
- h("player-elevate-loyaltycard", { endpoint: this.endpoint, session: this.session, language: this.language, "client-styling-url": this.clientStylingUrl, "client-styling": this.clientStyling })))));
266
+ static get states() {
267
+ return {
268
+ "isOpen": {},
269
+ "isLoading": {},
270
+ "stylingAppends": {},
271
+ "loyaltyPoints": {}
272
+ };
136
273
  }
137
- }
138
- static get is() { return "gamification-dropdown"; }
139
- static get encapsulation() { return "shadow"; }
140
- static get originalStyleUrls() { return {
141
- "$": ["gamification-dropdown.scss"]
142
- }; }
143
- static get styleUrls() { return {
144
- "$": ["gamification-dropdown.css"]
145
- }; }
146
- static get properties() { return {
147
- "endpoint": {
148
- "type": "string",
149
- "mutable": false,
150
- "complexType": {
151
- "original": "string",
152
- "resolved": "string",
153
- "references": {}
154
- },
155
- "required": false,
156
- "optional": false,
157
- "docs": {
158
- "tags": [],
159
- "text": "Endpoint URL for the source of data"
160
- },
161
- "attribute": "endpoint",
162
- "reflect": true
163
- },
164
- "language": {
165
- "type": "string",
166
- "mutable": false,
167
- "complexType": {
168
- "original": "string",
169
- "resolved": "string",
170
- "references": {}
171
- },
172
- "required": false,
173
- "optional": false,
174
- "docs": {
175
- "tags": [],
176
- "text": "Language of the widget"
177
- },
178
- "attribute": "language",
179
- "reflect": true,
180
- "defaultValue": "'en'"
181
- },
182
- "session": {
183
- "type": "string",
184
- "mutable": false,
185
- "complexType": {
186
- "original": "string",
187
- "resolved": "string",
188
- "references": {}
189
- },
190
- "required": false,
191
- "optional": false,
192
- "docs": {
193
- "tags": [],
194
- "text": "Session of the user"
195
- },
196
- "attribute": "session",
197
- "reflect": true,
198
- "defaultValue": "''"
199
- },
200
- "clientStyling": {
201
- "type": "string",
202
- "mutable": false,
203
- "complexType": {
204
- "original": "string",
205
- "resolved": "string",
206
- "references": {}
207
- },
208
- "required": false,
209
- "optional": false,
210
- "docs": {
211
- "tags": [],
212
- "text": "Client custom styling via string"
213
- },
214
- "attribute": "client-styling",
215
- "reflect": true,
216
- "defaultValue": "''"
217
- },
218
- "clientStylingUrl": {
219
- "type": "string",
220
- "mutable": false,
221
- "complexType": {
222
- "original": "string",
223
- "resolved": "string",
224
- "references": {}
225
- },
226
- "required": false,
227
- "optional": false,
228
- "docs": {
229
- "tags": [],
230
- "text": "Client custom styling via url"
231
- },
232
- "attribute": "client-styling-url",
233
- "reflect": true,
234
- "defaultValue": "''"
235
- },
236
- "translationUrl": {
237
- "type": "string",
238
- "mutable": false,
239
- "complexType": {
240
- "original": "string",
241
- "resolved": "string",
242
- "references": {}
243
- },
244
- "required": false,
245
- "optional": false,
246
- "docs": {
247
- "tags": [],
248
- "text": "Translations via URL"
249
- },
250
- "attribute": "translation-url",
251
- "reflect": true,
252
- "defaultValue": "''"
274
+ static get elementRef() { return "el"; }
275
+ static get watchers() {
276
+ return [{
277
+ "propName": "translationUrl",
278
+ "methodName": "handleNewTranslations"
279
+ }];
253
280
  }
254
- }; }
255
- static get states() { return {
256
- "isOpen": {},
257
- "isLoading": {},
258
- "stylingAppends": {},
259
- "loyaltyPoints": {}
260
- }; }
261
- static get elementRef() { return "el"; }
262
- static get watchers() { return [{
263
- "propName": "translationUrl",
264
- "methodName": "handleNewTranslations"
265
- }]; }
266
281
  }
@@ -0,0 +1 @@
1
+ export { GamificationDropdown } from './gamification-dropdown';
@@ -1 +1 @@
1
- export * from './components';
1
+ export * from './components/gamification-dropdown';
@@ -1,42 +1,42 @@
1
1
  const DEFAULT_LANGUAGE = 'en';
2
2
  let TRANSLATIONS = {
3
- en: {
4
- gamificationNoPoints: "No points"
5
- },
6
- de: {
7
- gamificationNoPoints: "No points"
8
- },
9
- ro: {
10
- gamificationNoPoints: "No points"
11
- },
12
- fr: {
13
- gamificationNoPoints: "No points"
14
- },
15
- ar: {
16
- gamificationNoPoints: "No points"
17
- },
18
- hr: {
19
- gamificationNoPoints: "No points"
20
- }
3
+ en: {
4
+ gamificationNoPoints: "No points"
5
+ },
6
+ de: {
7
+ gamificationNoPoints: "No points"
8
+ },
9
+ ro: {
10
+ gamificationNoPoints: "No points"
11
+ },
12
+ fr: {
13
+ gamificationNoPoints: "No points"
14
+ },
15
+ ar: {
16
+ gamificationNoPoints: "No points"
17
+ },
18
+ hr: {
19
+ gamificationNoPoints: "No points"
20
+ }
21
21
  };
22
22
  export const getTranslations = (url) => {
23
- return new Promise((resolve) => {
24
- fetch(url)
25
- .then((res) => res.json())
26
- .then((data) => {
27
- Object.keys(data).forEach((lang) => {
28
- if (!TRANSLATIONS[lang]) {
29
- TRANSLATIONS[lang] = {};
30
- }
31
- for (let key in data[lang]) {
32
- TRANSLATIONS[lang][key] = data[lang][key];
33
- }
34
- });
35
- resolve(true);
23
+ return new Promise((resolve) => {
24
+ fetch(url)
25
+ .then((res) => res.json())
26
+ .then((data) => {
27
+ Object.keys(data).forEach((lang) => {
28
+ if (!TRANSLATIONS[lang]) {
29
+ TRANSLATIONS[lang] = {};
30
+ }
31
+ for (let key in data[lang]) {
32
+ TRANSLATIONS[lang][key] = data[lang][key];
33
+ }
34
+ });
35
+ resolve(true);
36
+ });
36
37
  });
37
- });
38
38
  };
39
39
  export const translate = (key, customLang) => {
40
- const lang = customLang;
41
- return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
40
+ const lang = customLang;
41
+ return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
42
42
  };
@@ -1,3 +1,3 @@
1
1
  export function format(first, middle, last) {
2
- return ((first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : ''));
2
+ return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');
3
3
  }
@@ -0,0 +1,3 @@
1
+ const globalScripts = () => {};
2
+
3
+ export { globalScripts as g };