@everymatrix/pam-logout 1.80.12 → 1.80.13

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 pamLogout = require('./pam-logout-b7c77f21.js');
5
+ const pamLogout = require('./pam-logout-bba672a3.js');
6
6
  require('./index-e376310b.js');
7
7
 
8
8
 
@@ -164,6 +164,7 @@ const PamLogout = class {
164
164
  index.registerInstance(this, hostRef);
165
165
  this.device = checkDeviceType();
166
166
  this.handleLogout = async () => {
167
+ var _a, _b;
167
168
  try {
168
169
  const headers = new Headers();
169
170
  headers.append('accept', 'text/plain');
@@ -172,10 +173,10 @@ const PamLogout = class {
172
173
  method: 'POST',
173
174
  headers: headers
174
175
  };
175
- const response = await fetch(`${this.endpoint}/api/v2/gm/sav2/sessions/terminate`, options);
176
+ const response = await fetch(`${this.endpoint}/api/pam/v1/logout`, options);
176
177
  if (response.ok) {
177
178
  let data = await response.json();
178
- if (data.details.exitReason === 'LOGGEDOFF') {
179
+ if (((_b = (_a = data === null || data === void 0 ? void 0 : data.session) === null || _a === void 0 ? void 0 : _a.details) === null || _b === void 0 ? void 0 : _b.exitReason) === 'LOGGEDOFF') {
179
180
  window.postMessage({ type: 'LogoutSuccessfull' }, window.location.href);
180
181
  dispatchCustomEvent('logged_out', {});
181
182
  }
@@ -239,11 +240,11 @@ const PamLogout = class {
239
240
  }
240
241
  }
241
242
  render() {
242
- return (index.h("div", { key: '032ff9b49abe238915c9e09ee188b55ec0905fe5', class: "LogoutContainer", ref: el => this.stylingContainer = el }, index.h("p", { key: '9e104e85c9fc882b19c1ae2aeb7c73fe92f81b59', class: {
243
+ return (index.h("div", { key: 'ebbb1f2c1c2950f00444fb899235a42c1fbcb10e', class: "LogoutContainer", ref: el => this.stylingContainer = el }, index.h("p", { key: '891bd35bc62a23c4b3668faacd1015364a252fb5', class: {
243
244
  'PlayerAccountMenuItemBox': true,
244
245
  'PlayerAccountMenuItemBoxMobile': this.device === 'mobile',
245
246
  'PlayerAccountMenuItemBoxTablet': this.device === 'tablet'
246
- }, onClick: this.handleLogout }, index.h("span", { key: '589c875ecf47d7f2a47ca0601939666a77c01f5f', style: { width: this.device === 'tablet' ? '24px' : '20px' } }, index.h("svg", { key: 'd8d1231b4d5372c96cdd6d046d7c6e2cab668e47', id: "bbfaf345-72af-4296-bf4b-2fd41fc03d5d", "data-name": "Layer 1", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 150 150", width: "100%", height: "100%" }, index.h("path", { key: 'e165df55c8ce1d39765190c9614ce0546f9ecc8f', class: "icon-path", d: "M147.16,67.69,115.42,36a9.6,9.6,0,1,0-13.58,13.58l15.32,15.31H49.58a9.63,9.63,0,1,0,0,19.26h67.58L101.84,99.42a9.64,9.64,0,0,0,6.79,16.43,9.41,9.41,0,0,0,6.79-2.85l31.74-31.73a9.53,9.53,0,0,0,0-13.58Z" }), index.h("path", { key: 'bb8da160d694fd29a6e19a4a9376987abcbafa76', class: "icon-path", d: "M45.16,122.16H19.26V26.79H45.32a9.63,9.63,0,1,0,0-19.26H9.63A9.56,9.56,0,0,0,0,17.16V131.63a9.57,9.57,0,0,0,9.63,9.64H45.32A9.57,9.57,0,0,0,55,131.63a9.78,9.78,0,0,0-9.79-9.47Z" }))), this.device !== 'mobile' && (index.h("span", { key: '5851825f4c5dc7b96268806cd19dcc4ae3687eaa', class: "PlayerLogoutText" }, translate('logoutButton', this.language))))));
247
+ }, onClick: this.handleLogout }, index.h("span", { key: '93e18c0751156d5f4e5085229dc9b68a946ec35a', style: { width: this.device === 'tablet' ? '24px' : '20px' } }, index.h("svg", { key: 'd77c42b64be06052f72da3867f84dd8408fc8f3b', id: "bbfaf345-72af-4296-bf4b-2fd41fc03d5d", "data-name": "Layer 1", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 150 150", width: "100%", height: "100%" }, index.h("path", { key: '771a1db24255b9817c462a034550f04bb0754e57', class: "icon-path", d: "M147.16,67.69,115.42,36a9.6,9.6,0,1,0-13.58,13.58l15.32,15.31H49.58a9.63,9.63,0,1,0,0,19.26h67.58L101.84,99.42a9.64,9.64,0,0,0,6.79,16.43,9.41,9.41,0,0,0,6.79-2.85l31.74-31.73a9.53,9.53,0,0,0,0-13.58Z" }), index.h("path", { key: '5e0592b92da57312febec43af1b8360f5f76abdb', class: "icon-path", d: "M45.16,122.16H19.26V26.79H45.32a9.63,9.63,0,1,0,0-19.26H9.63A9.56,9.56,0,0,0,0,17.16V131.63a9.57,9.57,0,0,0,9.63,9.64H45.32A9.57,9.57,0,0,0,55,131.63a9.78,9.78,0,0,0-9.79-9.47Z" }))), this.device !== 'mobile' && (index.h("span", { key: 'eb1d8a4430b07418db8de665f98b3e8a9d9def75', class: "PlayerLogoutText" }, translate('logoutButton', this.language))))));
247
248
  }
248
249
  static get watchers() { return {
249
250
  "clientStyling": ["handleClientStylingChange"],
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const pamLogout = require('./pam-logout-b7c77f21.js');
5
+ const pamLogout = require('./pam-logout-bba672a3.js');
6
6
  require('./index-e376310b.js');
7
7
 
8
8
 
@@ -7,6 +7,7 @@ export class PamLogout {
7
7
  constructor() {
8
8
  this.device = checkDeviceType();
9
9
  this.handleLogout = async () => {
10
+ var _a, _b;
10
11
  try {
11
12
  const headers = new Headers();
12
13
  headers.append('accept', 'text/plain');
@@ -15,10 +16,10 @@ export class PamLogout {
15
16
  method: 'POST',
16
17
  headers: headers
17
18
  };
18
- const response = await fetch(`${this.endpoint}/api/v2/gm/sav2/sessions/terminate`, options);
19
+ const response = await fetch(`${this.endpoint}/api/pam/v1/logout`, options);
19
20
  if (response.ok) {
20
21
  let data = await response.json();
21
- if (data.details.exitReason === 'LOGGEDOFF') {
22
+ if (((_b = (_a = data === null || data === void 0 ? void 0 : data.session) === null || _a === void 0 ? void 0 : _a.details) === null || _b === void 0 ? void 0 : _b.exitReason) === 'LOGGEDOFF') {
22
23
  window.postMessage({ type: 'LogoutSuccessfull' }, window.location.href);
23
24
  dispatchCustomEvent('logged_out', {});
24
25
  }
@@ -82,11 +83,11 @@ export class PamLogout {
82
83
  }
83
84
  }
84
85
  render() {
85
- return (h("div", { key: '032ff9b49abe238915c9e09ee188b55ec0905fe5', class: "LogoutContainer", ref: el => this.stylingContainer = el }, h("p", { key: '9e104e85c9fc882b19c1ae2aeb7c73fe92f81b59', class: {
86
+ return (h("div", { key: 'ebbb1f2c1c2950f00444fb899235a42c1fbcb10e', class: "LogoutContainer", ref: el => this.stylingContainer = el }, h("p", { key: '891bd35bc62a23c4b3668faacd1015364a252fb5', class: {
86
87
  'PlayerAccountMenuItemBox': true,
87
88
  'PlayerAccountMenuItemBoxMobile': this.device === 'mobile',
88
89
  'PlayerAccountMenuItemBoxTablet': this.device === 'tablet'
89
- }, onClick: this.handleLogout }, h("span", { key: '589c875ecf47d7f2a47ca0601939666a77c01f5f', style: { width: this.device === 'tablet' ? '24px' : '20px' } }, h("svg", { key: 'd8d1231b4d5372c96cdd6d046d7c6e2cab668e47', id: "bbfaf345-72af-4296-bf4b-2fd41fc03d5d", "data-name": "Layer 1", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 150 150", width: "100%", height: "100%" }, h("path", { key: 'e165df55c8ce1d39765190c9614ce0546f9ecc8f', class: "icon-path", d: "M147.16,67.69,115.42,36a9.6,9.6,0,1,0-13.58,13.58l15.32,15.31H49.58a9.63,9.63,0,1,0,0,19.26h67.58L101.84,99.42a9.64,9.64,0,0,0,6.79,16.43,9.41,9.41,0,0,0,6.79-2.85l31.74-31.73a9.53,9.53,0,0,0,0-13.58Z" }), h("path", { key: 'bb8da160d694fd29a6e19a4a9376987abcbafa76', class: "icon-path", d: "M45.16,122.16H19.26V26.79H45.32a9.63,9.63,0,1,0,0-19.26H9.63A9.56,9.56,0,0,0,0,17.16V131.63a9.57,9.57,0,0,0,9.63,9.64H45.32A9.57,9.57,0,0,0,55,131.63a9.78,9.78,0,0,0-9.79-9.47Z" }))), this.device !== 'mobile' && (h("span", { key: '5851825f4c5dc7b96268806cd19dcc4ae3687eaa', class: "PlayerLogoutText" }, translate('logoutButton', this.language))))));
90
+ }, onClick: this.handleLogout }, h("span", { key: '93e18c0751156d5f4e5085229dc9b68a946ec35a', style: { width: this.device === 'tablet' ? '24px' : '20px' } }, h("svg", { key: 'd77c42b64be06052f72da3867f84dd8408fc8f3b', id: "bbfaf345-72af-4296-bf4b-2fd41fc03d5d", "data-name": "Layer 1", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 150 150", width: "100%", height: "100%" }, h("path", { key: '771a1db24255b9817c462a034550f04bb0754e57', class: "icon-path", d: "M147.16,67.69,115.42,36a9.6,9.6,0,1,0-13.58,13.58l15.32,15.31H49.58a9.63,9.63,0,1,0,0,19.26h67.58L101.84,99.42a9.64,9.64,0,0,0,6.79,16.43,9.41,9.41,0,0,0,6.79-2.85l31.74-31.73a9.53,9.53,0,0,0,0-13.58Z" }), h("path", { key: '5e0592b92da57312febec43af1b8360f5f76abdb', class: "icon-path", d: "M45.16,122.16H19.26V26.79H45.32a9.63,9.63,0,1,0,0-19.26H9.63A9.56,9.56,0,0,0,0,17.16V131.63a9.57,9.57,0,0,0,9.63,9.64H45.32A9.57,9.57,0,0,0,55,131.63a9.78,9.78,0,0,0-9.79-9.47Z" }))), this.device !== 'mobile' && (h("span", { key: 'eb1d8a4430b07418db8de665f98b3e8a9d9def75', class: "PlayerLogoutText" }, translate('logoutButton', this.language))))));
90
91
  }
91
92
  static get is() { return "pam-logout"; }
92
93
  static get encapsulation() { return "shadow"; }
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { P as PamLogout } from './pam-logout-e2463ce5.js';
1
+ export { P as PamLogout } from './pam-logout-ca67c66d.js';
2
2
  import './index-1abc369e.js';
@@ -162,6 +162,7 @@ const PamLogout = class {
162
162
  registerInstance(this, hostRef);
163
163
  this.device = checkDeviceType();
164
164
  this.handleLogout = async () => {
165
+ var _a, _b;
165
166
  try {
166
167
  const headers = new Headers();
167
168
  headers.append('accept', 'text/plain');
@@ -170,10 +171,10 @@ const PamLogout = class {
170
171
  method: 'POST',
171
172
  headers: headers
172
173
  };
173
- const response = await fetch(`${this.endpoint}/api/v2/gm/sav2/sessions/terminate`, options);
174
+ const response = await fetch(`${this.endpoint}/api/pam/v1/logout`, options);
174
175
  if (response.ok) {
175
176
  let data = await response.json();
176
- if (data.details.exitReason === 'LOGGEDOFF') {
177
+ if (((_b = (_a = data === null || data === void 0 ? void 0 : data.session) === null || _a === void 0 ? void 0 : _a.details) === null || _b === void 0 ? void 0 : _b.exitReason) === 'LOGGEDOFF') {
177
178
  window.postMessage({ type: 'LogoutSuccessfull' }, window.location.href);
178
179
  dispatchCustomEvent('logged_out', {});
179
180
  }
@@ -237,11 +238,11 @@ const PamLogout = class {
237
238
  }
238
239
  }
239
240
  render() {
240
- return (h("div", { key: '032ff9b49abe238915c9e09ee188b55ec0905fe5', class: "LogoutContainer", ref: el => this.stylingContainer = el }, h("p", { key: '9e104e85c9fc882b19c1ae2aeb7c73fe92f81b59', class: {
241
+ return (h("div", { key: 'ebbb1f2c1c2950f00444fb899235a42c1fbcb10e', class: "LogoutContainer", ref: el => this.stylingContainer = el }, h("p", { key: '891bd35bc62a23c4b3668faacd1015364a252fb5', class: {
241
242
  'PlayerAccountMenuItemBox': true,
242
243
  'PlayerAccountMenuItemBoxMobile': this.device === 'mobile',
243
244
  'PlayerAccountMenuItemBoxTablet': this.device === 'tablet'
244
- }, onClick: this.handleLogout }, h("span", { key: '589c875ecf47d7f2a47ca0601939666a77c01f5f', style: { width: this.device === 'tablet' ? '24px' : '20px' } }, h("svg", { key: 'd8d1231b4d5372c96cdd6d046d7c6e2cab668e47', id: "bbfaf345-72af-4296-bf4b-2fd41fc03d5d", "data-name": "Layer 1", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 150 150", width: "100%", height: "100%" }, h("path", { key: 'e165df55c8ce1d39765190c9614ce0546f9ecc8f', class: "icon-path", d: "M147.16,67.69,115.42,36a9.6,9.6,0,1,0-13.58,13.58l15.32,15.31H49.58a9.63,9.63,0,1,0,0,19.26h67.58L101.84,99.42a9.64,9.64,0,0,0,6.79,16.43,9.41,9.41,0,0,0,6.79-2.85l31.74-31.73a9.53,9.53,0,0,0,0-13.58Z" }), h("path", { key: 'bb8da160d694fd29a6e19a4a9376987abcbafa76', class: "icon-path", d: "M45.16,122.16H19.26V26.79H45.32a9.63,9.63,0,1,0,0-19.26H9.63A9.56,9.56,0,0,0,0,17.16V131.63a9.57,9.57,0,0,0,9.63,9.64H45.32A9.57,9.57,0,0,0,55,131.63a9.78,9.78,0,0,0-9.79-9.47Z" }))), this.device !== 'mobile' && (h("span", { key: '5851825f4c5dc7b96268806cd19dcc4ae3687eaa', class: "PlayerLogoutText" }, translate('logoutButton', this.language))))));
245
+ }, onClick: this.handleLogout }, h("span", { key: '93e18c0751156d5f4e5085229dc9b68a946ec35a', style: { width: this.device === 'tablet' ? '24px' : '20px' } }, h("svg", { key: 'd77c42b64be06052f72da3867f84dd8408fc8f3b', id: "bbfaf345-72af-4296-bf4b-2fd41fc03d5d", "data-name": "Layer 1", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 150 150", width: "100%", height: "100%" }, h("path", { key: '771a1db24255b9817c462a034550f04bb0754e57', class: "icon-path", d: "M147.16,67.69,115.42,36a9.6,9.6,0,1,0-13.58,13.58l15.32,15.31H49.58a9.63,9.63,0,1,0,0,19.26h67.58L101.84,99.42a9.64,9.64,0,0,0,6.79,16.43,9.41,9.41,0,0,0,6.79-2.85l31.74-31.73a9.53,9.53,0,0,0,0-13.58Z" }), h("path", { key: '5e0592b92da57312febec43af1b8360f5f76abdb', class: "icon-path", d: "M45.16,122.16H19.26V26.79H45.32a9.63,9.63,0,1,0,0-19.26H9.63A9.56,9.56,0,0,0,0,17.16V131.63a9.57,9.57,0,0,0,9.63,9.64H45.32A9.57,9.57,0,0,0,55,131.63a9.78,9.78,0,0,0-9.79-9.47Z" }))), this.device !== 'mobile' && (h("span", { key: 'eb1d8a4430b07418db8de665f98b3e8a9d9def75', class: "PlayerLogoutText" }, translate('logoutButton', this.language))))));
245
246
  }
246
247
  static get watchers() { return {
247
248
  "clientStyling": ["handleClientStylingChange"],
@@ -1,2 +1,2 @@
1
- export { P as pam_logout } from './pam-logout-e2463ce5.js';
1
+ export { P as pam_logout } from './pam-logout-ca67c66d.js';
2
2
  import './index-1abc369e.js';
@@ -1 +1 @@
1
- export{P as PamLogout}from"./pam-logout-e2463ce5.js";import"./index-1abc369e.js";
1
+ export{P as PamLogout}from"./pam-logout-ca67c66d.js";import"./index-1abc369e.js";
@@ -0,0 +1 @@
1
+ import{r as t,h as e}from"./index-1abc369e.js";function o(t,e){if(t){const o=document.createElement("style");o.innerHTML=e,t.appendChild(o)}}function n(t,e){const o=new URL(e);fetch(o.href).then((t=>t.text())).then((e=>{const o=document.createElement("style");o.innerHTML=e,t&&t.appendChild(o)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}function i(t,e){if(window.emMessageBus){const o=document.createElement("style");window.emMessageBus.subscribe(e,(e=>{o.innerHTML=e,t&&t.appendChild(o)}))}}const a={en:{logoutButton:"Logout"},hu:{logoutButton:"Logout"},ro:{logoutButton:"Logout"},fr:{logoutButton:"Déconnexion"},tr:{logoutButton:"Çıkış Yap"},hr:{logoutButton:"Logout"},"pt-br":{logoutButton:"Logout"},"es-mx":{logoutButton:"Logout"}},s=class{constructor(e){t(this,e),this.device=function(){const t=navigator.userAgent.toLowerCase(),e=screen.availWidth,o=screen.availHeight;if(t.includes("iphone"))return"mobile";if(t.includes("android")){if(o>e&&e<800)return"mobile";if(e>o&&o<800)return"tablet"}return"desktop"}(),this.handleLogout=async()=>{var t,e;try{const o=new Headers;o.append("accept","text/plain"),o.append("X-SessionId",this.session);const n={method:"POST",headers:o},i=await fetch(`${this.endpoint}/api/pam/v1/logout`,n);if(!i.ok)throw new Error(`Logout failed with status: ${i.status}`);{let o=await i.json();"LOGGEDOFF"===(null===(e=null===(t=null==o?void 0:o.session)||void 0===t?void 0:t.details)||void 0===e?void 0:e.exitReason)&&(window.postMessage({type:"LogoutSuccessfull"},window.location.href),((t,e={})=>{const o=new CustomEvent("track-custom-event",{detail:{type:"logged_out",data:e},bubbles:!0,composed:!0});document.dispatchEvent(o)})(0,{}))}}catch(t){console.error("Logout error:",t),window.postMessage({type:"LogoutFailed"},window.location.href)}},this.endpoint=void 0,this.session=void 0,this.language="en",this.mbSource=void 0,this.clientStyling="",this.clientStylingUrl="",this.translationUrl=""}handleClientStylingChange(t,e){t!==e&&this.stylingContainer&&o(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(t,e){t!==e&&this.stylingContainer&&n(this.stylingContainer,this.clientStylingUrl)}handleMbSourceChange(t,e){t!==e&&this.stylingContainer&&i(this.stylingContainer,`${this.mbSource}.Style`)}async componentWillLoad(){if(!this.endpoint||!this.session)throw new Error("endpoint and session props are required");var t;this.translationUrl&&this.translationUrl.length>2&&await(t=this.translationUrl,new Promise((e=>{fetch(t).then((t=>t.json())).then((t=>{Object.keys(t).forEach((e=>{for(let o in t[e])a[e][o]=t[e][o]})),e(!0)}))})))}componentDidLoad(){this.stylingContainer&&(this.mbSource&&i(this.stylingContainer,`${this.mbSource}.Style`),this.clientStyling&&o(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&n(this.stylingContainer,this.clientStylingUrl))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}render(){return e("div",{key:"ebbb1f2c1c2950f00444fb899235a42c1fbcb10e",class:"LogoutContainer",ref:t=>this.stylingContainer=t},e("p",{key:"891bd35bc62a23c4b3668faacd1015364a252fb5",class:{PlayerAccountMenuItemBox:!0,PlayerAccountMenuItemBoxMobile:"mobile"===this.device,PlayerAccountMenuItemBoxTablet:"tablet"===this.device},onClick:this.handleLogout},e("span",{key:"93e18c0751156d5f4e5085229dc9b68a946ec35a",style:{width:"tablet"===this.device?"24px":"20px"}},e("svg",{key:"d77c42b64be06052f72da3867f84dd8408fc8f3b",id:"bbfaf345-72af-4296-bf4b-2fd41fc03d5d","data-name":"Layer 1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 150 150",width:"100%",height:"100%"},e("path",{key:"771a1db24255b9817c462a034550f04bb0754e57",class:"icon-path",d:"M147.16,67.69,115.42,36a9.6,9.6,0,1,0-13.58,13.58l15.32,15.31H49.58a9.63,9.63,0,1,0,0,19.26h67.58L101.84,99.42a9.64,9.64,0,0,0,6.79,16.43,9.41,9.41,0,0,0,6.79-2.85l31.74-31.73a9.53,9.53,0,0,0,0-13.58Z"}),e("path",{key:"5e0592b92da57312febec43af1b8360f5f76abdb",class:"icon-path",d:"M45.16,122.16H19.26V26.79H45.32a9.63,9.63,0,1,0,0-19.26H9.63A9.56,9.56,0,0,0,0,17.16V131.63a9.57,9.57,0,0,0,9.63,9.64H45.32A9.57,9.57,0,0,0,55,131.63a9.78,9.78,0,0,0-9.79-9.47Z"}))),"mobile"!==this.device&&e("span",{key:"eb1d8a4430b07418db8de665f98b3e8a9d9def75",class:"PlayerLogoutText"},((t,e)=>{let o=a[void 0!==e?e:"en"].logoutButton;return o})(0,this.language))))}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}}};s.style=":host{display:block}:host *,:host *::before,:host *::after{margin:0;padding:0;list-style:none;text-decoration:none;outline:none;box-sizing:border-box}.PlayerAccountMenuItemBox{padding:20px;font-size:16px;display:inline-flex;width:100%;box-sizing:border-box;align-items:center;cursor:pointer}.PlayerAccountMenuItemBox .PlayerLogoutText{margin-left:20px}.PlayerAccountMenuItemBox svg{display:block;width:100%;height:100%}.PlayerAccountMenuItemBox svg .logout-icon-path{fill:var(--emw--pam-typography-color-nav-bg, var(--emw--color-white, #FFFFFF))}.PlayerAccountMenuItemBoxMobile.PlayerAccountMenuItemBox{height:auto;justify-content:center;position:relative;display:flex;width:unset;padding:0}.PlayerAccountMenuItemBoxMobile.PlayerAccountMenuItemBox svg .logout-icon-path{fill:var(--emw--pam-typography-color-nav-bg, var(--emw--color-white, #FFFFFF))}";export{s as P}
@@ -1 +1 @@
1
- export{P as pam_logout}from"./pam-logout-e2463ce5.js";import"./index-1abc369e.js";
1
+ export{P as pam_logout}from"./pam-logout-ca67c66d.js";import"./index-1abc369e.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/pam-logout",
3
- "version": "1.80.12",
3
+ "version": "1.80.13",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",
@@ -1 +0,0 @@
1
- import{r as t,h as e}from"./index-1abc369e.js";function o(t,e){if(t){const o=document.createElement("style");o.innerHTML=e,t.appendChild(o)}}function n(t,e){const o=new URL(e);fetch(o.href).then((t=>t.text())).then((e=>{const o=document.createElement("style");o.innerHTML=e,t&&t.appendChild(o)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}function i(t,e){if(window.emMessageBus){const o=document.createElement("style");window.emMessageBus.subscribe(e,(e=>{o.innerHTML=e,t&&t.appendChild(o)}))}}const a={en:{logoutButton:"Logout"},hu:{logoutButton:"Logout"},ro:{logoutButton:"Logout"},fr:{logoutButton:"Déconnexion"},tr:{logoutButton:"Çıkış Yap"},hr:{logoutButton:"Logout"},"pt-br":{logoutButton:"Logout"},"es-mx":{logoutButton:"Logout"}},s=class{constructor(e){t(this,e),this.device=function(){const t=navigator.userAgent.toLowerCase(),e=screen.availWidth,o=screen.availHeight;if(t.includes("iphone"))return"mobile";if(t.includes("android")){if(o>e&&e<800)return"mobile";if(e>o&&o<800)return"tablet"}return"desktop"}(),this.handleLogout=async()=>{try{const t=new Headers;t.append("accept","text/plain"),t.append("X-SessionId",this.session);const e={method:"POST",headers:t},o=await fetch(`${this.endpoint}/api/v2/gm/sav2/sessions/terminate`,e);if(!o.ok)throw new Error(`Logout failed with status: ${o.status}`);"LOGGEDOFF"===(await o.json()).details.exitReason&&(window.postMessage({type:"LogoutSuccessfull"},window.location.href),((t,e={})=>{const o=new CustomEvent("track-custom-event",{detail:{type:"logged_out",data:e},bubbles:!0,composed:!0});document.dispatchEvent(o)})(0,{}))}catch(t){console.error("Logout error:",t),window.postMessage({type:"LogoutFailed"},window.location.href)}},this.endpoint=void 0,this.session=void 0,this.language="en",this.mbSource=void 0,this.clientStyling="",this.clientStylingUrl="",this.translationUrl=""}handleClientStylingChange(t,e){t!==e&&this.stylingContainer&&o(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(t,e){t!==e&&this.stylingContainer&&n(this.stylingContainer,this.clientStylingUrl)}handleMbSourceChange(t,e){t!==e&&this.stylingContainer&&i(this.stylingContainer,`${this.mbSource}.Style`)}async componentWillLoad(){if(!this.endpoint||!this.session)throw new Error("endpoint and session props are required");var t;this.translationUrl&&this.translationUrl.length>2&&await(t=this.translationUrl,new Promise((e=>{fetch(t).then((t=>t.json())).then((t=>{Object.keys(t).forEach((e=>{for(let o in t[e])a[e][o]=t[e][o]})),e(!0)}))})))}componentDidLoad(){this.stylingContainer&&(this.mbSource&&i(this.stylingContainer,`${this.mbSource}.Style`),this.clientStyling&&o(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&n(this.stylingContainer,this.clientStylingUrl))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}render(){return e("div",{key:"032ff9b49abe238915c9e09ee188b55ec0905fe5",class:"LogoutContainer",ref:t=>this.stylingContainer=t},e("p",{key:"9e104e85c9fc882b19c1ae2aeb7c73fe92f81b59",class:{PlayerAccountMenuItemBox:!0,PlayerAccountMenuItemBoxMobile:"mobile"===this.device,PlayerAccountMenuItemBoxTablet:"tablet"===this.device},onClick:this.handleLogout},e("span",{key:"589c875ecf47d7f2a47ca0601939666a77c01f5f",style:{width:"tablet"===this.device?"24px":"20px"}},e("svg",{key:"d8d1231b4d5372c96cdd6d046d7c6e2cab668e47",id:"bbfaf345-72af-4296-bf4b-2fd41fc03d5d","data-name":"Layer 1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 150 150",width:"100%",height:"100%"},e("path",{key:"e165df55c8ce1d39765190c9614ce0546f9ecc8f",class:"icon-path",d:"M147.16,67.69,115.42,36a9.6,9.6,0,1,0-13.58,13.58l15.32,15.31H49.58a9.63,9.63,0,1,0,0,19.26h67.58L101.84,99.42a9.64,9.64,0,0,0,6.79,16.43,9.41,9.41,0,0,0,6.79-2.85l31.74-31.73a9.53,9.53,0,0,0,0-13.58Z"}),e("path",{key:"bb8da160d694fd29a6e19a4a9376987abcbafa76",class:"icon-path",d:"M45.16,122.16H19.26V26.79H45.32a9.63,9.63,0,1,0,0-19.26H9.63A9.56,9.56,0,0,0,0,17.16V131.63a9.57,9.57,0,0,0,9.63,9.64H45.32A9.57,9.57,0,0,0,55,131.63a9.78,9.78,0,0,0-9.79-9.47Z"}))),"mobile"!==this.device&&e("span",{key:"5851825f4c5dc7b96268806cd19dcc4ae3687eaa",class:"PlayerLogoutText"},((t,e)=>{let o=a[void 0!==e?e:"en"].logoutButton;return o})(0,this.language))))}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}}};s.style=":host{display:block}:host *,:host *::before,:host *::after{margin:0;padding:0;list-style:none;text-decoration:none;outline:none;box-sizing:border-box}.PlayerAccountMenuItemBox{padding:20px;font-size:16px;display:inline-flex;width:100%;box-sizing:border-box;align-items:center;cursor:pointer}.PlayerAccountMenuItemBox .PlayerLogoutText{margin-left:20px}.PlayerAccountMenuItemBox svg{display:block;width:100%;height:100%}.PlayerAccountMenuItemBox svg .logout-icon-path{fill:var(--emw--pam-typography-color-nav-bg, var(--emw--color-white, #FFFFFF))}.PlayerAccountMenuItemBoxMobile.PlayerAccountMenuItemBox{height:auto;justify-content:center;position:relative;display:flex;width:unset;padding:0}.PlayerAccountMenuItemBoxMobile.PlayerAccountMenuItemBox svg .logout-icon-path{fill:var(--emw--pam-typography-color-nav-bg, var(--emw--color-white, #FFFFFF))}";export{s as P}