@everymatrix/user-action-controller 0.0.1 → 1.13.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/dist/cjs/generic-user-consent_3.cjs.entry.js +113 -8
  2. package/dist/cjs/{index-4a3038bd.js → index-3529682c.js} +35 -1
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/user-action-controller.cjs.js +2 -2
  5. package/dist/collection/components/user-action-controller/user-action-controller.css +6 -0
  6. package/dist/collection/components/user-action-controller/user-action-controller.js +181 -7
  7. package/dist/components/generic-user-consent2.js +23 -2
  8. package/dist/components/legislation-wrapper2.js +23 -2
  9. package/dist/components/user-action-controller.js +80 -7
  10. package/dist/esm/generic-user-consent_3.entry.js +113 -8
  11. package/dist/esm/{index-9eef5ef8.js → index-f118067b.js} +35 -1
  12. package/dist/esm/loader.js +2 -2
  13. package/dist/esm/user-action-controller.js +2 -2
  14. package/dist/types/Users/adrian.pripon/Documents/Work/stencil/widgets-stencil/packages/user-action-controller/.stencil/packages/user-action-controller/stencil.config.d.ts +2 -0
  15. package/dist/types/components/user-action-controller/user-action-controller.d.ts +31 -0
  16. package/dist/types/components.d.ts +44 -0
  17. package/dist/user-action-controller/p-a9c2a73d.js +1 -0
  18. package/dist/user-action-controller/p-aa12aa8d.entry.js +1 -0
  19. package/dist/user-action-controller/user-action-controller.esm.js +1 -1
  20. package/package.json +2 -5
  21. package/dist/types/Users/user/workspace/everymatrix/widgets-stencil/packages/user-action-controller/.stencil/packages/user-action-controller/stencil.config.d.ts +0 -2
  22. package/dist/user-action-controller/p-013051ff.entry.js +0 -1
  23. package/dist/user-action-controller/p-54386d36.js +0 -1
@@ -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": [1, "active-user-actions"],
37
+ "clientStyling": [1, "client-styling"],
38
+ "limitStylingAppends": [32]
18
39
  }]);
19
40
  function defineCustomElement() {
20
41
  if (typeof customElements === "undefined") {
@@ -1,14 +1,27 @@
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';
17
+ /**
18
+ * Client custom styling via inline style
19
+ */
20
+ this.clientStyling = '';
21
+ /**
22
+ * Client custom styling via url
23
+ */
24
+ this.clientStylingUrl = '';
12
25
  this.consentTitles = {
13
26
  termsandconditions: "Terms and Conditions",
14
27
  sms: "SMS marketing",
@@ -20,10 +33,30 @@ const UserActionController$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
20
33
  this.queryFired = false;
21
34
  this.readyActionsCount = 0;
22
35
  this.receivedQueryResponses = 0;
36
+ this.limitStylingAppends = false;
23
37
  this.mandatoryActions = ['termsandconditions'];
24
38
  this.requiredActionsCount = 0;
25
39
  this.expectedQueryResponses = 0;
26
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
+ };
27
60
  }
28
61
  determineMandatoryActions() {
29
62
  let url = new URL(`${this.endpoint}v1/player/consentRequirements`);
@@ -56,9 +89,25 @@ const UserActionController$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
56
89
  };
57
90
  fetch(url.href, options)
58
91
  .then(res => res.json())
59
- // .then(data => {
60
- // console.log(data);
61
- // })
92
+ .then(() => {
93
+ /**
94
+ * @TODO document this
95
+ */
96
+ window.postMessage({ type: 'WidgetNotification', data: {
97
+ type: 'success',
98
+ message: 'Consent update successfull!'
99
+ } }, window.location.href);
100
+ })
101
+ .catch((err) => {
102
+ /**
103
+ * @TODO document this
104
+ */
105
+ window.postMessage({ type: 'WidgetNotification', data: {
106
+ type: 'error',
107
+ message: 'Server might not be responding',
108
+ err
109
+ } }, window.location.href);
110
+ })
62
111
  .finally(() => {
63
112
  window.postMessage({ type: "UserActionsCompleted" }, window.location.href);
64
113
  });
@@ -66,6 +115,12 @@ const UserActionController$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
66
115
  handleApplyClick() {
67
116
  this.queryFired = true;
68
117
  }
118
+ handleClose() {
119
+ if (this.usePostmessage) {
120
+ window.postMessage({ type: this.postMessageEvent });
121
+ }
122
+ this.closeButtonEvent.emit();
123
+ }
69
124
  userLegislationConsentHandler(event) {
70
125
  // Increase / Decrease the amount of mandatory actions taken
71
126
  if (this.mandatoryActions.includes(event.detail.type)) {
@@ -84,11 +139,23 @@ const UserActionController$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
84
139
  componentWillLoad() {
85
140
  return this.determineMandatoryActions();
86
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
+ }
87
153
  render() {
88
154
  const activeUAList = this.activeUserActions.replace(/ /g, '').split(',');
89
155
  this.requiredActionsCount = activeUAList.filter(action => this.mandatoryActions.includes(action)).length;
90
156
  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 &&
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 &&
92
159
  h("button", { class: "ConsentSubmitButton", disabled: this.readyActionsCount === this.requiredActionsCount ? false : true, onClick: () => this.handleApplyClick() }, this.submitButtonText))));
93
160
  }
