@everymatrix/pam-player-profile 0.11.0 → 0.11.3

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const pamPlayerProfile = require('./pam-player-profile-dc13914a.js');
5
+ const pamPlayerProfile = require('./pam-player-profile-3185ce39.js');
6
6
  require('./index-4130c9d2.js');
7
7
 
8
8
 
@@ -8,7 +8,7 @@ const appGlobals = require('./app-globals-3a1e7e63.js');
8
8
  const defineCustomElements = async (win, options) => {
9
9
  if (typeof window === 'undefined') return undefined;
10
10
  await appGlobals.globalScripts();
11
- return index.bootstrapLazy([["pam-player-profile_2.cjs",[[1,"pam-player-profile",{"userId":[513,"user-id"],"session":[513],"endpoint":[513],"lang":[513],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"dobFormat":[513,"dob-format"],"isStandAlone":[513,"is-stand-alone"],"limitStylingAppends":[32],"skeletonLoading":[32],"isSubmitButtonAvailable":[32],"invalidFields":[32],"isMobile":[32]},null,{"clientStyling":["handleStylingChange"],"clientStylingUrl":["handleStylingUrlChange"]}],[0,"ui-skeleton",{"structure":[1],"width":[1],"height":[1],"borderRadius":[2,"border-radius"],"marginBottom":[2,"margin-bottom"],"marginTop":[2,"margin-top"],"marginLeft":[2,"margin-left"],"marginRight":[2,"margin-right"],"animation":[4],"rows":[2],"size":[1],"color":[1],"primaryColor":[1,"primary-color"],"secondaryColor":[1,"secondary-color"]},null,{"structure":["handleStructureChange"]}]]]], options);
11
+ return index.bootstrapLazy([["pam-player-profile_2.cjs",[[1,"pam-player-profile",{"userId":[513,"user-id"],"session":[513],"endpoint":[513],"lang":[513],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"dobFormat":[513,"dob-format"],"isStandAlone":[513,"is-stand-alone"],"limitStylingAppends":[32],"skeletonLoading":[32],"isSubmitButtonAvailable":[32],"invalidFields":[32],"isMobile":[32],"isError":[32],"errorMessage":[32],"errorCode":[32]},null,{"clientStyling":["handleStylingChange"],"clientStylingUrl":["handleStylingUrlChange"]}],[0,"ui-skeleton",{"structure":[1],"width":[1],"height":[1],"borderRadius":[8,"border-radius"],"marginBottom":[8,"margin-bottom"],"marginTop":[8,"margin-top"],"marginLeft":[8,"margin-left"],"marginRight":[8,"margin-right"],"animation":[4],"rows":[2],"size":[1]},null,{"structure":["handleStructureChange"]}]]]], options);
12
12
  };
13
13
 
14
14
  exports.setNonce = index.setNonce;
@@ -277,7 +277,7 @@ var dayjs_min = {exports: {}};
277
277
 
278
278
  const dayjs = dayjs_min.exports;
279
279
 
