@everymatrix/user-action-controller 0.0.1 → 1.0.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-4a3038bd.js');
5
+ const index = require('./index-5b463836.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
 
@@ -84,11 +84,16 @@ const LegislationWrapper = class {
84
84
  };
85
85
  LegislationWrapper.style = legislationWrapperCss;
86
86
 
87
- const userActionControllerCss = ":host{display:block}.QueryReferenceContainer{height:100%;width:100%}.UserConsentNotice{font-size:1.2rem;font-weight:200;text-align:center}.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}}";
87
+ const userActionControllerCss = ":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}}";
88
88
 
89
89
  const UserActionController = class {
90
90
  constructor(hostRef) {
91
91
  index.registerInstance(this, hostRef);
92
+ this.closeButtonEvent = index.createEvent(this, "closeButtonClicked", 7);
93
+ /**
94
+ * Event name to be sent when the button is clicked
95
+ */
96
+ this.postMessageEvent = 'closeButtonClicked';
92
97
  this.consentTitles = {
93
98
  termsandconditions: "Terms and Conditions",
94
99
  sms: "SMS marketing",
@@ -136,9 +141,25 @@ const UserActionController = class {
136
141
  };
137
142
  fetch(url.href, options)
138
143
  .then(res => res.json())
139
- // .then(data => {
140
- // console.log(data);
141
- // })
144
+ .then(() => {
145
+ /**
146
+ * @TODO document this
147
+ */
148
+ window.postMessage({ type: 'WidgetNotification', data: {
149
+ type: 'success',
150
+ message: 'Consent update successfull!'
151
+ } }, window.location.href);
152
+ })
153
+ .catch((err) => {
154
+ /**
155
+ * @TODO document this
156
+ */
157
+ window.postMessage({ type: 'WidgetNotification', data: {
158
+ type: 'error',
159
+ message: 'Server might not be responding',
160
+ err
161
+ } }, window.location.href);
162
+ })
142
163
  .finally(() => {
143
164
  window.postMessage({ type: "UserActionsCompleted" }, window.location.href);
144
165
  });
@@ -146,6 +167,12 @@ const UserActionController = class {
146
167
  handleApplyClick() {
147
168
  this.queryFired = true;
148
169
  }
170
+ handleClose() {
171
+ if (this.usePostmessage) {
172
+ window.postMessage({ type: this.postMessageEvent });
173
+ }
174
+ this.closeButtonEvent.emit();
175
+ }
149
176
  userLegislationConsentHandler(event) {
150
177
  // Increase / Decrease the amount of mandatory actions taken
151
178
  if (this.mandatoryActions.includes(event.detail.type)) {
@@ -168,7 +195,8 @@ const UserActionController = class {
168
195
  const activeUAList = this.activeUserActions.replace(/ /g, '').split(',');
169
196
  this.requiredActionsCount = activeUAList.filter(action => this.mandatoryActions.includes(action)).length;
170
197
  this.expectedQueryResponses = activeUAList.length;
171
- return (index.h("div", { class: "QueryReferenceContainer" }, index.h("div", { class: "UserActionController" }, 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 &&
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 &&
172
200
  index.h("button", { class: "ConsentSubmitButton", disabled: this.readyActionsCount === this.requiredActionsCount ? false : true, onClick: () => this.handleApplyClick() }, this.submitButtonText))));
173
201
  }
174
202
  static get watchers() { return {
@@ -164,6 +164,11 @@ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
164
164
  * Don't add values to these!!
165
165
  */
166
166
  const EMPTY_OBJ = {};
167
+ /**
168
+ * Namespaces
169
+ */
170
+ const SVG_NS = 'http://www.w3.org/2000/svg';
171
+ const HTML_NS = 'http://www.w3.org/1999/xhtml';
167
172
  const isDef = (v) => v != null;
168
173
  const isComplexType = (o) => {
169
174
  // https://jsperf.com/typeof-fn-object/5
@@ -380,8 +385,15 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
380
385
  elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
381
386
  }
382
387
  else {
388
+ if (!isSvgMode) {
389
+ isSvgMode = newVNode.$tag$ === 'svg';
390
+ }
383
391
  // create element
384
- elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
392
+ elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$tag$)
393
+ );
394
+ if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
395
+ isSvgMode = false;
396
+ }
385
397
  // add css classes, attrs, props, listeners, etc.
386
398
  {
387
399
  updateElement(null, newVNode, isSvgMode);
@@ -402,6 +414,16 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
402
414
  }
403
415
  }
404
416
  }
417
+ {
418
+ if (newVNode.$tag$ === 'svg') {
419
+ // Only reset the SVG context when we're exiting <svg> element
420
+ isSvgMode = false;
421
+ }
422
+ else if (elm.tagName === 'foreignObject') {
423
+ // Reenter SVG context when we're exiting <foreignObject> element
424
+ isSvgMode = true;
425
+ }
426
+ }
405
427
  }
406
428
  return elm;
407
429
  };
@@ -512,6 +534,11 @@ const patch = (oldVNode, newVNode) => {
512
534
  const tag = newVNode.$tag$;
513
535
  const text = newVNode.$text$;
514
536
  if (text === null) {
537
+ {
538
+ // test if we're rendering an svg element, or still rendering nodes inside of one
539
+ // only add this to the when the compiler sees we're using an svg somewhere
540
+ isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
541
+ }
515
542
  // element node
516
543
  {
517
544
  if (tag === 'slot')
@@ -540,6 +567,9 @@ const patch = (oldVNode, newVNode) => {
540
567
  // no new child vnodes, but there are old child vnodes to remove
541
568
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
542
569
  }
570
+ if (isSvgMode && tag === 'svg') {
571
+ isSvgMode = false;
572
+ }
543
573
  }
544
574
  else if (oldVNode.$text$ !== text) {
545
575
  // update the text content for the text only vnode
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-4a3038bd.js');
5
+ const index = require('./index-5b463836.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"],"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":[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
18
  });
19
19
  };
20
20
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-4a3038bd.js');
3
+ const index = require('./index-5b463836.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"],"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":[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);
19
19
  });
@@ -13,6 +13,12 @@
13
13
  text-align: center;
14
14
  }
15
15
 
16
+ .CloseButton {
17
+ width: 25px;
18
+ height: 25px;
19
+ align-self: flex-end;
20
+ }
21
+
16
22
  .UserActionController {
17
23
  font-family: Arial, Helvetica, sans-serif;
18
24
  font-weight: 100;
@@ -1,8 +1,12 @@
1
- import { Component, h, Prop, Listen, State, Watch } from '@stencil/core';
1
+ import { Component, h, Prop, Listen, State, Watch, Event } from '@stencil/core';
2
2
  import '@everymatrix/legislation-wrapper';
3
3
  import '@everymatrix/generic-user-consent';
4
4
  export class UserActionController {
5
5
  constructor() {
6
+ /**
7
+ * Event name to be sent when the button is clicked
8
+ */
9
+ this.postMessageEvent = 'closeButtonClicked';
6
10
  this.consentTitles = {
7
11
  termsandconditions: "Terms and Conditions",
8
12
  sms: "SMS marketing",
@@ -50,9 +54,25 @@ export class UserActionController {
50
54
  };
51
55
  fetch(url.href, options)
52
56
  .then(res => res.json())
53
- // .then(data => {
54
- // console.log(data);
55
- // })
57
+ .then(() => {
58
+ /**
59
+ * @TODO document this
60
+ */
61
+ window.postMessage({ type: 'WidgetNotification', data: {
62
+ type: 'success',
63
+ message: 'Consent update successfull!'
64
+ } }, window.location.href);
65
+ })
66
+ .catch((err) => {
67
+ /**
68
+ * @TODO document this
69
+ */
70
+ window.postMessage({ type: 'WidgetNotification', data: {
71
+ type: 'error',
72
+ message: 'Server might not be responding',
73
+ err
74
+ } }, window.location.href);
75
+ })
56
76
  .finally(() => {
57
77
  window.postMessage({ type: "UserActionsCompleted" }, window.location.href);
58
78
  });
@@ -60,6 +80,12 @@ export class UserActionController {
60
80
  handleApplyClick() {
61
81
  this.queryFired = true;
62
82
  }
83
+ handleClose() {
84
+ if (this.usePostmessage) {
85
+ window.postMessage({ type: this.postMessageEvent });
86
+ }
87
+ this.closeButtonEvent.emit();
88
+ }
63
89
  userLegislationConsentHandler(event) {
64
90
  // Increase / Decrease the amount of mandatory actions taken
65
91
  if (this.mandatoryActions.includes(event.detail.type)) {
@@ -84,6 +110,10 @@ export class UserActionController {
84
110
  this.expectedQueryResponses = activeUAList.length;
85
111
  return (h("div", { class: "QueryReferenceContainer" },
86
112
  h("div", { class: "UserActionController" },
113
+ this.showCloseButton &&
114
+ h("div", { class: "CloseButton", onClick: () => this.handleClose() },
115
+ h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "25", height: "25", fill: "currentColor", viewBox: "0 0 16 16" },
116
+ 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" }))),
87
117
  h("h2", { class: "UserConsentNotice" }, this.userNoticeText),
88
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) })))),
89
119
  this.includeSubmitButton &&
@@ -216,6 +246,58 @@ export class UserActionController {
216
246
  },
217
247
  "attribute": "active-user-actions",
218
248
  "reflect": false
249
+ },
250
+ "showCloseButton": {
251
+ "type": "boolean",
252
+ "mutable": false,
253
+ "complexType": {
254
+ "original": "boolean",
255
+ "resolved": "boolean",
256
+ "references": {}
257
+ },
258
+ "required": true,
259
+ "optional": false,
260
+ "docs": {
261
+ "tags": [],
262
+ "text": "Property used to display the close/cancel button"
263
+ },
264
+ "attribute": "show-close-button",
265
+ "reflect": false
266
+ },
267
+ "usePostmessage": {
268
+ "type": "boolean",
269
+ "mutable": false,
270
+ "complexType": {
271
+ "original": "boolean",
272
+ "resolved": "boolean",
273
+ "references": {}
274
+ },
275
+ "required": true,
276
+ "optional": false,
277
+ "docs": {
278
+ "tags": [],
279
+ "text": "Use postMessage event to communicate"
280
+ },
281
+ "attribute": "use-postmessage",
282
+ "reflect": false
283
+ },
284
+ "postMessageEvent": {
285
+ "type": "string",
286
+ "mutable": false,
287
+ "complexType": {
288
+ "original": "string",
289
+ "resolved": "string",
290
+ "references": {}
291
+ },
292
+ "required": false,
293
+ "optional": false,
294
+ "docs": {
295
+ "tags": [],
296
+ "text": "Event name to be sent when the button is clicked"
297
+ },
298
+ "attribute": "post-message-event",
299
+ "reflect": false,
300
+ "defaultValue": "'closeButtonClicked'"
219
301
  }
220
302
  }; }
221
303
  static get states() { return {
@@ -223,6 +305,22 @@ export class UserActionController {
223
305
  "readyActionsCount": {},
224
306
  "receivedQueryResponses": {}
225
307
  }; }
308
+ static get events() { return [{
309
+ "method": "closeButtonEvent",
310
+ "name": "closeButtonClicked",
311
+ "bubbles": true,
312
+ "cancelable": true,
313
+ "composed": true,
314
+ "docs": {
315
+ "tags": [],
316
+ "text": "Event emitted when the close button is clicked"
317
+ },
318
+ "complexType": {
319
+ "original": "any",
320
+ "resolved": "any",
321
+ "references": {}
322
+ }
323
+ }]; }
226
324
  static get watchers() { return [{
227
325
  "propName": "receivedQueryResponses",
228
326
  "methodName": "handleQueryResponse"
@@ -1,14 +1,19 @@
1
- import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
1
+ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
2
  import { d as defineCustomElement$3 } from './generic-user-consent2.js';
3
3
  import { d as defineCustomElement$2 } from './legislation-wrapper2.js';
4
4
 
5
- const userActionControllerCss = ":host{display:block}.QueryReferenceContainer{height:100%;width:100%}.UserConsentNotice{font-size:1.2rem;font-weight:200;text-align:center}.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}}";
5
+ const userActionControllerCss = ":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}}";
6
6
 
7
7
  const UserActionController$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
8
8
  constructor() {
9
9
  super();
10
10
  this.__registerHost();
11
11
  this.__attachShadow();
12
+ this.closeButtonEvent = createEvent(this, "closeButtonClicked", 7);
13
+ /**
14
+ * Event name to be sent when the button is clicked
15
+ */
16
+ this.postMessageEvent = 'closeButtonClicked';
12
17
  this.consentTitles = {
13
18
  termsandconditions: "Terms and Conditions",
14
19
  sms: "SMS marketing",
@@ -56,9 +61,25 @@ const UserActionController$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
56
61
  };
57
62
  fetch(url.href, options)
58
63
  .then(res => res.json())
59
- // .then(data => {
60
- // console.log(data);
61
- // })
64
+ .then(() => {
65
+ /**
66
+ * @TODO document this
67
+ */
68
+ window.postMessage({ type: 'WidgetNotification', data: {
69
+ type: 'success',
70
+ message: 'Consent update successfull!'
71
+ } }, window.location.href);
72
+ })
73
+ .catch((err) => {
74
+ /**
75
+ * @TODO document this
76
+ */
77
+ window.postMessage({ type: 'WidgetNotification', data: {
78
+ type: 'error',
79
+ message: 'Server might not be responding',
80
+ err
81
+ } }, window.location.href);
82
+ })
62
83
  .finally(() => {
63
84
  window.postMessage({ type: "UserActionsCompleted" }, window.location.href);
64
85
  });
@@ -66,6 +87,12 @@ const UserActionController$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
66
87
  handleApplyClick() {
67
88
  this.queryFired = true;
68
89
  }
90
+ handleClose() {
91
+ if (this.usePostmessage) {
92
+ window.postMessage({ type: this.postMessageEvent });
93
+ }
94
+ this.closeButtonEvent.emit();
95
+ }
69
96
  userLegislationConsentHandler(event) {
70
97
  // Increase / Decrease the amount of mandatory actions taken
71
98
  if (this.mandatoryActions.includes(event.detail.type)) {
@@ -88,7 +115,8 @@ const UserActionController$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
88
115
  const activeUAList = this.activeUserActions.replace(/ /g, '').split(',');
89
116
  this.requiredActionsCount = activeUAList.filter(action => this.mandatoryActions.includes(action)).length;
90
117
  this.expectedQueryResponses = activeUAList.length;
91
- return (h("div", { class: "QueryReferenceContainer" }, h("div", { class: "UserActionController" }, 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 &&
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 &&
92
120
  h("button", { class: "ConsentSubmitButton", disabled: this.readyActionsCount === this.requiredActionsCount ? false : true, onClick: () => this.handleApplyClick() }, this.submitButtonText))));
93
121
  }
94
122
  static get watchers() { return {
@@ -103,6 +131,9 @@ const UserActionController$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
103
131
  "submitButtonText": [1, "submit-button-text"],
104
132
  "userNoticeText": [1, "user-notice-text"],
105
133
  "activeUserActions": [1, "active-user-actions"],
134
+ "showCloseButton": [4, "show-close-button"],
135
+ "usePostmessage": [4, "use-postmessage"],
136
+ "postMessageEvent": [1, "post-message-event"],
106
137
  "queryFired": [32],
107
138
  "readyActionsCount": [32],
108
139
  "receivedQueryResponses": [32]
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, c as createEvent, h } from './index-9eef5ef8.js';
1
+ import { r as registerInstance, c as createEvent, h } from './index-e34db4b0.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
 
@@ -80,11 +80,16 @@ const LegislationWrapper = class {
80
80
  };
81
81
  LegislationWrapper.style = legislationWrapperCss;
82
82
 
83
- const userActionControllerCss = ":host{display:block}.QueryReferenceContainer{height:100%;width:100%}.UserConsentNotice{font-size:1.2rem;font-weight:200;text-align:center}.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}}";
83
+ const userActionControllerCss = ":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}}";
84
84
 
85
85
  const UserActionController = class {
86
86
  constructor(hostRef) {
87
87
  registerInstance(this, hostRef);
88
+ this.closeButtonEvent = createEvent(this, "closeButtonClicked", 7);
89
+ /**
90
+ * Event name to be sent when the button is clicked
91
+ */
92
+ this.postMessageEvent = 'closeButtonClicked';
88
93
  this.consentTitles = {
89
94
  termsandconditions: "Terms and Conditions",
90
95
  sms: "SMS marketing",
@@ -132,9 +137,25 @@ const UserActionController = class {
132
137
  };
133
138
  fetch(url.href, options)
134
139
  .then(res => res.json())
135
- // .then(data => {
136
- // console.log(data);
137
- // })
140
+ .then(() => {
141
+ /**
142
+ * @TODO document this
143
+ */
144
+ window.postMessage({ type: 'WidgetNotification', data: {
145
+ type: 'success',
146
+ message: 'Consent update successfull!'
147
+ } }, window.location.href);
148
+ })
149
+ .catch((err) => {
150
+ /**
151
+ * @TODO document this
152
+ */
153
+ window.postMessage({ type: 'WidgetNotification', data: {
154
+ type: 'error',
155
+ message: 'Server might not be responding',
156
+ err
157
+ } }, window.location.href);
158
+ })
138
159
  .finally(() => {
139
160
  window.postMessage({ type: "UserActionsCompleted" }, window.location.href);
140
161
  });
@@ -142,6 +163,12 @@ const UserActionController = class {
142
163
  handleApplyClick() {
143
164
  this.queryFired = true;
144
165
  }
166
+ handleClose() {
167
+ if (this.usePostmessage) {
168
+ window.postMessage({ type: this.postMessageEvent });
169
+ }
170
+ this.closeButtonEvent.emit();
171
+ }
145
172
  userLegislationConsentHandler(event) {
146
173
  // Increase / Decrease the amount of mandatory actions taken
147
174
  if (this.mandatoryActions.includes(event.detail.type)) {
@@ -164,7 +191,8 @@ const UserActionController = class {
164
191
  const activeUAList = this.activeUserActions.replace(/ /g, '').split(',');
165
192
  this.requiredActionsCount = activeUAList.filter(action => this.mandatoryActions.includes(action)).length;
166
193
  this.expectedQueryResponses = activeUAList.length;
167
- return (h("div", { class: "QueryReferenceContainer" }, h("div", { class: "UserActionController" }, 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 &&
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 &&
168
196
  h("button", { class: "ConsentSubmitButton", disabled: this.readyActionsCount === this.requiredActionsCount ? false : true, onClick: () => this.handleApplyClick() }, this.submitButtonText))));
169
197
  }
170
198
  static get watchers() { return {
@@ -142,6 +142,11 @@ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
142
142
  * Don't add values to these!!
143
143
  */
144
144
  const EMPTY_OBJ = {};
145
+ /**
146
+ * Namespaces
147
+ */
148
+ const SVG_NS = 'http://www.w3.org/2000/svg';
149
+ const HTML_NS = 'http://www.w3.org/1999/xhtml';
145
150
  const isDef = (v) => v != null;
146
151
  const isComplexType = (o) => {
147
152
  // https://jsperf.com/typeof-fn-object/5
@@ -358,8 +363,15 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
358
363
  elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
359
364
  }
360
365
  else {
366
+ if (!isSvgMode) {
367
+ isSvgMode = newVNode.$tag$ === 'svg';
368
+ }
361
369
  // create element
362
- elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
370
+ elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$tag$)
371
+ );
372
+ if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
373
+ isSvgMode = false;
374
+ }
363
375
  // add css classes, attrs, props, listeners, etc.
364
376
  {
365
377
  updateElement(null, newVNode, isSvgMode);
@@ -380,6 +392,16 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
380
392
  }
381
393
  }
382
394
  }
395
+ {
396
+ if (newVNode.$tag$ === 'svg') {
397
+ // Only reset the SVG context when we're exiting <svg> element
398
+ isSvgMode = false;
399
+ }
400
+ else if (elm.tagName === 'foreignObject') {
401
+ // Reenter SVG context when we're exiting <foreignObject> element
402
+ isSvgMode = true;
403
+ }
404
+ }
383
405
  }
384
406
  return elm;
385
407
  };
@@ -490,6 +512,11 @@ const patch = (oldVNode, newVNode) => {
490
512
  const tag = newVNode.$tag$;
491
513
  const text = newVNode.$text$;
492
514
  if (text === null) {
515
+ {
516
+ // test if we're rendering an svg element, or still rendering nodes inside of one
517
+ // only add this to the when the compiler sees we're using an svg somewhere
518
+ isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
519
+ }
493
520
  // element node
494
521
  {
495
522
  if (tag === 'slot')
@@ -518,6 +545,9 @@ const patch = (oldVNode, newVNode) => {
518
545
  // no new child vnodes, but there are old child vnodes to remove
519
546
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
520
547
  }
548
+ if (isSvgMode && tag === 'svg') {
549
+ isSvgMode = false;
550
+ }
521
551
  }
522
552
  else if (oldVNode.$text$ !== text) {
523
553
  // update the text content for the text only vnode
@@ -1,4 +1,4 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-9eef5ef8.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-e34db4b0.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"],"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":[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);
14
14
  });
15
15
  };
16
16
 
@@ -1,4 +1,4 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-9eef5ef8.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-e34db4b0.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"],"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":[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
17
  });
@@ -1,3 +1,4 @@
1
+ import { EventEmitter } from '../../stencil-public-runtime';
1
2
  import '@everymatrix/legislation-wrapper';
2
3
  import '@everymatrix/generic-user-consent';
3
4
  interface LegislationConsentEvent {
@@ -33,6 +34,22 @@ export declare class UserActionController {
33
34
  * which user action widgets are included
34
35
  */
35
36
  activeUserActions: string;
37
+ /**
38
+ * Property used to display the close/cancel button
39
+ */
40
+ showCloseButton: boolean;
41
+ /**
42
+ * Use postMessage event to communicate
43
+ */
44
+ usePostmessage: boolean;
45
+ /**
46
+ * Event name to be sent when the button is clicked
47
+ */
48
+ postMessageEvent: string;
49
+ /**
50
+ * Event emitted when the close button is clicked
51
+ */
52
+ closeButtonEvent: EventEmitter<any>;
36
53
  private consentTitles;
37
54
  /**
38
55
  * Which actions are required in order to activate the "Apply" button. Other actions are considered optional.
@@ -48,6 +65,7 @@ export declare class UserActionController {
48
65
  handleQueryResponse(): void;
49
66
  updateUserConsents(): void;
50
67
  handleApplyClick(): void;
68
+ handleClose(): void;
51
69
  userLegislationConsentHandler(event: CustomEvent<LegislationConsentEvent>): void;
52
70
  componentWillLoad(): Promise<void>;
53
71
  render(): any;
@@ -19,10 +19,22 @@ export namespace Components {
19
19
  * wether or not to include the submit button (in case we want to compose a different )
20
20
  */
21
21
  "includeSubmitButton": boolean;
22
+ /**
23
+ * Event name to be sent when the button is clicked
24
+ */
25
+ "postMessageEvent": string;
26
+ /**
27
+ * Property used to display the close/cancel button
28
+ */
29
+ "showCloseButton": boolean;
22
30
  /**
23
31
  * the text of the button, if button is enabled
24
32
  */
25
33
  "submitButtonText": string;
34
+ /**
35
+ * Use postMessage event to communicate
36
+ */
37
+ "usePostmessage": boolean;
26
38
  /**
27
39
  * user id required for the update call
28
40
  */
@@ -62,10 +74,26 @@ declare namespace LocalJSX {
62
74
  * wether or not to include the submit button (in case we want to compose a different )
63
75
  */
64
76
  "includeSubmitButton": boolean;
77
+ /**
78
+ * Event emitted when the close button is clicked
79
+ */
80
+ "onCloseButtonClicked"?: (event: CustomEvent<any>) => void;
81
+ /**
82
+ * Event name to be sent when the button is clicked
83
+ */
84
+ "postMessageEvent"?: string;
85
+ /**
86
+ * Property used to display the close/cancel button
87
+ */
88
+ "showCloseButton": boolean;
65
89
  /**
66
90
  * the text of the button, if button is enabled
67
91
  */
68
92
  "submitButtonText"?: string;
93
+ /**
94
+ * Use postMessage event to communicate
95
+ */
96
+ "usePostmessage": boolean;
69
97
  /**
70
98
  * user id required for the update call
71
99
  */
@@ -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,$=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}
@@ -0,0 +1 @@
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}
@@ -1 +1 @@
1
- import{p as e,b as t}from"./p-54386d36.js";(()=>{const t=import.meta.url,n={};return""!==t&&(n.resourcesUrl=new URL(".",t).href),e(n)})().then((e=>t([["p-013051ff",[[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"],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 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)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/user-action-controller",
3
- "version": "0.0.1",
3
+ "version": "1.0.0",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",
@@ -12,8 +12,5 @@
12
12
  "files": [
13
13
  "dist/",
14
14
  "loader/"
15
- ],
16
- "publishConfig": {
17
- "access": "public"
18
- }
15
+ ]
19
16
  }
@@ -1 +0,0 @@
1
- import{r as t,c as e,h as s}from"./p-54386d36.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(e){t(this,e),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())).finally((()=>{window.postMessage({type:"UserActionsCompleted"},window.location.href)}))}handleApplyClick(){this.queryFired=!0}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"},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}.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}
@@ -1 +0,0 @@
1
- let e,t,n=!1;const l="undefined"!=typeof window?window:{},s=l.document||{head:{}},o={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),r=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),i=(e,t,n)=>{n&&n.map((([n,l,s])=>{const c=e,r=u(t,s),i=a(n);o.ael(c,l,r,i),(t.o=t.o||[]).push((()=>o.rel(c,l,r,i)))}))},u=(e,t)=>n=>{try{256&e.t?e.i[t](n):(e.u=e.u||[]).push([t,n])}catch(e){I(e)}},a=e=>0!=(2&e),f=new WeakMap,h=e=>"sc-"+e.h,$={},y=e=>"object"==(e=typeof e)||"function"===e,d=(e,t,...n)=>{let l=null,s=!1,o=!1,c=[];const r=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?r(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!y(l))&&(l+=""),s&&o?c[c.length-1].$+=l:c.push(s?m(null,l):l),o=s)};if(r(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=m(e,null);return i.m=t,c.length>0&&(i.p=c),i},m=(e,t)=>({t:0,S:e,$:t,g:null,p:null,m:null}),p={},b=(e,t,n,s,c,r)=>{if(n!==s){let i=G(e,t),u=t.toLowerCase();if("class"===t){const t=e.classList,l=S(n),o=S(s);t.remove(...l.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!l.includes(e))))}else if("ref"===t)s&&s(e);else if(i||"o"!==t[0]||"n"!==t[1]){const l=y(s);if((i||l&&null!==s)&&!c)try{if(e.tagName.includes("-"))e[t]=s;else{let l=null==s?"":s;"list"===t?i=!1:null!=n&&e[t]==l||(e[t]=l)}}catch(e){}null==s||!1===s?!1===s&&""!==e.getAttribute(t)||e.removeAttribute(t):(!i||4&r||c)&&!l&&e.setAttribute(t,s=!0===s?"":s)}else t="-"===t[2]?t.slice(3):G(l,u)?u.slice(2):u[2]+t.slice(3),n&&o.rel(e,t,n,!1),s&&o.ael(e,t,s,!1)}},w=/\s/,S=e=>e?e.split(w):[],g=(e,t,n,l)=>{const s=11===t.g.nodeType&&t.g.host?t.g.host:t.g,o=e&&e.m||$,c=t.m||$;for(l in o)l in c||b(s,l,o[l],void 0,n,t.t);for(l in c)b(s,l,o[l],c[l],n,t.t)},j=(t,n,l)=>{let o,c,r=n.p[l],i=0;if(null!==r.$)o=r.g=s.createTextNode(r.$);else if(o=r.g=s.createElement(r.S),g(null,r,!1),null!=e&&o["s-si"]!==e&&o.classList.add(o["s-si"]=e),r.p)for(i=0;i<r.p.length;++i)c=j(t,r,i),c&&o.appendChild(c);return o},v=(e,n,l,s,o,c)=>{let r,i=e;for(i.shadowRoot&&i.tagName===t&&(i=i.shadowRoot);o<=c;++o)s[o]&&(r=j(null,l,o),r&&(s[o].g=r,i.insertBefore(r,n)))},M=(e,t,n,l,s)=>{for(;t<=n;++t)(l=e[t])&&(s=l.g,O(l),s.remove())},k=(e,t)=>e.S===t.S,C=(e,t)=>{const n=t.g=e.g,l=e.p,s=t.p,o=t.$;null===o?("slot"===t.S||g(e,t,!1),null!==l&&null!==s?((e,t,n,l)=>{let s,o=0,c=0,r=t.length-1,i=t[0],u=t[r],a=l.length-1,f=l[0],h=l[a];for(;o<=r&&c<=a;)null==i?i=t[++o]:null==u?u=t[--r]:null==f?f=l[++c]:null==h?h=l[--a]:k(i,f)?(C(i,f),i=t[++o],f=l[++c]):k(u,h)?(C(u,h),u=t[--r],h=l[--a]):k(i,h)?(C(i,h),e.insertBefore(i.g,u.g.nextSibling),i=t[++o],h=l[--a]):k(u,f)?(C(u,f),e.insertBefore(u.g,i.g),u=t[--r],f=l[++c]):(s=j(t&&t[c],n,c),f=l[++c],s&&i.g.parentNode.insertBefore(s,i.g));o>r?v(e,null==l[a+1]?null:l[a+1].g,n,l,c,a):c>a&&M(t,o,r)})(n,l,t,s):null!==s?(null!==e.$&&(n.textContent=""),v(n,null,t,s,0,s.length-1)):null!==l&&M(l,0,l.length-1)):e.$!==o&&(n.data=o)},O=e=>{e.m&&e.m.ref&&e.m.ref(null),e.p&&e.p.map(O)},P=(e,t,n)=>{const l=(e=>z(e).j)(e);return{emit:e=>x(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},x=(e,t,n)=>{const l=o.ce(t,n);return e.dispatchEvent(l),l},E=(e,t)=>{t&&!e.v&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.v=t)))},L=(e,t)=>{if(e.t|=16,!(4&e.t))return E(e,e.M),le((()=>N(e,t)));e.t|=512},N=(e,t)=>{const n=e.i;let l;return t&&(e.t|=256,e.u&&(e.u.map((([e,t])=>U(n,e,t))),e.u=null),l=U(n,"componentWillLoad")),q(l,(()=>T(e,n,t)))},T=async(e,t,n)=>{const l=e.j,o=l["s-rc"];n&&(e=>{const t=e.k,n=e.j,l=t.t,o=((e,t)=>{let n=h(t),l=Q.get(n);if(e=11===e.nodeType?e:s,l)if("string"==typeof l){let t,o=f.get(e=e.head||e);o||f.set(e,o=new Set),o.has(n)||(t=s.createElement("style"),t.innerHTML=l,e.insertBefore(t,e.querySelector("link")),o&&o.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"]=o,n.classList.add(o+"-h"))})(e);W(e,t),o&&(o.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.j,o=n.C||m(null,null),c=(e=>e&&e.S===p)(l)?l:d(null,null,l);t=s.tagName,c.S=null,c.t|=4,n.C=c,c.g=o.g=s.shadowRoot||s,e=s["s-sc"],C(o,c)})(n,l)}catch(e){I(e,n.j)}return null},A=e=>{const t=e.j,n=e.M;64&e.t||(e.t|=64,F(t),e.O(t),n||R()),e.v&&(e.v(),e.v=void 0),512&e.t&&ne((()=>L(e,!1))),e.t&=-517},R=()=>{F(s.documentElement),ne((()=>x(l,"appload",{detail:{namespace:"user-action-controller"}})))},U=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){I(e)}},q=(e,t)=>e&&e.then?e.then(t):t(),F=e=>e.classList.add("hydrated"),H=(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)=>z(this).N.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=z(e),o=s.j,c=s.N.get(t),r=s.t,i=s.i;if(n=((e,t)=>null==e||y(e)?e:4&t?"false"!==e&&(""===e||!!e):1&t?e+"":e)(n,l.P[t][0]),(!(8&r)||void 0===c)&&n!==c&&(!Number.isNaN(c)||!Number.isNaN(n))&&(s.N.set(t,n),i)){if(l.L&&128&r){const e=l.L[t];e&&e.map((e=>{try{i[e](n,c,t)}catch(e){I(e,o)}}))}2==(18&r)&&L(s,!1)}})(this,e,n,t)},configurable:!0,enumerable:!0})})),1&n){const t=new Map;s.attributeChangedCallback=function(e,n,l){o.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},V=(e,t={})=>{const n=[],c=t.exclude||[],u=l.customElements,a=s.head,f=a.querySelector("meta[charset]"),$=s.createElement("style"),y=[];let d,m=!0;Object.assign(o,t),o.l=new URL(t.resourcesUrl||"./",s.baseURI).href,e.map((e=>{e[1].map((t=>{const l={t:t[0],h:t[1],P:t[2],T:t[3]};l.P=t[2],l.T=t[3],l.L={};const s=l.h,a=class extends HTMLElement{constructor(e){super(e),D(e=this,l),1&l.t&&e.attachShadow({mode:"open"})}connectedCallback(){d&&(clearTimeout(d),d=null),m?y.push(this):o.jmp((()=>(e=>{if(0==(1&o.t)){const t=z(e),n=t.k,l=()=>{};if(1&t.t)i(e,t,n.T);else{t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){E(t,t.M=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=K(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(n.L=s.watchers,H(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){I(e)}t.t&=-9,t.t|=128,e()}if(s.style){let e=s.style;const t=h(n);if(!Q.has(t)){const l=()=>{};((e,t,n)=>{let l=Q.get(e);r&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,Q.set(e,l)})(t,e,!!(1&n.t)),l()}}}const o=t.M,c=()=>L(t,!0);o&&o["s-rc"]?o["s-rc"].push(c):c()})(0,t,n)}l()}})(this)))}disconnectedCallback(){o.jmp((()=>(()=>{if(0==(1&o.t)){const e=z(this);e.o&&(e.o.map((e=>e())),e.o=void 0)}})()))}componentOnReady(){return z(this).W}};l.A=e[0],c.includes(s)||u.get(s)||(n.push(s),u.define(s,H(a,l,1)))}))})),$.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",$.setAttribute("data-styles",""),a.insertBefore($,f?f.nextSibling:a.firstChild),m=!1,y.length?y.map((e=>e.connectedCallback())):o.jmp((()=>d=setTimeout(R,30)))},_=new WeakMap,z=e=>_.get(e),B=(e,t)=>_.set(t.i=e,t),D=(e,t)=>{const n={t:0,j:e,k:t,N:new Map};return n.W=new Promise((e=>n.O=e)),e["s-p"]=[],e["s-rc"]=[],i(e,n,t.T),_.set(e,n)},G=(e,t)=>t in e,I=(e,t)=>(0,console.error)(e,t),J=new Map,K=e=>{const t=e.h.replace(/-/g,"_"),n=e.A,l=J.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(J.set(n,e),e[t])),I)},Q=new Map,X=[],Y=[],Z=(e,t)=>l=>{e.push(l),n||(n=!0,t&&4&o.t?ne(te):o.raf(te))},ee=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){I(e)}e.length=0},te=()=>{ee(X),ee(Y),(n=X.length>0)&&o.raf(te)},ne=e=>c().then(e),le=Z(Y,!0);export{V as b,P as c,d as h,c as p,B as r}