@everymatrix/user-action-controller 1.0.0 → 1.15.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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-5b463836.js');
5
+ const index = require('./index-87049e21.js');
6
6
 
7
7
  const genericUserConsentCss = ":host{display:block}.ConsentTitle{margin-bottom:0.2rem;font-weight:600}.userConsent:hover{border-bottom:1px solid #000;cursor:pointer}.MandatoryItem{color:#f00;font-size:1.2rem}";
8
8
 
@@ -34,10 +34,15 @@ const GenericUserConsent = class {
34
34
  * link to privacy policy page
35
35
  */
36
36
  this.privacyLink = '#';
37
+ /**
38
+ * Client custom styling via inline style
39
+ */
40
+ this.clientStyling = '';
37
41
  /**
38
42
  * the text content to be rendered by the component. Determined at runtime
39
43
  */
40
44
  this.textContent = '';
45
+ this.limitStylingAppends = false;
41
46
  // Maybe switch this out with a localization source
42
47
  this.stringVariants = {
43
48
  termsandconditions1: "I accept the ",
@@ -48,6 +53,11 @@ const GenericUserConsent = class {
48
53
  sms: "I consent to receive marketing communication via SMS.",
49
54
  emailmarketing: "I consent to receive marketing communication via Email."
50
55
  };
56
+ this.setClientStyling = () => {
57
+ let sheet = document.createElement('style');
58
+ sheet.innerHTML = this.clientStyling;
59
+ this.stylingContainer.prepend(sheet);
60
+ };
51
61
  }
52
62
  determineTextContent() {
53
63
  let result = this.consentType === 'termsandconditions' ?
@@ -61,12 +71,21 @@ const GenericUserConsent = class {
61
71
  value: this.checkboxInput.checked
62
72
  });
63
73
  }
74
+ componentDidRender() {
75
+ // start custom styling area
76
+ if (!this.limitStylingAppends && this.stylingContainer) {
77
+ if (this.clientStyling)
78
+ this.setClientStyling();
79
+ this.limitStylingAppends = true;
80
+ }
81
+ // end custom styling area
82
+ }
64
83
  render() {
65
84
  if (this.queried) {
66
85
  this.userLegislationConsentHandler();
67
86
  }
68
87
  this.textContent = this.determineTextContent();
69
- return (index.h("div", null, index.h("p", { class: "ConsentTitle" }, this.consentTitle), index.h("label", { class: "userConsent", htmlFor: "userConsent" }, index.h("input", { ref: el => this.checkboxInput = el, id: "userConsent", type: "checkbox", onInput: () => this.userLegislationConsentHandler() }), this.textContent, this.mandatory && index.h("span", { class: "MandatoryItem" }, "*"))));
88
+ return (index.h("div", { ref: el => this.stylingContainer = el }, index.h("p", { class: "ConsentTitle" }, this.consentTitle), index.h("label", { class: "userConsent", htmlFor: "userConsent" }, index.h("input", { ref: el => this.checkboxInput = el, id: "userConsent", type: "checkbox", onInput: () => this.userLegislationConsentHandler() }), this.textContent, this.mandatory && index.h("span", { class: "MandatoryItem" }, "*"))));
70
89
  }
71
90
  };
72
91
  GenericUserConsent.style = genericUserConsentCss;
@@ -76,10 +95,29 @@ const legislationWrapperCss = ":host{display:block}";
76
95
  const LegislationWrapper = class {
77
96
  constructor(hostRef) {
78
97
  index.registerInstance(this, hostRef);
98
+ /**
99
+ * Client custom styling via inline style
100
+ */
101
+ this.clientStyling = '';
102
+ this.limitStylingAppends = false;
103
+ this.setClientStyling = () => {
104
+ let sheet = document.createElement('style');
105
+ sheet.innerHTML = this.clientStyling;
106
+ this.stylingContainer.prepend(sheet);
107
+ };
108
+ }
109
+ componentDidRender() {
110
+ // start custom styling area
111
+ if (!this.limitStylingAppends && this.stylingContainer) {
112
+ if (this.clientStyling)
113
+ this.setClientStyling();
114
+ this.limitStylingAppends = true;
115
+ }
116
+ // end custom styling area
79
117
  }
80
118
  render() {
81
119
  const activeUAList = this.activeUserActions.replace(/ /g, '').split(',');
82
- return (index.h("div", { class: "LegislationWrapper" }, activeUAList.map(action => (index.h("slot", { name: action })))));
120
+ return (index.h("div", { class: "LegislationWrapper", ref: el => this.stylingContainer = el }, activeUAList.map(action => (index.h("slot", { name: action })))));
83
121
  }
84
122
  };
85
123
  LegislationWrapper.style = legislationWrapperCss;