280
- const pamPlayerProfileCss = ":host {\n display: block;\n}\n\nbutton {\n font-family: var(--emw--button-typography);\n}\n\ninput, select, option {\n font-family: inherit;\n}\n\n.PamPlayerProfileWrapper {\n color: var(--emw--pam-typography, var(--emw-color-contrast, #07072A));\n background: var(--emw-color-pale, var(--emw--color-gray-50, #F1F1F1));\n padding: 50px;\n height: 100%;\n border-radius: var(--emw--border-radius-large, 10px);\n container-type: inline-size;\n opacity: 1;\n animation-name: fadeIn;\n animation-iteration-count: 1;\n animation-timing-function: ease-in;\n animation-duration: 0.3s;\n}\n.PamPlayerProfileWrapper .ReturnButton {\n display: none;\n}\n.PamPlayerProfileWrapper .HeaderText {\n font-size: var(--emw--font-size-x-large, 24px);\n color: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n text-transform: capitalize;\n font-weight: var(--emw--font-weight-semibold, 500);\n}\n.PamPlayerProfileWrapper .Section {\n background: var(--emw-color-pale, var(--emw--color-gray-100, #E6E6E6));\n border-radius: var(--emw--border-radius-large, 10px);\n padding: 10px;\n margin-bottom: 10px;\n}\n.PamPlayerProfileWrapper .Section .SectionTitle {\n font-size: var(--emw--font-size-large, 20px);\n color: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n text-transform: capitalize;\n font-weight: var(--emw--font-weight-semibold, 500);\n padding: 0;\n border: 0;\n margin-top: 10px;\n margin-bottom: 10px;\n background: transparent;\n cursor: pointer;\n}\n.PamPlayerProfileWrapper .Section .SectionContent {\n display: grid;\n column-gap: 50px;\n row-gap: 25px;\n grid-template-rows: auto;\n grid-template-columns: 1fr 1fr;\n padding-bottom: 30px;\n margin-top: 10px;\n}\n.PamPlayerProfileWrapper .Section .SectionContent .Field {\n width: 100%;\n display: flex;\n flex-direction: column;\n /* Chrome, Safari, Edge, Opera */\n /* Firefox */\n}\n.PamPlayerProfileWrapper .Section .SectionContent .Field label {\n font-size: var(--emw--size-small, 14px);\n font-weight: var(--emw--font-weight-semibold, 500);\n margin-bottom: 5px;\n}\n.PamPlayerProfileWrapper .Section .SectionContent .Field input {\n font-size: var(--emw--size-small, 14px);\n font-weight: var(--emw--font-weight-light, 300);\n color: var(--emw--pam-contrast, var(--emw-color-contrast, #07072A));\n padding: 10px;\n line-height: 16px;\n background: var(--emw-color-white, #FFFFFF);\n outline: none;\n transition-duration: var(--emw--transition-medium, 250ms);\n border: 1px solid var(--emw--color-gray-100, #353535);\n border-radius: var(--emw--border-radius-medium, 10px);\n width: 100%;\n box-sizing: border-box;\n}\n.PamPlayerProfileWrapper .Section .SectionContent .Field input:focus, .PamPlayerProfileWrapper .Section .SectionContent .Field input :focus-within, .PamPlayerProfileWrapper .Section .SectionContent .Field input :focus-visible, .PamPlayerProfileWrapper .Section .SectionContent .Field input :visited {\n border: 1px solid var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n box-shadow: 0 0 0 1pt var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n}\n.PamPlayerProfileWrapper .Section .SectionContent .Field input::-webkit-outer-spin-button,\n.PamPlayerProfileWrapper .Section .SectionContent .Field input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n.PamPlayerProfileWrapper .Section .SectionContent .Field input[type=number] {\n -moz-appearance: textfield;\n appearance: textfield;\n}\n.PamPlayerProfileWrapper .Section .SectionContent .Field.Invalid input {\n border: 1px solid var(--emw-color-error, var(--emw-color-red, #FD2839));\n background: var(--emw-color-pale, #FBECF4);\n color: var(--emw-color-error, var(--emw-color-red, #FD2839));\n}\n.PamPlayerProfileWrapper .Section .SectionContent .Field .Error {\n color: var(--emw-color-error, var(--emw-color-red, #FD2839));\n font-size: var(--emw--font-size-x-small, 12px);\n line-height: 10px;\n}\n.PamPlayerProfileWrapper .Section .SectionContent .Field.Disabled input {\n opacity: 0.5;\n}\n.PamPlayerProfileWrapper .Section .SectionContent .CompoundField {\n width: 100%;\n display: flex;\n gap: 10px;\n flex-direction: row;\n}\n.PamPlayerProfileWrapper .ButtonsArea {\n grid-column-gap: 10px;\n grid-template-rows: auto;\n grid-template-columns: 1fr;\n margin-top: 20px;\n width: 50%;\n}\n.PamPlayerProfileWrapper .ButtonsArea .SaveButton {\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n cursor: pointer;\n background-image: linear-gradient(to bottom, color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, black 20%), var(--emw--color-primary, #22B04E), color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, white 30%));\n border: 2px solid var(--emw--button-border-color, #0E5924);\n color: var(--emw--button-text-color, #FFFFFF);\n border-radius: var(--emw--button-border-radius, 10px);\n font-size: var(--emw--size-standard, 16px);\n text-transform: uppercase;\n transition-duration: var(--emw--transition-medium, 250ms);\n max-width: 400px;\n min-width: 200px;\n padding: 13px 0;\n width: 100%;\n}\n.PamPlayerProfileWrapper .ButtonsArea .SaveButton:active {\n background: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n}\n.PamPlayerProfileWrapper .ButtonsArea .SaveButton.Disabled {\n opacity: 0.3;\n cursor: not-allowed;\n}\n.PamPlayerProfileWrapper.skeleton .ReturnButton {\n display: block;\n width: 200px;\n margin-top: 15px;\n margin-bottom: 20px;\n}\n.PamPlayerProfileWrapper.skeleton .Section .SectionContent {\n grid-template-columns: 50% 50%;\n overflow: hidden;\n}\n.PamPlayerProfileWrapper.skeleton .Section .SectionContent .Field {\n height: 55px;\n overflow: hidden;\n}\n.PamPlayerProfileWrapper.skeleton .ButtonsArea .SaveButton {\n width: 500px;\n border-radius: 30px;\n overflow: hidden;\n display: block;\n background-image: none;\n border: none;\n}\n@container (max-width: 425px) {\n .PamPlayerProfileWrapper {\n padding: 20px 15px;\n background: var(--emw-color-gray-50, #F9F8F8);\n max-width: unset;\n border-radius: var(--emw--border-radius-small, 5px);\n }\n .PamPlayerProfileWrapper .HeaderText {\n display: none;\n }\n .PamPlayerProfileWrapper .ReturnButton {\n color: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n display: inline-flex;\n align-items: center;\n column-gap: 10px;\n margin-bottom: 10px;\n }\n .PamPlayerProfileWrapper .ReturnButton svg {\n fill: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n }\n .PamPlayerProfileWrapper h2 {\n color: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n font-size: var(--emw--font-size-large, 20px);\n font-weight: var(--emw--font-weight-semibold, 500);\n }\n .PamPlayerProfileWrapper .Section .SectionContent {\n row-gap: 15px;\n grid-template-columns: 1fr;\n }\n .PamPlayerProfileWrapper .Section .SectionTitle {\n margin-top: 5px;\n margin-bottom: 5px;\n font-size: var(--emw--font-size-medium, 16px);\n }\n .PamPlayerProfileWrapper .Section .Field label {\n color: var(--emw-color-gray-300, #58586B);\n font-size: var(--emw--size-x-small, 12px);\n font-weight: var(-emw--font-weight-normal, 400);\n }\n .PamPlayerProfileWrapper .Section .Field input {\n color: var(--emw-color-gray-300, #58586B);\n font-size: var(--emw--size-x-small, 12px);\n font-weight: var(--emw--font-weight-light, 300);\n }\n .PamPlayerProfileWrapper .Section .CompoundField {\n width: 100%;\n display: flex;\n gap: 10px;\n flex-direction: row;\n }\n .PamPlayerProfileWrapper .ButtonsArea {\n grid-column-gap: 10px;\n width: 100%;\n grid-template-columns: 1fr 1fr;\n }\n .PamPlayerProfileWrapper .ButtonsArea .SaveButton {\n font-size: var(--emw--size-x-small, 12px);\n height: 40px;\n color: var(--emw-button-typography, var(--emw-color-white, #FFFFFF));\n }\n .PamPlayerProfileWrapper .ButtonsArea .SaveButton.Disabled {\n color: var(--emw-color-gray-300, #58586B);\n }\n .PamPlayerProfileWrapper.skeleton .Section .SectionContent {\n display: block;\n }\n .PamPlayerProfileWrapper.skeleton .Section .SectionContent .Field {\n margin-bottom: 15px;\n }\n .PamPlayerProfileWrapper.skeleton .ButtonsArea .SaveButton {\n width: 100%;\n height: 100%;\n border-radius: 20px;\n }\n}\n\n@keyframes fadeIn {\n 0% {\n opacity: 0.01;\n }\n 1% {\n opacity: 0;\n }\n 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}";
280
+ const pamPlayerProfileCss = ":host {\n display: block;\n}\n\nbutton {\n font-family: var(--emw--button-typography);\n}\n\ninput, select, option {\n font-family: inherit;\n}\n\n.errorContainer {\n font-family: \"Roboto\";\n font-style: normal;\n font-family: sans-serif;\n display: flex;\n flex-direction: column;\n gap: 24px;\n width: 100%;\n height: 100%;\n}\n.errorContainer .errorMessage {\n color: var(--emw--color-error, var(--emw--color-red, #ed0909));\n font-size: var(--emw-font-size-small, 13px);\n display: block;\n justify-content: center;\n text-align: center;\n}\n\n.PamPlayerProfileWrapper {\n color: var(--emw--pam-typography, var(--emw-color-contrast, #07072A));\n background: var(--emw-color-pale, var(--emw--color-gray-50, #F1F1F1));\n padding: 50px;\n height: 100%;\n border-radius: var(--emw--border-radius-large, 10px);\n container-type: inline-size;\n opacity: 1;\n animation-name: fadeIn;\n animation-iteration-count: 1;\n animation-timing-function: ease-in;\n animation-duration: 0.3s;\n}\n.PamPlayerProfileWrapper .ReturnButton {\n display: none;\n}\n.PamPlayerProfileWrapper .HeaderText {\n font-size: var(--emw--font-size-x-large, 24px);\n color: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n text-transform: capitalize;\n font-weight: var(--emw--font-weight-semibold, 500);\n}\n.PamPlayerProfileWrapper .Section {\n background: var(--emw-color-pale, var(--emw--color-gray-100, #E6E6E6));\n border-radius: var(--emw--border-radius-large, 10px);\n padding: 10px;\n margin-bottom: 10px;\n}\n.PamPlayerProfileWrapper .Section .SectionTitle {\n font-size: var(--emw--font-size-large, 20px);\n color: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n text-transform: capitalize;\n font-weight: var(--emw--font-weight-semibold, 500);\n padding: 0;\n border: 0;\n margin-top: 10px;\n margin-bottom: 10px;\n background: transparent;\n cursor: pointer;\n}\n.PamPlayerProfileWrapper .Section .SectionContent {\n display: grid;\n column-gap: 50px;\n row-gap: 25px;\n grid-template-rows: auto;\n grid-template-columns: 1fr 1fr;\n padding-bottom: 30px;\n margin-top: 10px;\n}\n.PamPlayerProfileWrapper .Section .SectionContent .Field {\n width: 100%;\n display: flex;\n flex-direction: column;\n /* Chrome, Safari, Edge, Opera */\n /* Firefox */\n}\n.PamPlayerProfileWrapper .Section .SectionContent .Field label {\n font-size: var(--emw--size-small, 14px);\n font-weight: var(--emw--font-weight-semibold, 500);\n margin-bottom: 5px;\n}\n.PamPlayerProfileWrapper .Section .SectionContent .Field input {\n font-size: var(--emw--size-small, 14px);\n font-weight: var(--emw--font-weight-light, 300);\n color: var(--emw--pam-contrast, var(--emw-color-contrast, #07072A));\n padding: 10px;\n line-height: 16px;\n background: var(--emw-color-white, #FFFFFF);\n outline: none;\n transition-duration: var(--emw--transition-medium, 250ms);\n border: 1px solid var(--emw--color-gray-100, #353535);\n border-radius: var(--emw--border-radius-medium, 10px);\n width: 100%;\n box-sizing: border-box;\n}\n.PamPlayerProfileWrapper .Section .SectionContent .Field input:focus, .PamPlayerProfileWrapper .Section .SectionContent .Field input :focus-within, .PamPlayerProfileWrapper .Section .SectionContent .Field input :focus-visible, .PamPlayerProfileWrapper .Section .SectionContent .Field input :visited {\n border: 1px solid var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n box-shadow: 0 0 0 1pt var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n}\n.PamPlayerProfileWrapper .Section .SectionContent .Field input::-webkit-outer-spin-button,\n.PamPlayerProfileWrapper .Section .SectionContent .Field input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n.PamPlayerProfileWrapper .Section .SectionContent .Field input[type=number] {\n -moz-appearance: textfield;\n appearance: textfield;\n}\n.PamPlayerProfileWrapper .Section .SectionContent .Field.Invalid input {\n border: 1px solid var(--emw-color-error, var(--emw-color-red, #FD2839));\n background: var(--emw-color-pale, #FBECF4);\n color: var(--emw-color-error, var(--emw-color-red, #FD2839));\n}\n.PamPlayerProfileWrapper .Section .SectionContent .Field .Error {\n color: var(--emw-color-error, var(--emw-color-red, #FD2839));\n font-size: var(--emw--font-size-x-small, 12px);\n line-height: 10px;\n}\n.PamPlayerProfileWrapper .Section .SectionContent .Field.Disabled input {\n opacity: 0.5;\n}\n.PamPlayerProfileWrapper .Section .SectionContent .CompoundField {\n width: 100%;\n display: flex;\n gap: 10px;\n flex-direction: row;\n}\n.PamPlayerProfileWrapper .ButtonsArea {\n grid-column-gap: 10px;\n grid-template-rows: auto;\n grid-template-columns: 1fr;\n margin-top: 20px;\n width: 50%;\n}\n.PamPlayerProfileWrapper .ButtonsArea .SaveButton {\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n cursor: pointer;\n background-image: linear-gradient(to bottom, color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, black 20%), var(--emw--color-primary, #22B04E), color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, white 30%));\n border: 2px solid var(--emw--button-border-color, #0E5924);\n color: var(--emw--button-text-color, #FFFFFF);\n border-radius: var(--emw--button-border-radius, 10px);\n font-size: var(--emw--size-standard, 16px);\n text-transform: uppercase;\n transition-duration: var(--emw--transition-medium, 250ms);\n max-width: 400px;\n min-width: 200px;\n padding: 13px 0;\n width: 100%;\n}\n.PamPlayerProfileWrapper .ButtonsArea .SaveButton:active {\n background: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n}\n.PamPlayerProfileWrapper .ButtonsArea .SaveButton.Disabled {\n opacity: 0.3;\n cursor: not-allowed;\n}\n.PamPlayerProfileWrapper.skeleton .ReturnButton {\n display: block;\n width: 200px;\n margin-top: 15px;\n margin-bottom: 20px;\n}\n.PamPlayerProfileWrapper.skeleton .Section .SectionContent {\n grid-template-columns: 50% 50%;\n overflow: hidden;\n}\n.PamPlayerProfileWrapper.skeleton .Section .SectionContent .Field {\n height: 55px;\n overflow: hidden;\n}\n.PamPlayerProfileWrapper.skeleton .ButtonsArea .SaveButton {\n width: 500px;\n border-radius: 30px;\n overflow: hidden;\n display: block;\n background-image: none;\n border: none;\n}\n@container (max-width: 425px) {\n .PamPlayerProfileWrapper {\n padding: 20px 15px;\n background: var(--emw-color-gray-50, #F9F8F8);\n max-width: unset;\n border-radius: var(--emw--border-radius-small, 5px);\n }\n .PamPlayerProfileWrapper .HeaderText {\n display: none;\n }\n .PamPlayerProfileWrapper .ReturnButton {\n color: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n display: inline-flex;\n align-items: center;\n column-gap: 10px;\n margin-bottom: 10px;\n }\n .PamPlayerProfileWrapper .ReturnButton svg {\n fill: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n }\n .PamPlayerProfileWrapper h2 {\n color: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n font-size: var(--emw--font-size-large, 20px);\n font-weight: var(--emw--font-weight-semibold, 500);\n }\n .PamPlayerProfileWrapper .Section .SectionContent {\n row-gap: 15px;\n grid-template-columns: 1fr;\n }\n .PamPlayerProfileWrapper .Section .SectionTitle {\n margin-top: 5px;\n margin-bottom: 5px;\n font-size: var(--emw--font-size-medium, 16px);\n }\n .PamPlayerProfileWrapper .Section .Field label {\n color: var(--emw-color-gray-300, #58586B);\n font-size: var(--emw--size-x-small, 12px);\n font-weight: var(-emw--font-weight-normal, 400);\n }\n .PamPlayerProfileWrapper .Section .Field input {\n color: var(--emw-color-gray-300, #58586B);\n font-size: var(--emw--size-x-small, 12px);\n font-weight: var(--emw--font-weight-light, 300);\n }\n .PamPlayerProfileWrapper .Section .CompoundField {\n width: 100%;\n display: flex;\n gap: 10px;\n flex-direction: row;\n }\n .PamPlayerProfileWrapper .ButtonsArea {\n grid-column-gap: 10px;\n width: 100%;\n grid-template-columns: 1fr 1fr;\n }\n .PamPlayerProfileWrapper .ButtonsArea .SaveButton {\n font-size: var(--emw--size-x-small, 12px);\n height: 40px;\n color: var(--emw-button-typography, var(--emw-color-white, #FFFFFF));\n }\n .PamPlayerProfileWrapper .ButtonsArea .SaveButton.Disabled {\n color: var(--emw-color-gray-300, #58586B);\n }\n .PamPlayerProfileWrapper.skeleton .Section .SectionContent {\n display: block;\n }\n .PamPlayerProfileWrapper.skeleton .Section .SectionContent .Field {\n margin-bottom: 15px;\n }\n .PamPlayerProfileWrapper.skeleton .ButtonsArea .SaveButton {\n width: 100%;\n height: 100%;\n border-radius: 20px;\n }\n}\n\n@keyframes fadeIn {\n 0% {\n opacity: 0.01;\n }\n 1% {\n opacity: 0;\n }\n 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}";
281
281
  const PamPlayerProfileStyle0 = pamPlayerProfileCss;