94
161
  static get watchers() { return {
@@ -103,9 +170,15 @@ const UserActionController$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
103
170
  "submitButtonText": [1, "submit-button-text"],
104
171
  "userNoticeText": [1, "user-notice-text"],
105
172
  "activeUserActions": [1, "active-user-actions"],
173
+ "showCloseButton": [4, "show-close-button"],
174
+ "usePostmessage": [4, "use-postmessage"],
175
+ "postMessageEvent": [1, "post-message-event"],
176
+ "clientStyling": [1025, "client-styling"],
177
+ "clientStylingUrl": [1, "client-styling-url"],
106
178
  "queryFired": [32],
107
179
  "readyActionsCount": [32],
108
- "receivedQueryResponses": [32]
180
+ "receivedQueryResponses": [32],
181
+ "limitStylingAppends": [32]
109
182
  }, [[0, "userLegislationConsent", "userLegislationConsentHandler"]]]);
110
183
  function defineCustomElement$1() {
111
184
  if (typeof customElements === "undefined") {
@@ -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-f118067b.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,19 +91,51 @@ 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;
82
120
 
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}}";
121
+ 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
122
 
85
123
  const UserActionController = class {
86
124
  constructor(hostRef) {
87
125
  registerInstance(this, hostRef);
126
+ this.closeButtonEvent = createEvent(this, "closeButtonClicked", 7);
127
+ /**
128
+ * Event name to be sent when the button is clicked
129
+ */
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 = '';
88
139
  this.consentTitles = {
89
140
  termsandconditions: "Terms and Conditions",
90
141
  sms: "SMS marketing",
@@ -96,10 +147,30 @@ const UserActionController = class {
96
147
  this.queryFired = false;
97
148
  this.readyActionsCount = 0;
98
149
  this.receivedQueryResponses = 0;
150
+ this.limitStylingAppends = false;
99
151
  this.mandatoryActions = ['termsandconditions'];
100
152
  this.requiredActionsCount = 0;
101
153
  this.expectedQueryResponses = 0;
102
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
+ };
103
174
  }
104
175
  determineMandatoryActions() {
105
176
  let url = new URL(`${this.endpoint}v1/player/consentRequirements`);
@@ -132,9 +203,25 @@ const UserActionController = class {
132
203
  };
133
204
  fetch(url.href, options)
134
205
  .then(res => res.json())
135
- // .then(data => {
136
- // console.log(data);
137
- // })
206
+ .then(() => {
207
+ /**
208
+ * @TODO document this
209
+ */
210
+ window.postMessage({ type: 'WidgetNotification', data: {
211
+ type: 'success',
212
+ message: 'Consent update successfull!'
213
+ } }, window.location.href);
214
+ })
215
+ .catch((err) => {
216
+ /**
217
+ * @TODO document this
218
+ */
219
+ window.postMessage({ type: 'WidgetNotification', data: {
220
+ type: 'error',
221
+ message: 'Server might not be responding',
222
+ err
223
+ } }, window.location.href);
224
+ })
138
225
  .finally(() => {
139
226
  window.postMessage({ type: "UserActionsCompleted" }, window.location.href);
140
227
  });
@@ -142,6 +229,12 @@ const UserActionController = class {
142
229
  handleApplyClick() {
143
230
  this.queryFired = true;
144
231
  }
232
+ handleClose() {
233
+ if (this.usePostmessage) {
234
+ window.postMessage({ type: this.postMessageEvent });
235
+ }
236
+ this.closeButtonEvent.emit();
237
+ }
145
238
  userLegislationConsentHandler(event) {
146
239
  // Increase / Decrease the amount of mandatory actions taken
147
240
  if (this.mandatoryActions.includes(event.detail.type)) {
@@ -160,11 +253,23 @@ const UserActionController = class {
160
253
  componentWillLoad() {
161
254
  return this.determineMandatoryActions();
162
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
+ }
163
267
  render() {
164
268
  const activeUAList = this.activeUserActions.replace(/ /g, '').split(',');
165
269
  this.requiredActionsCount = activeUAList.filter(action => this.mandatoryActions.includes(action)).length;
166
270
  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 &&
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 &&
168
273
  h("button", { class: "ConsentSubmitButton", disabled: this.readyActionsCount === this.requiredActionsCount ? false : true, onClick: () => this.handleApplyClick() }, this.submitButtonText))));
169
274
  }
170
275
  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
@@ -675,7 +705,11 @@ const postUpdateComponent = (hostRef) => {
675
705
  const tagName = hostRef.$cmpMeta$.$tagName$;
676
706
  const elm = hostRef.$hostElement$;
677
707
  const endPostUpdate = createTime('postUpdate', tagName);
708
+ const instance = hostRef.$lazyInstance$ ;
678
709
  const ancestorComponent = hostRef.$ancestorComponent$;
710
+ {
711
+ safeCall(instance, 'componentDidRender');
712
+ }
679
713
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
680
714
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
681
715
  {
@@ -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-f118067b.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"],"clientStyling":[1025,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"queryFired":[32],"readyActionsCount":[32],"receivedQueryResponses":[32],"limitStylingAppends":[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"],"clientStyling":[1,"client-styling"],"textContent":[32],"limitStylingAppends":[32]}],[1,"legislation-wrapper",{"activeUserActions":[1,"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-9eef5ef8.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-f118067b.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"],"clientStyling":[1025,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"queryFired":[32],"readyActionsCount":[32],"receivedQueryResponses":[32],"limitStylingAppends":[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"],"clientStyling":[1,"client-styling"],"textContent":[32],"limitStylingAppends":[32]}],[1,"legislation-wrapper",{"activeUserActions":[1,"active-user-actions"],"clientStyling":[1,"client-styling"],"limitStylingAppends":[32]}]]]], options);
17
17
  });
@@ -0,0 +1,2 @@
1
+ import { Config } from '../../../../../../../../../../../stencil-public-runtime';
2
+ export declare const config: Config;
@@ -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,30 @@ 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
+ * Client custom styling via inline style
51
+ */
52
+ clientStyling: string;
53
+ /**
54
+ * Client custom styling via url
55
+ */
56
+ clientStylingUrl: string;
57
+ /**
58
+ * Event emitted when the close button is clicked
59
+ */
60
+ closeButtonEvent: EventEmitter<any>;
36
61
  private consentTitles;
37
62
  /**
38
63
  * Which actions are required in order to activate the "Apply" button. Other actions are considered optional.
@@ -40,16 +65,22 @@ export declare class UserActionController {
40
65
  queryFired: boolean;
41
66
  readyActionsCount: number;
42
67
  receivedQueryResponses: number;
68
+ private limitStylingAppends;
43
69
  private mandatoryActions;
44
70
  private requiredActionsCount;
45
71
  private expectedQueryResponses;
46
72
  private userActions;
73
+ private stylingContainer;
47
74
  determineMandatoryActions(): Promise<void>;
48
75
  handleQueryResponse(): void;
49
76
  updateUserConsents(): void;
50
77
  handleApplyClick(): void;
78
+ handleClose(): void;
51
79
  userLegislationConsentHandler(event: CustomEvent<LegislationConsentEvent>): void;
52
80
  componentWillLoad(): Promise<void>;
81
+ componentDidRender(): void;
82
+ setClientStyling: () => void;
83
+ setClientStylingURL: () => void;
53
84
  render(): any;
54
85
  }
55
86
  export {};
@@ -11,6 +11,14 @@ 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
  */
@@ -19,10 +27,22 @@ export namespace Components {
19
27
  * wether or not to include the submit button (in case we want to compose a different )
20
28
  */
21
29
  "includeSubmitButton": boolean;
30
+ /**
31
+ * Event name to be sent when the button is clicked
32
+ */
33
+ "postMessageEvent": string;
34
+ /**
35
+ * Property used to display the close/cancel button
36
+ */
37
+ "showCloseButton": boolean;
22
38
  /**
23
39
  * the text of the button, if button is enabled
24
40
  */
25
41
  "submitButtonText": string;
42
+ /**
43
+ * Use postMessage event to communicate
44
+ */
45
+ "usePostmessage": boolean;
26
46
  /**
27
47
  * user id required for the update call
28
48
  */
@@ -54,6 +74,14 @@ declare namespace LocalJSX {
54
74
  * which user action widgets are included
55
75
  */
56
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;
57
85
  /**
58
86
  * the endpoint required for the update call
59
87
  */
@@ -62,10 +90,26 @@ declare namespace LocalJSX {
62
90
  * wether or not to include the submit button (in case we want to compose a different )
63
91
  */
64
92
  "includeSubmitButton": boolean;
93
+ /**
94
+ * Event emitted when the close button is clicked
95
+ */
96
+ "onCloseButtonClicked"?: (event: CustomEvent<any>) => void;
97
+ /**
98
+ * Event name to be sent when the button is clicked
99
+ */
100
+ "postMessageEvent"?: string;
101
+ /**
102
+ * Property used to display the close/cancel button
103
+ */
104
+ "showCloseButton": boolean;
65
105
  /**
66
106
  * the text of the button, if button is enabled
67
107
  */
68
108
  "submitButtonText"?: string;
109
+ /**
110
+ * Use postMessage event to communicate
111
+ */
112
+ "usePostmessage": boolean;
69
113
  /**
70
114
  * user id required for the update call
71
115
  */