@everymatrix/pam-player-contacts 0.11.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 (56) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/index-ed59decb.js +1227 -0
  3. package/dist/cjs/index.cjs.js +10 -0
  4. package/dist/cjs/loader.cjs.js +15 -0
  5. package/dist/cjs/pam-player-contacts-4a593000.js +469 -0
  6. package/dist/cjs/pam-player-contacts.cjs.js +25 -0
  7. package/dist/cjs/pam-player-contacts_2.cjs.entry.js +203 -0
  8. package/dist/collection/collection-manifest.json +19 -0
  9. package/dist/collection/components/pam-player-contacts/index.js +1 -0
  10. package/dist/collection/components/pam-player-contacts/pam-player-contacts.css +318 -0
  11. package/dist/collection/components/pam-player-contacts/pam-player-contacts.js +492 -0
  12. package/dist/collection/index.js +1 -0
  13. package/dist/collection/utils/locale.utils.js +139 -0
  14. package/dist/collection/utils/utils.js +12 -0
  15. package/dist/esm/app-globals-0f993ce5.js +3 -0
  16. package/dist/esm/index-f7c756b2.js +1200 -0
  17. package/dist/esm/index.js +2 -0
  18. package/dist/esm/loader.js +11 -0
  19. package/dist/esm/pam-player-contacts-08c08e29.js +467 -0
  20. package/dist/esm/pam-player-contacts.js +20 -0
  21. package/dist/esm/pam-player-contacts_2.entry.js +198 -0
  22. package/dist/index.cjs.js +1 -0
  23. package/dist/index.js +1 -0
  24. package/dist/pam-player-contacts/app-globals-0f993ce5.js +1 -0
  25. package/dist/pam-player-contacts/index-f7c756b2.js +2 -0
  26. package/dist/pam-player-contacts/index.esm.js +1 -0
  27. package/dist/pam-player-contacts/pam-player-contacts-08c08e29.js +1 -0
  28. package/dist/pam-player-contacts/pam-player-contacts.esm.js +1 -0
  29. package/dist/pam-player-contacts/pam-player-contacts_2.entry.js +1 -0
  30. package/dist/stencil.config.dev.js +17 -0
  31. package/dist/stencil.config.js +19 -0
  32. package/dist/storybook/main.js +47 -0
  33. package/dist/storybook/preview.js +9 -0
  34. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-contacts/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
  35. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-contacts/.stencil/packages/stencil/pam-player-contacts/stencil.config.d.ts +2 -0
  36. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-contacts/.stencil/packages/stencil/pam-player-contacts/stencil.config.dev.d.ts +2 -0
  37. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-contacts/.stencil/packages/stencil/pam-player-contacts/storybook/main.d.ts +3 -0
  38. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-contacts/.stencil/packages/stencil/pam-player-contacts/storybook/preview.d.ts +70 -0
  39. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-contacts/.stencil/tools/plugins/index.d.ts +3 -0
  40. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-contacts/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
  41. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-contacts/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  42. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-contacts/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  43. package/dist/types/components/pam-player-contacts/index.d.ts +1 -0
  44. package/dist/types/components/pam-player-contacts/pam-player-contacts.d.ts +56 -0
  45. package/dist/types/components.d.ts +59 -0
  46. package/dist/types/index.d.ts +1 -0
  47. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  48. package/dist/types/utils/locale.utils.d.ts +23 -0
  49. package/dist/types/utils/utils.d.ts +7 -0
  50. package/loader/cdn.js +1 -0
  51. package/loader/index.cjs.js +1 -0
  52. package/loader/index.d.ts +24 -0
  53. package/loader/index.es2017.js +1 -0
  54. package/loader/index.js +2 -0
  55. package/loader/package.json +11 -0
  56. package/package.json +26 -0