282
282
 
283
283
  const PamPlayerProfile = class {
@@ -313,25 +313,53 @@ const PamPlayerProfile = class {
313
313
  break;
314
314
  }
315
315
  };
316
+ /**
317
+ * Promise for fetching the response and returning the response or the erorr message
318
+ * @param res - response from the API
319
+ */
320
+ this.handleFetchResponse = async (res) => {
321
+ var _a;
322
+ if (res.status >= 300) {
323
+ this.isError = true;
324
+ let response = await res.json();
325
+ this.errorCode = (_a = response.thirdPartyResponse) === null || _a === void 0 ? void 0 : _a.errorCode;
326
+ this.errorMessage = this.errorCode ? translate(this.errorCode, this.lang) : translate('errorMessageFetch', this.lang);
327
+ window.postMessage({
328
+ type: 'WidgetNotification',
329
+ data: {
330
+ type: 'error',
331
+ message: this.errorMessage
332
+ }
333
+ }, window.location.href);
334
+ return Promise.reject(this.errorMessage);
335
+ }
336
+ else {
337
+ this.isError = false;
338
+ if (res.headers.get('content-type')) {
339
+ let response = await res.json();
340
+ return Promise.resolve(response);
341
+ }
342
+ return Promise.resolve();
343
+ }
344
+ };
316
345
  this.getData = () => {
317
- const url = new URL(`api/v1/players/${this.userId}/player-identifiable-information`, this.endpoint);
346
+ const url = new URL(`/api/v1/players/${this.userId}/player-identifiable-information/`, this.endpoint);
318
347
  const headers = new Headers();
319
348
  headers.append('X-SessionID', this.session);
320
349
  const options = {
321
350
  method: 'GET',
322
351
  headers: headers
323
352
  };
324
- return new Promise((resolve) => {
353
+ return new Promise((resolve, reject) => {
325
354
  fetch(url.href, options)
326
- .then(res => {
327
- if (res.ok) {
328
- return res.json();
329
- }
330
- this.sendErrorNotification('errorMessageFetch');
331
- })
355
+ .then((res) => this.handleFetchResponse(res))
332
356
  .then(res => {
333
357
  this.data = res.player;
334
358
  resolve();
359
+ })
360
+ .catch((error) => {
361
+ console.error(error);
362
+ reject(error);
335
363
  });
336
364
  });
337
365
  };
@@ -374,7 +402,7 @@ const PamPlayerProfile = class {
374
402
  this.updateData = (e) => {
375
403
  if (e)
376
404
  e.preventDefault();
377
- const url = new URL(`/api/v1/players/${this.userId}/player-identifiable-information`, this.endpoint);
405
+ const url = new URL(`/api/v1/players/${this.userId}/player-identifiable-information/`, this.endpoint);
378
406
  const headers = new Headers();
379
407
  headers.append('X-SessionId', this.session);
380
408
  headers.append('Content-Type', 'application/problem+json; charset=utf-8');
@@ -386,12 +414,13 @@ const PamPlayerProfile = class {
386
414
  body: JSON.stringify(this.data)
387
415
  };
388
416
  fetch(url, reqParams)
389
- .then(res => {
390
- if (!res.ok) {
391
- return this.sendErrorNotification('errorMessageUpdate');
392
- }
417
+ .then(res => this.handleFetchResponse(res))
418
+ .then(() => {
393
419
  this.sendSuccessNotification();
394
420
  this.getData().then(() => this.resetState());
421
+ })
422
+ .catch((error) => {
423
+ console.error(error);
395
424
  });
396
425
  };
397
426
  this.updateSubmitButtonStatus = () => {
@@ -434,6 +463,9 @@ const PamPlayerProfile = class {
434
463
  this.isSubmitButtonAvailable = false;
435
464
  this.invalidFields = 0;
436
465
  this.isMobile = isMobile(window.navigator.userAgent);
466
+ this.isError = false;
467
+ this.errorMessage = '';
468
+ this.errorCode = '';
437
469
  }
438
470
  handleStylingChange(newValue, oldValue) {
439
471
  if (newValue !== oldValue)
@@ -494,7 +526,10 @@ const PamPlayerProfile = class {
494
526
  this.isSubmitButtonAvailable = false;
495
527
  }
496
528
  render() {
497
- return (index.h("div", { key: '0bfa140cc83e29e99e4af534700e5b009a88e9ac', ref: el => this.stylingContainer = el }, this.skeletonLoading
529
+ if (!this.skeletonLoading && this.isError) {
530
+ return (index.h("div", { class: "errorContainer" }, index.h("p", { class: "errorMessage", innerHTML: this.errorMessage })));
531
+ }
532
+ return (index.h("div", { ref: el => this.stylingContainer = el }, this.skeletonLoading
498
533
  ? index.h("form", { class: "PamPlayerProfileWrapper skeleton" }, index.h("div", { class: "ReturnButton" }, index.h("ui-skeleton", { structure: "title", width: "auto", height: "30px" })), index.h("div", { class: "Section" }, index.h("section", { class: "SectionContent" }, [...Array(6).keys()].map(() => index.h("div", { class: "Field" }, index.h("ui-skeleton", { structure: "text", width: "auto", "margin-bottom": "10px", height: "10px" }), index.h("ui-skeleton", { structure: "rectangle", width: "100%", height: "20px" }))), index.h("div", { class: "CompoundField" }, index.h("div", { class: "Field" }, index.h("ui-skeleton", { structure: "text", width: "auto", "margin-bottom": "10px", height: "10px" }), index.h("ui-skeleton", { structure: "rectangle", width: "100%", height: "20px" })), index.h("div", { class: "Field" }, index.h("ui-skeleton", { structure: "text", width: "auto", "margin-bottom": "10px", height: "10px" }), index.h("ui-skeleton", { structure: "rectangle", width: "100%", height: "20px" }))), index.h("div", { class: "Field" }, index.h("ui-skeleton", { structure: "text", width: "auto", "margin-bottom": "10px", height: "10px" }), index.h("ui-skeleton", { structure: "rectangle", width: "auto", height: "20px" })))), index.h("section", { class: "ButtonsArea" }, index.h("div", { class: "SaveButton" }, index.h("ui-skeleton", { structure: "rectangle", width: "auto", height: "50px" }))))
499
534
  : index.h("form", { class: `PamPlayerProfileWrapper ${this.isMobile ? 'Mobile' : ''}` }, index.h("div", { class: "ReturnButton", onClick: this.toggleScreen }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "15", height: "15", viewBox: "0 0 15 15" }, index.h("g", { transform: "translate(-20 -158)" }, index.h("g", { transform: "translate(20 158)" }, index.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)" })))), index.h("h2", null, translate('title', this.lang))), index.h("h2", { class: "HeaderText" }, translate('title', this.lang)), index.h("div", { class: "Section" }, index.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'), index.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' &&
500
535
  index.h("section", { class: "ButtonsArea" }, index.h("button", { class: `SaveButton ${this.isSubmitButtonAvailable ? '' : 'Disabled'}`, onClick: this.updateData }, translate('saveButton'))))));
@@ -19,7 +19,7 @@ var patchBrowser = () => {
19
19
 
20
20
  patchBrowser().then(async (options) => {
21
21
  await appGlobals.globalScripts();
22
- return index.bootstrapLazy([["pam-player-profile_2.cjs",[[1,"pam-player-profile",{"userId":[513,"user-id"],"session":[513],"endpoint":[513],"lang":[513],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"dobFormat":[513,"dob-format"],"isStandAlone":[513,"is-stand-alone"],"limitStylingAppends":[32],"skeletonLoading":[32],"isSubmitButtonAvailable":[32],"invalidFields":[32],"isMobile":[32]},null,{"clientStyling":["handleStylingChange"],"clientStylingUrl":["handleStylingUrlChange"]}],[0,"ui-skeleton",{"structure":[1],"width":[1],"height":[1],"borderRadius":[2,"border-radius"],"marginBottom":[2,"margin-bottom"],"marginTop":[2,"margin-top"],"marginLeft":[2,"margin-left"],"marginRight":[2,"margin-right"],"animation":[4],"rows":[2],"size":[1],"color":[1],"primaryColor":[1,"primary-color"],"secondaryColor":[1,"secondary-color"]},null,{"structure":["handleStructureChange"]}]]]], options);
22
+ return index.bootstrapLazy([["pam-player-profile_2.cjs",[[1,"pam-player-profile",{"userId":[513,"user-id"],"session":[513],"endpoint":[513],"lang":[513],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"dobFormat":[513,"dob-format"],"isStandAlone":[513,"is-stand-alone"],"limitStylingAppends":[32],"skeletonLoading":[32],"isSubmitButtonAvailable":[32],"invalidFields":[32],"isMobile":[32],"isError":[32],"errorMessage":[32],"errorCode":[32]},null,{"clientStyling":["handleStylingChange"],"clientStylingUrl":["handleStylingUrlChange"]}],[0,"ui-skeleton",{"structure":[1],"width":[1],"height":[1],"borderRadius":[8,"border-radius"],"marginBottom":[8,"margin-bottom"],"marginTop":[8,"margin-top"],"marginLeft":[8,"margin-left"],"marginRight":[8,"margin-right"],"animation":[4],"rows":[2],"size":[1]},null,{"structure":["handleStructureChange"]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;
@@ -2,35 +2,61 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const pamPlayerProfile = require('./pam-player-profile-dc13914a.js');
5
+ const pamPlayerProfile = require('./pam-player-profile-3185ce39.js');
6
6
  const index = require('./index-4130c9d2.js');
7
7
 
8
- const uiSkeletonCss = ":host{display:block;--emw-skeleton-rectangle-background:#c2c2c2;--emw-skeleton-circle-background:#c2c2c2;--emw-skeleton-text-background:#c2c2c2;--emw-skeleton-title-background:#c2c2c2;--emw-skeleton-image-background:#c2c2c2;--emw-skeleton-logo-background:#c2c2c2;--emw-skeleton-primary-color:#e0e0e0;--emw-skeleton-secondary-color:#f0f0f0}.Skeleton{animation:skeleton-loading 1s linear infinite alternate}.Rectangle{background-color:var(--emw-skeleton-rectangle-background, #c2c2c2);width:var(--emw-skeleton-rectangle-width, 400px);height:var(--emw-skeleton-rectangle-height, 200px);border-radius:var(--emw-skeleton-rectangle-border-radius, 2px)}.Circle{background-color:var(--emw-skeleton-circle-background, #c2c2c2);width:var(--emw-skeleton-circle-size, 400px);height:var(--emw-skeleton-circle-size, 400px);border-radius:50%}.Text{background-color:var(--emw-skeleton-text-background, #c2c2c2);width:var(--emw-skeleton-text-width, 500px);height:var(--emw-skeleton-text-height, 20px);border-radius:var(--emw-skeleton-text-border-radius, 5px);margin-bottom:var(--emw-skeleton-text-margin-bottom, 5px)}.Text:last-child{width:var(--emw-skeleton-text-width-100, 300px)}.Title{background-color:var(--emw-skeleton-title-background, #c2c2c2);width:var(--emw-skeleton-title-width, 300px);height:var(--emw-skeleton-title-height, 30px);border-radius:var(--emw-skeleton-title-border-radius, 5px);margin-bottom:var(--emw-skeleton-title-margin-bottom, 5px)}.Image{background-color:var(--emw-skeleton-image-background, #c2c2c2);width:var(--emw-skeleton-image-width, 100%);height:var(--emw-skeleton-image-height, 100%);border-radius:var(--emw-skeleton-image-border-radius, inherit)}.Logo{background-color:var(--emw-skeleton-logo-background, #c2c2c2);width:var(--emw-skeleton-logo-width, 120px);height:var(--emw-skeleton-logo-height, 75px);border-radius:var(--emw-skeleton-logo-border-radius, 5px)}@keyframes skeleton-loading{0%{background-color:var(--emw-skeleton-primary-color, var(--emw-skeleton-color-0, #c2c2c2))}100%{background-color:var(--emw-skeleton-secondary-color, var(--emw-skeleton-color-100, #f0f0f0))}}";
8
+ const uiSkeletonCss = ":host{display:block}.Skeleton{animation:skeleton-loading 1s linear infinite alternate}.Rectangle{background-color:var(--emw-skeleton-rectangle-background, #c2c2c2);width:var(--emw-skeleton-rectangle-width, 400px);height:var(--emw-skeleton-rectangle-height, 200px);border-radius:var(--emw-skeleton-rectangle-border-radius, 10px)}.Circle{background-color:var(--emw-skeleton-circle-background, #c2c2c2);width:var(--emw-skeleton-circle-size, 400px);height:var(--emw-skeleton-circle-size, 400px);border-radius:50%}.Text{background-color:var(--emw-skeleton-text-background, #c2c2c2);width:var(--emw-skeleton-text-width, 500px);height:var(--emw-skeleton-text-height, 20px);border-radius:var(--emw-skeleton-text-border-radius, 10px);margin-bottom:var(--emw-skeleton-text-margin-bottom, 5px)}.Text:last-child{width:calc(var(--emw-skeleton-text-width, 400px) - 100px)}.Title{background-color:var(--emw-skeleton-title-background, #c2c2c2);width:var(--emw-skeleton-title-width, 300px);height:var(--emw-skeleton-title-height, 30px);border-radius:var(--emw-skeleton-title-border-radius, 10px);margin-bottom:var(--emw-skeleton-title-margin-bottom, 5px)}.Image{background-color:var(--emw-skeleton-image-background, #c2c2c2);width:var(--emw-skeleton-image-width, 100%);height:var(--emw-skeleton-image-height, 100%);border-radius:var(--emw-skeleton-image-border-radius, unset)}.Logo{background-color:var(--emw-skeleton-logo-background, #c2c2c2);width:var(--emw-skeleton-logo-width, 120px);height:var(--emw-skeleton-logo-height, 75px);border-radius:var(--emw-skeleton-logo-border-radius, 10px)}@keyframes skeleton-loading{0%{background-color:var(--emw-skeleton-primary-color, #e0e0e0)}100%{background-color:var(--emw-skeleton-secondary-color, #f0f0f0)}}";
9
9
  const UiSkeletonStyle0 = uiSkeletonCss;
10
10
 
11
11
  const UiSkeleton = class {
12
12
  constructor(hostRef) {
13
13
  index.registerInstance(this, hostRef);
14
+ this.stylingValue = {
15
+ width: this.handleStylingProps(this.width),
16
+ height: this.handleStylingProps(this.height),
17
+ borderRadius: this.handleStylingProps(this.borderRadius),
18
+ marginBottom: this.handleStylingProps(this.marginBottom),
19
+ marginTop: this.handleStylingProps(this.marginTop),
20
+ marginLeft: this.handleStylingProps(this.marginLeft),
21
+ marginRight: this.handleStylingProps(this.marginRight),
22
+ size: this.handleStylingProps(this.size)
23
+ };
14
24
  this.structure = undefined;
15
- this.width = undefined;
16
- this.height = undefined;
17
- this.borderRadius = undefined;
18
- this.marginBottom = undefined;
19
- this.marginTop = undefined;
20
- this.marginLeft = undefined;
21
- this.marginRight = undefined;
25
+ this.width = 'unset';
26
+ this.height = 'unset';
27
+ this.borderRadius = 'unset';
28
+ this.marginBottom = 'unset';
29
+ this.marginTop = 'unset';
30
+ this.marginLeft = 'unset';
31
+ this.marginRight = 'unset';
22
32
  this.animation = true;
23
- this.rows = undefined;
24
- this.size = undefined;
25
- this.color = undefined;
26
- this.primaryColor = undefined;
27
- this.secondaryColor = undefined;
33
+ this.rows = 0;
34
+ this.size = '100%';
28
35
  }
29
36
  handleStructureChange(newValue, oldValue) {
30
37
  if (oldValue !== newValue) {
31
38
  this.handleStructure(newValue);
32
39
  }
33
40
  }
41
+ handleStylingProps(value) {
42
+ switch (typeof value) {
43
+ case 'number':
44
+ return value === 0 ? 0 : `${value}px`;
45
+ case 'undefined':
46
+ return 'unset';
47
+ case 'string':
48
+ if (['auto', 'unset', 'none', 'inherit', 'initial'].includes(value) ||
49
+ value.endsWith('px') ||
50
+ value.endsWith('%')) {
51
+ return value;
52
+ }
53
+ else {
54
+ return 'unset';
55
+ }
56
+ default:
57
+ return 'unset';
58
+ }
59
+ }
34
60
  handleStructure(structure) {
35
61
  switch (structure) {
36
62
  case 'logo':
@@ -50,22 +76,22 @@ const UiSkeleton = class {
50
76
  }
51
77
  }
52
78
  renderLogo() {
53
- return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: "Logo " + (this.animation ? 'Skeleton' : '') })));
79
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: 'Logo ' + (this.animation ? 'Skeleton' : '') })));
54
80
  }
55
81
  renderImage() {
56
- return (index.h("div", { class: "Image " + (this.animation ? 'Skeleton' : '') }));
82
+ return index.h("div", { class: 'Image ' + (this.animation ? 'Skeleton' : '') });
57
83
  }
58
84
  renderTitle() {
59
- return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: "Title " + (this.animation ? 'Skeleton' : '') })));
85
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: 'Title ' + (this.animation ? 'Skeleton' : '') })));
60
86
  }
61
87
  renderText() {
62
- return (index.h("div", { class: "SkeletonContainer" }, Array.from({ length: this.rows > 0 ? this.rows : 1 }).map((_, index$1) => (index.h("div", { key: index$1, class: "Text " + (this.animation ? 'Skeleton' : '') })))));
88
+ return (index.h("div", { class: "SkeletonContainer" }, Array.from({ length: this.rows > 0 ? this.rows : 1 }).map((_, index$1) => (index.h("div", { key: index$1, class: 'Text ' + (this.animation ? 'Skeleton' : '') })))));
63
89
  }
64
90
  renderRectangle() {
65
- return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: "Rectangle " + (this.animation ? 'Skeleton' : '') })));
91
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: 'Rectangle ' + (this.animation ? 'Skeleton' : '') })));
66
92
  }
