@everymatrix/pam-logout 0.0.1

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 (57) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/index-e376310b.js +1241 -0
  3. package/dist/cjs/index.cjs.js +10 -0
  4. package/dist/cjs/loader.cjs.js +15 -0
  5. package/dist/cjs/pam-logout-f179c4f1.js +263 -0
  6. package/dist/cjs/pam-logout.cjs.entry.js +10 -0
  7. package/dist/cjs/pam-logout.cjs.js +25 -0
  8. package/dist/collection/collection-manifest.json +12 -0
  9. package/dist/collection/components/pam_logout/index.js +1 -0
  10. package/dist/collection/components/pam_logout/pam-logout.css +47 -0
  11. package/dist/collection/components/pam_logout/pam-logout.js +249 -0
  12. package/dist/collection/index.js +1 -0
  13. package/dist/collection/utils/locale.utils.js +53 -0
  14. package/dist/collection/utils/utils.js +56 -0
  15. package/dist/esm/app-globals-0f993ce5.js +3 -0
  16. package/dist/esm/index-1abc369e.js +1215 -0
  17. package/dist/esm/index.js +2 -0
  18. package/dist/esm/loader.js +11 -0
  19. package/dist/esm/pam-logout-b28be36e.js +261 -0
  20. package/dist/esm/pam-logout.entry.js +2 -0
  21. package/dist/esm/pam-logout.js +20 -0
  22. package/dist/index.cjs.js +1 -0
  23. package/dist/index.js +1 -0
  24. package/dist/pam-logout/app-globals-0f993ce5.js +1 -0
  25. package/dist/pam-logout/index-1abc369e.js +2 -0
  26. package/dist/pam-logout/index.esm.js +1 -0
  27. package/dist/pam-logout/pam-logout-b28be36e.js +1 -0
  28. package/dist/pam-logout/pam-logout.entry.js +1 -0
  29. package/dist/pam-logout/pam-logout.esm.js +1 -0
  30. package/dist/stencil.config.dev.js +19 -0
  31. package/dist/stencil.config.js +19 -0
  32. package/dist/storybook/main.js +43 -0
  33. package/dist/storybook/preview.js +9 -0
  34. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-logout/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
  35. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-logout/.stencil/packages/stencil/pam-logout/stencil.config.d.ts +2 -0
  36. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-logout/.stencil/packages/stencil/pam-logout/stencil.config.dev.d.ts +2 -0
  37. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-logout/.stencil/packages/stencil/pam-logout/storybook/main.d.ts +3 -0
  38. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-logout/.stencil/packages/stencil/pam-logout/storybook/preview.d.ts +70 -0
  39. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-logout/.stencil/tools/plugins/index.d.ts +4 -0
  40. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-logout/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
  41. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-logout/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
  42. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-logout/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  43. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-logout/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  44. package/dist/types/components/pam_logout/index.d.ts +1 -0
  45. package/dist/types/components/pam_logout/pam-logout.d.ts +27 -0
  46. package/dist/types/components.d.ts +93 -0
  47. package/dist/types/index.d.ts +1 -0
  48. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  49. package/dist/types/utils/locale.utils.d.ts +6 -0
  50. package/dist/types/utils/utils.d.ts +10 -0
  51. package/loader/cdn.js +1 -0
  52. package/loader/index.cjs.js +1 -0
  53. package/loader/index.d.ts +24 -0
  54. package/loader/index.es2017.js +1 -0
  55. package/loader/index.js +2 -0
  56. package/loader/package.json +11 -0
  57. package/package.json +27 -0
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const pamLogout = require('./pam-logout-f179c4f1.js');
6
+ require('./index-e376310b.js');
7
+
8
+
9
+
10
+ exports.PamLogout = pamLogout.PamLogout;
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-e376310b.js');
6
+ const appGlobals = require('./app-globals-3a1e7e63.js');
7
+
8
+ const defineCustomElements = async (win, options) => {
9
+ if (typeof window === 'undefined') return undefined;
10
+ await appGlobals.globalScripts();
11
+ return index.bootstrapLazy([["pam-logout.cjs",[[1,"pam-logout",{"endpoint":[513],"session":[513],"language":[1537],"mbSource":[513,"mb-source"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
12
+ };
13
+
14
+ exports.setNonce = index.setNonce;
15
+ exports.defineCustomElements = defineCustomElements;
@@ -0,0 +1,263 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-e376310b.js');
4
+
5
+ /**
6
+ * @name setClientStyling
7
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
8
+ * @param {HTMLElement} stylingContainer The reference element of the widget
9
+ * @param {string} clientStyling The style content
10
+ */
11
+ function setClientStyling(stylingContainer, clientStyling) {
12
+ if (stylingContainer) {
13
+ const sheet = document.createElement('style');
14
+ sheet.innerHTML = clientStyling;
15
+ stylingContainer.appendChild(sheet);
16
+ }
17
+ }
18
+
19
+ /**
20
+ * @name setClientStylingURL
21
+ * @description Method used to create and append to the passed element of the widget a style element with the content fetched from a given URL
22
+ * @param {HTMLElement} stylingContainer The reference element of the widget
23
+ * @param {string} clientStylingUrl The URL of the style content
24
+ */
25
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
26
+ const url = new URL(clientStylingUrl);
27
+
28
+ fetch(url.href)
29
+ .then((res) => res.text())
30
+ .then((data) => {
31
+ const cssFile = document.createElement('style');
32
+ cssFile.innerHTML = data;
33
+ if (stylingContainer) {
34
+ stylingContainer.appendChild(cssFile);
35
+ }
36
+ })
37
+ .catch((err) => {
38
+ console.error('There was an error while trying to load client styling from URL', err);
39
+ });
40
+ }
41
+
42
+ /**
43
+ * @name setStreamLibrary
44
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
45
+ * @param {HTMLElement} stylingContainer The highest element of the widget
46
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
47
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
48
+ */
49
+ function setStreamStyling(stylingContainer, domain, subscription) {
50
+ if (window.emMessageBus) {
51
+ const sheet = document.createElement('style');
52
+
53
+ window.emMessageBus.subscribe(domain, (data) => {
54
+ sheet.innerHTML = data;
55
+ if (stylingContainer) {
56
+ stylingContainer.appendChild(sheet);
57
+ }
58
+ });
59
+ }
60
+ }
61
+
62
+ /**
63
+ * @name dispatchCustomEvent
64
+ * @description dispatches the custom event CustomEventProcessor is listening for
65
+ * @param {string} type of the custom event
66
+ * @param {Object} data may contain additional information about the event, e.g. userId
67
+ */
68
+ const dispatchCustomEvent = (type, data = {}) => {
69
+ const event = new CustomEvent('track-custom-event', {
70
+ detail: {
71
+ type,
72
+ data
73
+ },
74
+ bubbles: true,
75
+ composed: true
76
+ });
77
+
78
+ document.dispatchEvent(event);
79
+ };
80
+
81
+ const DEFAULT_LANGUAGE = 'en';
82
+ const TRANSLATIONS = {
83
+ en: {
84
+ logoutButton: 'Logout'
85
+ },
86
+ hu: {
87
+ logoutButton: 'Logout'
88
+ },
89
+ ro: {
90
+ logoutButton: 'Logout'
91
+ },
92
+ fr: {
93
+ logoutButton: 'Déconnexion'
94
+ },
95
+ tr: {
96
+ logoutButton: 'Çıkış Yap'
97
+ },
98
+ hr: {
99
+ logoutButton: 'Logout'
100
+ },
101
+ 'pt-br': {
102
+ logoutButton: 'Logout'
103
+ },
104
+ 'es-mx': {
105
+ logoutButton: 'Logout'
106
+ }
107
+ };
108
+ const translate = (key, customLang, values) => {
109
+ const lang = customLang;
110
+ let translation = TRANSLATIONS[lang !== undefined ? lang : DEFAULT_LANGUAGE][key];
111
+ if (values !== undefined) {
112
+ for (const [key, value] of Object.entries(values.values)) {
113
+ const regex = new RegExp(`{${key}}`, 'g');
114
+ translation = translation.replace(regex, value);
115
+ }
116
+ }
117
+ return translation;
118
+ };
119
+ const getTranslations = (url) => {
120
+ // fetch url, get the data, replace the TRANSLATIONS content
121
+ return new Promise((resolve) => {
122
+ fetch(url)
123
+ .then((res) => res.json())
124
+ .then((data) => {
125
+ Object.keys(data).forEach((item) => {
126
+ for (let key in data[item]) {
127
+ TRANSLATIONS[item][key] = data[item][key];
128
+ }
129
+ });
130
+ resolve(true);
131
+ });
132
+ });
133
+ };
134
+
135
+ /**
136
+ * @name isMobile
137
+ * @description A method that returns if the browser used to access the app is from a mobile device or not
138
+ * @param {String} userAgent window.navigator.userAgent
139
+ * @returns {Boolean} true or false
140
+ */
141
+ function checkDeviceType() {
142
+ const userAgent = navigator.userAgent.toLowerCase();
143
+ const width = screen.availWidth;
144
+ const height = screen.availHeight;
145
+ if (userAgent.includes('iphone')) {
146
+ return 'mobile';
147
+ }
148
+ if (userAgent.includes('android')) {
149
+ if (height > width && width < 800) {
150
+ return 'mobile';
151
+ }
152
+ if (width > height && height < 800) {
153
+ return 'tablet';
154
+ }
155
+ }
156
+ return 'desktop';
157
+ }
158
+
159
+ const pamLogoutCss = ":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))}";
160
+ const PamLogoutStyle0 = pamLogoutCss;
161
+
162
+ const PamLogout = class {
163
+ constructor(hostRef) {
164
+ index.registerInstance(this, hostRef);
165
+ this.device = checkDeviceType();
166
+ this.handleLogout = async () => {
167
+ try {
168
+ const headers = new Headers();
169
+ headers.append('accept', 'text/plain');
170
+ headers.append('X-SessionId', this.session);
171
+ const options = {
172
+ method: 'POST',
173
+ headers: headers
174
+ };
175
+ const response = await fetch(`${this.endpoint}/api/v2/gm/sav2/sessions/terminate`, options);
176
+ if (response.ok) {
177
+ let data = await response.json();
178
+ if (data.details.exitReason === 'LOGGEDOFF') {
179
+ window.postMessage({ type: 'LogoutSuccessfull' }, window.location.href);
180
+ dispatchCustomEvent('logged_out', {});
181
+ }
182
+ }
183
+ else {
184
+ throw new Error(`Logout failed with status: ${response.status}`);
185
+ }
186
+ }
187
+ catch (error) {
188
+ console.error('Logout error:', error);
189
+ window.postMessage({
190
+ type: 'WidgetNotification',
191
+ data: {
192
+ type: 'error',
193
+ message: 'Logout failed. Please try again.',
194
+ error
195
+ }
196
+ }, window.location.href);
197
+ }
198
+ };
199
+ this.endpoint = undefined;
200
+ this.session = undefined;
201
+ this.language = 'en';
202
+ this.mbSource = undefined;
203
+ this.clientStyling = '';
204
+ this.clientStylingUrl = '';
205
+ this.translationUrl = '';
206
+ }
207
+ handleClientStylingChange(newValue, oldValue) {
208
+ if (newValue !== oldValue && this.stylingContainer) {
209
+ setClientStyling(this.stylingContainer, this.clientStyling);
210
+ }
211
+ }
212
+ handleClientStylingUrlChange(newValue, oldValue) {
213
+ if (newValue !== oldValue && this.stylingContainer) {
214
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
215
+ }
216
+ }
217
+ handleMbSourceChange(newValue, oldValue) {
218
+ if (newValue !== oldValue && this.stylingContainer) {
219
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
220
+ }
221
+ }
222
+ async componentWillLoad() {
223
+ if (!this.endpoint || !this.session) {
224
+ throw new Error('endpoint and session props are required');
225
+ }
226
+ if (this.translationUrl && this.translationUrl.length > 2) {
227
+ await getTranslations(this.translationUrl);
228
+ }
229
+ }
230
+ componentDidLoad() {
231
+ if (this.stylingContainer) {
232
+ if (this.mbSource) {
233
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
234
+ }
235
+ if (this.clientStyling) {
236
+ setClientStyling(this.stylingContainer, this.clientStyling);
237
+ }
238
+ if (this.clientStylingUrl) {
239
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
240
+ }
241
+ }
242
+ }
243
+ disconnectedCallback() {
244
+ if (this.stylingSubscription) {
245
+ this.stylingSubscription.unsubscribe();
246
+ }
247
+ }
248
+ render() {
249
+ return (index.h("div", { key: 'fd28f2abf2ac49d499193091ead03c6770bc2610', class: "LogoutContainer", ref: el => this.stylingContainer = el }, index.h("p", { key: '0c0fe4e0a6e1928215d2dc607412d419c33ae319', class: {
250
+ 'PlayerAccountMenuItemBox': true,
251
+ 'PlayerAccountMenuItemBoxMobile': this.device === 'mobile',
252
+ 'PlayerAccountMenuItemBoxTablet': this.device === 'tablet'
253
+ }, onClick: this.handleLogout }, index.h("span", { key: '602622ac17b77524716c2acffc1939b2926c3436', style: { width: this.device === 'tablet' ? '24px' : '20px' } }, index.h("svg", { key: 'ee293dcd05d15d60db596e82975ee0aaea1764f0', 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: 'eda0097f7b1ea557e30b459581b733295fd02480', 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: 'cfc27c506086165b71de92fc2064ebd7c7d9eb21', 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: '0c65abb764174563c9e87fbadf3eef7cfb5339ea', class: "PlayerLogoutText" }, translate('logoutButton', this.language))))));
254
+ }
255
+ static get watchers() { return {
256
+ "clientStyling": ["handleClientStylingChange"],
257
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
258
+ "mbSource": ["handleMbSourceChange"]
259
+ }; }
260
+ };
261
+ PamLogout.style = PamLogoutStyle0;
262
+
263
+ exports.PamLogout = PamLogout;
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const pamLogout = require('./pam-logout-f179c4f1.js');
6
+ require('./index-e376310b.js');
7
+
8
+
9
+
10
+ exports.pam_logout = pamLogout.PamLogout;
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-e376310b.js');
6
+ const appGlobals = require('./app-globals-3a1e7e63.js');
7
+
8
+ /*
9
+ Stencil Client Patch Browser v4.19.2 | MIT Licensed | https://stenciljs.com
10
+ */
11
+ var patchBrowser = () => {
12
+ const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('pam-logout.cjs.js', document.baseURI).href));
13
+ const opts = {};
14
+ if (importMeta !== "") {
15
+ opts.resourcesUrl = new URL(".", importMeta).href;
16
+ }
17
+ return index.promiseResolve(opts);
18
+ };
19
+
20
+ patchBrowser().then(async (options) => {
21
+ await appGlobals.globalScripts();
22
+ return index.bootstrapLazy([["pam-logout.cjs",[[1,"pam-logout",{"endpoint":[513],"session":[513],"language":[1537],"mbSource":[513,"mb-source"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
23
+ });
24
+
25
+ exports.setNonce = index.setNonce;
@@ -0,0 +1,12 @@
1
+ {
2
+ "entries": [
3
+ "components/pam_logout/pam-logout.js"
4
+ ],
5
+ "compiler": {
6
+ "name": "@stencil/core",
7
+ "version": "4.19.2",
8
+ "typescriptVersion": "5.4.5"
9
+ },
10
+ "collections": [],
11
+ "bundles": []
12
+ }
@@ -0,0 +1 @@
1
+ export { PamLogout } from './pam-logout';
@@ -0,0 +1,47 @@
1
+ :host {
2
+ display: block;
3
+ }
4
+ :host *,
5
+ :host *::before,
6
+ :host *::after {
7
+ margin: 0;
8
+ padding: 0;
9
+ list-style: none;
10
+ text-decoration: none;
11
+ outline: none;
12
+ box-sizing: border-box;
13
+ }
14
+
15
+ .PlayerAccountMenuItemBox {
16
+ padding: 20px;
17
+ font-size: 16px;
18
+ display: inline-flex;
19
+ width: 100%;
20
+ box-sizing: border-box;
21
+ align-items: center;
22
+ cursor: pointer;
23
+ }
24
+ .PlayerAccountMenuItemBox .PlayerLogoutText {
25
+ margin-left: 20px;
26
+ }
27
+ .PlayerAccountMenuItemBox svg {
28
+ display: block;
29
+ width: 100%;
30
+ height: 100%;
31
+ }
32
+ .PlayerAccountMenuItemBox svg .logout-icon-path {
33
+ fill: var(--emw--pam-typography-color-nav-bg, var(--emw--color-white, #FFFFFF));
34
+ }
35
+
36
+ .PlayerAccountMenuItemBoxMobile.PlayerAccountMenuItemBox {
37
+ height: auto;
38
+ justify-content: center;
39
+ position: relative;
40
+ /*top: 20px;*/
41
+ display: flex;
42
+ width: unset;
43
+ padding: 0;
44
+ }
45
+ .PlayerAccountMenuItemBoxMobile.PlayerAccountMenuItemBox svg .logout-icon-path {
46
+ fill: var(--emw--pam-typography-color-nav-bg, var(--emw--color-white, #FFFFFF));
47
+ }
@@ -0,0 +1,249 @@
1
+ import { h } from "@stencil/core";
2
+ import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
3
+ import { dispatchCustomEvent } from "../../../../../../../../libs/custom-events/src/index";
4
+ import { getTranslations, translate } from "../../utils/locale.utils";
5
+ import { checkDeviceType } from "../../utils/utils";
6
+ export class PamLogout {
7
+ constructor() {
8
+ this.device = checkDeviceType();
9
+ this.handleLogout = async () => {
10
+ try {
11
+ const headers = new Headers();
12
+ headers.append('accept', 'text/plain');
13
+ headers.append('X-SessionId', this.session);
14
+ const options = {
15
+ method: 'POST',
16
+ headers: headers
17
+ };
18
+ const response = await fetch(`${this.endpoint}/api/v2/gm/sav2/sessions/terminate`, options);
19
+ if (response.ok) {
20
+ let data = await response.json();
21
+ if (data.details.exitReason === 'LOGGEDOFF') {
22
+ window.postMessage({ type: 'LogoutSuccessfull' }, window.location.href);
23
+ dispatchCustomEvent('logged_out', {});
24
+ }
25
+ }
26
+ else {
27
+ throw new Error(`Logout failed with status: ${response.status}`);
28
+ }
29
+ }
30
+ catch (error) {
31
+ console.error('Logout error:', error);
32
+ window.postMessage({
33
+ type: 'WidgetNotification',
34
+ data: {
35
+ type: 'error',
36
+ message: 'Logout failed. Please try again.',
37
+ error
38
+ }
39
+ }, window.location.href);
40
+ }
41
+ };
42
+ this.endpoint = undefined;
43
+ this.session = undefined;
44
+ this.language = 'en';
45
+ this.mbSource = undefined;
46
+ this.clientStyling = '';
47
+ this.clientStylingUrl = '';
48
+ this.translationUrl = '';
49
+ }
50
+ handleClientStylingChange(newValue, oldValue) {
51
+ if (newValue !== oldValue && this.stylingContainer) {
52
+ setClientStyling(this.stylingContainer, this.clientStyling);
53
+ }
54
+ }
55
+ handleClientStylingUrlChange(newValue, oldValue) {
56
+ if (newValue !== oldValue && this.stylingContainer) {
57
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
58
+ }
59
+ }
60
+ handleMbSourceChange(newValue, oldValue) {
61
+ if (newValue !== oldValue && this.stylingContainer) {
62
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
63
+ }
64
+ }
65
+ async componentWillLoad() {
66
+ if (!this.endpoint || !this.session) {
67
+ throw new Error('endpoint and session props are required');
68
+ }
69
+ if (this.translationUrl && this.translationUrl.length > 2) {
70
+ await getTranslations(this.translationUrl);
71
+ }
72
+ }
73
+ componentDidLoad() {
74
+ if (this.stylingContainer) {
75
+ if (this.mbSource) {
76
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
77
+ }
78
+ if (this.clientStyling) {
79
+ setClientStyling(this.stylingContainer, this.clientStyling);
80
+ }
81
+ if (this.clientStylingUrl) {
82
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
83
+ }
84
+ }
85
+ }
86
+ disconnectedCallback() {
87
+ if (this.stylingSubscription) {
88
+ this.stylingSubscription.unsubscribe();
89
+ }
90
+ }
91
+ render() {
92
+ return (h("div", { key: 'fd28f2abf2ac49d499193091ead03c6770bc2610', class: "LogoutContainer", ref: el => this.stylingContainer = el }, h("p", { key: '0c0fe4e0a6e1928215d2dc607412d419c33ae319', class: {
93
+ 'PlayerAccountMenuItemBox': true,
94
+ 'PlayerAccountMenuItemBoxMobile': this.device === 'mobile',
95
+ 'PlayerAccountMenuItemBoxTablet': this.device === 'tablet'
96
+ }, onClick: this.handleLogout }, h("span", { key: '602622ac17b77524716c2acffc1939b2926c3436', style: { width: this.device === 'tablet' ? '24px' : '20px' } }, h("svg", { key: 'ee293dcd05d15d60db596e82975ee0aaea1764f0', 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: 'eda0097f7b1ea557e30b459581b733295fd02480', 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: 'cfc27c506086165b71de92fc2064ebd7c7d9eb21', 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: '0c65abb764174563c9e87fbadf3eef7cfb5339ea', class: "PlayerLogoutText" }, translate('logoutButton', this.language))))));
97
+ }
98
+ static get is() { return "pam-logout"; }
99
+ static get encapsulation() { return "shadow"; }
100
+ static get originalStyleUrls() {
101
+ return {
102
+ "$": ["pam-logout.scss"]
103
+ };
104
+ }
105
+ static get styleUrls() {
106
+ return {
107
+ "$": ["pam-logout.css"]
108
+ };
109
+ }
110
+ static get properties() {
111
+ return {
112
+ "endpoint": {
113
+ "type": "string",
114
+ "mutable": false,
115
+ "complexType": {
116
+ "original": "string",
117
+ "resolved": "string",
118
+ "references": {}
119
+ },
120
+ "required": true,
121
+ "optional": false,
122
+ "docs": {
123
+ "tags": [],
124
+ "text": "The endpoint URL for logout request"
125
+ },
126
+ "attribute": "endpoint",
127
+ "reflect": true
128
+ },
129
+ "session": {
130
+ "type": "string",
131
+ "mutable": false,
132
+ "complexType": {
133
+ "original": "string",
134
+ "resolved": "string",
135
+ "references": {}
136
+ },
137
+ "required": true,
138
+ "optional": false,
139
+ "docs": {
140
+ "tags": [],
141
+ "text": "User session required for logout"
142
+ },
143
+ "attribute": "session",
144
+ "reflect": true
145
+ },
146
+ "language": {
147
+ "type": "string",
148
+ "mutable": true,
149
+ "complexType": {
150
+ "original": "string",
151
+ "resolved": "string",
152
+ "references": {}
153
+ },
154
+ "required": false,
155
+ "optional": false,
156
+ "docs": {
157
+ "tags": [],
158
+ "text": "Language code"
159
+ },
160
+ "attribute": "language",
161
+ "reflect": true,
162
+ "defaultValue": "'en'"
163
+ },
164
+ "mbSource": {
165
+ "type": "string",
166
+ "mutable": false,
167
+ "complexType": {
168
+ "original": "string",
169
+ "resolved": "string",
170
+ "references": {}
171
+ },
172
+ "required": false,
173
+ "optional": false,
174
+ "docs": {
175
+ "tags": [],
176
+ "text": "mbSource for styling"
177
+ },
178
+ "attribute": "mb-source",
179
+ "reflect": true
180
+ },
181
+ "clientStyling": {
182
+ "type": "string",
183
+ "mutable": true,
184
+ "complexType": {
185
+ "original": "string",
186
+ "resolved": "string",
187
+ "references": {}
188
+ },
189
+ "required": false,
190
+ "optional": false,
191
+ "docs": {
192
+ "tags": [],
193
+ "text": "Client custom styling via inline style"
194
+ },
195
+ "attribute": "client-styling",
196
+ "reflect": true,
197
+ "defaultValue": "''"
198
+ },
199
+ "clientStylingUrl": {
200
+ "type": "string",
201
+ "mutable": false,
202
+ "complexType": {
203
+ "original": "string",
204
+ "resolved": "string",
205
+ "references": {}
206
+ },
207
+ "required": false,
208
+ "optional": false,
209
+ "docs": {
210
+ "tags": [],
211
+ "text": "Client custom styling via URL"
212
+ },
213
+ "attribute": "client-styling-url",
214
+ "reflect": true,
215
+ "defaultValue": "''"
216
+ },
217
+ "translationUrl": {
218
+ "type": "string",
219
+ "mutable": false,
220
+ "complexType": {
221
+ "original": "string",
222
+ "resolved": "string",
223
+ "references": {}
224
+ },
225
+ "required": false,
226
+ "optional": false,
227
+ "docs": {
228
+ "tags": [],
229
+ "text": "Translation URL"
230
+ },
231
+ "attribute": "translation-url",
232
+ "reflect": true,
233
+ "defaultValue": "''"
234
+ }
235
+ };
236
+ }
237
+ static get watchers() {
238
+ return [{
239
+ "propName": "clientStyling",
240
+ "methodName": "handleClientStylingChange"
241
+ }, {
242
+ "propName": "clientStylingUrl",
243
+ "methodName": "handleClientStylingUrlChange"
244
+ }, {
245
+ "propName": "mbSource",
246
+ "methodName": "handleMbSourceChange"
247
+ }];
248
+ }
249
+ }
@@ -0,0 +1 @@
1
+ export * from './components/pam_logout';