@@ -0,0 +1,492 @@
1
+ import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
2
+ import { h } from "@stencil/core";
3
+ import { translate } from "../../utils/locale.utils";
4
+ import { isMobile } from "../../utils/utils";
5
+ import "../../../../../ui-skeleton/dist/types/index";
6
+ export class PamPlayerContacts {
7
+ constructor() {
8
+ this.dataRef = {};
9
+ this.fieldsState = {};
10
+ this.sendLoadedMessage = () => {
11
+ window.postMessage({ type: 'CONTACTS_LOADED' });
12
+ };
13
+ this.sendValidMessage = () => {
14
+ window.postMessage({ type: 'CONTACTS_VALIDITY', data: this.isSubmitButtonAvailable });
15
+ };
16
+ this.sendContactVerificationRequest = (contactType) => (e) => {
17
+ e.preventDefault();
18
+ window.postMessage({ type: 'ContactVerification', contactType });
19
+ };
20
+ this.sendSuccessNotification = () => {
21
+ window.postMessage({ type: 'WidgetNotification', data: { type: 'success', message: translate('successMessage', this.lang) } }, window.location.href);
22
+ };
23
+ this.sendErrorNotification = (errorKey) => {
24
+ window.postMessage({ type: 'WidgetNotification', data: { type: 'error', message: translate(errorKey, this.lang) } }, window.location.href);
25
+ };
26
+ this.sendData = () => {
27
+ window.postMessage({ type: 'CONTACTS_UPDATE_DATA', data: this.data }, window.location.href);
28
+ };
29
+ this.messageHandler = (message) => {
30
+ var _a;
31
+ switch ((_a = message.data) === null || _a === void 0 ? void 0 : _a.type) {
32
+ case 'CONTACTS_DATA':
33
+ this.data = message.data.data;
34
+ this.resetState();
35
+ this.isSkeletonLoading = false;
36
+ break;
37
+ case 'CONTACTS_SEND_DATA':
38
+ this.sendData();
39
+ break;
40
+ }
41
+ };
42
+ /**
43
+ * Promise for fetching the response and returning the response or the erorr message
44
+ * @param res - response from the API
45
+ */
46
+ this.handleFetchResponse = async (res) => {
47
+ var _a;
48
+ if (res.status >= 300) {
49
+ this.isError = true;
50
+ let response = await res.json();
51
+ this.errorCode = (_a = response.thirdPartyResponse) === null || _a === void 0 ? void 0 : _a.errorCode;
52
+ this.errorMessage = this.errorCode ? translate(this.errorCode, this.lang) : translate('errorMessageFetch', this.lang);
53
+ window.postMessage({
54
+ type: 'WidgetNotification',
55
+ data: {
56
+ type: 'error',
57
+ message: this.errorMessage
58
+ }
59
+ }, window.location.href);
60
+ return Promise.reject(this.errorMessage);
61
+ }
62
+ else {
63
+ this.isError = false;
64
+ if (res.headers.get('content-type')) {
65
+ let response = await res.json();
66
+ return Promise.resolve(response);
67
+ }
68
+ return Promise.resolve();
69
+ }
70
+ };
71
+ this.getData = () => {
72
+ const url = new URL(`/api/v1/players/${this.userId}/player-identifiable-information/contacts/`, this.endpoint);
73
+ const headers = new Headers();
74
+ headers.append('X-SessionID', this.session);
75
+ const options = {
76
+ method: 'GET',
77
+ headers: headers
78
+ };
79
+ return new Promise((resolve, reject) => {
80
+ fetch(url.href, options)
81
+ .then((res) => this.handleFetchResponse(res))
82
+ .then(res => {
83
+ this.data = res;
84
+ resolve();
85
+ })
86
+ .catch((error) => {
87
+ console.log(error);
88
+ reject();
89
+ });
90
+ });
91
+ };
92
+ this.buildFieldState = (isValid, initialValue, rule) => Object.assign({ 'isValid': isValid, 'initialValue': initialValue, 'rule': rule });
93
+ this.resetState = () => {
94
+ this.initData();
95
+ this.initEditableFieldsState();
96
+ this.invalidFields = 0;
97
+ this.isSubmitButtonAvailable = false;
98
+ };
99
+ this.updateState = (fieldKey) => (e) => {
100
+ this.dataRef[fieldKey].contactValue = e.target.value;
101
+ const fieldState = this.fieldsState[fieldKey]['data'].contactValue;
102
+ const value = e.target.value;
103
+ const passedRuleCheck = fieldState.rule(value);
104
+ if (passedRuleCheck && !fieldState.isValid) {
105
+ fieldState.isValid = true;
106
+ this.invalidFields -= 1;
107
+ }
108
+ else if (!passedRuleCheck && fieldState.isValid) {
109
+ fieldState.isValid = false;
110
+ this.invalidFields += 1;
111
+ }
112
+ this.fieldsState[fieldKey]['hasChanged'] = value !== fieldState.initialValue;
113
+ const previous = this.isSubmitButtonAvailable;
114
+ this.updateSubmitButtonStatus();
115
+ if (this.isStandAlone !== 'true' && this.isSubmitButtonAvailable !== previous) {
116
+ this.sendValidMessage();
117
+ }
118
+ };
119
+ this.updateData = (e) => {
120
+ if (e)
121
+ e.preventDefault();
122
+ const promises = [];
123
+ for (const contactType of Object.keys(this.fieldsState)) {
124
+ if (!this.fieldsState[contactType]['hasChanged'])
125
+ continue;
126
+ const contact = this.dataRef[contactType];
127
+ const url = new URL(`/api/v1/players/${this.userId}/player-identifiable-information/contacts/${contact['contactId']}/`, this.endpoint);
128
+ const headers = new Headers();
129
+ headers.append('X-SessionId', this.session);
130
+ headers.append('Content-Type', 'application/json-patch+json');
131
+ const reqParams = {
132
+ method: 'PUT',
133
+ headers,
134
+ body: JSON.stringify(contact)
135
+ };
136
+ promises.push(fetch(url, reqParams));
137
+ }
138
+ Promise.all(promises)
139
+ .then(resArr => {
140
+ if (resArr.some(res => !res.ok)) {
141
+ return this.sendErrorNotification('errorMessageUpdate');
142
+ }
143
+ this.sendSuccessNotification();
144
+ this.getData().then(() => this.resetState());
145
+ });
146
+ };
147
+ this.updateSubmitButtonStatus = () => {
148
+ this.isSubmitButtonAvailable = this.invalidFields === 0 && Object.values(this.fieldsState).some(v => v.hasChanged);
149
+ };
150
+ this.editableField = (fieldKey, labelTranslationKey, errorTranslationKey) => {
151
+ const fieldState = this.fieldsState[fieldKey]['data'].contactValue;
152
+ const value = this.dataRef[fieldKey];
153
+ if (fieldState) {
154
+ return (h("div", { class: `Field ${fieldState.isValid ? '' : 'Invalid'}` }, h("label", null, translate(labelTranslationKey, this.lang)), this.isVerificationStatusDisplayed === 'true'
155
+ ? h("div", null, h("input", { type: "text", value: value.contactValue, onKeyUp: this.updateState(fieldKey) }), value.isVerified
156
+ ? h("svg", { class: "VerifiedCheckmark", xmlns: "http://www.w3.org/2000/svg", version: "1.1", id: "Capa_1", width: "40px", height: "40px", viewBox: "-53.65 -53.65 643.84 643.84", transform: "matrix(1, 0, 0, 1, 0, 0)rotate(0)" }, h("g", { id: "SVGRepo_bgCarrier", "stroke-width": "0" }), h("g", { id: "SVGRepo_tracerCarrier", "stroke-linecap": "round", "stroke-linejoin": "round", stroke: "#CCCCCC", "stroke-width": "1.073082" }), h("g", { id: "SVGRepo_iconCarrier" }, " ", h("g", null, " ", h("g", null, " ", h("path", { d: "M496.785,152.779c-3.305-25.085-16.549-51.934-38.826-74.205c-22.264-22.265-49.107-35.508-74.186-38.813 c-11.348-1.499-26.5-7.766-35.582-14.737C328.111,9.626,299.764,0,268.27,0s-59.841,9.626-79.921,25.024 c-9.082,6.965-24.235,13.238-35.582,14.737c-25.08,3.305-51.922,16.549-74.187,38.813c-22.277,22.271-35.521,49.119-38.825,74.205 c-1.493,11.347-7.766,26.494-14.731,35.57C9.621,208.422,0,236.776,0,268.27s9.621,59.847,25.024,79.921 c6.971,9.082,13.238,24.223,14.731,35.568c3.305,25.086,16.548,51.936,38.825,74.205c22.265,22.266,49.107,35.51,74.187,38.814 c11.347,1.498,26.5,7.771,35.582,14.736c20.073,15.398,48.421,25.025,79.921,25.025s59.841-9.627,79.921-25.025 c9.082-6.965,24.234-13.238,35.582-14.736c25.078-3.305,51.922-16.549,74.186-38.814c22.277-22.27,35.521-49.119,38.826-74.205 c1.492-11.346,7.766-26.492,14.73-35.568c15.404-20.074,25.025-48.422,25.025-79.921c0-31.494-9.621-59.848-25.025-79.921 C504.545,179.273,498.277,164.126,496.785,152.779z M439.256,180.43L246.477,373.209l-30.845,30.846 c-8.519,8.52-22.326,8.52-30.845,0l-30.845-30.846l-56.665-56.658c-8.519-8.52-8.519-22.326,0-30.846l30.845-30.844 c8.519-8.519,22.326-8.519,30.845,0l41.237,41.236L377.561,118.74c8.52-8.519,22.326-8.519,30.846,0l30.844,30.845 C447.775,158.104,447.775,171.917,439.256,180.43z" }), " "), " "), " "))
157
+ : h("button", { onClick: this.sendContactVerificationRequest(fieldKey) }, translate('verifyContactButton')))
158
+ : h("input", { type: "text", value: value.contactValue, onKeyUp: this.updateState(fieldKey) }), !fieldState.isValid &&
159
+ h("p", { class: "Error" }, translate(errorTranslationKey, this.lang))));
160
+ }
161
+ else {
162
+ return null;
163
+ }
164
+ };
165
+ this.staticField = (fieldKey, labelTranslationKey) => {
166
+ const value = this.dataRef[fieldKey];
167
+ if (value && value.contactValue) {
168
+ return (h("div", { class: "Field Disabled" }, h("label", null, translate(labelTranslationKey, this.lang)), this.isVerificationStatusDisplayed === 'true'
169
+ ? h("div", null, h("input", { type: "text", value: value.contactValue, readonly: true }), value.isVerified
170
+ ? h("svg", { class: "VerifiedCheckmark", xmlns: "http://www.w3.org/2000/svg", version: "1.1", id: "Capa_1", width: "40px", height: "40px", viewBox: "-53.65 -53.65 643.84 643.84", transform: "matrix(1, 0, 0, 1, 0, 0)rotate(0)" }, h("g", { id: "SVGRepo_bgCarrier", "stroke-width": "0" }), h("g", { id: "SVGRepo_tracerCarrier", "stroke-linecap": "round", "stroke-linejoin": "round", stroke: "#CCCCCC", "stroke-width": "1.073082" }), h("g", { id: "SVGRepo_iconCarrier" }, " ", h("g", null, " ", h("g", null, " ", h("path", { d: "M496.785,152.779c-3.305-25.085-16.549-51.934-38.826-74.205c-22.264-22.265-49.107-35.508-74.186-38.813 c-11.348-1.499-26.5-7.766-35.582-14.737C328.111,9.626,299.764,0,268.27,0s-59.841,9.626-79.921,25.024 c-9.082,6.965-24.235,13.238-35.582,14.737c-25.08,3.305-51.922,16.549-74.187,38.813c-22.277,22.271-35.521,49.119-38.825,74.205 c-1.493,11.347-7.766,26.494-14.731,35.57C9.621,208.422,0,236.776,0,268.27s9.621,59.847,25.024,79.921 c6.971,9.082,13.238,24.223,14.731,35.568c3.305,25.086,16.548,51.936,38.825,74.205c22.265,22.266,49.107,35.51,74.187,38.814 c11.347,1.498,26.5,7.771,35.582,14.736c20.073,15.398,48.421,25.025,79.921,25.025s59.841-9.627,79.921-25.025 c9.082-6.965,24.234-13.238,35.582-14.736c25.078-3.305,51.922-16.549,74.186-38.814c22.277-22.27,35.521-49.119,38.826-74.205 c1.492-11.346,7.766-26.492,14.73-35.568c15.404-20.074,25.025-48.422,25.025-79.921c0-31.494-9.621-59.848-25.025-79.921 C504.545,179.273,498.277,164.126,496.785,152.779z M439.256,180.43L246.477,373.209l-30.845,30.846 c-8.519,8.52-22.326,8.52-30.845,0l-30.845-30.846l-56.665-56.658c-8.519-8.52-8.519-22.326,0-30.846l30.845-30.844 c8.519-8.519,22.326-8.519,30.845,0l41.237,41.236L377.561,118.74c8.52-8.519,22.326-8.519,30.846,0l30.844,30.845 C447.775,158.104,447.775,171.917,439.256,180.43z" }), " "), " "), " "))
171
+ : h("button", { onClick: this.sendContactVerificationRequest(fieldKey) }, translate('verifyContactButton')))
172
+ : h("input", { type: "text", value: value.contactValue, readonly: true })));
173
+ }
174
+ else {
175
+ return null;
176
+ }
177
+ };
178
+ this.toggleScreen = () => {
179
+ window.postMessage({ type: 'PlayerAccountMenuActive', isMobile: this.isMobile }, window.location.href);
180
+ };
181
+ this.userId = undefined;
182
+ this.session = undefined;
183
+ this.endpoint = undefined;
184
+ this.lang = 'en';
185
+ this.mbSource = undefined;
186
+ this.clientStyling = undefined;
187
+ this.clientStylingUrl = undefined;
188
+ this.translationUrl = undefined;
189
+ this.isVerificationStatusDisplayed = 'false';
190
+ this.isPhoneNumberEditable = 'true';
191
+ this.isStandAlone = 'true';
192
+ this.limitStylingAppends = false;
193
+ this.isSkeletonLoading = true;
194
+ this.isSubmitButtonAvailable = false;
195
+ this.invalidFields = 0;
196
+ this.isMobile = isMobile(window.navigator.userAgent);
197
+ this.isError = false;
198
+ this.errorMessage = '';
199
+ this.errorCode = '';
200
+ }
201
+ handleStylingChange(newValue, oldValue) {
202
+ if (newValue !== oldValue)
203
+ setClientStyling(this.stylingContainer, this.clientStyling);
204
+ }
205
+ handleStylingUrlChange(newValue, oldValue) {
206
+ if (newValue !== oldValue)
207
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
208
+ }
209
+ async componentWillLoad() {
210
+ if (this.isStandAlone !== 'true') {
211
+ return;
212
+ }
213
+ await this.getData()
214
+ .then(() => {
215
+ this.initData();
216
+ this.initEditableFieldsState();
217
+ })
218
+ .finally(() => this.isSkeletonLoading = false);
219
+ }
220
+ componentDidLoad() {
221
+ if (this.stylingContainer) {
222
+ if (window.emMessageBuss != undefined) {
223
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
224
+ }
225
+ else {
226
+ if (this.clientStyling)
227
+ setClientStyling(this.stylingContainer, this.clientStyling);
228
+ if (this.clientStylingUrl)
229
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
230
+ }
231
+ }
232
+ if (this.isStandAlone !== 'true') {
233
+ window.addEventListener('message', this.messageHandler, false);
234
+ this.sendLoadedMessage();
235
+ }
236
+ }
237
+ disconnectedCallback() {
238
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
239
+ if (this.isStandAlone !== 'true')
240
+ window.removeEventListener('message', this.messageHandler, false);
241
+ }
242
+ initData() {
243
+ for (const contact of this.data.contacts) {
244
+ this.dataRef[contact.contactType] = contact;
245
+ }
246
+ }
247
+ initEditableFieldsState() {
248
+ if (this.dataRef['PhoneNumber'] && this.isPhoneNumberEditable === 'true') {
249
+ this.fieldsState['PhoneNumber'] = {};
250
+ this.fieldsState['PhoneNumber']['hasChanged'] = false;
251
+ this.fieldsState['PhoneNumber']['data'] = {};
252
+ this.fieldsState['PhoneNumber']['data']['contactValue'] = this.buildFieldState(true, this.dataRef['PhoneNumber'].contactValue, (val) => val && val.length >= 5 && val.length <= 15 && !Number.isNaN(Number(val)));
253
+ }
254
+ }
255
+ render() {
256
+ if (!this.isSkeletonLoading && this.isError) {
257
+ return (h("div", { class: "errorContainer" }, h("p", { class: "errorMessage", innerHTML: this.errorMessage })));
258
+ }
259
+ return (h("div", { ref: el => this.stylingContainer = el }, this.isSkeletonLoading
260
+ ? h("form", { class: "PlayerContactsWrapper skeleton" }, h("div", { class: "ReturnButton" }, h("ui-skeleton", { structure: "title", width: "auto", height: "30px" })), h("div", { class: "Section" }, h("section", { class: "SectionContent" }, h("div", { class: "Field" }, h("ui-skeleton", { structure: "text", width: "auto", "margin-bottom": "10px", height: "10px" }), h("ui-skeleton", { structure: "title", width: "100%", height: "40px" })), h("div", { class: "Field" }, h("ui-skeleton", { structure: "text", width: "auto", "margin-bottom": "10px", height: "10px" }), h("ui-skeleton", { structure: "title", width: "100%", height: "40px" })))), h("section", { class: "ButtonsArea" }, h("div", { class: "SaveButton" }, h("ui-skeleton", { structure: "rectangle", width: "auto", height: "40px" }))))
261
+ : h("form", { class: "PlayerContactsWrapper" }, 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.editableField('PhoneNumber', 'phoneNumber', 'phoneNumberError'), this.staticField('Email', 'email'))), this.isStandAlone === 'true' &&
262
+ h("section", { class: "ButtonsArea" }, h("button", { class: `SaveButton ${this.isSubmitButtonAvailable ? '' : 'Disabled'}`, onClick: this.updateData }, translate('saveButton'))))));
263
+ }
264
+ static get is() { return "pam-player-contacts"; }
265
+ static get encapsulation() { return "shadow"; }
266
+ static get originalStyleUrls() {
267
+ return {
268
+ "$": ["pam-player-contacts.scss"]
269
+ };
270
+ }
271
+ static get styleUrls() {
272
+ return {
273
+ "$": ["pam-player-contacts.css"]
274
+ };
275
+ }
276
+ static get properties() {
277
+ return {
278
+ "userId": {
279
+ "type": "string",
280
+ "mutable": false,
281
+ "complexType": {
282
+ "original": "string",
283
+ "resolved": "string",
284
+ "references": {}
285
+ },
286
+ "required": false,
287
+ "optional": false,
288
+ "docs": {
289
+ "tags": [],
290
+ "text": ""
291
+ },
292
+ "attribute": "user-id",
293
+ "reflect": true
294
+ },
295
+ "session": {
296
+ "type": "string",
297
+ "mutable": false,
298
+ "complexType": {
299
+ "original": "string",
300
+ "resolved": "string",
301
+ "references": {}
302
+ },
303
+ "required": false,
304
+ "optional": false,
305
+ "docs": {
306
+ "tags": [],
307
+ "text": ""
308
+ },
309
+ "attribute": "session",
310
+ "reflect": true
311
+ },
312
+ "endpoint": {
313
+ "type": "string",
314
+ "mutable": false,
315
+ "complexType": {
316
+ "original": "string",
317
+ "resolved": "string",
318
+ "references": {}
319
+ },
320
+ "required": false,
321
+ "optional": false,
322
+ "docs": {
323
+ "tags": [],
324
+ "text": ""
325
+ },
326
+ "attribute": "endpoint",
327
+ "reflect": true
328
+ },
329
+ "lang": {
330
+ "type": "string",
331
+ "mutable": false,
332
+ "complexType": {
333
+ "original": "string",
334
+ "resolved": "string",
335
+ "references": {}
336
+ },
337
+ "required": false,
338
+ "optional": false,
339
+ "docs": {
340
+ "tags": [],
341
+ "text": ""
342
+ },
343
+ "attribute": "lang",
344
+ "reflect": true,
345
+ "defaultValue": "'en'"
346
+ },
347
+ "mbSource": {
348
+ "type": "string",
349
+ "mutable": false,
350
+ "complexType": {
351
+ "original": "string",
352
+ "resolved": "string",
353
+ "references": {}
354
+ },
355
+ "required": false,
356
+ "optional": false,
357
+ "docs": {
358
+ "tags": [],
359
+ "text": ""
360
+ },
361
+ "attribute": "mb-source",
362
+ "reflect": true
363
+ },
364
+ "clientStyling": {
365
+ "type": "string",
366
+ "mutable": false,
367
+ "complexType": {
368
+ "original": "string",
369
+ "resolved": "string",
370
+ "references": {}
371
+ },
372
+ "required": false,
373
+ "optional": false,
374
+ "docs": {
375
+ "tags": [],
376
+ "text": ""
377
+ },
378
+ "attribute": "client-styling",
379
+ "reflect": true
380
+ },
381
+ "clientStylingUrl": {
382
+ "type": "string",
383
+ "mutable": false,
384
+ "complexType": {
385
+ "original": "string",
386
+ "resolved": "string",
387
+ "references": {}
388
+ },
389
+ "required": false,
390
+ "optional": false,
391
+ "docs": {
392
+ "tags": [],
393
+ "text": ""
394
+ },
395
+ "attribute": "client-styling-url",
396
+ "reflect": true
397
+ },
398
+ "translationUrl": {
399
+ "type": "string",
400
+ "mutable": false,
401
+ "complexType": {
402
+ "original": "string",
403
+ "resolved": "string",
404
+ "references": {}
405
+ },
406
+ "required": false,
407
+ "optional": false,
408
+ "docs": {
409
+ "tags": [],
410
+ "text": ""
411
+ },
412
+ "attribute": "translation-url",
413
+ "reflect": true
414
+ },
415
+ "isVerificationStatusDisplayed": {
416
+ "type": "string",
417
+ "mutable": false,
418
+ "complexType": {
419
+ "original": "string",
420
+ "resolved": "string",
421
+ "references": {}
422
+ },
423
+ "required": false,
424
+ "optional": false,
425
+ "docs": {
426
+ "tags": [],
427
+ "text": ""
428
+ },
429
+ "attribute": "is-verification-status-displayed",
430
+ "reflect": true,
431
+ "defaultValue": "'false'"
432
+ },
433
+ "isPhoneNumberEditable": {
434
+ "type": "string",
435
+ "mutable": false,
436
+ "complexType": {
437
+ "original": "string",
438
+ "resolved": "string",
439
+ "references": {}
440
+ },
441
+ "required": false,
442
+ "optional": false,
443
+ "docs": {
444
+ "tags": [],
445
+ "text": ""
446
+ },
447
+ "attribute": "is-phone-number-editable",
448
+ "reflect": true,
449
+ "defaultValue": "'true'"
450
+ },
451
+ "isStandAlone": {
452
+ "type": "string",
453
+ "mutable": false,
454
+ "complexType": {
455
+ "original": "string",
456
+ "resolved": "string",
457
+ "references": {}
458
+ },
459
+ "required": false,
460
+ "optional": false,
461
+ "docs": {
462
+ "tags": [],
463
+ "text": ""
464
+ },
465
+ "attribute": "is-stand-alone",
466
+ "reflect": true,
467
+ "defaultValue": "'true'"
468
+ }
469
+ };
470
+ }
471
+ static get states() {
472
+ return {
473
+ "limitStylingAppends": {},
474
+ "isSkeletonLoading": {},
475
+ "isSubmitButtonAvailable": {},
476
+ "invalidFields": {},
477
+ "isMobile": {},
478
+ "isError": {},
479
+ "errorMessage": {},
480
+ "errorCode": {}
481
+ };
482
+ }
483
+ static get watchers() {
484
+ return [{
485
+ "propName": "clientStyling",
486
+ "methodName": "handleStylingChange"
487
+ }, {
488
+ "propName": "clientStylingUrl",
489
+ "methodName": "handleStylingUrlChange"
490
+ }];
491
+ }
492
+ }
@@ -0,0 +1 @@
1
+ export * from './components/pam-player-contacts';
@@ -0,0 +1,139 @@
1
+ export const DEFAULT_LANGUAGE = 'en';
2
+ export const TRANSLATIONS = {
3
+ "en": {
4
+ "title": "Contacts",
5
+ "email": "Email",
6
+ "phoneNumber": "Phone Number",
7
+ "phoneNumberError": "The phone number must be at least 5 digits and at most 15 digits",
8
+ "verifyContactButton": "Verify",
9
+ "saveButton": "Save Changes",
10
+ "successMessage": "Your changes have been saved!",
11
+ "errorMessageUpdate": "An error has occured when attempting to update the contacts information",
12
+ "errorMessageFetch": "An error has occured when attempting to fetch the contacts information"
13
+ },
14
+ "zh-hk": {
15
+ "title": "聯絡人",
16
+ "email": "電子郵件",
17
+ "phoneNumber": "電話號碼",
18
+ "phoneNumberError": "電話號碼必須至少5位數字,最多15位數字",
19
+ "verifyContactButton": "驗證",
20
+ "saveButton": "保存更改",
21
+ "successMessage": "您的更改已保存!",
22
+ "errorMessageUpdate": "嘗試更新聯絡人信息時發生錯誤",
23
+ "errorMessageFetch": "在嘗試獲取聯絡人信息時發生錯誤"
24
+ },
25
+ "fr": {
26
+ "title": "Contacts",
27
+ "email": "Email",
28
+ "phoneNumber": "Numéro de téléphone",
29
+ "phoneNumberError": "Le numéro de téléphone doit comporter au moins 5 chiffres et au maximum 15 chiffres",
30
+ "verifyContactButton": "Vérifier",
31
+ "saveButton": "Enregistrer les modifications",
32
+ "successMessage": "Vos modifications ont été enregistrées !",
33
+ "errorMessageUpdate": "Une erreur s'est produite lors de la tentative de mise à jour des informations de contact",
34
+ "errorMessageFetch": "Une erreur est survenue lors de la tentative de récupération des informations de contact"
35
+ },
36
+ "ro": {
37
+ "title": "Contacte",
38
+ "email": "Email",
39
+ "phoneNumber": "Număr de telefon",
40
+ "phoneNumberError": "Numărul de telefon trebuie să aibă cel puțin 5 cifre și maximum 15 cifre",
41
+ "verifyContactButton": "Verifică",
42
+ "saveButton": "Salvează modificările",
43
+ "successMessage": "Modificările dvs. au fost salvate!",
44
+ "errorMessageUpdate": "A apărut o eroare la încercarea de a actualiza informațiile de contact",
45
+ "errorMessageFetch": "A apărut o eroare la încercarea de a obține informațiile de contact"
46
+ },
47
+ "tr": {
48
+ "title": "Kişiler",
49
+ "email": "E-posta",
50
+ "phoneNumber": "Telefon Numarası",
51
+ "phoneNumberError": "Telefon numarası en az 5 haneli ve en fazla 15 haneli olmalıdır",
52
+ "verifyContactButton": "Doğrula",
53
+ "saveButton": "Değişiklikleri Kaydet",
54
+ "successMessage": "Değişiklikleriniz kaydedildi!",
55
+ "errorMessageUpdate": "Kişi bilgilerini güncellemeye çalışırken bir hata oluştu",
56
+ "errorMessageFetch": "İletişim bilgilerini almak için yapılan işlemde bir hata oluştu"
57
+ },
58
+ "es": {
59
+ "title": "Contactos",
60
+ "email": "Correo electrónico",
61
+ "phoneNumber": "Número de teléfono",
62
+ "phoneNumberError": "El número de teléfono debe tener al menos 5 dígitos y un máximo de 15 dígitos",
63
+ "verifyContactButton": "Verificar",
64
+ "saveButton": "Guardar cambios",
65
+ "successMessage": "¡Tus cambios han sido guardados!",
66
+ "errorMessageUpdate": "Se ha producido un error al intentar actualizar la información de contactos",
67
+ "errorMessageFetch": "Se ha producido un error al intentar obtener la información de los contactos"
68
+ },
69
+ "pt": {
70
+ "title": "Contatos",
71
+ "email": "Email",
72
+ "phoneNumber": "Número de telefone",
73
+ "phoneNumberError": "O número de telefone deve ter pelo menos 5 dígitos e no máximo 15 dígitos",
74
+ "verifyContactButton": "Verificar",
75
+ "saveButton": "Salvar alterações",
76
+ "successMessage": "Suas alterações foram salvas!",
77
+ "errorMessageUpdate": "Ocorreu um erro ao tentar atualizar as informações de contato",
78
+ "errorMessageFetch": "Ocorreu um erro ao tentar buscar as informações de contato"
79
+ },
80
+ "hr": {
81
+ "title": "Kontakti",
82
+ "email": "Email",
83
+ "phoneNumber": "Broj telefona",
84
+ "phoneNumberError": "Broj telefona mora imati najmanje 5 znamenki i najviše 15 znamenki",
85
+ "verifyContactButton": "Provjeri",
86
+ "saveButton": "Spremi promjene",
87
+ "successMessage": "Vaše promjene su spremljene!",
88
+ "errorMessageUpdate": "Došlo je do pogreške prilikom pokušaja ažuriranja informacija o kontaktima",
89
+ "errorMessageFetch": "Došlo je do greške prilikom pokušaja dobijanja informacija o kontaktima"
90
+ },
91
+ "pt-br": {
92
+ "title": "Contatos",
93
+ "email": "Email",
94
+ "phoneNumber": "Número de telefone",
95
+ "phoneNumberError": "O número de telefone deve ter pelo menos 5 dígitos e no máximo 15 dígitos",
96
+ "verifyContactButton": "Verificar",
97
+ "saveButton": "Salvar alterações",
98
+ "successMessage": "Suas alterações foram salvas!",
99
+ "errorMessageUpdate": "Ocorreu um erro ao tentar atualizar as informações de contato",
100
+ "errorMessageFetch": "Ocorreu um erro ao tentar buscar as informações de contato"
101
+ },
102
+ "es-mx": {
103
+ "title": "Contactos",
104
+ "email": "Correo electrónico",
105
+ "phoneNumber": "Número de teléfono",
106
+ "phoneNumberError": "El número de teléfono debe tener al menos 5 dígitos y un máximo de 15 dígitos",
107
+ "verifyContactButton": "Verificar",
108
+ "saveButton": "Guardar cambios",
109
+ "successMessage": "¡Tus cambios han sido guardados!",
110
+ "errorMessageUpdate": "Se ha producido un error al intentar actualizar la información de contactos",
111
+ "errorMessageFetch": "Se ha producido un error al intentar obtener la información de los contactos"
112
+ }
113
+ };
114
+ export const getTranslations = (url) => {
115
+ // fetch url, get the data, replace the TRANSLATIONS content
116
+ return new Promise((resolve) => {
117
+ fetch(url)
118
+ .then((res) => res.json())
119
+ .then((data) => {
120
+ Object.keys(data).forEach((item) => {
121
+ for (let key in data[item]) {
122
+ TRANSLATIONS[item][key] = data[item][key];
123
+ }
124
+ });
125
+ resolve(true);
126
+ });
127
+ });
128
+ };
129
+ export const translate = (key, customLang, values) => {
130
+ let lang = TRANSLATIONS[customLang] ? customLang : DEFAULT_LANGUAGE;
131
+ let translation = TRANSLATIONS[lang][key];
132
+ if (values !== undefined) {
133
+ for (const [key, value] of Object.entries(values.values)) {
134
+ const regex = new RegExp(`{${key}}`, 'g');
135
+ translation = translation.replace(regex, value);
136
+ }
137
+ }
138
+ return translation;
139
+ };
@@ -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
+ };
@@ -0,0 +1,3 @@
1
+ const globalScripts = () => {};
2
+
3
+ export { globalScripts as g };