67
93
  renderCircle() {
68
- return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: "Circle " + (this.animation ? 'Skeleton' : '') })));
94
+ return (index.h("div", { class: "SkeletonContainer" }, index.h("div", { class: 'Circle ' + (this.animation ? 'Skeleton' : '') })));
69
95
  }
70
96
  render() {
71
97
  let styleBlock = '';
@@ -73,97 +99,79 @@ const UiSkeleton = class {
73
99
  case 'logo':
74
100
  styleBlock = `
75
101
  :host {
76
- --emw-skeleton-logo-width: ${this.width};
77
- --emw-skeleton-logo-height: ${this.height};
78
- --emw-skeleton-logo-border-radius: ${this.borderRadius}px;
79
- --emw-skeleton-logo-margin-bottom: ${this.marginBottom}px;
80
- --emw-skeleton-logo-margin-top: ${this.marginTop}px;
81
- --emw-skeleton-logo-margin-left: ${this.marginLeft}px;
82
- --emw-skeleton-logo-margin-right: ${this.marginRight}px;
83
- --emw-skeleton-logo-background: ${this.color};
84
- --emw-skeleton-primary-color: ${this.primaryColor};
85
- --emw-skeleton-secondary-color: ${this.secondaryColor};
102
+ --emw-skeleton-logo-width: ${this.stylingValue.width};
103
+ --emw-skeleton-logo-height: ${this.stylingValue.height};
104
+ --emw-skeleton-logo-border-radius: ${this.stylingValue.borderRadius};
105
+ --emw-skeleton-logo-margin-bottom: ${this.stylingValue.marginBottom};
106
+ --emw-skeleton-logo-margin-top: ${this.stylingValue.marginTop};
107
+ --emw-skeleton-logo-margin-left: ${this.stylingValue.marginLeft};
108
+ --emw-skeleton-logo-margin-right: ${this.stylingValue.marginRight};
86
109
  }
87
110
  `;
88
111
  break;
89
112
  case 'image':
90
113
  styleBlock = `
91
114
  :host {
92
- --emw-skeleton-image-width: ${this.width};
93
- --emw-skeleton-image-height: ${this.height};
94
- --emw-skeleton-image-border-radius: ${this.borderRadius}px;
95
- --emw-skeleton-image-margin-bottom: ${this.marginBottom}px;
96
- --emw-skeleton-image-margin-top: ${this.marginTop}px;
97
- --emw-skeleton-image-margin-left: ${this.marginLeft}px;
98
- --emw-skeleton-image-margin-right: ${this.marginRight}px;
99
- --emw-skeleton-image-background: ${this.color};
100
- --emw-skeleton-primary-color: ${this.primaryColor};
101
- --emw-skeleton-secondary-color: ${this.secondaryColor};
115
+ --emw-skeleton-image-width: ${this.stylingValue.width};
116
+ --emw-skeleton-image-height: ${this.stylingValue.height};
117
+ --emw-skeleton-image-border-radius: ${this.stylingValue.borderRadius};
118
+ --emw-skeleton-image-margin-bottom: ${this.stylingValue.marginBottom};
119
+ --emw-skeleton-image-margin-top: ${this.stylingValue.marginTop};
120
+ --emw-skeleton-image-margin-left: ${this.stylingValue.marginLeft};
121
+ --emw-skeleton-image-margin-right: ${this.stylingValue.marginRight};
102
122
  }
103
123
  `;
104
124
  break;
105
125
  case 'title':
106
126
  styleBlock = `
107
127
  :host {
108
- --emw-skeleton-title-width: ${this.width};
109
- --emw-skeleton-title-height: ${this.height};
110
- --emw-skeleton-title-border-radius: ${this.borderRadius}px;
111
- --emw-skeleton-title-margin-bottom: ${this.marginBottom}px;
112
- --emw-skeleton-title-margin-top: ${this.marginTop}px;
113
- --emw-skeleton-title-margin-left: ${this.marginLeft}px;
114
- --emw-skeleton-title-margin-right: ${this.marginRight}px;
115
- --emw-skeleton-title-background: ${this.color};
116
- --emw-skeleton-primary-color: ${this.primaryColor};
117
- --emw-skeleton-secondary-color: ${this.secondaryColor};
128
+ --emw-skeleton-title-width: ${this.stylingValue.width};
129
+ --emw-skeleton-title-height: ${this.stylingValue.height};
130
+ --emw-skeleton-title-border-radius: ${this.stylingValue.borderRadius};
131
+ --emw-skeleton-title-margin-bottom: ${this.stylingValue.marginBottom};
132
+ --emw-skeleton-title-margin-top: ${this.stylingValue.marginTop};
133
+ --emw-skeleton-title-margin-left: ${this.stylingValue.marginLeft};
134
+ --emw-skeleton-title-margin-right: ${this.stylingValue.marginRight};
118
135
  }
119
136
  `;
120
137
  break;
121
138
  case 'text':
122
139
  styleBlock = `
123
140
  :host {
124
- --emw-skeleton-text-width: ${this.width};
125
- --emw-skeleton-text-height: ${this.height};
126
- --emw-skeleton-text-border-radius: ${this.borderRadius}px;
127
- --emw-skeleton-text-margin-bottom: ${this.marginBottom}px;
128
- --emw-skeleton-text-margin-top: ${this.marginTop}px;
129
- --emw-skeleton-text-margin-left: ${this.marginLeft}px;
130
- --emw-skeleton-text-margin-right: ${this.marginRight}px;
131
- --emw-skeleton-text-background: ${this.color};
132
- --emw-skeleton-primary-color: ${this.primaryColor};
133
- --emw-skeleton-secondary-color: ${this.secondaryColor};
141
+ --emw-skeleton-text-width: ${this.stylingValue.width};
142
+ --emw-skeleton-text-height: ${this.stylingValue.height};
143
+ --emw-skeleton-text-border-radius: ${this.stylingValue.borderRadius};
144
+ --emw-skeleton-text-margin-bottom: ${this.stylingValue.marginBottom};
145
+ --emw-skeleton-text-margin-top: ${this.stylingValue.marginTop};
146
+ --emw-skeleton-text-margin-left: ${this.stylingValue.marginLeft};
147
+ --emw-skeleton-text-margin-right: ${this.stylingValue.marginRight};
134
148
  }
135
149
  `;
136
150
  break;
137
151
  case 'rectangle':
138
152
  styleBlock = `
139
153
  :host {
140
- --emw-skeleton-rectangle-width: ${this.width};
141
- --emw-skeleton-rectangle-height: ${this.height};
142
- --emw-skeleton-rectangle-border-radius: ${this.borderRadius}px;
143
- --emw-skeleton-rectangle-margin-bottom: ${this.marginBottom}px;
144
- --emw-skeleton-rectangle-margin-top: ${this.marginTop}px;
145
- --emw-skeleton-rectangle-margin-left: ${this.marginLeft}px;
146
- --emw-skeleton-rectangle-margin-right: ${this.marginRight}px;
147
- --emw-skeleton-rectangle-background: ${this.color};
148
- --emw-skeleton-primary-color: ${this.primaryColor};
149
- --emw-skeleton-secondary-color: ${this.secondaryColor};
154
+ --emw-skeleton-rectangle-width: ${this.stylingValue.width};
155
+ --emw-skeleton-rectangle-height: ${this.stylingValue.height};
156
+ --emw-skeleton-rectangle-border-radius: ${this.stylingValue.borderRadius};
157
+ --emw-skeleton-rectangle-margin-bottom: ${this.stylingValue.marginBottom};
158
+ --emw-skeleton-rectangle-margin-top: ${this.stylingValue.marginTop};
159
+ --emw-skeleton-rectangle-margin-left: ${this.stylingValue.marginLeft};
160
+ --emw-skeleton-rectangle-margin-right: ${this.stylingValue.marginRight};
150
161
  }
151
162
  `;
152
163
  break;
153
164
  case 'circle':
154
165
  styleBlock = `
155
166
  :host {
156
- --emw-skeleton-circle-size: ${this.size};
157
- --emw-skeleton-circle-background: ${this.color};
158
- --emw-skeleton-primary-color: ${this.primaryColor};
159
- --emw-skeleton-secondary-color: ${this.secondaryColor};
167
+ --emw-skeleton-circle-size: ${this.stylingValue.size};
160
168
  }
161
169
  `;
162
170
  break;
163
171
  default:
164
172
  styleBlock = '';
165
173
  }
166
- return (index.h(index.Host, { key: '3bb792a149db7fe732d5cbfa092cdb4d6ca0689e' }, index.h("style", { key: 'a4607599b60659f385ae2660513e38b383739674' }, styleBlock), this.handleStructure(this.structure)));
174
+ return (index.h(index.Host, { key: 'e6b885bfd985ce7663d990756fe9101e25eb97f0' }, index.h("style", { key: '06ae24c7bb74f4dacfc12ae58085333f9dc89da5' }, styleBlock), this.handleStructure(this.structure)));
167
175
  }
