@everymatrix/user-action-controller 1.44.0 → 1.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/index-c5061e5a.js +1315 -0
  3. package/dist/cjs/loader.cjs.js +7 -13
  4. package/dist/cjs/player-user-consents_2.cjs.entry.js +457 -495
  5. package/dist/cjs/user-action-controller.cjs.js +17 -11
  6. package/dist/collection/collection-manifest.json +3 -3
  7. package/dist/collection/components/user-action-controller/index.js +1 -0
  8. package/dist/collection/components/user-action-controller/user-action-controller.js +408 -414
  9. package/dist/collection/utils/locale.utils.js +70 -70
  10. package/dist/collection/utils/utils.js +1 -1
  11. package/dist/esm/app-globals-0f993ce5.js +3 -0
  12. package/dist/esm/index-02b86e76.js +1288 -0
  13. package/dist/esm/loader.js +7 -13
  14. package/dist/esm/player-user-consents_2.entry.js +457 -495
  15. package/dist/esm/user-action-controller.js +14 -11
  16. package/dist/stencil.config.dev.js +17 -0
  17. package/dist/stencil.config.js +14 -19
  18. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/user-action-controller/.stencil/packages/stencil/user-action-controller/stencil.config.d.ts +2 -0
  19. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/user-action-controller/.stencil/packages/stencil/user-action-controller/stencil.config.dev.d.ts +2 -0
  20. package/dist/types/components/user-action-controller/index.d.ts +1 -0
  21. package/dist/types/components/user-action-controller/user-action-controller.d.ts +68 -68
  22. package/dist/types/stencil-public-runtime.d.ts +142 -33
  23. package/dist/user-action-controller/p-b996e8b8.js +2 -0
  24. package/dist/user-action-controller/p-d7fbd383.entry.js +1 -0
  25. package/dist/user-action-controller/p-e1255160.js +1 -0
  26. package/dist/user-action-controller/user-action-controller.esm.js +1 -1
  27. package/loader/cdn.js +1 -3
  28. package/loader/index.cjs.js +1 -3
  29. package/loader/index.d.ts +13 -1
  30. package/loader/index.es2017.js +1 -3
  31. package/loader/index.js +1 -3
  32. package/loader/package.json +1 -0
  33. package/package.json +9 -2
  34. package/dist/cjs/index-87049e21.js +0 -1300
  35. package/dist/components/index.d.ts +0 -26
  36. package/dist/components/index.js +0 -1
  37. package/dist/components/player-user-consents.js +0 -6
  38. package/dist/components/player-user-consents2.js +0 -257
  39. package/dist/components/user-action-controller.d.ts +0 -11
  40. package/dist/components/user-action-controller.js +0 -365
  41. package/dist/esm/index-71f14530.js +0 -1274
  42. package/dist/esm/polyfills/core-js.js +0 -11
  43. package/dist/esm/polyfills/css-shim.js +0 -1
  44. package/dist/esm/polyfills/dom.js +0 -79
  45. package/dist/esm/polyfills/es5-html-element.js +0 -1
  46. package/dist/esm/polyfills/index.js +0 -34
  47. package/dist/esm/polyfills/system.js +0 -6
  48. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/user-action-controller/.stencil/packages/user-action-controller/stencil.config.d.ts +0 -2
  49. package/dist/user-action-controller/p-2dc9103a.entry.js +0 -1
  50. package/dist/user-action-controller/p-ba444709.js +0 -1
