@everymatrix/user-action-controller 1.15.0 → 1.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{generic-user-consent_3.cjs.entry.js → player-legislation-wrapper_3.cjs.entry.js} +38 -38
- package/dist/cjs/user-action-controller.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +4 -4
- package/dist/collection/components/user-action-controller/user-action-controller.js +3 -3
- package/dist/components/player-legislation-wrapper.js +6 -0
- package/dist/components/{legislation-wrapper2.js → player-legislation-wrapper2.js} +9 -9
- package/dist/components/player-user-consents.js +6 -0
- package/dist/components/{generic-user-consent2.js → player-user-consents2.js} +8 -8
- package/dist/components/user-action-controller.js +6 -6
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{generic-user-consent_3.entry.js → player-legislation-wrapper_3.entry.js} +38 -38
- package/dist/esm/user-action-controller.js +1 -1
- package/dist/types/components/user-action-controller/user-action-controller.d.ts +2 -2
- package/dist/user-action-controller/p-cb43c2db.entry.js +1 -0
- package/dist/user-action-controller/user-action-controller.esm.js +1 -1
- package/package.json +5 -2
- package/dist/components/generic-user-consent.js +0 -6
- package/dist/components/legislation-wrapper.js +0 -6
- package/dist/user-action-controller/p-94fcd363.entry.js +0 -1
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -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([["
|
|
17
|
+
return index.bootstrapLazy([["player-legislation-wrapper_3.cjs",[[1,"user-action-controller",{"endpoint":[513],"userSession":[513,"user-session"],"userId":[513,"user-id"],"includeSubmitButton":[516,"include-submit-button"],"submitButtonText":[513,"submit-button-text"],"userNoticeText":[513,"user-notice-text"],"activeUserActions":[513,"active-user-actions"],"showCloseButton":[516,"show-close-button"],"usePostmessage":[516,"use-postmessage"],"postMessageEvent":[1,"post-message-event"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"queryFired":[32],"readyActionsCount":[32],"receivedQueryResponses":[32],"limitStylingAppends":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[1,"player-legislation-wrapper",{"activeUserActions":[513,"active-user-actions"],"clientStyling":[1,"client-styling"],"limitStylingAppends":[32]}],[1,"player-user-consents",{"queried":[516],"consentType":[513,"consent-type"],"mandatory":[516],"consentTitle":[513,"consent-title"],"tcLink":[513,"tc-link"],"privacyLink":[513,"privacy-link"],"clientStyling":[1,"client-styling"],"textContent":[32],"limitStylingAppends":[32]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
package/dist/cjs/{generic-user-consent_3.cjs.entry.js → player-legislation-wrapper_3.cjs.entry.js}
RENAMED
|
@@ -4,9 +4,41 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-87049e21.js');
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const playerLegislationWrapperCss = ":host{display:block}";
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const PlayerLegislationWrapper = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
index.registerInstance(this, hostRef);
|
|
12
|
+
/**
|
|
13
|
+
* Client custom styling via inline style
|
|
14
|
+
*/
|
|
15
|
+
this.clientStyling = '';
|
|
16
|
+
this.limitStylingAppends = false;
|
|
17
|
+
this.setClientStyling = () => {
|
|
18
|
+
let sheet = document.createElement('style');
|
|
19
|
+
sheet.innerHTML = this.clientStyling;
|
|
20
|
+
this.stylingContainer.prepend(sheet);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
componentDidRender() {
|
|
24
|
+
// start custom styling area
|
|
25
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
26
|
+
if (this.clientStyling)
|
|
27
|
+
this.setClientStyling();
|
|
28
|
+
this.limitStylingAppends = true;
|
|
29
|
+
}
|
|
30
|
+
// end custom styling area
|
|
31
|
+
}
|
|
32
|
+
render() {
|
|
33
|
+
const activeUAList = this.activeUserActions.replace(/ /g, '').split(',');
|
|
34
|
+
return (index.h("div", { class: "PlayerLegislationWrapper", ref: el => this.stylingContainer = el }, activeUAList.map(action => (index.h("slot", { name: action })))));
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
PlayerLegislationWrapper.style = playerLegislationWrapperCss;
|
|
38
|
+
|
|
39
|
+
const playerUserConsentsCss = ":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}";
|
|
40
|
+
|
|
41
|
+
const PlayerUserConsents = class {
|
|
10
42
|
constructor(hostRef) {
|
|
11
43
|
index.registerInstance(this, hostRef);
|
|
12
44
|
this.userLegislationConsent = index.createEvent(this, "userLegislationConsent", 7);
|
|
@@ -88,39 +120,7 @@ const GenericUserConsent = class {
|
|
|
88
120
|
return (index.h("div", { ref: el => this.stylingContainer = el }, index.h("p", { class: "ConsentTitle" }, this.consentTitle), index.h("label", { class: "userConsent", htmlFor: "userConsent" }, index.h("input", { ref: el => this.checkboxInput = el, id: "userConsent", type: "checkbox", onInput: () => this.userLegislationConsentHandler() }), this.textContent, this.mandatory && index.h("span", { class: "MandatoryItem" }, "*"))));
|
|
89
121
|
}
|
|
90
122
|
};
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const legislationWrapperCss = ":host{display:block}";
|
|
94
|
-
|
|
95
|
-
const LegislationWrapper = class {
|
|
96
|
-
constructor(hostRef) {
|
|
97
|
-
index.registerInstance(this, hostRef);
|
|
98
|
-
/**
|
|
99
|
-
* Client custom styling via inline style
|
|
100
|
-
*/
|
|
101
|
-
this.clientStyling = '';
|
|
102
|
-
this.limitStylingAppends = false;
|
|
103
|
-
this.setClientStyling = () => {
|
|
104
|
-
let sheet = document.createElement('style');
|
|
105
|
-
sheet.innerHTML = this.clientStyling;
|
|
106
|
-
this.stylingContainer.prepend(sheet);
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
componentDidRender() {
|
|
110
|
-
// start custom styling area
|
|
111
|
-
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
112
|
-
if (this.clientStyling)
|
|
113
|
-
this.setClientStyling();
|
|
114
|
-
this.limitStylingAppends = true;
|
|
115
|
-
}
|
|
116
|
-
// end custom styling area
|
|
117
|
-
}
|
|
118
|
-
render() {
|
|
119
|
-
const activeUAList = this.activeUserActions.replace(/ /g, '').split(',');
|
|
120
|
-
return (index.h("div", { class: "LegislationWrapper", ref: el => this.stylingContainer = el }, activeUAList.map(action => (index.h("slot", { name: action })))));
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
LegislationWrapper.style = legislationWrapperCss;
|
|
123
|
+
PlayerUserConsents.style = playerUserConsentsCss;
|
|
124
124
|
|
|
125
125
|
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}}";
|
|
126
126
|
|
|
@@ -273,7 +273,7 @@ const UserActionController = class {
|
|
|
273
273
|
this.requiredActionsCount = activeUAList.filter(action => this.mandatoryActions.includes(action)).length;
|
|
274
274
|
this.expectedQueryResponses = activeUAList.length;
|
|
275
275
|
return (index.h("div", { class: "QueryReferenceContainer", ref: el => this.stylingContainer = el }, index.h("div", { class: "UserActionController" }, this.showCloseButton &&
|
|
276
|
-
index.h("div", { class: "CloseButton", onClick: () => this.handleClose() }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "25", height: "25", fill: "currentColor", viewBox: "0 0 16 16" }, index.h("path", { d: "M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z" }))), index.h("h2", { class: "UserConsentNotice" }, this.userNoticeText), index.h("legislation-wrapper", { "active-user-actions": this.activeUserActions, "client-styling": this.clientStyling }, activeUAList.map(item => (index.h("
|
|
276
|
+
index.h("div", { class: "CloseButton", onClick: () => this.handleClose() }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "25", height: "25", fill: "currentColor", viewBox: "0 0 16 16" }, index.h("path", { d: "M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z" }))), index.h("h2", { class: "UserConsentNotice" }, this.userNoticeText), index.h("player-legislation-wrapper", { "active-user-actions": this.activeUserActions, "client-styling": this.clientStyling }, activeUAList.map(item => (index.h("player-user-consents", { slot: item, consentType: item, consentTitle: this.consentTitles[item], queried: this.queryFired, mandatory: this.mandatoryActions.includes(item), "client-styling": this.clientStyling })))), this.includeSubmitButton &&
|
|
277
277
|
index.h("button", { class: "ConsentSubmitButton", disabled: this.readyActionsCount === this.requiredActionsCount ? false : true, onClick: () => this.handleApplyClick() }, this.submitButtonText))));
|
|
278
278
|
}
|
|
279
279
|
static get watchers() { return {
|
|
@@ -282,6 +282,6 @@ const UserActionController = class {
|
|
|
282
282
|
};
|
|
283
283
|
UserActionController.style = userActionControllerCss;
|
|
284
284
|
|
|
285
|
-
exports.
|
|
286
|
-
exports.
|
|
285
|
+
exports.player_legislation_wrapper = PlayerLegislationWrapper;
|
|
286
|
+
exports.player_user_consents = PlayerUserConsents;
|
|
287
287
|
exports.user_action_controller = UserActionController;
|
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["
|
|
18
|
+
return index.bootstrapLazy([["player-legislation-wrapper_3.cjs",[[1,"user-action-controller",{"endpoint":[513],"userSession":[513,"user-session"],"userId":[513,"user-id"],"includeSubmitButton":[516,"include-submit-button"],"submitButtonText":[513,"submit-button-text"],"userNoticeText":[513,"user-notice-text"],"activeUserActions":[513,"active-user-actions"],"showCloseButton":[516,"show-close-button"],"usePostmessage":[516,"use-postmessage"],"postMessageEvent":[1,"post-message-event"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"queryFired":[32],"readyActionsCount":[32],"receivedQueryResponses":[32],"limitStylingAppends":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[1,"player-legislation-wrapper",{"activeUserActions":[513,"active-user-actions"],"clientStyling":[1,"client-styling"],"limitStylingAppends":[32]}],[1,"player-user-consents",{"queried":[516],"consentType":[513,"consent-type"],"mandatory":[516],"consentTitle":[513,"consent-title"],"tcLink":[513,"tc-link"],"privacyLink":[513,"privacy-link"],"clientStyling":[1,"client-styling"],"textContent":[32],"limitStylingAppends":[32]}]]]], options);
|
|
19
19
|
});
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
},
|
|
10
10
|
"collections": [
|
|
11
11
|
{
|
|
12
|
-
"name": "@everymatrix/
|
|
12
|
+
"name": "@everymatrix/player-legislation-wrapper",
|
|
13
13
|
"tags": [
|
|
14
|
-
"
|
|
14
|
+
"player-legislation-wrapper"
|
|
15
15
|
]
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
"name": "@everymatrix/
|
|
18
|
+
"name": "@everymatrix/player-user-consents",
|
|
19
19
|
"tags": [
|
|
20
|
-
"
|
|
20
|
+
"player-user-consents"
|
|
21
21
|
]
|
|
22
22
|
}
|
|
23
23
|
],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component, h, Prop, Listen, State, Watch, Event } from '@stencil/core';
|
|
2
|
-
import '@everymatrix/legislation-wrapper';
|
|
3
|
-
import '@everymatrix/
|
|
2
|
+
import '@everymatrix/player-legislation-wrapper';
|
|
3
|
+
import '@everymatrix/player-user-consents';
|
|
4
4
|
export class UserActionController {
|
|
5
5
|
constructor() {
|
|
6
6
|
/**
|
|
@@ -154,7 +154,7 @@ export class UserActionController {
|
|
|
154
154
|
h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "25", height: "25", fill: "currentColor", viewBox: "0 0 16 16" },
|
|
155
155
|
h("path", { d: "M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z" }))),
|
|
156
156
|
h("h2", { class: "UserConsentNotice" }, this.userNoticeText),
|
|
157
|
-
h("legislation-wrapper", { "active-user-actions": this.activeUserActions, "client-styling": this.clientStyling }, activeUAList.map(item => (h("
|
|
157
|
+
h("player-legislation-wrapper", { "active-user-actions": this.activeUserActions, "client-styling": this.clientStyling }, activeUAList.map(item => (h("player-user-consents", { slot: item, consentType: item, consentTitle: this.consentTitles[item], queried: this.queryFired, mandatory: this.mandatoryActions.includes(item), "client-styling": this.clientStyling })))),
|
|
158
158
|
this.includeSubmitButton &&
|
|
159
159
|
h("button", { class: "ConsentSubmitButton", disabled: this.readyActionsCount === this.requiredActionsCount ? false : true, onClick: () => this.handleApplyClick() }, this.submitButtonText))));
|
|
160
160
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { P as PlayerLegislationWrapper$1, d as defineCustomElement$1 } from './player-legislation-wrapper2.js';
|
|
2
|
+
|
|
3
|
+
const PlayerLegislationWrapper = PlayerLegislationWrapper$1;
|
|
4
|
+
const defineCustomElement = defineCustomElement$1;
|
|
5
|
+
|
|
6
|
+
export { PlayerLegislationWrapper, defineCustomElement };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const playerLegislationWrapperCss = ":host{display:block}";
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const PlayerLegislationWrapper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
6
|
constructor() {
|
|
7
7
|
super();
|
|
8
8
|
this.__registerHost();
|
|
@@ -29,10 +29,10 @@ const LegislationWrapper = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
29
29
|
}
|
|
30
30
|
render() {
|
|
31
31
|
const activeUAList = this.activeUserActions.replace(/ /g, '').split(',');
|
|
32
|
-
return (h("div", { class: "
|
|
32
|
+
return (h("div", { class: "PlayerLegislationWrapper", ref: el => this.stylingContainer = el }, activeUAList.map(action => (h("slot", { name: action })))));
|
|
33
33
|
}
|
|
34
|
-
static get style() { return
|
|
35
|
-
}, [1, "legislation-wrapper", {
|
|
34
|
+
static get style() { return playerLegislationWrapperCss; }
|
|
35
|
+
}, [1, "player-legislation-wrapper", {
|
|
36
36
|
"activeUserActions": [513, "active-user-actions"],
|
|
37
37
|
"clientStyling": [1, "client-styling"],
|
|
38
38
|
"limitStylingAppends": [32]
|
|
@@ -41,14 +41,14 @@ function defineCustomElement() {
|
|
|
41
41
|
if (typeof customElements === "undefined") {
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
|
-
const components = ["legislation-wrapper"];
|
|
44
|
+
const components = ["player-legislation-wrapper"];
|
|
45
45
|
components.forEach(tagName => { switch (tagName) {
|
|
46
|
-
case "legislation-wrapper":
|
|
46
|
+
case "player-legislation-wrapper":
|
|
47
47
|
if (!customElements.get(tagName)) {
|
|
48
|
-
customElements.define(tagName,
|
|
48
|
+
customElements.define(tagName, PlayerLegislationWrapper);
|
|
49
49
|
}
|
|
50
50
|
break;
|
|
51
51
|
} });
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
export {
|
|
54
|
+
export { PlayerLegislationWrapper as P, defineCustomElement as d };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const playerUserConsentsCss = ":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
|
|
|
5
|
-
const
|
|
5
|
+
const PlayerUserConsents = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
6
|
constructor() {
|
|
7
7
|
super();
|
|
8
8
|
this.__registerHost();
|
|
@@ -85,8 +85,8 @@ const GenericUserConsent = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
85
85
|
this.textContent = this.determineTextContent();
|
|
86
86
|
return (h("div", { ref: el => this.stylingContainer = el }, h("p", { class: "ConsentTitle" }, this.consentTitle), h("label", { class: "userConsent", htmlFor: "userConsent" }, h("input", { ref: el => this.checkboxInput = el, id: "userConsent", type: "checkbox", onInput: () => this.userLegislationConsentHandler() }), this.textContent, this.mandatory && h("span", { class: "MandatoryItem" }, "*"))));
|
|
87
87
|
}
|
|
88
|
-
static get style() { return
|
|
89
|
-
}, [1, "
|
|
88
|
+
static get style() { return playerUserConsentsCss; }
|
|
89
|
+
}, [1, "player-user-consents", {
|
|
90
90
|
"queried": [516],
|
|
91
91
|
"consentType": [513, "consent-type"],
|
|
92
92
|
"mandatory": [516],
|
|
@@ -101,14 +101,14 @@ function defineCustomElement() {
|
|
|
101
101
|
if (typeof customElements === "undefined") {
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
-
const components = ["
|
|
104
|
+
const components = ["player-user-consents"];
|
|
105
105
|
components.forEach(tagName => { switch (tagName) {
|
|
106
|
-
case "
|
|
106
|
+
case "player-user-consents":
|
|
107
107
|
if (!customElements.get(tagName)) {
|
|
108
|
-
customElements.define(tagName,
|
|
108
|
+
customElements.define(tagName, PlayerUserConsents);
|
|
109
109
|
}
|
|
110
110
|
break;
|
|
111
111
|
} });
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
export {
|
|
114
|
+
export { PlayerUserConsents as P, defineCustomElement as d };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import { d as defineCustomElement$3 } from './
|
|
3
|
-
import { d as defineCustomElement$2 } from './
|
|
2
|
+
import { d as defineCustomElement$3 } from './player-legislation-wrapper2.js';
|
|
3
|
+
import { d as defineCustomElement$2 } from './player-user-consents2.js';
|
|
4
4
|
|
|
5
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
|
|
|
@@ -155,7 +155,7 @@ const UserActionController$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
|
|
|
155
155
|
this.requiredActionsCount = activeUAList.filter(action => this.mandatoryActions.includes(action)).length;
|
|
156
156
|
this.expectedQueryResponses = activeUAList.length;
|
|
157
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("
|
|
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("player-legislation-wrapper", { "active-user-actions": this.activeUserActions, "client-styling": this.clientStyling }, activeUAList.map(item => (h("player-user-consents", { slot: item, consentType: item, consentTitle: this.consentTitles[item], queried: this.queryFired, mandatory: this.mandatoryActions.includes(item), "client-styling": this.clientStyling })))), this.includeSubmitButton &&
|
|
159
159
|
h("button", { class: "ConsentSubmitButton", disabled: this.readyActionsCount === this.requiredActionsCount ? false : true, onClick: () => this.handleApplyClick() }, this.submitButtonText))));
|
|
160
160
|
}
|
|
161
161
|
static get watchers() { return {
|
|
@@ -184,19 +184,19 @@ function defineCustomElement$1() {
|
|
|
184
184
|
if (typeof customElements === "undefined") {
|
|
185
185
|
return;
|
|
186
186
|
}
|
|
187
|
-
const components = ["user-action-controller", "
|
|
187
|
+
const components = ["user-action-controller", "player-legislation-wrapper", "player-user-consents"];
|
|
188
188
|
components.forEach(tagName => { switch (tagName) {
|
|
189
189
|
case "user-action-controller":
|
|
190
190
|
if (!customElements.get(tagName)) {
|
|
191
191
|
customElements.define(tagName, UserActionController$1);
|
|
192
192
|
}
|
|
193
193
|
break;
|
|
194
|
-
case "
|
|
194
|
+
case "player-legislation-wrapper":
|
|
195
195
|
if (!customElements.get(tagName)) {
|
|
196
196
|
defineCustomElement$3();
|
|
197
197
|
}
|
|
198
198
|
break;
|
|
199
|
-
case "
|
|
199
|
+
case "player-user-consents":
|
|
200
200
|
if (!customElements.get(tagName)) {
|
|
201
201
|
defineCustomElement$2();
|
|
202
202
|
}
|
package/dist/esm/loader.js
CHANGED
|
@@ -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([["
|
|
13
|
+
return bootstrapLazy([["player-legislation-wrapper_3",[[1,"user-action-controller",{"endpoint":[513],"userSession":[513,"user-session"],"userId":[513,"user-id"],"includeSubmitButton":[516,"include-submit-button"],"submitButtonText":[513,"submit-button-text"],"userNoticeText":[513,"user-notice-text"],"activeUserActions":[513,"active-user-actions"],"showCloseButton":[516,"show-close-button"],"usePostmessage":[516,"use-postmessage"],"postMessageEvent":[1,"post-message-event"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"queryFired":[32],"readyActionsCount":[32],"receivedQueryResponses":[32],"limitStylingAppends":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[1,"player-legislation-wrapper",{"activeUserActions":[513,"active-user-actions"],"clientStyling":[1,"client-styling"],"limitStylingAppends":[32]}],[1,"player-user-consents",{"queried":[516],"consentType":[513,"consent-type"],"mandatory":[516],"consentTitle":[513,"consent-title"],"tcLink":[513,"tc-link"],"privacyLink":[513,"privacy-link"],"clientStyling":[1,"client-styling"],"textContent":[32],"limitStylingAppends":[32]}]]]], options);
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -1,8 +1,40 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent
|
|
1
|
+
import { r as registerInstance, h, c as createEvent } from './index-71f14530.js';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const playerLegislationWrapperCss = ":host{display:block}";
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const PlayerLegislationWrapper = class {
|
|
6
|
+
constructor(hostRef) {
|
|
7
|
+
registerInstance(this, hostRef);
|
|
8
|
+
/**
|
|
9
|
+
* Client custom styling via inline style
|
|
10
|
+
*/
|
|
11
|
+
this.clientStyling = '';
|
|
12
|
+
this.limitStylingAppends = false;
|
|
13
|
+
this.setClientStyling = () => {
|
|
14
|
+
let sheet = document.createElement('style');
|
|
15
|
+
sheet.innerHTML = this.clientStyling;
|
|
16
|
+
this.stylingContainer.prepend(sheet);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
componentDidRender() {
|
|
20
|
+
// start custom styling area
|
|
21
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
22
|
+
if (this.clientStyling)
|
|
23
|
+
this.setClientStyling();
|
|
24
|
+
this.limitStylingAppends = true;
|
|
25
|
+
}
|
|
26
|
+
// end custom styling area
|
|
27
|
+
}
|
|
28
|
+
render() {
|
|
29
|
+
const activeUAList = this.activeUserActions.replace(/ /g, '').split(',');
|
|
30
|
+
return (h("div", { class: "PlayerLegislationWrapper", ref: el => this.stylingContainer = el }, activeUAList.map(action => (h("slot", { name: action })))));
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
PlayerLegislationWrapper.style = playerLegislationWrapperCss;
|
|
34
|
+
|
|
35
|
+
const playerUserConsentsCss = ":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}";
|
|
36
|
+
|
|
37
|
+
const PlayerUserConsents = class {
|
|
6
38
|
constructor(hostRef) {
|
|
7
39
|
registerInstance(this, hostRef);
|
|
8
40
|
this.userLegislationConsent = createEvent(this, "userLegislationConsent", 7);
|
|
@@ -84,39 +116,7 @@ const GenericUserConsent = class {
|
|
|
84
116
|
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" }, "*"))));
|
|
85
117
|
}
|
|
86
118
|
};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const legislationWrapperCss = ":host{display:block}";
|
|
90
|
-
|
|
91
|
-
const LegislationWrapper = class {
|
|
92
|
-
constructor(hostRef) {
|
|
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
|
|
113
|
-
}
|
|
114
|
-
render() {
|
|
115
|
-
const activeUAList = this.activeUserActions.replace(/ /g, '').split(',');
|
|
116
|
-
return (h("div", { class: "LegislationWrapper", ref: el => this.stylingContainer = el }, activeUAList.map(action => (h("slot", { name: action })))));
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
LegislationWrapper.style = legislationWrapperCss;
|
|
119
|
+
PlayerUserConsents.style = playerUserConsentsCss;
|
|
120
120
|
|
|
121
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}}";
|
|
122
122
|
|
|
@@ -269,7 +269,7 @@ const UserActionController = class {
|
|
|
269
269
|
this.requiredActionsCount = activeUAList.filter(action => this.mandatoryActions.includes(action)).length;
|
|
270
270
|
this.expectedQueryResponses = activeUAList.length;
|
|
271
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("
|
|
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("player-legislation-wrapper", { "active-user-actions": this.activeUserActions, "client-styling": this.clientStyling }, activeUAList.map(item => (h("player-user-consents", { slot: item, consentType: item, consentTitle: this.consentTitles[item], queried: this.queryFired, mandatory: this.mandatoryActions.includes(item), "client-styling": this.clientStyling })))), this.includeSubmitButton &&
|
|
273
273
|
h("button", { class: "ConsentSubmitButton", disabled: this.readyActionsCount === this.requiredActionsCount ? false : true, onClick: () => this.handleApplyClick() }, this.submitButtonText))));
|
|
274
274
|
}
|
|
275
275
|
static get watchers() { return {
|
|
@@ -278,4 +278,4 @@ const UserActionController = class {
|
|
|
278
278
|
};
|
|
279
279
|
UserActionController.style = userActionControllerCss;
|
|
280
280
|
|
|
281
|
-
export {
|
|
281
|
+
export { PlayerLegislationWrapper as player_legislation_wrapper, PlayerUserConsents as player_user_consents, UserActionController as user_action_controller };
|
|
@@ -13,5 +13,5 @@ const patchBrowser = () => {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
patchBrowser().then(options => {
|
|
16
|
-
return bootstrapLazy([["
|
|
16
|
+
return bootstrapLazy([["player-legislation-wrapper_3",[[1,"user-action-controller",{"endpoint":[513],"userSession":[513,"user-session"],"userId":[513,"user-id"],"includeSubmitButton":[516,"include-submit-button"],"submitButtonText":[513,"submit-button-text"],"userNoticeText":[513,"user-notice-text"],"activeUserActions":[513,"active-user-actions"],"showCloseButton":[516,"show-close-button"],"usePostmessage":[516,"use-postmessage"],"postMessageEvent":[1,"post-message-event"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"queryFired":[32],"readyActionsCount":[32],"receivedQueryResponses":[32],"limitStylingAppends":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[1,"player-legislation-wrapper",{"activeUserActions":[513,"active-user-actions"],"clientStyling":[1,"client-styling"],"limitStylingAppends":[32]}],[1,"player-user-consents",{"queried":[516],"consentType":[513,"consent-type"],"mandatory":[516],"consentTitle":[513,"consent-title"],"tcLink":[513,"tc-link"],"privacyLink":[513,"privacy-link"],"clientStyling":[1,"client-styling"],"textContent":[32],"limitStylingAppends":[32]}]]]], options);
|
|
17
17
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
-
import '@everymatrix/legislation-wrapper';
|
|
3
|
-
import '@everymatrix/
|
|
2
|
+
import '@everymatrix/player-legislation-wrapper';
|
|
3
|
+
import '@everymatrix/player-user-consents';
|
|
4
4
|
interface LegislationConsentEvent {
|
|
5
5
|
type: string;
|
|
6
6
|
value: boolean | string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as s,c as e}from"./p-ba444709.js";const i=class{constructor(s){t(this,s),this.clientStyling="",this.limitStylingAppends=!1,this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)}}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.limitStylingAppends=!0)}render(){const t=this.activeUserActions.replace(/ /g,"").split(",");return s("div",{class:"PlayerLegislationWrapper",ref:t=>this.stylingContainer=t},t.map((t=>s("slot",{name:t}))))}};i.style=":host{display:block}";const n=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.clientStyling="",this.textContent="",this.limitStylingAppends=!1,this.stringVariants={termsandconditions1:"I accept the ",termsandconditions2:", I have read and understood the ",termsandconditions3:" as published on this site and confirm that I am over 18 years old.",tc:"Terms and Conditions",privacy:"Privacy Policy",sms:"I consent to receive marketing communication via SMS.",emailmarketing:"I consent to receive marketing communication via Email."},this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)}}determineTextContent(){return"termsandconditions"===this.consentType?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})}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.limitStylingAppends=!0)}render(){return this.queried&&this.userLegislationConsentHandler(),this.textContent=this.determineTextContent(),s("div",{ref:t=>this.stylingContainer=t},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"},"*")))}};n.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 o=class{constructor(s){t(this,s),this.closeButtonEvent=e(this,"closeButtonClicked",7),this.postMessageEvent="closeButtonClicked",this.clientStyling="",this.clientStylingUrl="",this.consentTitles={termsandconditions:"Terms and Conditions",sms:"SMS marketing",emailmarketing:"Email marketing"},this.queryFired=!1,this.readyActionsCount=0,this.receivedQueryResponses=0,this.limitStylingAppends=!1,this.mandatoryActions=["termsandconditions"],this.requiredActionsCount=0,this.expectedQueryResponses=0,this.userActions=[],this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)},this.setClientStylingURL=()=>{let t=new URL(this.clientStylingUrl),s=document.createElement("style");fetch(t.href).then((t=>t.text())).then((t=>{this.clientStyling=t,s.innerHTML=t,setTimeout((()=>{this.stylingContainer.prepend(s)}),1)})).catch((t=>{console.log("error ",t)}))}}determineMandatoryActions(){let t=new URL(`${this.endpoint}v1/player/consentRequirements`);return fetch(t.href).then((t=>t.json())).then((t=>{t.items.forEach((t=>{t.mustAccept&&this.mandatoryActions.push(t.tagCode)}))}))}handleQueryResponse(){this.receivedQueryResponses===this.expectedQueryResponses&&this.updateUserConsents()}updateUserConsents(){const t=new URL(`${this.endpoint}v1/player/${this.userId}/consent`);let s={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-SessionId":`${this.userSession}`},body:JSON.stringify({items:this.userActions})};fetch(t.href,s).then((t=>t.json())).then((()=>{window.postMessage({type:"WidgetNotification",data:{type:"success",message:"Consent update successfull!"}},window.location.href)})).catch((t=>{window.postMessage({type:"WidgetNotification",data:{type:"error",message:"Server might not be responding",err:t}},window.location.href)})).finally((()=>{window.postMessage({type:"UserActionsCompleted"},window.location.href)}))}handleApplyClick(){this.queryFired=!0}handleClose(){this.usePostmessage&&window.postMessage({type:this.postMessageEvent}),this.closeButtonEvent.emit()}userLegislationConsentHandler(t){this.mandatoryActions.includes(t.detail.type)&&(t.detail.value?this.readyActionsCount++:this.readyActionsCount--),this.queryFired&&(this.userActions.push({tagCode:t.detail.type,status:t.detail.value?"Accepted":"Denied"}),this.receivedQueryResponses++)}componentWillLoad(){return this.determineMandatoryActions()}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}render(){const t=this.activeUserActions.replace(/ /g,"").split(",");return this.requiredActionsCount=t.filter((t=>this.mandatoryActions.includes(t))).length,this.expectedQueryResponses=t.length,s("div",{class:"QueryReferenceContainer",ref:t=>this.stylingContainer=t},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("player-legislation-wrapper",{"active-user-actions":this.activeUserActions,"client-styling":this.clientStyling},t.map((t=>s("player-user-consents",{slot:t,consentType:t,consentTitle:this.consentTitles[t],queried:this.queryFired,mandatory:this.mandatoryActions.includes(t),"client-styling":this.clientStyling})))),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 player_legislation_wrapper,n as player_user_consents,o as user_action_controller}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,b as e}from"./p-ba444709.js";(()=>{const e=import.meta.url,n={};return""!==e&&(n.resourcesUrl=new URL(".",e).href),t(n)})().then((t=>e([["p-
|
|
1
|
+
import{p as t,b as e}from"./p-ba444709.js";(()=>{const e=import.meta.url,n={};return""!==e&&(n.resourcesUrl=new URL(".",e).href),t(n)})().then((t=>e([["p-cb43c2db",[[1,"user-action-controller",{endpoint:[513],userSession:[513,"user-session"],userId:[513,"user-id"],includeSubmitButton:[516,"include-submit-button"],submitButtonText:[513,"submit-button-text"],userNoticeText:[513,"user-notice-text"],activeUserActions:[513,"active-user-actions"],showCloseButton:[516,"show-close-button"],usePostmessage:[516,"use-postmessage"],postMessageEvent:[1,"post-message-event"],clientStyling:[1537,"client-styling"],clientStylingUrl:[513,"client-styling-url"],queryFired:[32],readyActionsCount:[32],receivedQueryResponses:[32],limitStylingAppends:[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[1,"player-legislation-wrapper",{activeUserActions:[513,"active-user-actions"],clientStyling:[1,"client-styling"],limitStylingAppends:[32]}],[1,"player-user-consents",{queried:[516],consentType:[513,"consent-type"],mandatory:[516],consentTitle:[513,"consent-title"],tcLink:[513,"tc-link"],privacyLink:[513,"privacy-link"],clientStyling:[1,"client-styling"],textContent:[32],limitStylingAppends:[32]}]]]],t)));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@everymatrix/user-action-controller",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.1",
|
|
4
4
|
"main": "./dist/index.cjs.js",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"es2015": "./dist/esm/index.mjs",
|
|
@@ -12,5 +12,8 @@
|
|
|
12
12
|
"files": [
|
|
13
13
|
"dist/",
|
|
14
14
|
"loader/"
|
|
15
|
-
]
|
|
15
|
+
],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
}
|
|
16
19
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as s,h as e}from"./p-ba444709.js";const i=class{constructor(e){t(this,e),this.userLegislationConsent=s(this,"userLegislationConsent",7),this.queried=!1,this.consentType="",this.mandatory=!1,this.consentTitle="",this.tcLink="#",this.privacyLink="#",this.clientStyling="",this.textContent="",this.limitStylingAppends=!1,this.stringVariants={termsandconditions1:"I accept the ",termsandconditions2:", I have read and understood the ",termsandconditions3:" as published on this site and confirm that I am over 18 years old.",tc:"Terms and Conditions",privacy:"Privacy Policy",sms:"I consent to receive marketing communication via SMS.",emailmarketing:"I consent to receive marketing communication via Email."},this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)}}determineTextContent(){return"termsandconditions"===this.consentType?e("span",null,this.stringVariants.termsandconditions1,e("a",{href:this.tcLink},this.stringVariants.tc),this.stringVariants.termsandconditions2,e("a",{href:this.privacyLink},this.stringVariants.privacy),this.stringVariants.termsandconditions3):e("span",null,this.stringVariants[this.consentType])}userLegislationConsentHandler(){this.userLegislationConsent.emit({type:this.consentType,value:this.checkboxInput.checked})}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.limitStylingAppends=!0)}render(){return this.queried&&this.userLegislationConsentHandler(),this.textContent=this.determineTextContent(),e("div",{ref:t=>this.stylingContainer=t},e("p",{class:"ConsentTitle"},this.consentTitle),e("label",{class:"userConsent",htmlFor:"userConsent"},e("input",{ref:t=>this.checkboxInput=t,id:"userConsent",type:"checkbox",onInput:()=>this.userLegislationConsentHandler()}),this.textContent,this.mandatory&&e("span",{class:"MandatoryItem"},"*")))}};i.style=":host{display:block}.ConsentTitle{margin-bottom:0.2rem;font-weight:600}.userConsent:hover{border-bottom:1px solid #000;cursor:pointer}.MandatoryItem{color:#f00;font-size:1.2rem}";const n=class{constructor(s){t(this,s),this.clientStyling="",this.limitStylingAppends=!1,this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)}}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.limitStylingAppends=!0)}render(){const t=this.activeUserActions.replace(/ /g,"").split(",");return e("div",{class:"LegislationWrapper",ref:t=>this.stylingContainer=t},t.map((t=>e("slot",{name:t}))))}};n.style=":host{display:block}";const o=class{constructor(e){t(this,e),this.closeButtonEvent=s(this,"closeButtonClicked",7),this.postMessageEvent="closeButtonClicked",this.clientStyling="",this.clientStylingUrl="",this.consentTitles={termsandconditions:"Terms and Conditions",sms:"SMS marketing",emailmarketing:"Email marketing"},this.queryFired=!1,this.readyActionsCount=0,this.receivedQueryResponses=0,this.limitStylingAppends=!1,this.mandatoryActions=["termsandconditions"],this.requiredActionsCount=0,this.expectedQueryResponses=0,this.userActions=[],this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)},this.setClientStylingURL=()=>{let t=new URL(this.clientStylingUrl),s=document.createElement("style");fetch(t.href).then((t=>t.text())).then((t=>{this.clientStyling=t,s.innerHTML=t,setTimeout((()=>{this.stylingContainer.prepend(s)}),1)})).catch((t=>{console.log("error ",t)}))}}determineMandatoryActions(){let t=new URL(`${this.endpoint}v1/player/consentRequirements`);return fetch(t.href).then((t=>t.json())).then((t=>{t.items.forEach((t=>{t.mustAccept&&this.mandatoryActions.push(t.tagCode)}))}))}handleQueryResponse(){this.receivedQueryResponses===this.expectedQueryResponses&&this.updateUserConsents()}updateUserConsents(){const t=new URL(`${this.endpoint}v1/player/${this.userId}/consent`);let s={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-SessionId":`${this.userSession}`},body:JSON.stringify({items:this.userActions})};fetch(t.href,s).then((t=>t.json())).then((()=>{window.postMessage({type:"WidgetNotification",data:{type:"success",message:"Consent update successfull!"}},window.location.href)})).catch((t=>{window.postMessage({type:"WidgetNotification",data:{type:"error",message:"Server might not be responding",err:t}},window.location.href)})).finally((()=>{window.postMessage({type:"UserActionsCompleted"},window.location.href)}))}handleApplyClick(){this.queryFired=!0}handleClose(){this.usePostmessage&&window.postMessage({type:this.postMessageEvent}),this.closeButtonEvent.emit()}userLegislationConsentHandler(t){this.mandatoryActions.includes(t.detail.type)&&(t.detail.value?this.readyActionsCount++:this.readyActionsCount--),this.queryFired&&(this.userActions.push({tagCode:t.detail.type,status:t.detail.value?"Accepted":"Denied"}),this.receivedQueryResponses++)}componentWillLoad(){return this.determineMandatoryActions()}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}render(){const t=this.activeUserActions.replace(/ /g,"").split(",");return this.requiredActionsCount=t.filter((t=>this.mandatoryActions.includes(t))).length,this.expectedQueryResponses=t.length,e("div",{class:"QueryReferenceContainer",ref:t=>this.stylingContainer=t},e("div",{class:"UserActionController"},this.showCloseButton&&e("div",{class:"CloseButton",onClick:()=>this.handleClose()},e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",fill:"currentColor",viewBox:"0 0 16 16"},e("path",{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"}))),e("h2",{class:"UserConsentNotice"},this.userNoticeText),e("legislation-wrapper",{"active-user-actions":this.activeUserActions,"client-styling":this.clientStyling},t.map((t=>e("generic-user-consent",{slot:t,consentType:t,consentTitle:this.consentTitles[t],queried:this.queryFired,mandatory:this.mandatoryActions.includes(t),"client-styling":this.clientStyling})))),this.includeSubmitButton&&e("button",{class:"ConsentSubmitButton",disabled:this.readyActionsCount!==this.requiredActionsCount,onClick:()=>this.handleApplyClick()},this.submitButtonText)))}static get watchers(){return{receivedQueryResponses:["handleQueryResponse"]}}};o.style=":host{display:block}.QueryReferenceContainer{height:100%;width:100%}.UserConsentNotice{font-size:1.2rem;font-weight:200;text-align:center}.CloseButton{width:25px;height:25px;align-self:flex-end}.UserActionController{font-family:Arial, Helvetica, sans-serif;font-weight:100;height:100%;width:100%;padding:1rem 1.5rem 2rem;background-color:#fff;display:flex;flex-direction:column;justify-content:space-between;border-radius:5%}.ConsentSubmitButton{font-size:1rem;padding:0.4rem 1.4rem;background:#fff;border:2px solid #000;color:#000;border-radius:5px;align-self:flex-end}.ConsentSubmitButton:disabled{border:2px solid #ccc;color:#ccc}@media screen and (max-width: 320px){.QueryReferenceContainer{font-size:0.8rem;color:blue}}";export{i as generic_user_consent,n as legislation_wrapper,o as user_action_controller}
|