@@ -94,6 +132,14 @@ const UserActionController = class {
94
132
  * Event name to be sent when the button is clicked
95
133
  */
96
134
  this.postMessageEvent = 'closeButtonClicked';
135
+ /**
136
+ * Client custom styling via inline style
137
+ */
138
+ this.clientStyling = '';
139
+ /**
140
+ * Client custom styling via url
141
+ */
142
+ this.clientStylingUrl = '';
97
143
  this.consentTitles = {
98
144
  termsandconditions: "Terms and Conditions",
99
145
  sms: "SMS marketing",
@@ -105,10 +151,30 @@ const UserActionController = class {
105
151
  this.queryFired = false;
106
152
  this.readyActionsCount = 0;
107
153
  this.receivedQueryResponses = 0;
154
+ this.limitStylingAppends = false;
108
155
  this.mandatoryActions = ['termsandconditions'];
109
156
  this.requiredActionsCount = 0;
110
157
  this.expectedQueryResponses = 0;
111
158
  this.userActions = [];
159
+ this.setClientStyling = () => {
160
+ let sheet = document.createElement('style');
161
+ sheet.innerHTML = this.clientStyling;
162
+ this.stylingContainer.prepend(sheet);
163
+ };
164
+ this.setClientStylingURL = () => {
165
+ let url = new URL(this.clientStylingUrl);
166
+ let cssFile = document.createElement('style');
167
+ fetch(url.href)
168
+ .then((res) => res.text())
169
+ .then((data) => {
170
+ this.clientStyling = data;
171
+ cssFile.innerHTML = data;
172
+ setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
173
+ })
174
+ .catch((err) => {
175
+ console.log('error ', err);
176
+ });
177
+ };
112
178
  }
113
179
  determineMandatoryActions() {
114
180
  let url = new URL(`${this.endpoint}v1/player/consentRequirements`);
@@ -191,12 +257,23 @@ const UserActionController = class {
191
257
  componentWillLoad() {
192
258
  return this.determineMandatoryActions();
193
259
  }
260
+ componentDidRender() {
261
+ // start custom styling area
262
+ if (!this.limitStylingAppends && this.stylingContainer) {
263
+ if (this.clientStyling)
264
+ this.setClientStyling();
265
+ if (this.clientStylingUrl)
266
+ this.setClientStylingURL();
267
+ this.limitStylingAppends = true;
268
+ }
269
+ // end custom styling area
270
+ }
194
271
  render() {
195
272
  const activeUAList = this.activeUserActions.replace(/ /g, '').split(',');
196
273
  this.requiredActionsCount = activeUAList.filter(action => this.mandatoryActions.includes(action)).length;
197
274
  this.expectedQueryResponses = activeUAList.length;
198
- return (index.h("div", { class: "QueryReferenceContainer" }, index.h("div", { class: "UserActionController" }, this.showCloseButton &&
199
- index.h("div", { class: "CloseButton", onClick: () => this.handleClose() }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "25", height: "25", fill: "currentColor", viewBox: "0 0 16 16" }, index.h("path", { d: "M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z" }))), index.h("h2", { class: "UserConsentNotice" }, this.userNoticeText), index.h("legislation-wrapper", { "active-user-actions": this.activeUserActions }, activeUAList.map(item => (index.h("generic-user-consent", { slot: item, consentType: item, consentTitle: this.consentTitles[item], queried: this.queryFired, mandatory: this.mandatoryActions.includes(item) })))), this.includeSubmitButton &&
275
+ return (index.h("div", { class: "QueryReferenceContainer", ref: el => this.stylingContainer = el }, index.h("div", { class: "UserActionController" }, this.showCloseButton &&
276
+ index.h("div", { class: "CloseButton", onClick: () => this.handleClose() }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "25", height: "25", fill: "currentColor", viewBox: "0 0 16 16" }, index.h("path", { d: "M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z" }))), index.h("h2", { class: "UserConsentNotice" }, this.userNoticeText), index.h("legislation-wrapper", { "active-user-actions": this.activeUserActions, "client-styling": this.clientStyling }, activeUAList.map(item => (index.h("generic-user-consent", { slot: item, consentType: item, consentTitle: this.consentTitles[item], queried: this.queryFired, mandatory: this.mandatoryActions.includes(item), "client-styling": this.clientStyling })))), this.includeSubmitButton &&
200
277
  index.h("button", { class: "ConsentSubmitButton", disabled: this.readyActionsCount === this.requiredActionsCount ? false : true, onClick: () => this.handleApplyClick() }, this.submitButtonText))));
201
278
  }
202
279
  static get watchers() { return {
@@ -585,9 +585,14 @@ const callNodeRefs = (vNode) => {
585
585
  };
586
586
  const renderVdom = (hostRef, renderFnResults) => {
587
587
  const hostElm = hostRef.$hostElement$;
588
+ const cmpMeta = hostRef.$cmpMeta$;
588
589
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
589
590
  const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
590
591
  hostTagName = hostElm.tagName;
592
+ if (cmpMeta.$attrsToReflect$) {
593
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
594
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
595
+ }
591
596
  rootVnode.$tag$ = null;
592
597
  rootVnode.$flags$ |= 4 /* isHost */;
593
598
  hostRef.$vnode$ = rootVnode;
@@ -727,7 +732,11 @@ const postUpdateComponent = (hostRef) => {
727
732
  const tagName = hostRef.$cmpMeta$.$tagName$;
728
733
  const elm = hostRef.$hostElement$;
729
734
  const endPostUpdate = createTime('postUpdate', tagName);
735
+ const instance = hostRef.$lazyInstance$ ;
730
736
  const ancestorComponent = hostRef.$ancestorComponent$;
737
+ {
738
+ safeCall(instance, 'componentDidRender');
739
+ }
731
740
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
732
741
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
733
742
  {
@@ -957,6 +966,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
957
966
  .map(([propName, m]) => {
958
967
  const attrName = m[1] || propName;
959
968
  attrNameToPropName.set(attrName, propName);
969
+ if (m[0] & 512 /* ReflectAttr */) {
970
+ cmpMeta.$attrsToReflect$.push([propName, attrName]);
971
+ }
960
972
  return attrName;
961
973
  });
962
974
  }
@@ -1126,6 +1138,9 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1126
1138
  {
1127
1139
  cmpMeta.$listeners$ = compactMeta[3];
1128
1140
  }
1141
+ {
1142
+ cmpMeta.$attrsToReflect$ = [];
1143
+ }
1129
1144
  {
1130
1145
  cmpMeta.$watchers$ = {};
1131
1146
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-5b463836.js');
5
+ const index = require('./index-87049e21.js');
6
6
 
7
7
  /*
8
8
  Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["generic-user-consent_3.cjs",[[1,"user-action-controller",{"endpoint":[1],"userSession":[1,"user-session"],"userId":[1,"user-id"],"includeSubmitButton":[4,"include-submit-button"],"submitButtonText":[1,"submit-button-text"],"userNoticeText":[1,"user-notice-text"],"activeUserActions":[1,"active-user-actions"],"showCloseButton":[4,"show-close-button"],"usePostmessage":[4,"use-postmessage"],"postMessageEvent":[1,"post-message-event"],"queryFired":[32],"readyActionsCount":[32],"receivedQueryResponses":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[1,"generic-user-consent",{"queried":[4],"consentType":[1,"consent-type"],"mandatory":[4],"consentTitle":[1,"consent-title"],"tcLink":[1,"tc-link"],"privacyLink":[1,"privacy-link"],"textContent":[32]}],[1,"legislation-wrapper",{"activeUserActions":[1,"active-user-actions"]}]]]], options);
17
+ return index.bootstrapLazy([["generic-user-consent_3.cjs",[[1,"user-action-controller",{"endpoint":[513],"userSession":[513,"user-session"],"userId":[513,"user-id"],"includeSubmitButton":[516,"include-submit-button"],"submitButtonText":[513,"submit-button-text"],"userNoticeText":[513,"user-notice-text"],"activeUserActions":[513,"active-user-actions"],"showCloseButton":[516,"show-close-button"],"usePostmessage":[516,"use-postmessage"],"postMessageEvent":[1,"post-message-event"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"queryFired":[32],"readyActionsCount":[32],"receivedQueryResponses":[32],"limitStylingAppends":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[1,"generic-user-consent",{"queried":[516],"consentType":[513,"consent-type"],"mandatory":[516],"consentTitle":[513,"consent-title"],"tcLink":[513,"tc-link"],"privacyLink":[513,"privacy-link"],"clientStyling":[1,"client-styling"],"textContent":[32],"limitStylingAppends":[32]}],[1,"legislation-wrapper",{"activeUserActions":[513,"active-user-actions"],"clientStyling":[1,"client-styling"],"limitStylingAppends":[32]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-5b463836.js');
3
+ const index = require('./index-87049e21.js');
4
4
 
5
5
  /*
6
6
  Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["generic-user-consent_3.cjs",[[1,"user-action-controller",{"endpoint":[1],"userSession":[1,"user-session"],"userId":[1,"user-id"],"includeSubmitButton":[4,"include-submit-button"],"submitButtonText":[1,"submit-button-text"],"userNoticeText":[1,"user-notice-text"],"activeUserActions":[1,"active-user-actions"],"showCloseButton":[4,"show-close-button"],"usePostmessage":[4,"use-postmessage"],"postMessageEvent":[1,"post-message-event"],"queryFired":[32],"readyActionsCount":[32],"receivedQueryResponses":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[1,"generic-user-consent",{"queried":[4],"consentType":[1,"consent-type"],"mandatory":[4],"consentTitle":[1,"consent-title"],"tcLink":[1,"tc-link"],"privacyLink":[1,"privacy-link"],"textContent":[32]}],[1,"legislation-wrapper",{"activeUserActions":[1,"active-user-actions"]}]]]], options);
18
+ return index.bootstrapLazy([["generic-user-consent_3.cjs",[[1,"user-action-controller",{"endpoint":[513],"userSession":[513,"user-session"],"userId":[513,"user-id"],"includeSubmitButton":[516,"include-submit-button"],"submitButtonText":[513,"submit-button-text"],"userNoticeText":[513,"user-notice-text"],"activeUserActions":[513,"active-user-actions"],"showCloseButton":[516,"show-close-button"],"usePostmessage":[516,"use-postmessage"],"postMessageEvent":[1,"post-message-event"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"queryFired":[32],"readyActionsCount":[32],"receivedQueryResponses":[32],"limitStylingAppends":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[1,"generic-user-consent",{"queried":[516],"consentType":[513,"consent-type"],"mandatory":[516],"consentTitle":[513,"consent-title"],"tcLink":[513,"tc-link"],"privacyLink":[513,"privacy-link"],"clientStyling":[1,"client-styling"],"textContent":[32],"limitStylingAppends":[32]}],[1,"legislation-wrapper",{"activeUserActions":[513,"active-user-actions"],"clientStyling":[1,"client-styling"],"limitStylingAppends":[32]}]]]], options);
19
19
  });
@@ -7,6 +7,14 @@ export class UserActionController {
7
7
  * Event name to be sent when the button is clicked
8
8
  */
9
9
  this.postMessageEvent = 'closeButtonClicked';
10
+ /**
11
+ * Client custom styling via inline style
12
+ */
13
+ this.clientStyling = '';
14
+ /**
15
+ * Client custom styling via url
16
+ */
17
+ this.clientStylingUrl = '';
10
18
  this.consentTitles = {
11
19
  termsandconditions: "Terms and Conditions",
12
20
  sms: "SMS marketing",
@@ -18,10 +26,30 @@ export class UserActionController {
18
26
  this.queryFired = false;
19
27
  this.readyActionsCount = 0;
20
28
  this.receivedQueryResponses = 0;
29
+ this.limitStylingAppends = false;
21
30
  this.mandatoryActions = ['termsandconditions'];
22
31
  this.requiredActionsCount = 0;
23
32
  this.expectedQueryResponses = 0;
24
33
  this.userActions = [];
34
+ this.setClientStyling = () => {
35
+ let sheet = document.createElement('style');
36
+ sheet.innerHTML = this.clientStyling;
37
+ this.stylingContainer.prepend(sheet);
38
+ };
39
+ this.setClientStylingURL = () => {
40
+ let url = new URL(this.clientStylingUrl);
41
+ let cssFile = document.createElement('style');
42
+ fetch(url.href)
43
+ .then((res) => res.text())
44
+ .then((data) => {
45
+ this.clientStyling = data;
46
+ cssFile.innerHTML = data;
47
+ setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
48
+ })
49
+ .catch((err) => {
50
+ console.log('error ', err);
51
+ });
52
+ };
25
53
  }
26
54
  determineMandatoryActions() {
27
55
  let url = new URL(`${this.endpoint}v1/player/consentRequirements`);
@@ -104,18 +132,29 @@ export class UserActionController {
104
132
  componentWillLoad() {
105
133
  return this.determineMandatoryActions();
106
134
  }
135
+ componentDidRender() {
136
+ // start custom styling area
137
+ if (!this.limitStylingAppends && this.stylingContainer) {
138
+ if (this.clientStyling)
139
+ this.setClientStyling();
140
+ if (this.clientStylingUrl)
141
+ this.setClientStylingURL();
142
+ this.limitStylingAppends = true;
143
+ }
144
+ // end custom styling area
145
+ }
107
146
  render() {
108
147
  const activeUAList = this.activeUserActions.replace(/ /g, '').split(',');
109
148
  this.requiredActionsCount = activeUAList.filter(action => this.mandatoryActions.includes(action)).length;
110
149
  this.expectedQueryResponses = activeUAList.length;
111
- return (h("div", { class: "QueryReferenceContainer" },
150
+ return (h("div", { class: "QueryReferenceContainer", ref: el => this.stylingContainer = el },
112
151
  h("div", { class: "UserActionController" },
113
152
  this.showCloseButton &&
114
153
  h("div", { class: "CloseButton", onClick: () => this.handleClose() },
115
154
  h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "25", height: "25", fill: "currentColor", viewBox: "0 0 16 16" },
116
155
  h("path", { d: "M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z" }))),
117
156
  h("h2", { class: "UserConsentNotice" }, this.userNoticeText),
118
- h("legislation-wrapper", { "active-user-actions": this.activeUserActions }, activeUAList.map(item => (h("generic-user-consent", { slot: item, consentType: item, consentTitle: this.consentTitles[item], queried: this.queryFired, mandatory: this.mandatoryActions.includes(item) })))),
157
+ h("legislation-wrapper", { "active-user-actions": this.activeUserActions, "client-styling": this.clientStyling }, activeUAList.map(item => (h("generic-user-consent", { slot: item, consentType: item, consentTitle: this.consentTitles[item], queried: this.queryFired, mandatory: this.mandatoryActions.includes(item), "client-styling": this.clientStyling })))),
119
158
  this.includeSubmitButton &&
120
159
  h("button", { class: "ConsentSubmitButton", disabled: this.readyActionsCount === this.requiredActionsCount ? false : true, onClick: () => this.handleApplyClick() }, this.submitButtonText))));
121
160
  }
@@ -143,7 +182,7 @@ export class UserActionController {
143
182
  "text": "the endpoint required for the update call"
144
183
  },
145
184
  "attribute": "endpoint",
146
- "reflect": false
185
+ "reflect": true
147
186
  },
148
187
  "userSession": {
149
188
  "type": "string",
@@ -160,7 +199,7 @@ export class UserActionController {
160
199
  "text": "user session required for the update call"
161
200
  },
162
201
  "attribute": "user-session",
163
- "reflect": false
202
+ "reflect": true
164
203
  },
165
204
  "userId": {
166
205
  "type": "string",
@@ -177,7 +216,7 @@ export class UserActionController {
177
216
  "text": "user id required for the update call"
178
217
  },
179
218
  "attribute": "user-id",
180
- "reflect": false
219
+ "reflect": true
181
220
  },
182
221
  "includeSubmitButton": {
183
222
  "type": "boolean",
@@ -191,10 +230,10 @@ export class UserActionController {
191
230
  "optional": false,
192
231
  "docs": {
193
232
  "tags": [],
194
- "text": "wether or not to include the submit button (in case we want to compose a different )"
233
+ "text": "whether or not to include the submit button (in case we want to compose a different )"
195
234
  },
196
235
  "attribute": "include-submit-button",
197
- "reflect": false
236
+ "reflect": true
198
237
  },
199
238
  "submitButtonText": {
200
239
  "type": "string",
@@ -211,7 +250,7 @@ export class UserActionController {
211
250
  "text": "the text of the button, if button is enabled"
212
251
  },
213
252
  "attribute": "submit-button-text",
214
- "reflect": false
253
+ "reflect": true
215
254
  },
216
255
  "userNoticeText": {
217
256
  "type": "string",
@@ -228,7 +267,7 @@ export class UserActionController {
228
267
  "text": "the title of the action group"
229
268
  },
230
269
  "attribute": "user-notice-text",
231
- "reflect": false
270
+ "reflect": true
232
271
  },
233
272
  "activeUserActions": {
234
273
  "type": "string",
@@ -245,7 +284,7 @@ export class UserActionController {
245
284
  "text": "which user action widgets are included"
246
285
  },
247
286
  "attribute": "active-user-actions",
248
- "reflect": false
287
+ "reflect": true
249
288
  },
250
289
  "showCloseButton": {
251
290
  "type": "boolean",
@@ -262,7 +301,7 @@ export class UserActionController {
262
301
  "text": "Property used to display the close/cancel button"
263
302
  },
264
303
  "attribute": "show-close-button",
265
- "reflect": false
304
+ "reflect": true
266
305
  },
267
306
  "usePostmessage": {
268
307
  "type": "boolean",
@@ -279,7 +318,7 @@ export class UserActionController {
279
318
  "text": "Use postMessage event to communicate"
280
319
  },
281
320
  "attribute": "use-postmessage",
282
- "reflect": false
321
+ "reflect": true
283
322
  },
284
323
  "postMessageEvent": {
285
324
  "type": "string",
@@ -298,12 +337,49 @@ export class UserActionController {
298
337
  "attribute": "post-message-event",
299
338
  "reflect": false,
300
339
  "defaultValue": "'closeButtonClicked'"
340
+ },
341
+ "clientStyling": {
342
+ "type": "string",
343
+ "mutable": true,
344
+ "complexType": {
345
+ "original": "string",
346
+ "resolved": "string",
347
+ "references": {}
348
+ },
349
+ "required": false,
350
+ "optional": false,
351
+ "docs": {
352
+ "tags": [],
353
+ "text": "Client custom styling via inline style"
354
+ },
355
+ "attribute": "client-styling",
356
+ "reflect": true,
357
+ "defaultValue": "''"
358
+ },
359
+ "clientStylingUrl": {
360
+ "type": "string",
361
+ "mutable": false,
362
+ "complexType": {
363
+ "original": "string",
364
+ "resolved": "string",
365
+ "references": {}
366
+ },
367
+ "required": false,
368
+ "optional": false,
369
+ "docs": {
370
+ "tags": [],
371
+ "text": "Client custom styling via url"
372
+ },
373
+ "attribute": "client-styling-url",
374
+ "reflect": true,
375
+ "defaultValue": "''"
301
376
  }
302
377
  }; }
303
378
  static get states() { return {
304
379
  "queryFired": {},
305
380
  "readyActionsCount": {},
306
- "receivedQueryResponses": {}
381
+ "receivedQueryResponses": {},
382
+ "limitStylingAppends": {}
307
383
  }; }
308
384
  static get events() { return [{
309
385
  "method": "closeButtonEvent",
@@ -32,10 +32,15 @@ const GenericUserConsent = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
32
32
  * link to privacy policy page
33
33
  */
34
34
  this.privacyLink = '#';
35
+ /**
36
+ * Client custom styling via inline style
37
+ */
38
+ this.clientStyling = '';
35
39
  /**
36
40
  * the text content to be rendered by the component. Determined at runtime
37
41
  */
38
42
  this.textContent = '';
43
+ this.limitStylingAppends = false;
39
44
  // Maybe switch this out with a localization source
40
45
  this.stringVariants = {
41
46
  termsandconditions1: "I accept the ",
@@ -46,6 +51,11 @@ const GenericUserConsent = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
46
51
  sms: "I consent to receive marketing communication via SMS.",
47
52
  emailmarketing: "I consent to receive marketing communication via Email."
48
53
  };
54
+ this.setClientStyling = () => {
55
+ let sheet = document.createElement('style');
56
+ sheet.innerHTML = this.clientStyling;
57
+ this.stylingContainer.prepend(sheet);
58
+ };
49
59
  }
50
60
  determineTextContent() {
51
61
  let result = this.consentType === 'termsandconditions' ?
@@ -59,22 +69,33 @@ const GenericUserConsent = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
59
69
  value: this.checkboxInput.checked
60
70
  });
61
71
  }
72
+ componentDidRender() {
73
+ // start custom styling area
74
+ if (!this.limitStylingAppends && this.stylingContainer) {
75
+ if (this.clientStyling)
76
+ this.setClientStyling();
77
+ this.limitStylingAppends = true;
78
+ }
79
+ // end custom styling area
80
+ }
62
81
  render() {
63
82
  if (this.queried) {
64
83
  this.userLegislationConsentHandler();
65
84
  }
66
85
  this.textContent = this.determineTextContent();
67
- return (h("div", null, h("p", { class: "ConsentTitle" }, this.consentTitle), h("label", { class: "userConsent", htmlFor: "userConsent" }, h("input", { ref: el => this.checkboxInput = el, id: "userConsent", type: "checkbox", onInput: () => this.userLegislationConsentHandler() }), this.textContent, this.mandatory && h("span", { class: "MandatoryItem" }, "*"))));
86
+ return (h("div", { ref: el => this.stylingContainer = el }, h("p", { class: "ConsentTitle" }, this.consentTitle), h("label", { class: "userConsent", htmlFor: "userConsent" }, h("input", { ref: el => this.checkboxInput = el, id: "userConsent", type: "checkbox", onInput: () => this.userLegislationConsentHandler() }), this.textContent, this.mandatory && h("span", { class: "MandatoryItem" }, "*"))));
68
87
  }
69
88
  static get style() { return genericUserConsentCss; }
70
89
  }, [1, "generic-user-consent", {
71
- "queried": [4],
72
- "consentType": [1, "consent-type"],
73
- "mandatory": [4],
74
- "consentTitle": [1, "consent-title"],
75
- "tcLink": [1, "tc-link"],
76
- "privacyLink": [1, "privacy-link"],
77
- "textContent": [32]
90
+ "queried": [516],
91
+ "consentType": [513, "consent-type"],
92
+ "mandatory": [516],
93
+ "consentTitle": [513, "consent-title"],
94
+ "tcLink": [513, "tc-link"],
95
+ "privacyLink": [513, "privacy-link"],
96
+ "clientStyling": [1, "client-styling"],
97
+ "textContent": [32],
98
+ "limitStylingAppends": [32]
78
99
  }]);
79
100
  function defineCustomElement() {
80
101
  if (typeof customElements === "undefined") {
@@ -7,14 +7,35 @@ const LegislationWrapper = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
7
7
  super();
8
8
  this.__registerHost();
9
9
  this.__attachShadow();
10
+ /**
11
+ * Client custom styling via inline style
12
+ */
13
+ this.clientStyling = '';
14
+ this.limitStylingAppends = false;
15
+ this.setClientStyling = () => {
16
+ let sheet = document.createElement('style');
17
+ sheet.innerHTML = this.clientStyling;
18
+ this.stylingContainer.prepend(sheet);
19
+ };
20
+ }
21
+ componentDidRender() {
22
+ // start custom styling area
23
+ if (!this.limitStylingAppends && this.stylingContainer) {
24
+ if (this.clientStyling)
25
+ this.setClientStyling();
26
+ this.limitStylingAppends = true;
27
+ }
28
+ // end custom styling area
10
29
  }
11
30
  render() {
12
31
  const activeUAList = this.activeUserActions.replace(/ /g, '').split(',');
13
- return (h("div", { class: "LegislationWrapper" }, activeUAList.map(action => (h("slot", { name: action })))));
32
+ return (h("div", { class: "LegislationWrapper", ref: el => this.stylingContainer = el }, activeUAList.map(action => (h("slot", { name: action })))));
14
33
  }
15
34
  static get style() { return legislationWrapperCss; }
16
35
  }, [1, "legislation-wrapper", {
17
- "activeUserActions": [1, "active-user-actions"]
36
+ "activeUserActions": [513, "active-user-actions"],
37
+ "clientStyling": [1, "client-styling"],
38
+ "limitStylingAppends": [32]
18
39
  }]);
19
40
  function defineCustomElement() {
20
41
  if (typeof customElements === "undefined") {
@@ -14,6 +14,14 @@ const UserActionController$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
14
14
  * Event name to be sent when the button is clicked
15
15
  */
16
16
  this.postMessageEvent = 'closeButtonClicked';
17
+ /**
18
+ * Client custom styling via inline style
19
+ */
20
+ this.clientStyling = '';
21
+ /**
22
+ * Client custom styling via url
23
+ */
24
+ this.clientStylingUrl = '';
17
25
  this.consentTitles = {
18
26
  termsandconditions: "Terms and Conditions",
19
27
  sms: "SMS marketing",
@@ -25,10 +33,30 @@ const UserActionController$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
25
33
  this.queryFired = false;
26
34
  this.readyActionsCount = 0;
27
35
  this.receivedQueryResponses = 0;
36
+ this.limitStylingAppends = false;
28
37
  this.mandatoryActions = ['termsandconditions'];
29
38
  this.requiredActionsCount = 0;
30
39
  this.expectedQueryResponses = 0;
31
40
  this.userActions = [];
41
+ this.setClientStyling = () => {
42
+ let sheet = document.createElement('style');
43
+ sheet.innerHTML = this.clientStyling;
44
+ this.stylingContainer.prepend(sheet);
45
+ };
46
+ this.setClientStylingURL = () => {
47
+ let url = new URL(this.clientStylingUrl);
48
+ let cssFile = document.createElement('style');
49
+ fetch(url.href)
50
+ .then((res) => res.text())
51
+ .then((data) => {
52
+ this.clientStyling = data;
53
+ cssFile.innerHTML = data;
54
+ setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
55
+ })
56
+ .catch((err) => {
57
+ console.log('error ', err);
58
+ });
59
+ };
32
60
  }
33
61
  determineMandatoryActions() {
34
62
  let url = new URL(`${this.endpoint}v1/player/consentRequirements`);
@@ -111,12 +139,23 @@ const UserActionController$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
111
139
  componentWillLoad() {
112
140
  return this.determineMandatoryActions();
113
141
  }
142
+ componentDidRender() {
143
+ // start custom styling area
144
+ if (!this.limitStylingAppends && this.stylingContainer) {
145
+ if (this.clientStyling)
146
+ this.setClientStyling();
147
+ if (this.clientStylingUrl)
148
+ this.setClientStylingURL();
149
+ this.limitStylingAppends = true;
150
+ }
151
+ // end custom styling area
152
+ }
114
153
  render() {
115
154
  const activeUAList = this.activeUserActions.replace(/ /g, '').split(',');
116
155
  this.requiredActionsCount = activeUAList.filter(action => this.mandatoryActions.includes(action)).length;
117
156
  this.expectedQueryResponses = activeUAList.length;
118
- return (h("div", { class: "QueryReferenceContainer" }, h("div", { class: "UserActionController" }, this.showCloseButton &&
119
- h("div", { class: "CloseButton", onClick: () => this.handleClose() }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "25", height: "25", fill: "currentColor", viewBox: "0 0 16 16" }, h("path", { d: "M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z" }))), h("h2", { class: "UserConsentNotice" }, this.userNoticeText), h("legislation-wrapper", { "active-user-actions": this.activeUserActions }, activeUAList.map(item => (h("generic-user-consent", { slot: item, consentType: item, consentTitle: this.consentTitles[item], queried: this.queryFired, mandatory: this.mandatoryActions.includes(item) })))), this.includeSubmitButton &&
157
+ return (h("div", { class: "QueryReferenceContainer", ref: el => this.stylingContainer = el }, h("div", { class: "UserActionController" }, this.showCloseButton &&
158
+ h("div", { class: "CloseButton", onClick: () => this.handleClose() }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "25", height: "25", fill: "currentColor", viewBox: "0 0 16 16" }, h("path", { d: "M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z" }))), h("h2", { class: "UserConsentNotice" }, this.userNoticeText), h("legislation-wrapper", { "active-user-actions": this.activeUserActions, "client-styling": this.clientStyling }, activeUAList.map(item => (h("generic-user-consent", { slot: item, consentType: item, consentTitle: this.consentTitles[item], queried: this.queryFired, mandatory: this.mandatoryActions.includes(item), "client-styling": this.clientStyling })))), this.includeSubmitButton &&
120
159
  h("button", { class: "ConsentSubmitButton", disabled: this.readyActionsCount === this.requiredActionsCount ? false : true, onClick: () => this.handleApplyClick() }, this.submitButtonText))));
121
160
  }
122
161
  static get watchers() { return {
@@ -124,19 +163,22 @@ const UserActionController$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
124
163
  }; }
125
164
  static get style() { return userActionControllerCss; }
126
165
  }, [1, "user-action-controller", {
127
- "endpoint": [1],
128
- "userSession": [1, "user-session"],
129
- "userId": [1, "user-id"],
130
- "includeSubmitButton": [4, "include-submit-button"],
131
- "submitButtonText": [1, "submit-button-text"],
132
- "userNoticeText": [1, "user-notice-text"],
133
- "activeUserActions": [1, "active-user-actions"],
134
- "showCloseButton": [4, "show-close-button"],
135
- "usePostmessage": [4, "use-postmessage"],
166
+ "endpoint": [513],
167
+ "userSession": [513, "user-session"],
168
+ "userId": [513, "user-id"],
169
+ "includeSubmitButton": [516, "include-submit-button"],
170
+ "submitButtonText": [513, "submit-button-text"],
171
+ "userNoticeText": [513, "user-notice-text"],
172
+ "activeUserActions": [513, "active-user-actions"],
173
+ "showCloseButton": [516, "show-close-button"],
174
+ "usePostmessage": [516, "use-postmessage"],
136
175
  "postMessageEvent": [1, "post-message-event"],
176
+ "clientStyling": [1537, "client-styling"],
177
+ "clientStylingUrl": [513, "client-styling-url"],
137
178
  "queryFired": [32],
138
179
  "readyActionsCount": [32],
139
- "receivedQueryResponses": [32]
180
+ "receivedQueryResponses": [32],
181
+ "limitStylingAppends": [32]
140
182
  }, [[0, "userLegislationConsent", "userLegislationConsentHandler"]]]);
141
183
  function defineCustomElement$1() {
142
184
  if (typeof customElements === "undefined") {
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, c as createEvent, h } from './index-e34db4b0.js';
1
+ import { r as registerInstance, c as createEvent, h } from './index-71f14530.js';
2
2
 
3
3
  const genericUserConsentCss = ":host{display:block}.ConsentTitle{margin-bottom:0.2rem;font-weight:600}.userConsent:hover{border-bottom:1px solid #000;cursor:pointer}.MandatoryItem{color:#f00;font-size:1.2rem}";
4
4
 
@@ -30,10 +30,15 @@ const GenericUserConsent = class {
30
30
  * link to privacy policy page
31
31
  */
32
32
  this.privacyLink = '#';
33
+ /**
34
+ * Client custom styling via inline style
35
+ */
36
+ this.clientStyling = '';
33
37
  /**
34
38
  * the text content to be rendered by the component. Determined at runtime
35
39
  */
36
40
  this.textContent = '';
41
+ this.limitStylingAppends = false;
37
42
  // Maybe switch this out with a localization source
38
43
  this.stringVariants = {
39
44
  termsandconditions1: "I accept the ",
@@ -44,6 +49,11 @@ const GenericUserConsent = class {
44
49
  sms: "I consent to receive marketing communication via SMS.",
45
50
  emailmarketing: "I consent to receive marketing communication via Email."
46
51
  };
52
+ this.setClientStyling = () => {
53
+ let sheet = document.createElement('style');
54
+ sheet.innerHTML = this.clientStyling;
55
+ this.stylingContainer.prepend(sheet);
56
+ };
47
57
  }
48
58
  determineTextContent() {
49
59
  let result = this.consentType === 'termsandconditions' ?
@@ -57,12 +67,21 @@ const GenericUserConsent = class {
57
67
  value: this.checkboxInput.checked
58
68
  });
59
69
  }
70
+ componentDidRender() {
71
+ // start custom styling area
72
+ if (!this.limitStylingAppends && this.stylingContainer) {
73
+ if (this.clientStyling)
74
+ this.setClientStyling();
75
+ this.limitStylingAppends = true;
76
+ }
77
+ // end custom styling area
78
+ }
60
79
  render() {
61
80
  if (this.queried) {
62
81
  this.userLegislationConsentHandler();
63
82
  }
64
83
  this.textContent = this.determineTextContent();
65
- return (h("div", null, h("p", { class: "ConsentTitle" }, this.consentTitle), h("label", { class: "userConsent", htmlFor: "userConsent" }, h("input", { ref: el => this.checkboxInput = el, id: "userConsent", type: "checkbox", onInput: () => this.userLegislationConsentHandler() }), this.textContent, this.mandatory && h("span", { class: "MandatoryItem" }, "*"))));
84
+ return (h("div", { ref: el => this.stylingContainer = el }, h("p", { class: "ConsentTitle" }, this.consentTitle), h("label", { class: "userConsent", htmlFor: "userConsent" }, h("input", { ref: el => this.checkboxInput = el, id: "userConsent", type: "checkbox", onInput: () => this.userLegislationConsentHandler() }), this.textContent, this.mandatory && h("span", { class: "MandatoryItem" }, "*"))));
66
85
  }
67
86
  };
68
87
  GenericUserConsent.style = genericUserConsentCss;
@@ -72,10 +91,29 @@ const legislationWrapperCss = ":host{display:block}";
72
91
  const LegislationWrapper = class {
73
92
  constructor(hostRef) {
74
93
  registerInstance(this, hostRef);
94
+ /**
95
+ * Client custom styling via inline style
96
+ */
97
+ this.clientStyling = '';
98
+ this.limitStylingAppends = false;
99
+ this.setClientStyling = () => {
100
+ let sheet = document.createElement('style');
101
+ sheet.innerHTML = this.clientStyling;
102
+ this.stylingContainer.prepend(sheet);
103
+ };
104
+ }
105
+ componentDidRender() {
106
+ // start custom styling area
107
+ if (!this.limitStylingAppends && this.stylingContainer) {
108
+ if (this.clientStyling)
109
+ this.setClientStyling();
110
+ this.limitStylingAppends = true;
111
+ }
112
+ // end custom styling area
75
113
  }
76
114
  render() {
77
115
  const activeUAList = this.activeUserActions.replace(/ /g, '').split(',');
78
- return (h("div", { class: "LegislationWrapper" }, activeUAList.map(action => (h("slot", { name: action })))));
116
+ return (h("div", { class: "LegislationWrapper", ref: el => this.stylingContainer = el }, activeUAList.map(action => (h("slot", { name: action })))));
79
117
  }
80
118
  };
81
119
  LegislationWrapper.style = legislationWrapperCss;
@@ -90,6 +128,14 @@ const UserActionController = class {
90
128
  * Event name to be sent when the button is clicked
91
129
  */
92
130
  this.postMessageEvent = 'closeButtonClicked';
131
+ /**
132
+ * Client custom styling via inline style
133
+ */
134
+ this.clientStyling = '';
135
+ /**
136
+ * Client custom styling via url
137
+ */
138
+ this.clientStylingUrl = '';
93
139
  this.consentTitles = {
94
140
  termsandconditions: "Terms and Conditions",
95
141
  sms: "SMS marketing",
@@ -101,10 +147,30 @@ const UserActionController = class {
101
147
  this.queryFired = false;
102
148
  this.readyActionsCount = 0;
103
149
  this.receivedQueryResponses = 0;
150
+ this.limitStylingAppends = false;
104
151
  this.mandatoryActions = ['termsandconditions'];
105
152
  this.requiredActionsCount = 0;
106
153
  this.expectedQueryResponses = 0;
107
154
  this.userActions = [];
155
+ this.setClientStyling = () => {
156
+ let sheet = document.createElement('style');
157
+ sheet.innerHTML = this.clientStyling;
158
+ this.stylingContainer.prepend(sheet);
159
+ };
160
+ this.setClientStylingURL = () => {
161
+ let url = new URL(this.clientStylingUrl);
162
+ let cssFile = document.createElement('style');
163
+ fetch(url.href)
164
+ .then((res) => res.text())
165
+ .then((data) => {
166
+ this.clientStyling = data;
167
+ cssFile.innerHTML = data;
168
+ setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
169
+ })
170
+ .catch((err) => {
171
+ console.log('error ', err);
172
+ });
173
+ };
108
174
  }
109
175
  determineMandatoryActions() {
110
176
  let url = new URL(`${this.endpoint}v1/player/consentRequirements`);
@@ -187,12 +253,23 @@ const UserActionController = class {
187
253
  componentWillLoad() {
188
254
  return this.determineMandatoryActions();
189
255
  }
256
+ componentDidRender() {
257
+ // start custom styling area
258
+ if (!this.limitStylingAppends && this.stylingContainer) {
259
+ if (this.clientStyling)
260
+ this.setClientStyling();
261
+ if (this.clientStylingUrl)
262
+ this.setClientStylingURL();
263
+ this.limitStylingAppends = true;
264
+ }
265
+ // end custom styling area
266
+ }
190
267
  render() {
191
268
  const activeUAList = this.activeUserActions.replace(/ /g, '').split(',');
192
269
  this.requiredActionsCount = activeUAList.filter(action => this.mandatoryActions.includes(action)).length;
193
270
  this.expectedQueryResponses = activeUAList.length;
194
- return (h("div", { class: "QueryReferenceContainer" }, h("div", { class: "UserActionController" }, this.showCloseButton &&
195
- h("div", { class: "CloseButton", onClick: () => this.handleClose() }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "25", height: "25", fill: "currentColor", viewBox: "0 0 16 16" }, h("path", { d: "M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z" }))), h("h2", { class: "UserConsentNotice" }, this.userNoticeText), h("legislation-wrapper", { "active-user-actions": this.activeUserActions }, activeUAList.map(item => (h("generic-user-consent", { slot: item, consentType: item, consentTitle: this.consentTitles[item], queried: this.queryFired, mandatory: this.mandatoryActions.includes(item) })))), this.includeSubmitButton &&
271
+ return (h("div", { class: "QueryReferenceContainer", ref: el => this.stylingContainer = el }, h("div", { class: "UserActionController" }, this.showCloseButton &&
272
+ h("div", { class: "CloseButton", onClick: () => this.handleClose() }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "25", height: "25", fill: "currentColor", viewBox: "0 0 16 16" }, h("path", { d: "M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z" }))), h("h2", { class: "UserConsentNotice" }, this.userNoticeText), h("legislation-wrapper", { "active-user-actions": this.activeUserActions, "client-styling": this.clientStyling }, activeUAList.map(item => (h("generic-user-consent", { slot: item, consentType: item, consentTitle: this.consentTitles[item], queried: this.queryFired, mandatory: this.mandatoryActions.includes(item), "client-styling": this.clientStyling })))), this.includeSubmitButton &&
196
273
  h("button", { class: "ConsentSubmitButton", disabled: this.readyActionsCount === this.requiredActionsCount ? false : true, onClick: () => this.handleApplyClick() }, this.submitButtonText))));
197
274
  }
198
275
  static get watchers() { return {
@@ -563,9 +563,14 @@ const callNodeRefs = (vNode) => {
563
563
  };
564
564
  const renderVdom = (hostRef, renderFnResults) => {
565
565
  const hostElm = hostRef.$hostElement$;
566
+ const cmpMeta = hostRef.$cmpMeta$;
566
567
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
567
568
  const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
568
569
  hostTagName = hostElm.tagName;
570
+ if (cmpMeta.$attrsToReflect$) {
571
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
572
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
573
+ }
569
574
  rootVnode.$tag$ = null;
570
575
  rootVnode.$flags$ |= 4 /* isHost */;
571
576
  hostRef.$vnode$ = rootVnode;
@@ -705,7 +710,11 @@ const postUpdateComponent = (hostRef) => {
705
710
  const tagName = hostRef.$cmpMeta$.$tagName$;
706
711
  const elm = hostRef.$hostElement$;
707
712
  const endPostUpdate = createTime('postUpdate', tagName);
713
+ const instance = hostRef.$lazyInstance$ ;
708
714
  const ancestorComponent = hostRef.$ancestorComponent$;
715
+ {
716
+ safeCall(instance, 'componentDidRender');
717
+ }
709
718
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
710
719
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
711
720
  {
@@ -935,6 +944,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
935
944
  .map(([propName, m]) => {
936
945
  const attrName = m[1] || propName;
937
946
  attrNameToPropName.set(attrName, propName);
947
+ if (m[0] & 512 /* ReflectAttr */) {
948
+ cmpMeta.$attrsToReflect$.push([propName, attrName]);
949
+ }
938
950
  return attrName;
939
951
  });
940
952
  }
@@ -1104,6 +1116,9 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1104
1116
  {
1105
1117
  cmpMeta.$listeners$ = compactMeta[3];
1106
1118
  }
1119
+ {
1120
+ cmpMeta.$attrsToReflect$ = [];
1121
+ }
1107
1122
  {
1108
1123
  cmpMeta.$watchers$ = {};
1109
1124
  }
@@ -1,4 +1,4 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-e34db4b0.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-71f14530.js';
2
2
 
3
3
  /*
4
4
  Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
@@ -10,7 +10,7 @@ const patchEsm = () => {
10
10
  const defineCustomElements = (win, options) => {
11
11
  if (typeof window === 'undefined') return Promise.resolve();
12
12
  return patchEsm().then(() => {
13
- return bootstrapLazy([["generic-user-consent_3",[[1,"user-action-controller",{"endpoint":[1],"userSession":[1,"user-session"],"userId":[1,"user-id"],"includeSubmitButton":[4,"include-submit-button"],"submitButtonText":[1,"submit-button-text"],"userNoticeText":[1,"user-notice-text"],"activeUserActions":[1,"active-user-actions"],"showCloseButton":[4,"show-close-button"],"usePostmessage":[4,"use-postmessage"],"postMessageEvent":[1,"post-message-event"],"queryFired":[32],"readyActionsCount":[32],"receivedQueryResponses":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[1,"generic-user-consent",{"queried":[4],"consentType":[1,"consent-type"],"mandatory":[4],"consentTitle":[1,"consent-title"],"tcLink":[1,"tc-link"],"privacyLink":[1,"privacy-link"],"textContent":[32]}],[1,"legislation-wrapper",{"activeUserActions":[1,"active-user-actions"]}]]]], options);
13
+ return bootstrapLazy([["generic-user-consent_3",[[1,"user-action-controller",{"endpoint":[513],"userSession":[513,"user-session"],"userId":[513,"user-id"],"includeSubmitButton":[516,"include-submit-button"],"submitButtonText":[513,"submit-button-text"],"userNoticeText":[513,"user-notice-text"],"activeUserActions":[513,"active-user-actions"],"showCloseButton":[516,"show-close-button"],"usePostmessage":[516,"use-postmessage"],"postMessageEvent":[1,"post-message-event"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"queryFired":[32],"readyActionsCount":[32],"receivedQueryResponses":[32],"limitStylingAppends":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[1,"generic-user-consent",{"queried":[516],"consentType":[513,"consent-type"],"mandatory":[516],"consentTitle":[513,"consent-title"],"tcLink":[513,"tc-link"],"privacyLink":[513,"privacy-link"],"clientStyling":[1,"client-styling"],"textContent":[32],"limitStylingAppends":[32]}],[1,"legislation-wrapper",{"activeUserActions":[513,"active-user-actions"],"clientStyling":[1,"client-styling"],"limitStylingAppends":[32]}]]]], options);
14
14
  });
15
15
  };
16
16
 
@@ -1,4 +1,4 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-e34db4b0.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-71f14530.js';
2
2
 
3
3
  /*
4
4
  Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
@@ -13,5 +13,5 @@ const patchBrowser = () => {
13
13
  };
14
14
 
15
15
  patchBrowser().then(options => {
16
- return bootstrapLazy([["generic-user-consent_3",[[1,"user-action-controller",{"endpoint":[1],"userSession":[1,"user-session"],"userId":[1,"user-id"],"includeSubmitButton":[4,"include-submit-button"],"submitButtonText":[1,"submit-button-text"],"userNoticeText":[1,"user-notice-text"],"activeUserActions":[1,"active-user-actions"],"showCloseButton":[4,"show-close-button"],"usePostmessage":[4,"use-postmessage"],"postMessageEvent":[1,"post-message-event"],"queryFired":[32],"readyActionsCount":[32],"receivedQueryResponses":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[1,"generic-user-consent",{"queried":[4],"consentType":[1,"consent-type"],"mandatory":[4],"consentTitle":[1,"consent-title"],"tcLink":[1,"tc-link"],"privacyLink":[1,"privacy-link"],"textContent":[32]}],[1,"legislation-wrapper",{"activeUserActions":[1,"active-user-actions"]}]]]], options);
16
+ return bootstrapLazy([["generic-user-consent_3",[[1,"user-action-controller",{"endpoint":[513],"userSession":[513,"user-session"],"userId":[513,"user-id"],"includeSubmitButton":[516,"include-submit-button"],"submitButtonText":[513,"submit-button-text"],"userNoticeText":[513,"user-notice-text"],"activeUserActions":[513,"active-user-actions"],"showCloseButton":[516,"show-close-button"],"usePostmessage":[516,"use-postmessage"],"postMessageEvent":[1,"post-message-event"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"queryFired":[32],"readyActionsCount":[32],"receivedQueryResponses":[32],"limitStylingAppends":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[1,"generic-user-consent",{"queried":[516],"consentType":[513,"consent-type"],"mandatory":[516],"consentTitle":[513,"consent-title"],"tcLink":[513,"tc-link"],"privacyLink":[513,"privacy-link"],"clientStyling":[1,"client-styling"],"textContent":[32],"limitStylingAppends":[32]}],[1,"legislation-wrapper",{"activeUserActions":[513,"active-user-actions"],"clientStyling":[1,"client-styling"],"limitStylingAppends":[32]}]]]], options);
17
17
  });
@@ -19,7 +19,7 @@ export declare class UserActionController {
19
19
  */
20
20
  userId: string;
21
21
  /**
22
- * wether or not to include the submit button (in case we want to compose a different )
22
+ * whether or not to include the submit button (in case we want to compose a different )
23
23
  */
24
24
  includeSubmitButton: boolean;
25
25
  /**
@@ -46,6 +46,14 @@ export declare class UserActionController {
46
46
  * Event name to be sent when the button is clicked
47
47
  */
48
48
  postMessageEvent: string;
49
+ /**
50
+ * Client custom styling via inline style
51
+ */
52
+ clientStyling: string;
53
+ /**
54
+ * Client custom styling via url
55
+ */
56
+ clientStylingUrl: string;
49
57
  /**
50
58
  * Event emitted when the close button is clicked
51
59
  */
@@ -57,10 +65,12 @@ export declare class UserActionController {
57
65
  queryFired: boolean;
58
66
  readyActionsCount: number;
59
67
  receivedQueryResponses: number;
68
+ private limitStylingAppends;
60
69
  private mandatoryActions;
61
70
  private requiredActionsCount;
62
71
  private expectedQueryResponses;
63
72
  private userActions;
73
+ private stylingContainer;
64
74
  determineMandatoryActions(): Promise<void>;
65
75
  handleQueryResponse(): void;
66
76
  updateUserConsents(): void;
@@ -68,6 +78,9 @@ export declare class UserActionController {
68
78
  handleClose(): void;
69
79
  userLegislationConsentHandler(event: CustomEvent<LegislationConsentEvent>): void;
70
80
  componentWillLoad(): Promise<void>;
81
+ componentDidRender(): void;
82
+ setClientStyling: () => void;
83
+ setClientStylingURL: () => void;
71
84
  render(): any;
72
85
  }
73
86
  export {};
@@ -11,12 +11,20 @@ export namespace Components {
11
11
  * which user action widgets are included
12
12
  */
13
13
  "activeUserActions": string;
14
+ /**
15
+ * Client custom styling via inline style
16
+ */
17
+ "clientStyling": string;
18
+ /**
19
+ * Client custom styling via url
20
+ */
21
+ "clientStylingUrl": string;
14
22
  /**
15
23
  * the endpoint required for the update call
16
24
  */
17
25
  "endpoint": string;
18
26
  /**
19
- * wether or not to include the submit button (in case we want to compose a different )
27
+ * whether or not to include the submit button (in case we want to compose a different )
20
28
  */
21
29
  "includeSubmitButton": boolean;
22
30
  /**
@@ -66,12 +74,20 @@ declare namespace LocalJSX {
66
74
  * which user action widgets are included
67
75
  */
68
76
  "activeUserActions": string;
77
+ /**
78
+ * Client custom styling via inline style
79
+ */
80
+ "clientStyling"?: string;
81
+ /**
82
+ * Client custom styling via url
83
+ */
84
+ "clientStylingUrl"?: string;
69
85
  /**
70
86
  * the endpoint required for the update call
71
87
  */
72
88
  "endpoint": string;
73
89
  /**
74
- * wether or not to include the submit button (in case we want to compose a different )
90
+ * whether or not to include the submit button (in case we want to compose a different )
75
91
  */
76
92
  "includeSubmitButton": boolean;
77
93
  /**
@@ -0,0 +1 @@
1
+ import{r as t,c as s,h as e}from"./p-ba444709.js";const i=class{constructor(e){t(this,e),this.userLegislationConsent=s(this,"userLegislationConsent",7),this.queried=!1,this.consentType="",this.mandatory=!1,this.consentTitle="",this.tcLink="#",this.privacyLink="#",this.clientStyling="",this.textContent="",this.limitStylingAppends=!1,this.stringVariants={termsandconditions1:"I accept the ",termsandconditions2:", I have read and understood the ",termsandconditions3:" as published on this site and confirm that I am over 18 years old.",tc:"Terms and Conditions",privacy:"Privacy Policy",sms:"I consent to receive marketing communication via SMS.",emailmarketing:"I consent to receive marketing communication via Email."},this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)}}determineTextContent(){return"termsandconditions"===this.consentType?e("span",null,this.stringVariants.termsandconditions1,e("a",{href:this.tcLink},this.stringVariants.tc),this.stringVariants.termsandconditions2,e("a",{href:this.privacyLink},this.stringVariants.privacy),this.stringVariants.termsandconditions3):e("span",null,this.stringVariants[this.consentType])}userLegislationConsentHandler(){this.userLegislationConsent.emit({type:this.consentType,value:this.checkboxInput.checked})}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.limitStylingAppends=!0)}render(){return this.queried&&this.userLegislationConsentHandler(),this.textContent=this.determineTextContent(),e("div",{ref:t=>this.stylingContainer=t},e("p",{class:"ConsentTitle"},this.consentTitle),e("label",{class:"userConsent",htmlFor:"userConsent"},e("input",{ref:t=>this.checkboxInput=t,id:"userConsent",type:"checkbox",onInput:()=>this.userLegislationConsentHandler()}),this.textContent,this.mandatory&&e("span",{class:"MandatoryItem"},"*")))}};i.style=":host{display:block}.ConsentTitle{margin-bottom:0.2rem;font-weight:600}.userConsent:hover{border-bottom:1px solid #000;cursor:pointer}.MandatoryItem{color:#f00;font-size:1.2rem}";const n=class{constructor(s){t(this,s),this.clientStyling="",this.limitStylingAppends=!1,this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)}}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.limitStylingAppends=!0)}render(){const t=this.activeUserActions.replace(/ /g,"").split(",");return e("div",{class:"LegislationWrapper",ref:t=>this.stylingContainer=t},t.map((t=>e("slot",{name:t}))))}};n.style=":host{display:block}";const o=class{constructor(e){t(this,e),this.closeButtonEvent=s(this,"closeButtonClicked",7),this.postMessageEvent="closeButtonClicked",this.clientStyling="",this.clientStylingUrl="",this.consentTitles={termsandconditions:"Terms and Conditions",sms:"SMS marketing",emailmarketing:"Email marketing"},this.queryFired=!1,this.readyActionsCount=0,this.receivedQueryResponses=0,this.limitStylingAppends=!1,this.mandatoryActions=["termsandconditions"],this.requiredActionsCount=0,this.expectedQueryResponses=0,this.userActions=[],this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)},this.setClientStylingURL=()=>{let t=new URL(this.clientStylingUrl),s=document.createElement("style");fetch(t.href).then((t=>t.text())).then((t=>{this.clientStyling=t,s.innerHTML=t,setTimeout((()=>{this.stylingContainer.prepend(s)}),1)})).catch((t=>{console.log("error ",t)}))}}determineMandatoryActions(){let t=new URL(`${this.endpoint}v1/player/consentRequirements`);return fetch(t.href).then((t=>t.json())).then((t=>{t.items.forEach((t=>{t.mustAccept&&this.mandatoryActions.push(t.tagCode)}))}))}handleQueryResponse(){this.receivedQueryResponses===this.expectedQueryResponses&&this.updateUserConsents()}updateUserConsents(){const t=new URL(`${this.endpoint}v1/player/${this.userId}/consent`);let s={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-SessionId":`${this.userSession}`},body:JSON.stringify({items:this.userActions})};fetch(t.href,s).then((t=>t.json())).then((()=>{window.postMessage({type:"WidgetNotification",data:{type:"success",message:"Consent update successfull!"}},window.location.href)})).catch((t=>{window.postMessage({type:"WidgetNotification",data:{type:"error",message:"Server might not be responding",err:t}},window.location.href)})).finally((()=>{window.postMessage({type:"UserActionsCompleted"},window.location.href)}))}handleApplyClick(){this.queryFired=!0}handleClose(){this.usePostmessage&&window.postMessage({type:this.postMessageEvent}),this.closeButtonEvent.emit()}userLegislationConsentHandler(t){this.mandatoryActions.includes(t.detail.type)&&(t.detail.value?this.readyActionsCount++:this.readyActionsCount--),this.queryFired&&(this.userActions.push({tagCode:t.detail.type,status:t.detail.value?"Accepted":"Denied"}),this.receivedQueryResponses++)}componentWillLoad(){return this.determineMandatoryActions()}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}render(){const t=this.activeUserActions.replace(/ /g,"").split(",");return this.requiredActionsCount=t.filter((t=>this.mandatoryActions.includes(t))).length,this.expectedQueryResponses=t.length,e("div",{class:"QueryReferenceContainer",ref:t=>this.stylingContainer=t},e("div",{class:"UserActionController"},this.showCloseButton&&e("div",{class:"CloseButton",onClick:()=>this.handleClose()},e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",fill:"currentColor",viewBox:"0 0 16 16"},e("path",{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"}))),e("h2",{class:"UserConsentNotice"},this.userNoticeText),e("legislation-wrapper",{"active-user-actions":this.activeUserActions,"client-styling":this.clientStyling},t.map((t=>e("generic-user-consent",{slot:t,consentType:t,consentTitle:this.consentTitles[t],queried:this.queryFired,mandatory:this.mandatoryActions.includes(t),"client-styling":this.clientStyling})))),this.includeSubmitButton&&e("button",{class:"ConsentSubmitButton",disabled:this.readyActionsCount!==this.requiredActionsCount,onClick:()=>this.handleApplyClick()},this.submitButtonText)))}static get watchers(){return{receivedQueryResponses:["handleQueryResponse"]}}};o.style=":host{display:block}.QueryReferenceContainer{height:100%;width:100%}.UserConsentNotice{font-size:1.2rem;font-weight:200;text-align:center}.CloseButton{width:25px;height:25px;align-self:flex-end}.UserActionController{font-family:Arial, Helvetica, sans-serif;font-weight:100;height:100%;width:100%;padding:1rem 1.5rem 2rem;background-color:#fff;display:flex;flex-direction:column;justify-content:space-between;border-radius:5%}.ConsentSubmitButton{font-size:1rem;padding:0.4rem 1.4rem;background:#fff;border:2px solid #000;color:#000;border-radius:5px;align-self:flex-end}.ConsentSubmitButton:disabled{border:2px solid #ccc;color:#ccc}@media screen and (max-width: 320px){.QueryReferenceContainer{font-size:0.8rem;color:blue}}";export{i as generic_user_consent,n as legislation_wrapper,o as user_action_controller}
@@ -0,0 +1 @@
1
+ let e,t,n=!1,l=!1;const s="undefined"!=typeof window?window:{},o=s.document||{head:{}},r={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},c=e=>Promise.resolve(e),i=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),u=(e,t,n)=>{n&&n.map((([n,l,s])=>{const o=e,c=a(t,s),i=f(n);r.ael(o,l,c,i),(t.o=t.o||[]).push((()=>r.rel(o,l,c,i)))}))},a=(e,t)=>n=>{try{256&e.t?e.i[t](n):(e.u=e.u||[]).push([t,n])}catch(e){J(e)}},f=e=>0!=(2&e),h=new WeakMap,d=e=>"sc-"+e.h,$={},m=e=>"object"==(e=typeof e)||"function"===e,p=(e,t,...n)=>{let l=null,s=!1,o=!1,r=[];const c=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?c(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!m(l))&&(l+=""),s&&o?r[r.length-1].$+=l:r.push(s?y(null,l):l),o=s)};if(c(n),t){const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}const i=y(e,null);return i.m=t,r.length>0&&(i.p=r),i},y=(e,t)=>({t:0,g:e,$:t,v:null,p:null,m:null}),b={},w=(e,t,n,l,o,c)=>{if(n!==l){let i=I(e,t),u=t.toLowerCase();if("class"===t){const t=e.classList,s=v(n),o=v(l);t.remove(...s.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!s.includes(e))))}else if("ref"===t)l&&l(e);else if(i||"o"!==t[0]||"n"!==t[1]){const s=m(l);if((i||s&&null!==l)&&!o)try{if(e.tagName.includes("-"))e[t]=l;else{let s=null==l?"":l;"list"===t?i=!1:null!=n&&e[t]==s||(e[t]=s)}}catch(e){}null==l||!1===l?!1===l&&""!==e.getAttribute(t)||e.removeAttribute(t):(!i||4&c||o)&&!s&&e.setAttribute(t,l=!0===l?"":l)}else t="-"===t[2]?t.slice(3):I(s,u)?u.slice(2):u[2]+t.slice(3),n&&r.rel(e,t,n,!1),l&&r.ael(e,t,l,!1)}},g=/\s/,v=e=>e?e.split(g):[],S=(e,t,n,l)=>{const s=11===t.v.nodeType&&t.v.host?t.v.host:t.v,o=e&&e.m||$,r=t.m||$;for(l in o)l in r||w(s,l,o[l],void 0,n,t.t);for(l in r)w(s,l,o[l],r[l],n,t.t)},j=(t,l,s)=>{let r,c,i=l.p[s],u=0;if(null!==i.$)r=i.v=o.createTextNode(i.$);else{if(n||(n="svg"===i.g),r=i.v=o.createElementNS(n?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",i.g),n&&"foreignObject"===i.g&&(n=!1),S(null,i,n),null!=e&&r["s-si"]!==e&&r.classList.add(r["s-si"]=e),i.p)for(u=0;u<i.p.length;++u)c=j(t,i,u),c&&r.appendChild(c);"svg"===i.g?n=!1:"foreignObject"===r.tagName&&(n=!0)}return r},O=(e,n,l,s,o,r)=>{let c,i=e;for(i.shadowRoot&&i.tagName===t&&(i=i.shadowRoot);o<=r;++o)s[o]&&(c=j(null,l,o),c&&(s[o].v=c,i.insertBefore(c,n)))},M=(e,t,n,l,s)=>{for(;t<=n;++t)(l=e[t])&&(s=l.v,x(l),s.remove())},k=(e,t)=>e.g===t.g,C=(e,t)=>{const l=t.v=e.v,s=e.p,o=t.p,r=t.g,c=t.$;null===c?(n="svg"===r||"foreignObject"!==r&&n,"slot"===r||S(e,t,n),null!==s&&null!==o?((e,t,n,l)=>{let s,o=0,r=0,c=t.length-1,i=t[0],u=t[c],a=l.length-1,f=l[0],h=l[a];for(;o<=c&&r<=a;)null==i?i=t[++o]:null==u?u=t[--c]:null==f?f=l[++r]:null==h?h=l[--a]:k(i,f)?(C(i,f),i=t[++o],f=l[++r]):k(u,h)?(C(u,h),u=t[--c],h=l[--a]):k(i,h)?(C(i,h),e.insertBefore(i.v,u.v.nextSibling),i=t[++o],h=l[--a]):k(u,f)?(C(u,f),e.insertBefore(u.v,i.v),u=t[--c],f=l[++r]):(s=j(t&&t[r],n,r),f=l[++r],s&&i.v.parentNode.insertBefore(s,i.v));o>c?O(e,null==l[a+1]?null:l[a+1].v,n,l,r,a):r>a&&M(t,o,c)})(l,s,t,o):null!==o?(null!==e.$&&(l.textContent=""),O(l,null,t,o,0,o.length-1)):null!==s&&M(s,0,s.length-1),n&&"svg"===r&&(n=!1)):e.$!==c&&(l.data=c)},x=e=>{e.m&&e.m.ref&&e.m.ref(null),e.p&&e.p.map(x)},P=(e,t,n)=>{const l=(e=>z(e).S)(e);return{emit:e=>E(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},E=(e,t,n)=>{const l=r.ce(t,n);return e.dispatchEvent(l),l},L=(e,t)=>{t&&!e.j&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.j=t)))},N=(e,t)=>{if(e.t|=16,!(4&e.t))return L(e,e.O),se((()=>R(e,t)));e.t|=512},R=(e,t)=>{const n=e.i;let l;return t&&(e.t|=256,e.u&&(e.u.map((([e,t])=>q(n,e,t))),e.u=null),l=q(n,"componentWillLoad")),D(l,(()=>T(e,n,t)))},T=async(e,t,n)=>{const l=e.S,s=l["s-rc"];n&&(e=>{const t=e.M,n=e.S,l=t.t,s=((e,t)=>{let n=d(t),l=X.get(n);if(e=11===e.nodeType?e:o,l)if("string"==typeof l){let t,s=h.get(e=e.head||e);s||h.set(e,s=new Set),s.has(n)||(t=o.createElement("style"),t.innerHTML=l,e.insertBefore(t,e.querySelector("link")),s&&s.add(n))}else e.adoptedStyleSheets.includes(l)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,l]);return n})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=s,n.classList.add(s+"-h"))})(e);W(e,t),s&&(s.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>A(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},W=(n,l)=>{try{l=l.render(),n.t&=-17,n.t|=2,((n,l)=>{const s=n.S,o=n.M,r=n.k||y(null,null),c=(e=>e&&e.g===b)(l)?l:p(null,null,l);t=s.tagName,o.C&&(c.m=c.m||{},o.C.map((([e,t])=>c.m[t]=s[e]))),c.g=null,c.t|=4,n.k=c,c.v=r.v=s.shadowRoot||s,e=s["s-sc"],C(r,c)})(n,l)}catch(e){J(e,n.S)}return null},A=e=>{const t=e.S,n=e.O;q(e.i,"componentDidRender"),64&e.t||(e.t|=64,F(t),e.P(t),n||U()),e.j&&(e.j(),e.j=void 0),512&e.t&&le((()=>N(e,!1))),e.t&=-517},U=()=>{F(o.documentElement),le((()=>E(s,"appload",{detail:{namespace:"user-action-controller"}})))},q=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){J(e)}},D=(e,t)=>e&&e.then?e.then(t):t(),F=e=>e.classList.add("hydrated"),H=(e,t,n)=>{if(t.L){e.watchers&&(t.N=e.watchers);const l=Object.entries(t.L),s=e.prototype;if(l.map((([e,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(s,e,{get(){return((e,t)=>z(this).R.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=z(e),o=s.S,r=s.R.get(t),c=s.t,i=s.i;if(n=((e,t)=>null==e||m(e)?e:4&t?"false"!==e&&(""===e||!!e):1&t?e+"":e)(n,l.L[t][0]),(!(8&c)||void 0===r)&&n!==r&&(!Number.isNaN(r)||!Number.isNaN(n))&&(s.R.set(t,n),i)){if(l.N&&128&c){const e=l.N[t];e&&e.map((e=>{try{i[e](n,r,t)}catch(e){J(e,o)}}))}2==(18&c)&&N(s,!1)}})(this,e,n,t)},configurable:!0,enumerable:!0})})),1&n){const n=new Map;s.attributeChangedCallback=function(e,t,l){r.jmp((()=>{const t=n.get(e);if(this.hasOwnProperty(t))l=this[t],delete this[t];else if(s.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==l)return;this[t]=(null!==l||"boolean"!=typeof this[t])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,l])=>{const s=l[1]||e;return n.set(s,e),512&l[0]&&t.C.push([e,s]),s}))}}return e},V=(e,t={})=>{const n=[],l=t.exclude||[],c=s.customElements,a=o.head,f=a.querySelector("meta[charset]"),h=o.createElement("style"),$=[];let m,p=!0;Object.assign(r,t),r.l=new URL(t.resourcesUrl||"./",o.baseURI).href,e.map((e=>{e[1].map((t=>{const s={t:t[0],h:t[1],L:t[2],T:t[3]};s.L=t[2],s.T=t[3],s.C=[],s.N={};const o=s.h,a=class extends HTMLElement{constructor(e){super(e),G(e=this,s),1&s.t&&e.attachShadow({mode:"open"})}connectedCallback(){m&&(clearTimeout(m),m=null),p?$.push(this):r.jmp((()=>(e=>{if(0==(1&r.t)){const t=z(e),n=t.M,l=()=>{};if(1&t.t)u(e,t,n.T);else{t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){L(t,t.O=n);break}}n.L&&Object.entries(n.L).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,l,s)=>{if(0==(32&t.t)){{if(t.t|=32,(s=Q(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(n.N=s.watchers,H(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){J(e)}t.t&=-9,t.t|=128,e()}if(s.style){let e=s.style;const t=d(n);if(!X.has(t)){const l=()=>{};((e,t,n)=>{let l=X.get(e);i&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,X.set(e,l)})(t,e,!!(1&n.t)),l()}}}const o=t.O,r=()=>N(t,!0);o&&o["s-rc"]?o["s-rc"].push(r):r()})(0,t,n)}l()}})(this)))}disconnectedCallback(){r.jmp((()=>(()=>{if(0==(1&r.t)){const e=z(this);e.o&&(e.o.map((e=>e())),e.o=void 0)}})()))}componentOnReady(){return z(this).W}};s.A=e[0],l.includes(o)||c.get(o)||(n.push(o),c.define(o,H(a,s,1)))}))})),h.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",h.setAttribute("data-styles",""),a.insertBefore(h,f?f.nextSibling:a.firstChild),p=!1,$.length?$.map((e=>e.connectedCallback())):r.jmp((()=>m=setTimeout(U,30)))},_=new WeakMap,z=e=>_.get(e),B=(e,t)=>_.set(t.i=e,t),G=(e,t)=>{const n={t:0,S:e,M:t,R:new Map};return n.W=new Promise((e=>n.P=e)),e["s-p"]=[],e["s-rc"]=[],u(e,n,t.T),_.set(e,n)},I=(e,t)=>t in e,J=(e,t)=>(0,console.error)(e,t),K=new Map,Q=e=>{const t=e.h.replace(/-/g,"_"),n=e.A,l=K.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(K.set(n,e),e[t])),J)},X=new Map,Y=[],Z=[],ee=(e,t)=>n=>{e.push(n),l||(l=!0,t&&4&r.t?le(ne):r.raf(ne))},te=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){J(e)}e.length=0},ne=()=>{te(Y),te(Z),(l=Y.length>0)&&r.raf(ne)},le=e=>c().then(e),se=ee(Z,!0);export{V as b,P as c,p as h,c as p,B as r}
@@ -1 +1 @@
1
- import{p as e,b as t}from"./p-20213f37.js";(()=>{const t=import.meta.url,s={};return""!==t&&(s.resourcesUrl=new URL(".",t).href),e(s)})().then((e=>t([["p-2a14a5fe",[[1,"user-action-controller",{endpoint:[1],userSession:[1,"user-session"],userId:[1,"user-id"],includeSubmitButton:[4,"include-submit-button"],submitButtonText:[1,"submit-button-text"],userNoticeText:[1,"user-notice-text"],activeUserActions:[1,"active-user-actions"],showCloseButton:[4,"show-close-button"],usePostmessage:[4,"use-postmessage"],postMessageEvent:[1,"post-message-event"],queryFired:[32],readyActionsCount:[32],receivedQueryResponses:[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[1,"generic-user-consent",{queried:[4],consentType:[1,"consent-type"],mandatory:[4],consentTitle:[1,"consent-title"],tcLink:[1,"tc-link"],privacyLink:[1,"privacy-link"],textContent:[32]}],[1,"legislation-wrapper",{activeUserActions:[1,"active-user-actions"]}]]]],e)));
1
+ import{p as t,b as e}from"./p-ba444709.js";(()=>{const e=import.meta.url,n={};return""!==e&&(n.resourcesUrl=new URL(".",e).href),t(n)})().then((t=>e([["p-94fcd363",[[1,"user-action-controller",{endpoint:[513],userSession:[513,"user-session"],userId:[513,"user-id"],includeSubmitButton:[516,"include-submit-button"],submitButtonText:[513,"submit-button-text"],userNoticeText:[513,"user-notice-text"],activeUserActions:[513,"active-user-actions"],showCloseButton:[516,"show-close-button"],usePostmessage:[516,"use-postmessage"],postMessageEvent:[1,"post-message-event"],clientStyling:[1537,"client-styling"],clientStylingUrl:[513,"client-styling-url"],queryFired:[32],readyActionsCount:[32],receivedQueryResponses:[32],limitStylingAppends:[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[1,"generic-user-consent",{queried:[516],consentType:[513,"consent-type"],mandatory:[516],consentTitle:[513,"consent-title"],tcLink:[513,"tc-link"],privacyLink:[513,"privacy-link"],clientStyling:[1,"client-styling"],textContent:[32],limitStylingAppends:[32]}],[1,"legislation-wrapper",{activeUserActions:[513,"active-user-actions"],clientStyling:[1,"client-styling"],limitStylingAppends:[32]}]]]],t)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/user-action-controller",
3
- "version": "1.0.0",
3
+ "version": "1.15.0",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",
@@ -8,7 +8,7 @@
8
8
  "types": "./dist/types/index.d.ts",
9
9
  "collection": "./dist/collection/collection-manifest.json",
10
10
  "collection:main": "./dist/collection/index.js",
11
- "unpkg": "./dist/user-action-controller/user-action-controller.js",
11
+ "unpkg": "./dist/user-action-controller/user-action-controller.esm.js",
12
12
  "files": [
13
13
  "dist/",
14
14
  "loader/"
@@ -1 +0,0 @@
1
- let e,t,n=!1,l=!1;const s="undefined"!=typeof window?window:{},o=s.document||{head:{}},r={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},c=e=>Promise.resolve(e),i=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),u=(e,t,n)=>{n&&n.map((([n,l,s])=>{const o=e,c=a(t,s),i=f(n);r.ael(o,l,c,i),(t.o=t.o||[]).push((()=>r.rel(o,l,c,i)))}))},a=(e,t)=>n=>{try{256&e.t?e.i[t](n):(e.u=e.u||[]).push([t,n])}catch(e){J(e)}},f=e=>0!=(2&e),h=new WeakMap,$=e=>"sc-"+e.h,y={},d=e=>"object"==(e=typeof e)||"function"===e,m=(e,t,...n)=>{let l=null,s=!1,o=!1,r=[];const c=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?c(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!d(l))&&(l+=""),s&&o?r[r.length-1].$+=l:r.push(s?p(null,l):l),o=s)};if(c(n),t){const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}const i=p(e,null);return i.m=t,r.length>0&&(i.p=r),i},p=(e,t)=>({t:0,g:e,$:t,v:null,p:null,m:null}),b={},w=(e,t,n,l,o,c)=>{if(n!==l){let i=I(e,t),u=t.toLowerCase();if("class"===t){const t=e.classList,s=v(n),o=v(l);t.remove(...s.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!s.includes(e))))}else if("ref"===t)l&&l(e);else if(i||"o"!==t[0]||"n"!==t[1]){const s=d(l);if((i||s&&null!==l)&&!o)try{if(e.tagName.includes("-"))e[t]=l;else{let s=null==l?"":l;"list"===t?i=!1:null!=n&&e[t]==s||(e[t]=s)}}catch(e){}null==l||!1===l?!1===l&&""!==e.getAttribute(t)||e.removeAttribute(t):(!i||4&c||o)&&!s&&e.setAttribute(t,l=!0===l?"":l)}else t="-"===t[2]?t.slice(3):I(s,u)?u.slice(2):u[2]+t.slice(3),n&&r.rel(e,t,n,!1),l&&r.ael(e,t,l,!1)}},g=/\s/,v=e=>e?e.split(g):[],S=(e,t,n,l)=>{const s=11===t.v.nodeType&&t.v.host?t.v.host:t.v,o=e&&e.m||y,r=t.m||y;for(l in o)l in r||w(s,l,o[l],void 0,n,t.t);for(l in r)w(s,l,o[l],r[l],n,t.t)},j=(t,l,s)=>{let r,c,i=l.p[s],u=0;if(null!==i.$)r=i.v=o.createTextNode(i.$);else{if(n||(n="svg"===i.g),r=i.v=o.createElementNS(n?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",i.g),n&&"foreignObject"===i.g&&(n=!1),S(null,i,n),null!=e&&r["s-si"]!==e&&r.classList.add(r["s-si"]=e),i.p)for(u=0;u<i.p.length;++u)c=j(t,i,u),c&&r.appendChild(c);"svg"===i.g?n=!1:"foreignObject"===r.tagName&&(n=!0)}return r},O=(e,n,l,s,o,r)=>{let c,i=e;for(i.shadowRoot&&i.tagName===t&&(i=i.shadowRoot);o<=r;++o)s[o]&&(c=j(null,l,o),c&&(s[o].v=c,i.insertBefore(c,n)))},M=(e,t,n,l,s)=>{for(;t<=n;++t)(l=e[t])&&(s=l.v,x(l),s.remove())},k=(e,t)=>e.g===t.g,C=(e,t)=>{const l=t.v=e.v,s=e.p,o=t.p,r=t.g,c=t.$;null===c?(n="svg"===r||"foreignObject"!==r&&n,"slot"===r||S(e,t,n),null!==s&&null!==o?((e,t,n,l)=>{let s,o=0,r=0,c=t.length-1,i=t[0],u=t[c],a=l.length-1,f=l[0],h=l[a];for(;o<=c&&r<=a;)null==i?i=t[++o]:null==u?u=t[--c]:null==f?f=l[++r]:null==h?h=l[--a]:k(i,f)?(C(i,f),i=t[++o],f=l[++r]):k(u,h)?(C(u,h),u=t[--c],h=l[--a]):k(i,h)?(C(i,h),e.insertBefore(i.v,u.v.nextSibling),i=t[++o],h=l[--a]):k(u,f)?(C(u,f),e.insertBefore(u.v,i.v),u=t[--c],f=l[++r]):(s=j(t&&t[r],n,r),f=l[++r],s&&i.v.parentNode.insertBefore(s,i.v));o>c?O(e,null==l[a+1]?null:l[a+1].v,n,l,r,a):r>a&&M(t,o,c)})(l,s,t,o):null!==o?(null!==e.$&&(l.textContent=""),O(l,null,t,o,0,o.length-1)):null!==s&&M(s,0,s.length-1),n&&"svg"===r&&(n=!1)):e.$!==c&&(l.data=c)},x=e=>{e.m&&e.m.ref&&e.m.ref(null),e.p&&e.p.map(x)},P=(e,t,n)=>{const l=(e=>B(e).S)(e);return{emit:e=>E(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},E=(e,t,n)=>{const l=r.ce(t,n);return e.dispatchEvent(l),l},L=(e,t)=>{t&&!e.j&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.j=t)))},N=(e,t)=>{if(e.t|=16,!(4&e.t))return L(e,e.O),se((()=>T(e,t)));e.t|=512},T=(e,t)=>{const n=e.i;let l;return t&&(e.t|=256,e.u&&(e.u.map((([e,t])=>q(n,e,t))),e.u=null),l=q(n,"componentWillLoad")),F(l,(()=>W(e,n,t)))},W=async(e,t,n)=>{const l=e.S,s=l["s-rc"];n&&(e=>{const t=e.M,n=e.S,l=t.t,s=((e,t)=>{let n=$(t),l=X.get(n);if(e=11===e.nodeType?e:o,l)if("string"==typeof l){let t,s=h.get(e=e.head||e);s||h.set(e,s=new Set),s.has(n)||(t=o.createElement("style"),t.innerHTML=l,e.insertBefore(t,e.querySelector("link")),s&&s.add(n))}else e.adoptedStyleSheets.includes(l)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,l]);return n})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=s,n.classList.add(s+"-h"))})(e);A(e,t),s&&(s.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>R(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},A=(n,l)=>{try{l=l.render(),n.t&=-17,n.t|=2,((n,l)=>{const s=n.S,o=n.k||p(null,null),r=(e=>e&&e.g===b)(l)?l:m(null,null,l);t=s.tagName,r.g=null,r.t|=4,n.k=r,r.v=o.v=s.shadowRoot||s,e=s["s-sc"],C(o,r)})(n,l)}catch(e){J(e,n.S)}return null},R=e=>{const t=e.S,n=e.O;64&e.t||(e.t|=64,H(t),e.C(t),n||U()),e.j&&(e.j(),e.j=void 0),512&e.t&&le((()=>N(e,!1))),e.t&=-517},U=()=>{H(o.documentElement),le((()=>E(s,"appload",{detail:{namespace:"user-action-controller"}})))},q=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){J(e)}},F=(e,t)=>e&&e.then?e.then(t):t(),H=e=>e.classList.add("hydrated"),V=(e,t,n)=>{if(t.P){e.watchers&&(t.L=e.watchers);const l=Object.entries(t.P),s=e.prototype;if(l.map((([e,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(s,e,{get(){return((e,t)=>B(this).N.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=B(e),o=s.S,r=s.N.get(t),c=s.t,i=s.i;if(n=((e,t)=>null==e||d(e)?e:4&t?"false"!==e&&(""===e||!!e):1&t?e+"":e)(n,l.P[t][0]),(!(8&c)||void 0===r)&&n!==r&&(!Number.isNaN(r)||!Number.isNaN(n))&&(s.N.set(t,n),i)){if(l.L&&128&c){const e=l.L[t];e&&e.map((e=>{try{i[e](n,r,t)}catch(e){J(e,o)}}))}2==(18&c)&&N(s,!1)}})(this,e,n,t)},configurable:!0,enumerable:!0})})),1&n){const t=new Map;s.attributeChangedCallback=function(e,n,l){r.jmp((()=>{const n=t.get(e);if(this.hasOwnProperty(n))l=this[n],delete this[n];else if(s.hasOwnProperty(n)&&"number"==typeof this[n]&&this[n]==l)return;this[n]=(null!==l||"boolean"!=typeof this[n])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,n])=>{const l=n[1]||e;return t.set(l,e),l}))}}return e},_=(e,t={})=>{const n=[],l=t.exclude||[],c=s.customElements,a=o.head,f=a.querySelector("meta[charset]"),h=o.createElement("style"),y=[];let d,m=!0;Object.assign(r,t),r.l=new URL(t.resourcesUrl||"./",o.baseURI).href,e.map((e=>{e[1].map((t=>{const s={t:t[0],h:t[1],P:t[2],T:t[3]};s.P=t[2],s.T=t[3],s.L={};const o=s.h,a=class extends HTMLElement{constructor(e){super(e),G(e=this,s),1&s.t&&e.attachShadow({mode:"open"})}connectedCallback(){d&&(clearTimeout(d),d=null),m?y.push(this):r.jmp((()=>(e=>{if(0==(1&r.t)){const t=B(e),n=t.M,l=()=>{};if(1&t.t)u(e,t,n.T);else{t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){L(t,t.O=n);break}}n.P&&Object.entries(n.P).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,l,s)=>{if(0==(32&t.t)){{if(t.t|=32,(s=Q(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(n.L=s.watchers,V(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){J(e)}t.t&=-9,t.t|=128,e()}if(s.style){let e=s.style;const t=$(n);if(!X.has(t)){const l=()=>{};((e,t,n)=>{let l=X.get(e);i&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,X.set(e,l)})(t,e,!!(1&n.t)),l()}}}const o=t.O,r=()=>N(t,!0);o&&o["s-rc"]?o["s-rc"].push(r):r()})(0,t,n)}l()}})(this)))}disconnectedCallback(){r.jmp((()=>(()=>{if(0==(1&r.t)){const e=B(this);e.o&&(e.o.map((e=>e())),e.o=void 0)}})()))}componentOnReady(){return B(this).W}};s.A=e[0],l.includes(o)||c.get(o)||(n.push(o),c.define(o,V(a,s,1)))}))})),h.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",h.setAttribute("data-styles",""),a.insertBefore(h,f?f.nextSibling:a.firstChild),m=!1,y.length?y.map((e=>e.connectedCallback())):r.jmp((()=>d=setTimeout(U,30)))},z=new WeakMap,B=e=>z.get(e),D=(e,t)=>z.set(t.i=e,t),G=(e,t)=>{const n={t:0,S:e,M:t,N:new Map};return n.W=new Promise((e=>n.C=e)),e["s-p"]=[],e["s-rc"]=[],u(e,n,t.T),z.set(e,n)},I=(e,t)=>t in e,J=(e,t)=>(0,console.error)(e,t),K=new Map,Q=e=>{const t=e.h.replace(/-/g,"_"),n=e.A,l=K.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(K.set(n,e),e[t])),J)},X=new Map,Y=[],Z=[],ee=(e,t)=>n=>{e.push(n),l||(l=!0,t&&4&r.t?le(ne):r.raf(ne))},te=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){J(e)}e.length=0},ne=()=>{te(Y),te(Z),(l=Y.length>0)&&r.raf(ne)},le=e=>c().then(e),se=ee(Z,!0);export{_ as b,P as c,m as h,c as p,D as r}
@@ -1 +0,0 @@
1
- import{r as t,c as e,h as s}from"./p-20213f37.js";const i=class{constructor(s){t(this,s),this.userLegislationConsent=e(this,"userLegislationConsent",7),this.queried=!1,this.consentType="",this.mandatory=!1,this.consentTitle="",this.tcLink="#",this.privacyLink="#",this.textContent="",this.stringVariants={termsandconditions1:"I accept the ",termsandconditions2:", I have read and understood the ",termsandconditions3:" as published on this site and confirm that I am over 18 years old.",tc:"Terms and Conditions",privacy:"Privacy Policy",sms:"I consent to receive marketing communication via SMS.",emailmarketing:"I consent to receive marketing communication via Email."}}determineTextContent(){return"termsandconditions"===this.consentType?s("span",null,this.stringVariants.termsandconditions1,s("a",{href:this.tcLink},this.stringVariants.tc),this.stringVariants.termsandconditions2,s("a",{href:this.privacyLink},this.stringVariants.privacy),this.stringVariants.termsandconditions3):s("span",null,this.stringVariants[this.consentType])}userLegislationConsentHandler(){this.userLegislationConsent.emit({type:this.consentType,value:this.checkboxInput.checked})}render(){return this.queried&&this.userLegislationConsentHandler(),this.textContent=this.determineTextContent(),s("div",null,s("p",{class:"ConsentTitle"},this.consentTitle),s("label",{class:"userConsent",htmlFor:"userConsent"},s("input",{ref:t=>this.checkboxInput=t,id:"userConsent",type:"checkbox",onInput:()=>this.userLegislationConsentHandler()}),this.textContent,this.mandatory&&s("span",{class:"MandatoryItem"},"*")))}};i.style=":host{display:block}.ConsentTitle{margin-bottom:0.2rem;font-weight:600}.userConsent:hover{border-bottom:1px solid #000;cursor:pointer}.MandatoryItem{color:#f00;font-size:1.2rem}";const n=class{constructor(e){t(this,e)}render(){const t=this.activeUserActions.replace(/ /g,"").split(",");return s("div",{class:"LegislationWrapper"},t.map((t=>s("slot",{name:t}))))}};n.style=":host{display:block}";const o=class{constructor(s){t(this,s),this.closeButtonEvent=e(this,"closeButtonClicked",7),this.postMessageEvent="closeButtonClicked",this.consentTitles={termsandconditions:"Terms and Conditions",sms:"SMS marketing",emailmarketing:"Email marketing"},this.queryFired=!1,this.readyActionsCount=0,this.receivedQueryResponses=0,this.mandatoryActions=["termsandconditions"],this.requiredActionsCount=0,this.expectedQueryResponses=0,this.userActions=[]}determineMandatoryActions(){let t=new URL(`${this.endpoint}v1/player/consentRequirements`);return fetch(t.href).then((t=>t.json())).then((t=>{t.items.forEach((t=>{t.mustAccept&&this.mandatoryActions.push(t.tagCode)}))}))}handleQueryResponse(){this.receivedQueryResponses===this.expectedQueryResponses&&this.updateUserConsents()}updateUserConsents(){const t=new URL(`${this.endpoint}v1/player/${this.userId}/consent`);let e={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-SessionId":`${this.userSession}`},body:JSON.stringify({items:this.userActions})};fetch(t.href,e).then((t=>t.json())).then((()=>{window.postMessage({type:"WidgetNotification",data:{type:"success",message:"Consent update successfull!"}},window.location.href)})).catch((t=>{window.postMessage({type:"WidgetNotification",data:{type:"error",message:"Server might not be responding",err:t}},window.location.href)})).finally((()=>{window.postMessage({type:"UserActionsCompleted"},window.location.href)}))}handleApplyClick(){this.queryFired=!0}handleClose(){this.usePostmessage&&window.postMessage({type:this.postMessageEvent}),this.closeButtonEvent.emit()}userLegislationConsentHandler(t){this.mandatoryActions.includes(t.detail.type)&&(t.detail.value?this.readyActionsCount++:this.readyActionsCount--),this.queryFired&&(this.userActions.push({tagCode:t.detail.type,status:t.detail.value?"Accepted":"Denied"}),this.receivedQueryResponses++)}componentWillLoad(){return this.determineMandatoryActions()}render(){const t=this.activeUserActions.replace(/ /g,"").split(",");return this.requiredActionsCount=t.filter((t=>this.mandatoryActions.includes(t))).length,this.expectedQueryResponses=t.length,s("div",{class:"QueryReferenceContainer"},s("div",{class:"UserActionController"},this.showCloseButton&&s("div",{class:"CloseButton",onClick:()=>this.handleClose()},s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",fill:"currentColor",viewBox:"0 0 16 16"},s("path",{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"}))),s("h2",{class:"UserConsentNotice"},this.userNoticeText),s("legislation-wrapper",{"active-user-actions":this.activeUserActions},t.map((t=>s("generic-user-consent",{slot:t,consentType:t,consentTitle:this.consentTitles[t],queried:this.queryFired,mandatory:this.mandatoryActions.includes(t)})))),this.includeSubmitButton&&s("button",{class:"ConsentSubmitButton",disabled:this.readyActionsCount!==this.requiredActionsCount,onClick:()=>this.handleApplyClick()},this.submitButtonText)))}static get watchers(){return{receivedQueryResponses:["handleQueryResponse"]}}};o.style=":host{display:block}.QueryReferenceContainer{height:100%;width:100%}.UserConsentNotice{font-size:1.2rem;font-weight:200;text-align:center}.CloseButton{width:25px;height:25px;align-self:flex-end}.UserActionController{font-family:Arial, Helvetica, sans-serif;font-weight:100;height:100%;width:100%;padding:1rem 1.5rem 2rem;background-color:#fff;display:flex;flex-direction:column;justify-content:space-between;border-radius:5%}.ConsentSubmitButton{font-size:1rem;padding:0.4rem 1.4rem;background:#fff;border:2px solid #000;color:#000;border-radius:5px;align-self:flex-end}.ConsentSubmitButton:disabled{border:2px solid #ccc;color:#ccc}@media screen and (max-width: 320px){.QueryReferenceContainer{font-size:0.8rem;color:blue}}";export{i as generic_user_consent,n as legislation_wrapper,o as user_action_controller}