@@ -1,431 +1,425 @@
1
- import { Component, h, Prop, Listen, State, Watch } from '@stencil/core';
2
- import { getTranslations, translate } from '../../utils/locale.utils';
3
- import '@everymatrix/player-user-consents';
1
+ import { h } from "@stencil/core";
2
+ import { getTranslations, translate } from "../../utils/locale.utils";
3
+ import "../../../../../player-user-consents/dist/types/index";
4
4
  export class UserActionController {
5
- constructor() {
6
- /**
7
- * Language
8
- */
9
- this.lang = 'en';
10
- /**
11
- * Select GM version
12
- */
13
- this.gmVersion = '';
14
- /**
15
- * Translation url
16
- */
17
- this.translationUrl = '';
18
- /**
19
- * Client custom styling via inline style
20
- */
21
- this.clientStyling = '';
22
- /**
23
- * Client custom styling via url
24
- */
25
- this.clientStylingUrl = '';
26
- /**
27
- * Which actions are required in order to activate the "Apply" button. Other actions are considered optional.
28
- */
29
- this.queryFired = false;
30
- this.readyActionsCount = 0;
31
- this.activeUserActions = [];
32
- this.userActionsValidated = true;
33
- this.receivedQueryResponses = 0;
34
- this.limitStylingAppends = false;
35
- this.isLoading = true;
36
- this.mandatoryActionsChecked = 0;
37
- //for now this variable is hardcoded bcs we have terms and conditions and privacy policy mandatory and we dont receive with these new functionality the mandatory actions
38
- this.mandatoryActions = ['termsandconditions', 'privacypolicy'];
39
- this.userActions = [];
40
- this.consentTitles = {
41
- termsandconditions: translate('termsAndConditionsTitle', this.lang),
42
- sms: translate('smsTitle', this.lang),
43
- emailmarketing: translate('emailMarketingTitle', this.lang),
44
- privacypolicy: translate('privacyPolicyTitle', this.lang)
45
- };
46
- this.setClientStyling = () => {
47
- let sheet = document.createElement('style');
48
- sheet.innerHTML = this.clientStyling;
49
- this.stylingContainer.prepend(sheet);
50
- };
51
- this.setClientStylingURL = () => {
52
- let url = new URL(this.clientStylingUrl);
53
- let cssFile = document.createElement('style');
54
- fetch(url.href)
55
- .then((res) => res.text())
56
- .then((data) => {
57
- this.clientStyling = data;
58
- cssFile.innerHTML = data;
59
- setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
60
- })
61
- .catch((err) => {
62
- console.log('error ', err);
63
- });
64
- };
65
- }
66
- handleNewTranslations() {
67
- getTranslations(this.translationUrl);
68
- }
69
- handleQueryResponse() {
70
- if (this.receivedQueryResponses === this.activeUserActions.length) {
71
- this.updateUserConsents();
5
+ constructor() {
6
+ //for now this variable is hardcoded bcs we have terms and conditions and privacy policy mandatory and we dont receive with these new functionality the mandatory actions
7
+ this.mandatoryActions = ['termsandconditions', 'privacypolicy'];
8
+ this.userActions = [];
9
+ this.consentTitles = {
10
+ termsandconditions: translate('termsAndConditionsTitle', this.lang),
11
+ sms: translate('smsTitle', this.lang),
12
+ emailmarketing: translate('emailMarketingTitle', this.lang),
13
+ privacypolicy: translate('privacyPolicyTitle', this.lang)
14
+ };
15
+ this.setClientStyling = () => {
16
+ let sheet = document.createElement('style');
17
+ sheet.innerHTML = this.clientStyling;
18
+ this.stylingContainer.prepend(sheet);
19
+ };
20
+ this.setClientStylingURL = () => {
21
+ let url = new URL(this.clientStylingUrl);
22
+ let cssFile = document.createElement('style');
23
+ fetch(url.href)
24
+ .then((res) => res.text())
25
+ .then((data) => {
26
+ this.clientStyling = data;
27
+ cssFile.innerHTML = data;
28
+ setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
29
+ })
30
+ .catch((err) => {
31
+ console.log('error ', err);
32
+ });
33
+ };
34
+ this.endpoint = undefined;
35
+ this.userSession = undefined;
36
+ this.userId = undefined;
37
+ this.lang = 'en';
38
+ this.includeSubmitButton = undefined;
39
+ this.gmVersion = '';
40
+ this.translationUrl = '';
41
+ this.clientStyling = '';
42
+ this.clientStylingUrl = '';
43
+ this.queryFired = false;
44
+ this.readyActionsCount = 0;
45
+ this.activeUserActions = [];
46
+ this.userActionsValidated = true;
47
+ this.receivedQueryResponses = 0;
48
+ this.limitStylingAppends = false;
49
+ this.isLoading = true;
50
+ this.mandatoryActionsChecked = 0;
51
+ this.mandatoryItems = undefined;
72
52
  }
73
- }
74
- userLegislationConsentHandler(event) {
75
- const actionType = event.detail.type;
76
- const actionTypeChecked = event.detail.value;
77
- if (this.mandatoryActions.includes(actionType) && this.queryFired === false) {
78
- actionTypeChecked === true ? this.mandatoryActionsChecked++ : this.mandatoryActionsChecked--;
53
+ handleNewTranslations() {
54
+ getTranslations(this.translationUrl);
79
55
  }
80
- // Register final user choices only if we're ready to update
81
- if (this.queryFired) {
82
- const determineStatus = (checked, version) => {
83
- if (version === 'gm16') {
84
- return checked ? 1 : 0;
56
+ handleQueryResponse() {
57
+ if (this.receivedQueryResponses === this.activeUserActions.length) {
58
+ this.updateUserConsents();
85
59
  }
86
- return checked ? 'Accepted' : 'Denied';
87
- };
88
- this.userActions.push(Object.assign({ tagCode: actionType, status: determineStatus(actionTypeChecked, this.gmVersion) }, (this.gmVersion === 'gm16' && { note: '' })));
89
- this.receivedQueryResponses++;
90
60
  }
91
- }
92
- determineUserActionsCore() {
93
- const url = new URL(`${this.endpoint}/v1/player/${this.userId}/consent`);
94
- const headers = new Headers();
95
- headers.append('X-SessionId', this.userSession);
96
- let requestOptions = {
97
- method: 'GET',
98
- headers
99
- };
100
- return fetch(url.href, requestOptions)
101
- .then(res => res.json())
102
- .then(data => {
103
- const actionItems = data.items;
104
- actionItems.forEach(element => {
105
- if (element.status === 'Expired') {
106
- this.activeUserActions.push(element.tagCode);
61
+ userLegislationConsentHandler(event) {
62
+ const actionType = event.detail.type;
63
+ const actionTypeChecked = event.detail.value;
64
+ if (this.mandatoryActions.includes(actionType) && this.queryFired === false) {
65
+ actionTypeChecked === true ? this.mandatoryActionsChecked++ : this.mandatoryActionsChecked--;
107
66
  }
108
- });
109
- this.isLoading = false;
110
- })
111
- .catch(error => {
112
- console.error('Error fetching data:', error);
113
- this.isLoading = false;
114
- }).finally(() => {
115
- this.calcMandatoryActions();
116
- window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 ? true : false }, window.location.href);
117
- });
118
- }
119
- determineUserActions16() {
120
- const url = new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
121
- const headers = new Headers();
122
- headers.append('X-SessionId', this.userSession);
123
- let requestOptions = {
124
- method: 'GET',
125
- headers
126
- };
127
- return fetch(url.href, requestOptions)
128
- .then(res => res.json())
129
- .then(data => {
130
- const actionItems = data.consents;
131
- actionItems.forEach(element => {
132
- if (element.status === 2 && element.tagCode !== 'pepconsent') {
133
- this.activeUserActions.push(element.tagCode);
67
+ // Register final user choices only if we're ready to update
68
+ if (this.queryFired) {
69
+ const determineStatus = (checked, version) => {
70
+ if (version === 'gm16') {
71
+ return checked ? 1 : 0;
72
+ }
73
+ return checked ? 'Accepted' : 'Denied';
74
+ };
75
+ this.userActions.push(Object.assign({ tagCode: actionType, status: determineStatus(actionTypeChecked, this.gmVersion) }, (this.gmVersion === 'gm16' && { note: '' })));
76
+ this.receivedQueryResponses++;
134
77
  }
135
- });
136
- this.isLoading = false;
137
- })
138
- .catch(error => {
139
- console.error('Error fetching data:', error);
140
- this.isLoading = false;
141
- }).finally(() => {
142
- this.calcMandatoryActions();
143
- window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 ? true : false }, window.location.href);
144
- });
145
- }
146
- updateUserConsents() {
147
- const url = (this.gmVersion === 'gmcore')
148
- ? new URL(`${this.endpoint}/v1/player/${this.userId}/consent`)
149
- : new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
150
- const body = {
151
- consents: this.userActions
152
- };
153
- let requestOptions = {
154
- method: 'POST',
155
- headers: {
156
- 'Content-Type': 'application/json',
157
- 'Accept': 'application/json',
158
- 'X-SessionId': `${this.userSession}`,
159
- },
160
- body: JSON.stringify(body)
161
- };
162
- fetch(url.href, requestOptions)
163
- .then(res => res.json())
164
- .then(() => {
165
- window.postMessage({
166
- type: 'WidgetNotification',
167
- data: {
168
- type: 'success',
169
- message: 'Consent update successful!'
78
+ }
79
+ determineUserActionsCore() {
80
+ const url = new URL(`${this.endpoint}/v1/player/${this.userId}/consent`);
81
+ const headers = new Headers();
82
+ headers.append('X-SessionId', this.userSession);
83
+ let requestOptions = {
84
+ method: 'GET',
85
+ headers
86
+ };
87
+ return fetch(url.href, requestOptions)
88
+ .then(res => res.json())
89
+ .then(data => {
90
+ const actionItems = data.items;
91
+ actionItems.forEach(element => {
92
+ if (element.status === 'Expired') {
93
+ this.activeUserActions.push(element.tagCode);
94
+ }
95
+ });
96
+ this.isLoading = false;
97
+ })
98
+ .catch(error => {
99
+ console.error('Error fetching data:', error);
100
+ this.isLoading = false;
101
+ }).finally(() => {
102
+ this.calcMandatoryActions();
103
+ window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 ? true : false }, window.location.href);
104
+ });
105
+ }
106
+ determineUserActions16() {
107
+ const url = new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
108
+ const headers = new Headers();
109
+ headers.append('X-SessionId', this.userSession);
110
+ let requestOptions = {
111
+ method: 'GET',
112
+ headers
113
+ };
114
+ return fetch(url.href, requestOptions)
115
+ .then(res => res.json())
116
+ .then(data => {
117
+ const actionItems = data.consents;
118
+ actionItems.forEach(element => {
119
+ if (element.status === 2 && element.tagCode !== 'pepconsent') {
120
+ this.activeUserActions.push(element.tagCode);
121
+ }
122
+ });
123
+ this.isLoading = false;
124
+ })
125
+ .catch(error => {
126
+ console.error('Error fetching data:', error);
127
+ this.isLoading = false;
128
+ }).finally(() => {
129
+ this.calcMandatoryActions();
130
+ window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 ? true : false }, window.location.href);
131
+ });
132
+ }
133
+ updateUserConsents() {
134
+ const url = (this.gmVersion === 'gmcore')
135
+ ? new URL(`${this.endpoint}/v1/player/${this.userId}/consent`)
136
+ : new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
137
+ const body = {
138
+ consents: this.userActions
139
+ };
140
+ let requestOptions = {
141
+ method: 'POST',
142
+ headers: {
143
+ 'Content-Type': 'application/json',
144
+ 'Accept': 'application/json',
145
+ 'X-SessionId': `${this.userSession}`,
146
+ },
147
+ body: JSON.stringify(body)
148
+ };
149
+ fetch(url.href, requestOptions)
150
+ .then(res => res.json())
151
+ .then(() => {
152
+ window.postMessage({
153
+ type: 'WidgetNotification',
154
+ data: {
155
+ type: 'success',
156
+ message: 'Consent update successful!'
157
+ }
158
+ }, window.location.href);
159
+ })
160
+ .catch((err) => {
161
+ window.postMessage({
162
+ type: 'WidgetNotification',
163
+ data: {
164
+ type: 'error',
165
+ message: 'Server might not be responding',
166
+ err
167
+ }
168
+ }, window.location.href);
169
+ })
170
+ .finally(() => {
171
+ window.postMessage({ type: 'UserActionsCompleted' }, window.location.href);
172
+ });
173
+ }
174
+ handleApplyClick() {
175
+ this.queryFired = true;
176
+ }
177
+ async componentWillLoad() {
178
+ if (this.gmVersion === 'gmcore') {
179
+ this.determineUserActionsCore();
180
+ }
181
+ if (this.gmVersion === 'gm16') {
182
+ this.determineUserActions16();
183
+ }
184
+ if (this.translationUrl.length > 2) {
185
+ await getTranslations(this.translationUrl);
186
+ }
187
+ }
188
+ componentDidRender() {
189
+ // start custom styling area
190
+ if (!this.limitStylingAppends && this.stylingContainer) {
191
+ if (this.clientStyling)
192
+ this.setClientStyling();
193
+ if (this.clientStylingUrl)
194
+ this.setClientStylingURL();
195
+ this.limitStylingAppends = true;
196
+ }
197
+ // end custom styling area
198
+ }
199
+ calcMandatoryActions() {
200
+ this.mandatoryItems = 0;
201
+ this.mandatoryActions.map(action => {
202
+ const isPresent = this.activeUserActions.includes(action);
203
+ if (isPresent) {
204
+ this.mandatoryItems++;
205
+ }
206
+ });
207
+ }
208
+ render() {
209
+ if (this.mandatoryItems > 0) {
210
+ this.userActionsValidated = this.mandatoryActionsChecked === this.mandatoryItems;
211
+ return (h("div", { class: "QueryReferenceContainer", ref: el => this.stylingContainer = el }, this.isLoading ? (h("slot", { name: 'spinner' })
212
+ &&
213
+ h("svg", { class: "spinner", viewBox: "0 0 50 50" }, h("circle", { class: "path", cx: "25", cy: "25", r: "20", fill: "none", "stroke-width": "5" }))) : (h("div", { class: "UserActionController" }, h("h2", { class: "UserConsentNotice" }, translate('userNoticeText', this.lang)), h("div", { class: "PlayerLegislationWrapper" }, this.activeUserActions.map(action => (h("slot", { name: action }, h("player-user-consents", { lang: this.lang, "gm-version": this.gmVersion, "translation-url": this.translationUrl, consentType: action, consentTitle: this.consentTitles[action], queried: this.queryFired, mandatory: this.mandatoryActions.includes(action), "client-styling": this.clientStyling }))))), this.includeSubmitButton &&
214
+ h("button", { class: "ConsentSubmitButton", disabled: !this.userActionsValidated, onClick: () => this.handleApplyClick() }, translate('submitButtonText', this.lang))))));
170
215
  }
171
- }, window.location.href);
172
- })
173
- .catch((err) => {
174
- window.postMessage({
175
- type: 'WidgetNotification',
176
- data: {
177
- type: 'error',
178
- message: 'Server might not be responding',
179
- err
216
+ else {
217
+ return;
180
218
  }
181
- }, window.location.href);
182
- })
183
- .finally(() => {
184
- window.postMessage({ type: 'UserActionsCompleted' }, window.location.href);
185
- });
186
- }
187
- handleApplyClick() {
188
- this.queryFired = true;
189
- }
190
- async componentWillLoad() {
191
- if (this.gmVersion === 'gmcore') {
192
- this.determineUserActionsCore();
193
219
  }
194
- if (this.gmVersion === 'gm16') {
195
- this.determineUserActions16();
220
+ static get is() { return "user-action-controller"; }
221
+ static get encapsulation() { return "shadow"; }
222
+ static get originalStyleUrls() {
223
+ return {
224
+ "$": ["user-action-controller.scss"]
225
+ };
196
226
  }
197
- if (this.translationUrl.length > 2) {
198
- await getTranslations(this.translationUrl);
227
+ static get styleUrls() {
228
+ return {
229
+ "$": ["user-action-controller.css"]
230
+ };
199
231
  }
200
- }
201
- componentDidRender() {
202
- // start custom styling area
203
- if (!this.limitStylingAppends && this.stylingContainer) {
204
- if (this.clientStyling)
205
- this.setClientStyling();
206
- if (this.clientStylingUrl)
207
- this.setClientStylingURL();
208
- this.limitStylingAppends = true;
232
+ static get properties() {
233
+ return {
234
+ "endpoint": {
235
+ "type": "string",
236
+ "mutable": false,
237
+ "complexType": {
238
+ "original": "string",
239
+ "resolved": "string",
240
+ "references": {}
241
+ },
242
+ "required": true,
243
+ "optional": false,
244
+ "docs": {
245
+ "tags": [],
246
+ "text": "the endpoint required for the update call"
247
+ },
248
+ "attribute": "endpoint",
249
+ "reflect": true
250
+ },
251
+ "userSession": {
252
+ "type": "string",
253
+ "mutable": false,
254
+ "complexType": {
255
+ "original": "string",
256
+ "resolved": "string",
257
+ "references": {}
258
+ },
259
+ "required": true,
260
+ "optional": false,
261
+ "docs": {
262
+ "tags": [],
263
+ "text": "user session required for the update call"
264
+ },
265
+ "attribute": "user-session",
266
+ "reflect": true
267
+ },
268
+ "userId": {
269
+ "type": "string",
270
+ "mutable": false,
271
+ "complexType": {
272
+ "original": "string",
273
+ "resolved": "string",
274
+ "references": {}
275
+ },
276
+ "required": true,
277
+ "optional": false,
278
+ "docs": {
279
+ "tags": [],
280
+ "text": "user id required for the update call"
281
+ },
282
+ "attribute": "user-id",
283
+ "reflect": true
284
+ },
285
+ "lang": {
286
+ "type": "string",
287
+ "mutable": true,
288
+ "complexType": {
289
+ "original": "string",
290
+ "resolved": "string",
291
+ "references": {}
292
+ },
293
+ "required": false,
294
+ "optional": false,
295
+ "docs": {
296
+ "tags": [],
297
+ "text": "Language"
298
+ },
299
+ "attribute": "lang",
300
+ "reflect": true,
301
+ "defaultValue": "'en'"
302
+ },
303
+ "includeSubmitButton": {
304
+ "type": "boolean",
305
+ "mutable": false,
306
+ "complexType": {
307
+ "original": "boolean",
308
+ "resolved": "boolean",
309
+ "references": {}
310
+ },
311
+ "required": true,
312
+ "optional": false,
313
+ "docs": {
314
+ "tags": [],
315
+ "text": "whether or not to include the submit button (in case we want to compose a different )"
316
+ },
317
+ "attribute": "include-submit-button",
318
+ "reflect": true
319
+ },
320
+ "gmVersion": {
321
+ "type": "string",
322
+ "mutable": false,
323
+ "complexType": {
324
+ "original": "string",
325
+ "resolved": "string",
326
+ "references": {}
327
+ },
328
+ "required": false,
329
+ "optional": false,
330
+ "docs": {
331
+ "tags": [],
332
+ "text": "Select GM version"
333
+ },
334
+ "attribute": "gm-version",
335
+ "reflect": false,
336
+ "defaultValue": "''"
337
+ },
338
+ "translationUrl": {
339
+ "type": "string",
340
+ "mutable": false,
341
+ "complexType": {
342
+ "original": "string",
343
+ "resolved": "string",
344
+ "references": {}
345
+ },
346
+ "required": false,
347
+ "optional": false,
348
+ "docs": {
349
+ "tags": [],
350
+ "text": "Translation url"
351
+ },
352
+ "attribute": "translation-url",
353
+ "reflect": true,
354
+ "defaultValue": "''"
355
+ },
356
+ "clientStyling": {
357
+ "type": "string",
358
+ "mutable": true,
359
+ "complexType": {
360
+ "original": "string",
361
+ "resolved": "string",
362
+ "references": {}
363
+ },
364
+ "required": false,
365
+ "optional": false,
366
+ "docs": {
367
+ "tags": [],
368
+ "text": "Client custom styling via inline style"
369
+ },
370
+ "attribute": "client-styling",
371
+ "reflect": true,
372
+ "defaultValue": "''"
373
+ },
374
+ "clientStylingUrl": {
375
+ "type": "string",
376
+ "mutable": false,
377
+ "complexType": {
378
+ "original": "string",
379
+ "resolved": "string",
380
+ "references": {}
381
+ },
382
+ "required": false,
383
+ "optional": false,
384
+ "docs": {
385
+ "tags": [],
386
+ "text": "Client custom styling via url"
387
+ },
388
+ "attribute": "client-styling-url",
389
+ "reflect": true,
390
+ "defaultValue": "''"
391
+ }
392
+ };
209
393
  }
210
- // end custom styling area
211
- }
212
- calcMandatoryActions() {
213
- this.mandatoryItems = 0;
214
- this.mandatoryActions.map(action => {
215
- const isPresent = this.activeUserActions.includes(action);
216
- if (isPresent) {
217
- this.mandatoryItems++;
218
- }
219
- });
220
- }
221
- render() {
222
- if (this.mandatoryItems > 0) {
223
- this.userActionsValidated = this.mandatoryActionsChecked === this.mandatoryItems;
224
- return (h("div", { class: "QueryReferenceContainer", ref: el => this.stylingContainer = el }, this.isLoading ? (h("slot", { name: 'spinner' })
225
- &&
226
- h("svg", { class: "spinner", viewBox: "0 0 50 50" },
227
- h("circle", { class: "path", cx: "25", cy: "25", r: "20", fill: "none", "stroke-width": "5" }))) : (h("div", { class: "UserActionController" },
228
- h("h2", { class: "UserConsentNotice" }, translate('userNoticeText', this.lang)),
229
- h("div", { class: "PlayerLegislationWrapper" }, this.activeUserActions.map(action => (h("slot", { name: action },
230
- h("player-user-consents", { lang: this.lang, "gm-version": this.gmVersion, "translation-url": this.translationUrl, consentType: action, consentTitle: this.consentTitles[action], queried: this.queryFired, mandatory: this.mandatoryActions.includes(action), "client-styling": this.clientStyling }))))),
231
- this.includeSubmitButton &&
232
- h("button", { class: "ConsentSubmitButton", disabled: !this.userActionsValidated, onClick: () => this.handleApplyClick() }, translate('submitButtonText', this.lang))))));
394
+ static get states() {
395
+ return {
396
+ "queryFired": {},
397
+ "readyActionsCount": {},
398
+ "activeUserActions": {},
399
+ "userActionsValidated": {},
400
+ "receivedQueryResponses": {},
401
+ "limitStylingAppends": {},
402
+ "isLoading": {},
403
+ "mandatoryActionsChecked": {},
404
+ "mandatoryItems": {}
405
+ };
233
406
  }
234
- else {
235
- return;
407
+ static get watchers() {
408
+ return [{
409
+ "propName": "translationUrl",
410
+ "methodName": "handleNewTranslations"
411
+ }, {
412
+ "propName": "receivedQueryResponses",
413
+ "methodName": "handleQueryResponse"
414
+ }];
236
415
  }
237
- }
238
- static get is() { return "user-action-controller"; }
239
- static get encapsulation() { return "shadow"; }
240
- static get originalStyleUrls() { return {
241
- "$": ["user-action-controller.scss"]
242
- }; }
243
- static get styleUrls() { return {
244
- "$": ["user-action-controller.css"]
245
- }; }
246
- static get properties() { return {
247
- "endpoint": {
248
- "type": "string",
249
- "mutable": false,
250
- "complexType": {
251
- "original": "string",
252
- "resolved": "string",
253
- "references": {}
254
- },
255
- "required": true,
256
- "optional": false,
257
- "docs": {
258
- "tags": [],
259
- "text": "the endpoint required for the update call"
260
- },
261
- "attribute": "endpoint",
262
- "reflect": true
263
- },
264
- "userSession": {
265
- "type": "string",
266
- "mutable": false,
267
- "complexType": {
268
- "original": "string",
269
- "resolved": "string",
270
- "references": {}
271
- },
272
- "required": true,
273
- "optional": false,
274
- "docs": {
275
- "tags": [],
276
- "text": "user session required for the update call"
277
- },
278
- "attribute": "user-session",
279
- "reflect": true
280
- },
281
- "userId": {
282
- "type": "string",
283
- "mutable": false,
284
- "complexType": {
285
- "original": "string",
286
- "resolved": "string",
287
- "references": {}
288
- },
289
- "required": true,
290
- "optional": false,
291
- "docs": {
292
- "tags": [],
293
- "text": "user id required for the update call"
294
- },
295
- "attribute": "user-id",
296
- "reflect": true
297
- },
298
- "lang": {
299
- "type": "string",
300
- "mutable": true,
301
- "complexType": {
302
- "original": "string",
303
- "resolved": "string",
304
- "references": {}
305
- },
306
- "required": false,
307
- "optional": false,
308
- "docs": {
309
- "tags": [],
310
- "text": "Language"
311
- },
312
- "attribute": "lang",
313
- "reflect": true,
314
- "defaultValue": "'en'"
315
- },
316
- "includeSubmitButton": {
317
- "type": "boolean",
318
- "mutable": false,
319
- "complexType": {
320
- "original": "boolean",
321
- "resolved": "boolean",
322
- "references": {}
323
- },
324
- "required": true,
325
- "optional": false,
326
- "docs": {
327
- "tags": [],
328
- "text": "whether or not to include the submit button (in case we want to compose a different )"
329
- },
330
- "attribute": "include-submit-button",
331
- "reflect": true
332
- },
333
- "gmVersion": {
334
- "type": "string",
335
- "mutable": false,
336
- "complexType": {
337
- "original": "string",
338
- "resolved": "string",
339
- "references": {}
340
- },
341
- "required": false,
342
- "optional": false,
343
- "docs": {
344
- "tags": [],
345
- "text": "Select GM version"
346
- },
347
- "attribute": "gm-version",
348
- "reflect": false,
349
- "defaultValue": "''"
350
- },
351
- "translationUrl": {
352
- "type": "string",
353
- "mutable": false,
354
- "complexType": {
355
- "original": "string",
356
- "resolved": "string",
357
- "references": {}
358
- },
359
- "required": false,
360
- "optional": false,
361
- "docs": {
362
- "tags": [],
363
- "text": "Translation url"
364
- },
365
- "attribute": "translation-url",
366
- "reflect": true,
367
- "defaultValue": "''"
368
- },
369
- "clientStyling": {
370
- "type": "string",
371
- "mutable": true,
372
- "complexType": {
373
- "original": "string",
374
- "resolved": "string",
375
- "references": {}
376
- },
377
- "required": false,
378
- "optional": false,
379
- "docs": {
380
- "tags": [],
381
- "text": "Client custom styling via inline style"
382
- },
383
- "attribute": "client-styling",
384
- "reflect": true,
385
- "defaultValue": "''"
386
- },
387
- "clientStylingUrl": {
388
- "type": "string",
389
- "mutable": false,
390
- "complexType": {
391
- "original": "string",
392
- "resolved": "string",
393
- "references": {}
394
- },
395
- "required": false,
396
- "optional": false,
397
- "docs": {
398
- "tags": [],
399
- "text": "Client custom styling via url"
400
- },
401
- "attribute": "client-styling-url",
402
- "reflect": true,
403
- "defaultValue": "''"
416
+ static get listeners() {
417
+ return [{
418
+ "name": "userLegislationConsent",
419
+ "method": "userLegislationConsentHandler",
420
+ "target": undefined,
421
+ "capture": false,
422
+ "passive": false
423
+ }];
404
424
  }
405
- }; }
406
- static get states() { return {
407
- "queryFired": {},
408
- "readyActionsCount": {},
409
- "activeUserActions": {},
410
- "userActionsValidated": {},
411
- "receivedQueryResponses": {},
412
- "limitStylingAppends": {},
413
- "isLoading": {},
414
- "mandatoryActionsChecked": {},
415
- "mandatoryItems": {}
416
- }; }
417
- static get watchers() { return [{
418
- "propName": "translationUrl",
419
- "methodName": "handleNewTranslations"
420
- }, {
421
- "propName": "receivedQueryResponses",
422
- "methodName": "handleQueryResponse"
423
- }]; }
424
- static get listeners() { return [{
425
- "name": "userLegislationConsent",
426
- "method": "userLegislationConsentHandler",
427
- "target": undefined,
428
- "capture": false,
429
- "passive": false
430
- }]; }
431
425
  }