@everymatrix/pam-player-profile 0.8.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.
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/index-4130c9d2.js +1227 -0
- package/dist/cjs/index.cjs.js +10 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/cjs/pam-player-profile-dc13914a.js +509 -0
- package/dist/cjs/pam-player-profile.cjs.js +25 -0
- package/dist/cjs/pam-player-profile_2.cjs.entry.js +175 -0
- package/dist/collection/collection-manifest.json +19 -0
- package/dist/collection/components/pam-player-profile/index.js +1 -0
- package/dist/collection/components/pam-player-profile/pam-player-profile.css +263 -0
- package/dist/collection/components/pam-player-profile/pam-player-profile.js +432 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +209 -0
- package/dist/collection/utils/utils.js +12 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/index-d953d051.js +1200 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/pam-player-profile-e280c440.js +507 -0
- package/dist/esm/pam-player-profile.js +20 -0
- package/dist/esm/pam-player-profile_2.entry.js +170 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/pam-player-profile/index.esm.js +1 -0
- package/dist/pam-player-profile/p-047a7a7b.js +2 -0
- package/dist/pam-player-profile/p-41838095.js +1 -0
- package/dist/pam-player-profile/p-b2438d4d.entry.js +1 -0
- package/dist/pam-player-profile/p-e1255160.js +1 -0
- package/dist/pam-player-profile/pam-player-profile.esm.js +1 -0
- package/dist/stencil.config.dev.js +16 -0
- package/dist/stencil.config.js +18 -0
- package/dist/storybook/main.js +47 -0
- package/dist/storybook/preview.js +9 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-profile/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-profile/.stencil/packages/stencil/pam-player-profile/stencil.config.d.ts +2 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-profile/.stencil/packages/stencil/pam-player-profile/stencil.config.dev.d.ts +2 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-profile/.stencil/packages/stencil/pam-player-profile/storybook/main.d.ts +3 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-profile/.stencil/packages/stencil/pam-player-profile/storybook/preview.d.ts +70 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-profile/.stencil/tools/plugins/index.d.ts +3 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-profile/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-profile/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-profile/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
- package/dist/types/components/pam-player-profile/index.d.ts +1 -0
- package/dist/types/components/pam-player-profile/pam-player-profile.d.ts +45 -0
- package/dist/types/components.d.ts +57 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1674 -0
- package/dist/types/utils/locale.utils.d.ts +23 -0
- package/dist/types/utils/utils.d.ts +7 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +26 -0
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { translate } from "../../utils/locale.utils";
|
|
3
|
+
import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
|
|
4
|
+
import { isMobile } from "../../utils/utils";
|
|
5
|
+
import "../../../../../ui-skeleton/dist/types/index";
|
|
6
|
+
import dayjs from "dayjs";
|
|
7
|
+
export class PamPlayerProfile {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.fieldsState = {};
|
|
10
|
+
this.sendLoadedMessage = () => {
|
|
11
|
+
window.postMessage({ type: 'PROFILE_LOADED' });
|
|
12
|
+
};
|
|
13
|
+
this.sendValidMessage = () => {
|
|
14
|
+
window.postMessage({ type: 'PROFILE_VALIDITY', data: this.isSubmitButtonAvailable });
|
|
15
|
+
};
|
|
16
|
+
this.sendSuccessNotification = () => {
|
|
17
|
+
window.postMessage({ type: 'WidgetNotification', data: { type: 'success', message: translate('successMessage', this.lang) } }, window.location.href);
|
|
18
|
+
};
|
|
19
|
+
this.sendErrorNotification = (errorKey) => {
|
|
20
|
+
window.postMessage({ type: 'WidgetNotification', data: { type: 'error', message: translate(errorKey, this.lang) } }, window.location.href);
|
|
21
|
+
};
|
|
22
|
+
this.sendData = () => {
|
|
23
|
+
delete this.data.contacts;
|
|
24
|
+
window.postMessage({ type: 'PROFILE_UPDATE_DATA', data: this.data }, window.location.href);
|
|
25
|
+
};
|
|
26
|
+
this.messageHandler = (message) => {
|
|
27
|
+
var _a;
|
|
28
|
+
switch ((_a = message.data) === null || _a === void 0 ? void 0 : _a.type) {
|
|
29
|
+
case 'PROFILE_DATA':
|
|
30
|
+
this.data = message.data.data;
|
|
31
|
+
this.resetState();
|
|
32
|
+
this.skeletonLoading = false;
|
|
33
|
+
break;
|
|
34
|
+
case 'PROFILE_SEND_DATA':
|
|
35
|
+
this.sendData();
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
this.getData = () => {
|
|
40
|
+
const url = new URL(`api/v1/players/${this.userId}/player-identifiable-information`, this.endpoint);
|
|
41
|
+
const headers = new Headers();
|
|
42
|
+
headers.append('X-SessionID', this.session);
|
|
43
|
+
const options = {
|
|
44
|
+
method: 'GET',
|
|
45
|
+
headers: headers
|
|
46
|
+
};
|
|
47
|
+
return new Promise((resolve) => {
|
|
48
|
+
fetch(url.href, options)
|
|
49
|
+
.then(res => {
|
|
50
|
+
if (res.ok) {
|
|
51
|
+
return res.json();
|
|
52
|
+
}
|
|
53
|
+
this.sendErrorNotification('errorMessageFetch');
|
|
54
|
+
})
|
|
55
|
+
.then(res => {
|
|
56
|
+
this.data = res.player;
|
|
57
|
+
resolve();
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
this.buildFieldState = (isValid, initialValue, rule) => Object.assign({ 'isValid': isValid, 'initialValue': initialValue, 'rule': rule });
|
|
62
|
+
this.initData = () => {
|
|
63
|
+
const data = {};
|
|
64
|
+
['externalPlayerId',
|
|
65
|
+
'affiliateMarker',
|
|
66
|
+
'personalInfo',
|
|
67
|
+
'communicationInfo',
|
|
68
|
+
'signupInfo',
|
|
69
|
+
'statusInfo',
|
|
70
|
+
'securityInfo',
|
|
71
|
+
'geographicInfo',
|
|
72
|
+
'playerInfo',
|
|
73
|
+
'contacts' // we need this because username is only sent in contacts section atm :(
|
|
74
|
+
].forEach(key => data[key] = this.data[key]);
|
|
75
|
+
this.data = data;
|
|
76
|
+
};
|
|
77
|
+
this.updateState = (sectionKey, fieldKey) => (e) => {
|
|
78
|
+
this.data[sectionKey][fieldKey] = e.target.value;
|
|
79
|
+
const fieldState = this.fieldsState['data'][fieldKey];
|
|
80
|
+
const value = e.target.value;
|
|
81
|
+
const passedRuleCheck = fieldState.rule(value);
|
|
82
|
+
if (passedRuleCheck && !fieldState.isValid) {
|
|
83
|
+
fieldState.isValid = true;
|
|
84
|
+
this.invalidFields -= 1;
|
|
85
|
+
}
|
|
86
|
+
else if (!passedRuleCheck && fieldState.isValid) {
|
|
87
|
+
fieldState.isValid = false;
|
|
88
|
+
this.invalidFields += 1;
|
|
89
|
+
}
|
|
90
|
+
this.fieldsState['hasChanged'] = value !== fieldState.initialValue;
|
|
91
|
+
const previous = this.isSubmitButtonAvailable;
|
|
92
|
+
this.updateSubmitButtonStatus();
|
|
93
|
+
if (this.isStandAlone !== 'true' && this.isSubmitButtonAvailable !== previous) {
|
|
94
|
+
this.sendValidMessage();
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
this.updateData = (e) => {
|
|
98
|
+
if (e)
|
|
99
|
+
e.preventDefault();
|
|
100
|
+
const url = new URL(`/api/v1/players/${this.userId}/player-identifiable-information`, this.endpoint);
|
|
101
|
+
const headers = new Headers();
|
|
102
|
+
headers.append('X-SessionId', this.session);
|
|
103
|
+
headers.append('Content-Type', 'application/problem+json; charset=utf-8');
|
|
104
|
+
if (this.data.contacts)
|
|
105
|
+
delete this.data.contacts;
|
|
106
|
+
const reqParams = {
|
|
107
|
+
method: 'PUT',
|
|
108
|
+
headers,
|
|
109
|
+
body: JSON.stringify(this.data)
|
|
110
|
+
};
|
|
111
|
+
fetch(url, reqParams)
|
|
112
|
+
.then(res => {
|
|
113
|
+
if (!res.ok) {
|
|
114
|
+
return this.sendErrorNotification('errorMessageUpdate');
|
|
115
|
+
}
|
|
116
|
+
this.sendSuccessNotification();
|
|
117
|
+
this.getData().then(() => this.resetState());
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
this.updateSubmitButtonStatus = () => {
|
|
121
|
+
this.isSubmitButtonAvailable = this.invalidFields === 0 && this.fieldsState.hasChanged;
|
|
122
|
+
};
|
|
123
|
+
this.editableField = (sectionKey, fieldKey, labelTranslationKey, errorTranslationKey) => {
|
|
124
|
+
const fieldState = this.fieldsState['data'][fieldKey];
|
|
125
|
+
const value = this.data[sectionKey][fieldKey];
|
|
126
|
+
if (fieldState) {
|
|
127
|
+
return (h("div", { class: `Field ${fieldState.isValid ? '' : 'Invalid'}` }, h("label", null, translate(labelTranslationKey, this.lang)), h("input", { type: "text", value: value, onKeyUp: this.updateState(sectionKey, fieldKey) }), !fieldState.isValid &&
|
|
128
|
+
h("p", { class: "Error" }, translate(errorTranslationKey, this.lang))));
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
this.staticField = (value, labelTranslationKey) => {
|
|
135
|
+
if (value) {
|
|
136
|
+
return (h("div", { class: "Field Disabled" }, h("label", null, translate(labelTranslationKey, this.lang)), h("input", { type: "text", value: value, readonly: true })));
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
this.toggleScreen = () => {
|
|
143
|
+
window.postMessage({ type: 'PlayerAccountMenuActive', isMobile: this.isMobile }, window.location.href);
|
|
144
|
+
};
|
|
145
|
+
this.userId = undefined;
|
|
146
|
+
this.session = undefined;
|
|
147
|
+
this.endpoint = undefined;
|
|
148
|
+
this.lang = 'en';
|
|
149
|
+
this.mbSource = undefined;
|
|
150
|
+
this.clientStyling = undefined;
|
|
151
|
+
this.clientStylingUrl = undefined;
|
|
152
|
+
this.translationUrl = undefined;
|
|
153
|
+
this.dobFormat = 'DD/MM/YYYY';
|
|
154
|
+
this.isStandAlone = 'true';
|
|
155
|
+
this.limitStylingAppends = false;
|
|
156
|
+
this.skeletonLoading = true;
|
|
157
|
+
this.isSubmitButtonAvailable = false;
|
|
158
|
+
this.invalidFields = 0;
|
|
159
|
+
this.isMobile = isMobile(window.navigator.userAgent);
|
|
160
|
+
}
|
|
161
|
+
handleStylingChange(newValue, oldValue) {
|
|
162
|
+
if (newValue !== oldValue)
|
|
163
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
164
|
+
}
|
|
165
|
+
handleStylingUrlChange(newValue, oldValue) {
|
|
166
|
+
if (newValue !== oldValue)
|
|
167
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
168
|
+
}
|
|
169
|
+
async componentWillLoad() {
|
|
170
|
+
if (this.isStandAlone !== 'true') {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
await this.getData()
|
|
174
|
+
.then(() => {
|
|
175
|
+
this.initData();
|
|
176
|
+
this.initEditableFieldsState();
|
|
177
|
+
})
|
|
178
|
+
.finally(() => this.skeletonLoading = false);
|
|
179
|
+
}
|
|
180
|
+
componentDidLoad() {
|
|
181
|
+
if (this.stylingContainer) {
|
|
182
|
+
if (window.emMessageBuss != undefined) {
|
|
183
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
if (this.clientStyling)
|
|
187
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
188
|
+
if (this.clientStylingUrl)
|
|
189
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (this.isStandAlone !== 'true') {
|
|
193
|
+
window.addEventListener('message', this.messageHandler, false);
|
|
194
|
+
this.sendLoadedMessage();
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
disconnectedCallback() {
|
|
198
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
199
|
+
if (this.isStandAlone !== 'true')
|
|
200
|
+
window.removeEventListener('message', this.messageHandler, false);
|
|
201
|
+
}
|
|
202
|
+
initEditableFieldsState() {
|
|
203
|
+
var _a, _b;
|
|
204
|
+
this.fieldsState['data'] = {};
|
|
205
|
+
this.fieldsState['hasChanged'] = false;
|
|
206
|
+
if ((_a = this.data.playerInfo) === null || _a === void 0 ? void 0 : _a.SecurityQuestion) {
|
|
207
|
+
this.fieldsState['data']['SecurityQuestion'] = this.buildFieldState(true, this.data.playerInfo.SecurityQuestion, (val) => val && val.length <= 120);
|
|
208
|
+
}
|
|
209
|
+
if ((_b = this.data.playerInfo) === null || _b === void 0 ? void 0 : _b.SecurityAnswer) {
|
|
210
|
+
this.fieldsState['data']['SecurityAnswer'] = this.buildFieldState(true, this.data.playerInfo.SecurityAnswer, (val) => val && val.length <= 120);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
resetState() {
|
|
214
|
+
this.initData();
|
|
215
|
+
this.initEditableFieldsState();
|
|
216
|
+
this.invalidFields = 0;
|
|
217
|
+
this.isSubmitButtonAvailable = false;
|
|
218
|
+
}
|
|
219
|
+
render() {
|
|
220
|
+
return (h("div", { key: '0bfa140cc83e29e99e4af534700e5b009a88e9ac', ref: el => this.stylingContainer = el }, this.skeletonLoading
|
|
221
|
+
? h("form", { class: "PamPlayerProfileWrapper skeleton" }, h("div", { class: "ReturnButton" }, h("ui-skeleton", { structure: "title", width: "auto", height: "30px" })), h("div", { class: "Section" }, h("section", { class: "SectionContent" }, [...Array(6).keys()].map(() => h("div", { class: "Field" }, h("ui-skeleton", { structure: "text", width: "auto", "margin-bottom": "10px", height: "10px" }), h("ui-skeleton", { structure: "rectangle", width: "100%", height: "20px" }))), h("div", { class: "CompoundField" }, h("div", { class: "Field" }, h("ui-skeleton", { structure: "text", width: "auto", "margin-bottom": "10px", height: "10px" }), h("ui-skeleton", { structure: "rectangle", width: "100%", height: "20px" })), h("div", { class: "Field" }, h("ui-skeleton", { structure: "text", width: "auto", "margin-bottom": "10px", height: "10px" }), h("ui-skeleton", { structure: "rectangle", width: "100%", height: "20px" }))), h("div", { class: "Field" }, h("ui-skeleton", { structure: "text", width: "auto", "margin-bottom": "10px", height: "10px" }), h("ui-skeleton", { structure: "rectangle", width: "auto", height: "20px" })))), h("section", { class: "ButtonsArea" }, h("div", { class: "SaveButton" }, h("ui-skeleton", { structure: "rectangle", width: "auto", height: "50px" }))))
|
|
222
|
+
: h("form", { class: `PamPlayerProfileWrapper ${this.isMobile ? 'Mobile' : ''}` }, h("div", { class: "ReturnButton", onClick: this.toggleScreen }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "15", height: "15", viewBox: "0 0 15 15" }, h("g", { transform: "translate(-20 -158)" }, h("g", { transform: "translate(20 158)" }, h("path", { class: "aaa", d: "M7.5,0,6.136,1.364,11.3,6.526H0V8.474H11.3L6.136,13.636,7.5,15,15,7.5Z", transform: "translate(15 15) rotate(180)" })))), h("h2", null, translate('title', this.lang))), h("h2", { class: "HeaderText" }, translate('title', this.lang)), h("div", { class: "Section" }, h("section", { class: "SectionContent" }, this.staticField(this.data.contacts.find(c => c.contatcType = 'Username').contactValue, 'username'), this.staticField(dayjs(this.data.personalInfo.birthDate).format(this.dobFormat), 'dateOfBirth'), this.staticField(this.data.personalInfo.firstName, 'firstName'), this.staticField(this.data.personalInfo.lastName, 'lastName'), this.editableField('playerInfo', 'SecurityQuestion', 'securityQuestion', 'securityQuestionError'), this.editableField('playerInfo', 'SecurityAnswer', 'securityAnswer', 'securityAnswerError'), h("div", { class: "CompoundField" }, this.staticField(this.data.personalInfo.title, 'playerTitle'), this.staticField(this.data.personalInfo.gender, 'gender')), this.staticField(this.data.communicationInfo.currency, 'currency'))), this.isStandAlone === 'true' &&
|
|
223
|
+
h("section", { class: "ButtonsArea" }, h("button", { class: `SaveButton ${this.isSubmitButtonAvailable ? '' : 'Disabled'}`, onClick: this.updateData }, translate('saveButton'))))));
|
|
224
|
+
}
|
|
225
|
+
static get is() { return "pam-player-profile"; }
|
|
226
|
+
static get encapsulation() { return "shadow"; }
|
|
227
|
+
static get originalStyleUrls() {
|
|
228
|
+
return {
|
|
229
|
+
"$": ["pam-player-profile.scss"]
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
static get styleUrls() {
|
|
233
|
+
return {
|
|
234
|
+
"$": ["pam-player-profile.css"]
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
static get properties() {
|
|
238
|
+
return {
|
|
239
|
+
"userId": {
|
|
240
|
+
"type": "string",
|
|
241
|
+
"mutable": false,
|
|
242
|
+
"complexType": {
|
|
243
|
+
"original": "string",
|
|
244
|
+
"resolved": "string",
|
|
245
|
+
"references": {}
|
|
246
|
+
},
|
|
247
|
+
"required": false,
|
|
248
|
+
"optional": false,
|
|
249
|
+
"docs": {
|
|
250
|
+
"tags": [],
|
|
251
|
+
"text": ""
|
|
252
|
+
},
|
|
253
|
+
"attribute": "user-id",
|
|
254
|
+
"reflect": true
|
|
255
|
+
},
|
|
256
|
+
"session": {
|
|
257
|
+
"type": "string",
|
|
258
|
+
"mutable": false,
|
|
259
|
+
"complexType": {
|
|
260
|
+
"original": "string",
|
|
261
|
+
"resolved": "string",
|
|
262
|
+
"references": {}
|
|
263
|
+
},
|
|
264
|
+
"required": false,
|
|
265
|
+
"optional": false,
|
|
266
|
+
"docs": {
|
|
267
|
+
"tags": [],
|
|
268
|
+
"text": ""
|
|
269
|
+
},
|
|
270
|
+
"attribute": "session",
|
|
271
|
+
"reflect": true
|
|
272
|
+
},
|
|
273
|
+
"endpoint": {
|
|
274
|
+
"type": "string",
|
|
275
|
+
"mutable": false,
|
|
276
|
+
"complexType": {
|
|
277
|
+
"original": "string",
|
|
278
|
+
"resolved": "string",
|
|
279
|
+
"references": {}
|
|
280
|
+
},
|
|
281
|
+
"required": false,
|
|
282
|
+
"optional": false,
|
|
283
|
+
"docs": {
|
|
284
|
+
"tags": [],
|
|
285
|
+
"text": ""
|
|
286
|
+
},
|
|
287
|
+
"attribute": "endpoint",
|
|
288
|
+
"reflect": true
|
|
289
|
+
},
|
|
290
|
+
"lang": {
|
|
291
|
+
"type": "string",
|
|
292
|
+
"mutable": false,
|
|
293
|
+
"complexType": {
|
|
294
|
+
"original": "string",
|
|
295
|
+
"resolved": "string",
|
|
296
|
+
"references": {}
|
|
297
|
+
},
|
|
298
|
+
"required": false,
|
|
299
|
+
"optional": false,
|
|
300
|
+
"docs": {
|
|
301
|
+
"tags": [],
|
|
302
|
+
"text": ""
|
|
303
|
+
},
|
|
304
|
+
"attribute": "lang",
|
|
305
|
+
"reflect": true,
|
|
306
|
+
"defaultValue": "'en'"
|
|
307
|
+
},
|
|
308
|
+
"mbSource": {
|
|
309
|
+
"type": "string",
|
|
310
|
+
"mutable": false,
|
|
311
|
+
"complexType": {
|
|
312
|
+
"original": "string",
|
|
313
|
+
"resolved": "string",
|
|
314
|
+
"references": {}
|
|
315
|
+
},
|
|
316
|
+
"required": false,
|
|
317
|
+
"optional": false,
|
|
318
|
+
"docs": {
|
|
319
|
+
"tags": [],
|
|
320
|
+
"text": ""
|
|
321
|
+
},
|
|
322
|
+
"attribute": "mb-source",
|
|
323
|
+
"reflect": true
|
|
324
|
+
},
|
|
325
|
+
"clientStyling": {
|
|
326
|
+
"type": "string",
|
|
327
|
+
"mutable": false,
|
|
328
|
+
"complexType": {
|
|
329
|
+
"original": "string",
|
|
330
|
+
"resolved": "string",
|
|
331
|
+
"references": {}
|
|
332
|
+
},
|
|
333
|
+
"required": false,
|
|
334
|
+
"optional": false,
|
|
335
|
+
"docs": {
|
|
336
|
+
"tags": [],
|
|
337
|
+
"text": ""
|
|
338
|
+
},
|
|
339
|
+
"attribute": "client-styling",
|
|
340
|
+
"reflect": true
|
|
341
|
+
},
|
|
342
|
+
"clientStylingUrl": {
|
|
343
|
+
"type": "string",
|
|
344
|
+
"mutable": false,
|
|
345
|
+
"complexType": {
|
|
346
|
+
"original": "string",
|
|
347
|
+
"resolved": "string",
|
|
348
|
+
"references": {}
|
|
349
|
+
},
|
|
350
|
+
"required": false,
|
|
351
|
+
"optional": false,
|
|
352
|
+
"docs": {
|
|
353
|
+
"tags": [],
|
|
354
|
+
"text": ""
|
|
355
|
+
},
|
|
356
|
+
"attribute": "client-styling-url",
|
|
357
|
+
"reflect": true
|
|
358
|
+
},
|
|
359
|
+
"translationUrl": {
|
|
360
|
+
"type": "string",
|
|
361
|
+
"mutable": false,
|
|
362
|
+
"complexType": {
|
|
363
|
+
"original": "string",
|
|
364
|
+
"resolved": "string",
|
|
365
|
+
"references": {}
|
|
366
|
+
},
|
|
367
|
+
"required": false,
|
|
368
|
+
"optional": false,
|
|
369
|
+
"docs": {
|
|
370
|
+
"tags": [],
|
|
371
|
+
"text": ""
|
|
372
|
+
},
|
|
373
|
+
"attribute": "translation-url",
|
|
374
|
+
"reflect": true
|
|
375
|
+
},
|
|
376
|
+
"dobFormat": {
|
|
377
|
+
"type": "string",
|
|
378
|
+
"mutable": false,
|
|
379
|
+
"complexType": {
|
|
380
|
+
"original": "string",
|
|
381
|
+
"resolved": "string",
|
|
382
|
+
"references": {}
|
|
383
|
+
},
|
|
384
|
+
"required": false,
|
|
385
|
+
"optional": false,
|
|
386
|
+
"docs": {
|
|
387
|
+
"tags": [],
|
|
388
|
+
"text": ""
|
|
389
|
+
},
|
|
390
|
+
"attribute": "dob-format",
|
|
391
|
+
"reflect": true,
|
|
392
|
+
"defaultValue": "'DD/MM/YYYY'"
|
|
393
|
+
},
|
|
394
|
+
"isStandAlone": {
|
|
395
|
+
"type": "string",
|
|
396
|
+
"mutable": false,
|
|
397
|
+
"complexType": {
|
|
398
|
+
"original": "string",
|
|
399
|
+
"resolved": "string",
|
|
400
|
+
"references": {}
|
|
401
|
+
},
|
|
402
|
+
"required": false,
|
|
403
|
+
"optional": false,
|
|
404
|
+
"docs": {
|
|
405
|
+
"tags": [],
|
|
406
|
+
"text": ""
|
|
407
|
+
},
|
|
408
|
+
"attribute": "is-stand-alone",
|
|
409
|
+
"reflect": true,
|
|
410
|
+
"defaultValue": "'true'"
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
static get states() {
|
|
415
|
+
return {
|
|
416
|
+
"limitStylingAppends": {},
|
|
417
|
+
"skeletonLoading": {},
|
|
418
|
+
"isSubmitButtonAvailable": {},
|
|
419
|
+
"invalidFields": {},
|
|
420
|
+
"isMobile": {}
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
static get watchers() {
|
|
424
|
+
return [{
|
|
425
|
+
"propName": "clientStyling",
|
|
426
|
+
"methodName": "handleStylingChange"
|
|
427
|
+
}, {
|
|
428
|
+
"propName": "clientStylingUrl",
|
|
429
|
+
"methodName": "handleStylingUrlChange"
|
|
430
|
+
}];
|
|
431
|
+
}
|
|
432
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/pam-player-profile';
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
export const DEFAULT_LANGUAGE = 'en';
|
|
2
|
+
export const TRANSLATIONS = {
|
|
3
|
+
"en": {
|
|
4
|
+
"title": "Profile Info",
|
|
5
|
+
"username": "Username",
|
|
6
|
+
"firstName": "First Name",
|
|
7
|
+
"lastName": "Last Name",
|
|
8
|
+
"securityQuestion": "Security Question",
|
|
9
|
+
"securityAnswer": "Security Answer",
|
|
10
|
+
"playerTitle": "Title",
|
|
11
|
+
"gender": "Gender",
|
|
12
|
+
"dateOfBirth": "Date Of Birth",
|
|
13
|
+
"currency": "Currency",
|
|
14
|
+
"securityQuestionError": "Security question must be at least 1 character long and maximum 120 characters.",
|
|
15
|
+
"securityAnswerError": "Security answer must be at least 1 character long and maximum 120 characters.",
|
|
16
|
+
"saveButton": "Save Changes",
|
|
17
|
+
"successMessage": "Your changes have been saved!",
|
|
18
|
+
"errorMessageUpdate": "An error has occured when attempting to update the profile information",
|
|
19
|
+
"errorMessageFetch": "An error has occured when attempting to fetch the profile information"
|
|
20
|
+
},
|
|
21
|
+
"zh-hk": {
|
|
22
|
+
"title": "個人資料",
|
|
23
|
+
"username": "用戶名",
|
|
24
|
+
"firstName": "名字",
|
|
25
|
+
"lastName": "姓氏",
|
|
26
|
+
"securityQuestion": "安全問題",
|
|
27
|
+
"securityAnswer": "安全答案",
|
|
28
|
+
"playerTitle": "稱號",
|
|
29
|
+
"gender": "性別",
|
|
30
|
+
"dateOfBirth": "出生日期",
|
|
31
|
+
"currency": "貨幣",
|
|
32
|
+
"securityQuestionError": "安全問題必須至少1個字符,最多120個字符。",
|
|
33
|
+
"securityAnswerError": "安全答案必須至少1個字符,最多120個字符。",
|
|
34
|
+
"saveButton": "保存更改",
|
|
35
|
+
"successMessage": "您的更改已保存!",
|
|
36
|
+
"errorMessageUpdate": "嘗試更新個人資料信息時發生錯誤",
|
|
37
|
+
"errorMessageFetch": "在嘗試獲取個人資料時發生錯誤"
|
|
38
|
+
},
|
|
39
|
+
"fr": {
|
|
40
|
+
"title": "Informations de profil",
|
|
41
|
+
"username": "Nom d'utilisateur",
|
|
42
|
+
"firstName": "Prénom",
|
|
43
|
+
"lastName": "Nom de famille",
|
|
44
|
+
"securityQuestion": "Question de sécurité",
|
|
45
|
+
"securityAnswer": "Réponse de sécurité",
|
|
46
|
+
"playerTitle": "Titre",
|
|
47
|
+
"gender": "Genre",
|
|
48
|
+
"dateOfBirth": "Date de naissance",
|
|
49
|
+
"currency": "Devise",
|
|
50
|
+
"securityQuestionError": "La question de sécurité doit comporter au moins 1 caractère et un maximum de 120 caractères.",
|
|
51
|
+
"securityAnswerError": "La réponse de sécurité doit comporter au moins 1 caractère et un maximum de 120 caractères.",
|
|
52
|
+
"saveButton": "Enregistrer les modifications",
|
|
53
|
+
"successMessage": "Vos modifications ont été enregistrées !",
|
|
54
|
+
"errorMessageUpdate": "Une erreur s'est produite lors de la tentative de mise à jour des informations de profil",
|
|
55
|
+
"errorMessageFetch": "Une erreur est survenue lors de la tentative de récupération des informations de profil"
|
|
56
|
+
},
|
|
57
|
+
"ro": {
|
|
58
|
+
"title": "Informații profil",
|
|
59
|
+
"username": "Nume de utilizator",
|
|
60
|
+
"firstName": "Prenume",
|
|
61
|
+
"lastName": "Nume de familie",
|
|
62
|
+
"securityQuestion": "Întrebare de securitate",
|
|
63
|
+
"securityAnswer": "Răspuns de securitate",
|
|
64
|
+
"playerTitle": "Titlu",
|
|
65
|
+
"gender": "Gen",
|
|
66
|
+
"dateOfBirth": "Data nașterii",
|
|
67
|
+
"currency": "Monedă",
|
|
68
|
+
"securityQuestionError": "Întrebarea de securitate trebuie să aibă cel puțin 1 caracter și maximum 120 de caractere.",
|
|
69
|
+
"securityAnswerError": "Răspunsul de securitate trebuie să aibă cel puțin 1 caracter și maximum 120 de caractere.",
|
|
70
|
+
"saveButton": "Salvează modificările",
|
|
71
|
+
"successMessage": "Modificările dvs. au fost salvate!",
|
|
72
|
+
"errorMessageUpdate": "A apărut o eroare la încercarea de a actualiza informațiile profilului",
|
|
73
|
+
"errorMessageFetch": "A apărut o eroare la încercarea de a obține informațiile profilului"
|
|
74
|
+
},
|
|
75
|
+
"tr": {
|
|
76
|
+
"title": "Profil Bilgileri",
|
|
77
|
+
"username": "Kullanıcı Adı",
|
|
78
|
+
"firstName": "Ad",
|
|
79
|
+
"lastName": "Soyad",
|
|
80
|
+
"securityQuestion": "Güvenlik Sorusu",
|
|
81
|
+
"securityAnswer": "Güvenlik Cevabı",
|
|
82
|
+
"playerTitle": "Başlık",
|
|
83
|
+
"gender": "Cinsiyet",
|
|
84
|
+
"dateOfBirth": "Doğum Tarihi",
|
|
85
|
+
"currency": "Para Birimi",
|
|
86
|
+
"securityQuestionError": "Güvenlik sorusu en az 1 karakter ve en fazla 120 karakter olmalıdır.",
|
|
87
|
+
"securityAnswerError": "Güvenlik cevabı en az 1 karakter ve en fazla 120 karakter olmalıdır.",
|
|
88
|
+
"saveButton": "Değişiklikleri Kaydet",
|
|
89
|
+
"successMessage": "Değişiklikleriniz kaydedildi!",
|
|
90
|
+
"errorMessageUpdate": "Profil bilgilerini güncellemeye çalışırken bir hata oluştu",
|
|
91
|
+
"errorMessageFetch": "Profil bilgilerini almak için yapılan işlemde bir hata oluştu"
|
|
92
|
+
},
|
|
93
|
+
"es": {
|
|
94
|
+
"title": "Información del perfil",
|
|
95
|
+
"username": "Nombre de usuario",
|
|
96
|
+
"firstName": "Nombre",
|
|
97
|
+
"lastName": "Apellido",
|
|
98
|
+
"securityQuestion": "Pregunta de seguridad",
|
|
99
|
+
"securityAnswer": "Respuesta de seguridad",
|
|
100
|
+
"playerTitle": "Título",
|
|
101
|
+
"gender": "Género",
|
|
102
|
+
"dateOfBirth": "Fecha de nacimiento",
|
|
103
|
+
"currency": "Moneda",
|
|
104
|
+
"securityQuestionError": "La pregunta de seguridad debe tener al menos 1 carácter y un máximo de 120 caracteres.",
|
|
105
|
+
"securityAnswerError": "La respuesta de seguridad debe tener al menos 1 carácter y un máximo de 120 caracteres.",
|
|
106
|
+
"saveButton": "Guardar cambios",
|
|
107
|
+
"successMessage": "¡Tus cambios han sido guardados!",
|
|
108
|
+
"errorMessageUpdate": "Se ha producido un error al intentar actualizar la información del perfil",
|
|
109
|
+
"errorMessageFetch": "Se ha producido un error al intentar obtener la información del perfil"
|
|
110
|
+
},
|
|
111
|
+
"pt": {
|
|
112
|
+
"title": "Informações do Perfil",
|
|
113
|
+
"username": "Nome de usuário",
|
|
114
|
+
"firstName": "Nome",
|
|
115
|
+
"lastName": "Sobrenome",
|
|
116
|
+
"securityQuestion": "Pergunta de segurança",
|
|
117
|
+
"securityAnswer": "Resposta de segurança",
|
|
118
|
+
"playerTitle": "Título",
|
|
119
|
+
"gender": "Gênero",
|
|
120
|
+
"dateOfBirth": "Data de nascimento",
|
|
121
|
+
"currency": "Moeda",
|
|
122
|
+
"securityQuestionError": "A pergunta de segurança deve ter pelo menos 1 caractere e no máximo 120 caracteres.",
|
|
123
|
+
"securityAnswerError": "A resposta de segurança deve ter pelo menos 1 caractere e no máximo 120 caracteres.",
|
|
124
|
+
"saveButton": "Salvar alterações",
|
|
125
|
+
"successMessage": "Suas alterações foram salvas!",
|
|
126
|
+
"errorMessageUpdate": "Ocorreu um erro ao tentar atualizar as informações do perfil",
|
|
127
|
+
"errorMessageFetch": "Ocorreu um erro ao tentar buscar as informações do perfil"
|
|
128
|
+
},
|
|
129
|
+
"hr": {
|
|
130
|
+
"title": "Informacije o profilu",
|
|
131
|
+
"username": "Korisničko ime",
|
|
132
|
+
"firstName": "Ime",
|
|
133
|
+
"lastName": "Prezime",
|
|
134
|
+
"securityQuestion": "Sigurnosno pitanje",
|
|
135
|
+
"securityAnswer": "Sigurnosni odgovor",
|
|
136
|
+
"playerTitle": "Naslov",
|
|
137
|
+
"gender": "Spol",
|
|
138
|
+
"dateOfBirth": "Datum rođenja",
|
|
139
|
+
"currency": "Valuta",
|
|
140
|
+
"securityQuestionError": "Sigurnosno pitanje mora imati najmanje 1 znak i najviše 120 znakova.",
|
|
141
|
+
"securityAnswerError": "Sigurnosni odgovor mora imati najmanje 1 znak i najviše 120 znakova.",
|
|
142
|
+
"saveButton": "Spremi promjene",
|
|
143
|
+
"successMessage": "Vaše promjene su spremljene!",
|
|
144
|
+
"errorMessageUpdate": "Došlo je do pogreške prilikom pokušaja ažuriranja informacija o profilu",
|
|
145
|
+
"errorMessageFetch": "Došlo je do greške prilikom pokušaja dobijanja informacija o profilu"
|
|
146
|
+
},
|
|
147
|
+
"pt-br": {
|
|
148
|
+
"title": "Informações do Perfil",
|
|
149
|
+
"username": "Nome de usuário",
|
|
150
|
+
"firstName": "Nome",
|
|
151
|
+
"lastName": "Sobrenome",
|
|
152
|
+
"securityQuestion": "Pergunta de segurança",
|
|
153
|
+
"securityAnswer": "Resposta de segurança",
|
|
154
|
+
"playerTitle": "Título",
|
|
155
|
+
"gender": "Gênero",
|
|
156
|
+
"dateOfBirth": "Data de nascimento",
|
|
157
|
+
"currency": "Moeda",
|
|
158
|
+
"securityQuestionError": "A pergunta de segurança deve ter pelo menos 1 caractere e no máximo 120 caracteres.",
|
|
159
|
+
"securityAnswerError": "A resposta de segurança deve ter pelo menos 1 caractere e no máximo 120 caracteres.",
|
|
160
|
+
"saveButton": "Salvar alterações",
|
|
161
|
+
"successMessage": "Suas alterações foram salvas!",
|
|
162
|
+
"errorMessageUpdate": "Ocorreu um erro ao tentar atualizar as informações do perfil",
|
|
163
|
+
"errorMessageFetch": "Ocorreu um erro ao tentar buscar as informações do perfil"
|
|
164
|
+
},
|
|
165
|
+
"es-mx": {
|
|
166
|
+
"title": "Información del perfil",
|
|
167
|
+
"username": "Nombre de usuario",
|
|
168
|
+
"firstName": "Nombre",
|
|
169
|
+
"lastName": "Apellido",
|
|
170
|
+
"securityQuestion": "Pregunta de seguridad",
|
|
171
|
+
"securityAnswer": "Respuesta de seguridad",
|
|
172
|
+
"playerTitle": "Título",
|
|
173
|
+
"gender": "Género",
|
|
174
|
+
"dateOfBirth": "Fecha de nacimiento",
|
|
175
|
+
"currency": "Moneda",
|
|
176
|
+
"securityQuestionError": "La pregunta de seguridad debe tener al menos 1 carácter y un máximo de 120 caracteres.",
|
|
177
|
+
"securityAnswerError": "La respuesta de seguridad debe tener al menos 1 carácter y un máximo de 120 caracteres.",
|
|
178
|
+
"saveButton": "Guardar cambios",
|
|
179
|
+
"successMessage": "¡Tus cambios han sido guardados!",
|
|
180
|
+
"errorMessageUpdate": "Se ha producido un error al intentar actualizar la información del perfil",
|
|
181
|
+
"errorMessageFetch": "Se ha producido un error al intentar obtener la información del perfil"
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
export const getTranslations = (url) => {
|
|
185
|
+
// fetch url, get the data, replace the TRANSLATIONS content
|
|
186
|
+
return new Promise((resolve) => {
|
|
187
|
+
fetch(url)
|
|
188
|
+
.then((res) => res.json())
|
|
189
|
+
.then((data) => {
|
|
190
|
+
Object.keys(data).forEach((item) => {
|
|
191
|
+
for (let key in data[item]) {
|
|
192
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
resolve(true);
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
export const translate = (key, customLang, values) => {
|
|
200
|
+
let lang = TRANSLATIONS[customLang] ? customLang : DEFAULT_LANGUAGE;
|
|
201
|
+
let translation = TRANSLATIONS[lang][key];
|
|
202
|
+
if (values !== undefined) {
|
|
203
|
+
for (const [key, value] of Object.entries(values.values)) {
|
|
204
|
+
const regex = new RegExp(`{${key}}`, 'g');
|
|
205
|
+
translation = translation.replace(regex, value);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return translation;
|
|
209
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name isMobile
|
|
3
|
+
* @description A method that returns if the browser used to access the app is from a mobile device or not
|
|
4
|
+
* @param {String} userAgent window.navigator.userAgent
|
|
5
|
+
* @returns {Boolean} true or false
|
|
6
|
+
*/
|
|
7
|
+
export const isMobile = (userAgent) => {
|
|
8
|
+
return !!(userAgent.toLowerCase().match(/android/i) ||
|
|
9
|
+
userAgent.toLowerCase().match(/blackberry|bb/i) ||
|
|
10
|
+
userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
|
|
11
|
+
userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
|
|
12
|
+
};
|