168
176
  static get watchers() { return {
169
177
  "structure": ["handleStructureChange"]
@@ -10,6 +10,24 @@ input, select, option {
10
10
  font-family: inherit;
11
11
  }
12
12
 
13
+ .errorContainer {
14
+ font-family: "Roboto";
15
+ font-style: normal;
16
+ font-family: sans-serif;
17
+ display: flex;
18
+ flex-direction: column;
19
+ gap: 24px;
20
+ width: 100%;
21
+ height: 100%;
22
+ }
23
+ .errorContainer .errorMessage {
24
+ color: var(--emw--color-error, var(--emw--color-red, #ed0909));
25
+ font-size: var(--emw-font-size-small, 13px);
26
+ display: block;
27
+ justify-content: center;
28
+ text-align: center;
29
+ }
30
+
13
31
  .PamPlayerProfileWrapper {
14
32
  color: var(--emw--pam-typography, var(--emw-color-contrast, #07072A));
15
33
  background: var(--emw-color-pale, var(--emw--color-gray-50, #F1F1F1));
@@ -36,25 +36,53 @@ export class PamPlayerProfile {
36
36
  break;
37
37
  }
38
38
  };
39
+ /**
40
+ * Promise for fetching the response and returning the response or the erorr message
41
+ * @param res - response from the API
42
+ */
43
+ this.handleFetchResponse = async (res) => {
44
+ var _a;
45
+ if (res.status >= 300) {
46
+ this.isError = true;
47
+ let response = await res.json();
48
+ this.errorCode = (_a = response.thirdPartyResponse) === null || _a === void 0 ? void 0 : _a.errorCode;
49
+ this.errorMessage = this.errorCode ? translate(this.errorCode, this.lang) : translate('errorMessageFetch', this.lang);
50
+ window.postMessage({
51
+ type: 'WidgetNotification',
52
+ data: {
53
+ type: 'error',
54
+ message: this.errorMessage
55
+ }
56
+ }, window.location.href);
57
+ return Promise.reject(this.errorMessage);
58
+ }
59
+ else {
60
+ this.isError = false;
61
+ if (res.headers.get('content-type')) {
62
+ let response = await res.json();
63
+ return Promise.resolve(response);
64
+ }
65
+ return Promise.resolve();
66
+ }
67
+ };
39
68
  this.getData = () => {
40
- const url = new URL(`api/v1/players/${this.userId}/player-identifiable-information`, this.endpoint);
69
+ const url = new URL(`/api/v1/players/${this.userId}/player-identifiable-information/`, this.endpoint);
41
70
  const headers = new Headers();
42
71
  headers.append('X-SessionID', this.session);
43
72
  const options = {
44
73
  method: 'GET',
45
74
  headers: headers
46
75
  };
47
- return new Promise((resolve) => {
76
+ return new Promise((resolve, reject) => {
48
77
  fetch(url.href, options)
49
- .then(res => {
50
- if (res.ok) {
51
- return res.json();
52
- }
53
- this.sendErrorNotification('errorMessageFetch');
54
- })
78
+ .then((res) => this.handleFetchResponse(res))
55
79
  .then(res => {
56
80
  this.data = res.player;
57
81
  resolve();
82
+ })
83
+ .catch((error) => {
84
+ console.error(error);
85
+ reject(error);
58
86
  });
59
87
  });
60
88
  };
@@ -97,7 +125,7 @@ export class PamPlayerProfile {
97
125
  this.updateData = (e) => {
98
126
  if (e)
99
127
  e.preventDefault();
100
- const url = new URL(`/api/v1/players/${this.userId}/player-identifiable-information`, this.endpoint);
128
+ const url = new URL(`/api/v1/players/${this.userId}/player-identifiable-information/`, this.endpoint);
101
129
  const headers = new Headers();
102
130
  headers.append('X-SessionId', this.session);
103
131
  headers.append('Content-Type', 'application/problem+json; charset=utf-8');
@@ -109,12 +137,13 @@ export class PamPlayerProfile {
109
137
  body: JSON.stringify(this.data)
110
138
  };
111
139
  fetch(url, reqParams)
112
- .then(res => {
113
- if (!res.ok) {
114
- return this.sendErrorNotification('errorMessageUpdate');
115
- }
140
+ .then(res => this.handleFetchResponse(res))
141
+ .then(() => {
116
142
  this.sendSuccessNotification();
117
143
  this.getData().then(() => this.resetState());
144
+ })
145
+ .catch((error) => {
146
+ console.error(error);
118
147
  });
119
148
  };
120
149
  this.updateSubmitButtonStatus = () => {
@@ -157,6 +186,9 @@ export class PamPlayerProfile {
157
186
  this.isSubmitButtonAvailable = false;
158
187
  this.invalidFields = 0;
159
188
  this.isMobile = isMobile(window.navigator.userAgent);
189
+ this.isError = false;
190
+ this.errorMessage = '';
191
+ this.errorCode = '';
160
192
  }
161
193
  handleStylingChange(newValue, oldValue) {
162
194
  if (newValue !== oldValue)
@@ -217,7 +249,10 @@ export class PamPlayerProfile {
217
249
  this.isSubmitButtonAvailable = false;
218
250
  }
219
251
  render() {
220
- return (h("div", { key: '0bfa140cc83e29e99e4af534700e5b009a88e9ac', ref: el => this.stylingContainer = el }, this.skeletonLoading
252
+ if (!this.skeletonLoading && this.isError) {
253
+ return (h("div", { class: "errorContainer" }, h("p", { class: "errorMessage", innerHTML: this.errorMessage })));
254
+ }
255
+ return (h("div", { ref: el => this.stylingContainer = el }, this.skeletonLoading
221
256
  ? 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
257
  : 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
258
  h("section", { class: "ButtonsArea" }, h("button", { class: `SaveButton ${this.isSubmitButtonAvailable ? '' : 'Disabled'}`, onClick: this.updateData }, translate('saveButton'))))));
@@ -417,7 +452,10 @@ export class PamPlayerProfile {
417
452
  "skeletonLoading": {},
418
453
  "isSubmitButtonAvailable": {},
419
454
  "invalidFields": {},
420
- "isMobile": {}
455
+ "isMobile": {},
456
+ "isError": {},
457
+ "errorMessage": {},
458
+ "errorCode": {}
421
459
  };
422
460
  }
423
461
  static get watchers() {
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { P as PamPlayerProfile } from './pam-player-profile-e280c440.js';
1
+ export { P as PamPlayerProfile } from './pam-player-profile-2ba91a9a.js';
2
2
  import './index-d953d051.js';
@@ -5,7 +5,7 @@ import { g as globalScripts } from './app-globals-0f993ce5.js';
5
5
  const defineCustomElements = async (win, options) => {
6
6
  if (typeof window === 'undefined') return undefined;
7
7
  await globalScripts();
8
- return bootstrapLazy([["pam-player-profile_2",[[1,"pam-player-profile",{"userId":[513,"user-id"],"session":[513],"endpoint":[513],"lang":[513],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"dobFormat":[513,"dob-format"],"isStandAlone":[513,"is-stand-alone"],"limitStylingAppends":[32],"skeletonLoading":[32],"isSubmitButtonAvailable":[32],"invalidFields":[32],"isMobile":[32]},null,{"clientStyling":["handleStylingChange"],"clientStylingUrl":["handleStylingUrlChange"]}],[0,"ui-skeleton",{"structure":[1],"width":[1],"height":[1],"borderRadius":[2,"border-radius"],"marginBottom":[2,"margin-bottom"],"marginTop":[2,"margin-top"],"marginLeft":[2,"margin-left"],"marginRight":[2,"margin-right"],"animation":[4],"rows":[2],"size":[1],"color":[1],"primaryColor":[1,"primary-color"],"secondaryColor":[1,"secondary-color"]},null,{"structure":["handleStructureChange"]}]]]], options);
8
+ return bootstrapLazy([["pam-player-profile_2",[[1,"pam-player-profile",{"userId":[513,"user-id"],"session":[513],"endpoint":[513],"lang":[513],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"dobFormat":[513,"dob-format"],"isStandAlone":[513,"is-stand-alone"],"limitStylingAppends":[32],"skeletonLoading":[32],"isSubmitButtonAvailable":[32],"invalidFields":[32],"isMobile":[32],"isError":[32],"errorMessage":[32],"errorCode":[32]},null,{"clientStyling":["handleStylingChange"],"clientStylingUrl":["handleStylingUrlChange"]}],[0,"ui-skeleton",{"structure":[1],"width":[1],"height":[1],"borderRadius":[8,"border-radius"],"marginBottom":[8,"margin-bottom"],"marginTop":[8,"margin-top"],"marginLeft":[8,"margin-left"],"marginRight":[8,"margin-right"],"animation":[4],"rows":[2],"size":[1]},null,{"structure":["handleStructureChange"]}]]]], options);
9
9
  };
10
10
 
11
11
  export { defineCustomElements };