@everymatrix/user-action-controller 1.27.10 → 1.28.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.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{player-legislation-wrapper_3.cjs.entry.js → player-user-consents_2.cjs.entry.js} +112 -70
- package/dist/cjs/user-action-controller.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +0 -6
- package/dist/collection/components/user-action-controller/user-action-controller.js +89 -60
- package/dist/collection/utils/locale.utils.js +60 -0
- package/dist/components/user-action-controller.js +120 -48
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{player-legislation-wrapper_3.entry.js → player-user-consents_2.entry.js} +114 -71
- package/dist/esm/user-action-controller.js +1 -1
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/user-action-controller/.stencil/packages/user-action-controller/stencil.config.d.ts +2 -0
- package/dist/types/components/user-action-controller/user-action-controller.d.ts +13 -10
- package/dist/types/components.d.ts +16 -8
- package/dist/types/utils/locale.utils.d.ts +2 -0
- package/dist/user-action-controller/p-711fa494.entry.js +1 -0
- package/dist/user-action-controller/user-action-controller.esm.js +1 -1
- package/package.json +1 -1
- package/dist/components/player-legislation-wrapper.js +0 -6
- package/dist/components/player-legislation-wrapper2.js +0 -54
- package/dist/types/Users/dragos.bodea/Documents/everymatrix-prjs/emfe-widgets/widgets-stencil/packages/user-action-controller/.stencil/packages/user-action-controller/stencil.config.d.ts +0 -2
- package/dist/user-action-controller/p-073a0fe2.entry.js +0 -1
|
@@ -7,10 +7,6 @@
|
|
|
7
7
|
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
8
8
|
export namespace Components {
|
|
9
9
|
interface UserActionController {
|
|
10
|
-
/**
|
|
11
|
-
* which user action widgets are included
|
|
12
|
-
*/
|
|
13
|
-
"activeUserActions": string;
|
|
14
10
|
/**
|
|
15
11
|
* Client custom styling via inline style
|
|
16
12
|
*/
|
|
@@ -31,10 +27,18 @@ export namespace Components {
|
|
|
31
27
|
* whether or not to include the submit button (in case we want to compose a different )
|
|
32
28
|
*/
|
|
33
29
|
"includeSubmitButton": boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Language
|
|
32
|
+
*/
|
|
33
|
+
"lang": string;
|
|
34
34
|
/**
|
|
35
35
|
* the text of the button, if button is enabled
|
|
36
36
|
*/
|
|
37
37
|
"submitButtonText": string;
|
|
38
|
+
/**
|
|
39
|
+
* Translation url
|
|
40
|
+
*/
|
|
41
|
+
"translationUrl": string;
|
|
38
42
|
/**
|
|
39
43
|
* user id required for the update call
|
|
40
44
|
*/
|
|
@@ -62,10 +66,6 @@ declare global {
|
|
|
62
66
|
}
|
|
63
67
|
declare namespace LocalJSX {
|
|
64
68
|
interface UserActionController {
|
|
65
|
-
/**
|
|
66
|
-
* which user action widgets are included
|
|
67
|
-
*/
|
|
68
|
-
"activeUserActions"?: string;
|
|
69
69
|
/**
|
|
70
70
|
* Client custom styling via inline style
|
|
71
71
|
*/
|
|
@@ -86,10 +86,18 @@ declare namespace LocalJSX {
|
|
|
86
86
|
* whether or not to include the submit button (in case we want to compose a different )
|
|
87
87
|
*/
|
|
88
88
|
"includeSubmitButton": boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Language
|
|
91
|
+
*/
|
|
92
|
+
"lang"?: string;
|
|
89
93
|
/**
|
|
90
94
|
* the text of the button, if button is enabled
|
|
91
95
|
*/
|
|
92
96
|
"submitButtonText"?: string;
|
|
97
|
+
/**
|
|
98
|
+
* Translation url
|
|
99
|
+
*/
|
|
100
|
+
"translationUrl"?: string;
|
|
93
101
|
/**
|
|
94
102
|
* user id required for the update call
|
|
95
103
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as s,h as e}from"./p-ba444709.js";const i=class{constructor(e){t(this,e),this.userLegislationConsent=s(this,"userLegislationConsent",7),this.queried=!1,this.consentType="",this.mandatory=!1,this.consentTitle="",this.tcLink="#",this.privacyLink="#",this.clientStyling="",this.textContent="",this.limitStylingAppends=!1,this.stringVariants={termsandconditions1:"I accept the ",termsandconditions2:", I have read and understood the ",termsandconditions3:" as published on this site and confirm that I am over 18 years old.",tc:"Terms and Conditions",privacy:"Privacy Policy",sms:"I consent to receive marketing communication via SMS.",emailmarketing:"I consent to receive marketing communication via Email."},this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)}}determineTextContent(){return"termsandconditions"===this.consentType?e("span",null,this.stringVariants.termsandconditions1,e("a",{href:this.tcLink},this.stringVariants.tc),this.stringVariants.termsandconditions2,e("a",{href:this.privacyLink},this.stringVariants.privacy),this.stringVariants.termsandconditions3):e("span",null,this.stringVariants[this.consentType])}userLegislationConsentHandler(){this.userLegislationConsent.emit({type:this.consentType,value:this.checkboxInput.checked})}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.limitStylingAppends=!0)}render(){return this.queried&&this.userLegislationConsentHandler(),this.textContent=this.determineTextContent(),e("div",{ref:t=>this.stylingContainer=t},e("p",{class:"ConsentTitle"},this.consentTitle),e("label",{class:"userConsent",htmlFor:"userConsent"},e("input",{ref:t=>this.checkboxInput=t,id:"userConsent",type:"checkbox",onInput:()=>this.userLegislationConsentHandler()}),this.textContent,this.mandatory&&e("span",{class:"MandatoryItem"},"*")))}};i.style=":host{display:block}.ConsentTitle{margin-bottom:0.2rem;font-weight:600}.userConsent:hover{border-bottom:1px solid #000;cursor:pointer}.MandatoryItem{color:#f00;font-size:1.2rem}";const n=["ro","en","cz","de","hr"],o={en:{termsandconditions:"Terms and Conditions",sms:"SMS marketing",emailmarketing:"Email marketing"},ro:{termsandconditions:"Terms and Conditions",sms:"SMS marketing",emailmarketing:"Email marketing"},hr:{termsandconditions:"Terms and Conditions",sms:"SMS marketing",emailmarketing:"Email marketing"},fr:{termsandconditions:"Terms and Conditions",sms:"SMS marketing",emailmarketing:"Email marketing"},cs:{termsandconditions:"Terms and Conditions",sms:"SMS marketing",emailmarketing:"Email marketing"},de:{termsandconditions:"Terms and Conditions",sms:"SMS marketing",emailmarketing:"Email marketing"}},r=t=>new Promise((s=>{fetch(t).then((t=>t.json())).then((t=>{Object.keys(t).forEach((s=>{for(let e in t[s])o[s][e]=t[s][e]})),s(!0)}))})),a=(t,s,e)=>{const i=s;let r=o[void 0!==i&&n.includes(i)?i:"en"][t];if(void 0!==e)for(const[t,s]of Object.entries(e.values)){const e=new RegExp(`{${t}}`,"g");r=r.replace(e,s)}return r},h=class{constructor(s){t(this,s),this.lang="en",this.gmVersion="",this.translationUrl="",this.clientStyling="",this.clientStylingUrl="",this.queryFired=!1,this.readyActionsCount=0,this.activeUserActions=[],this.userActionsValidated=!0,this.receivedQueryResponses=0,this.limitStylingAppends=!1,this.isLoading=!0,this.mandatoryActionsChecked=0,this.mandatoryActions=["termsandconditions"],this.userActions=[],this.consentTitles={termsandconditions:a("termsandconditions",this.lang),sms:a("sms",this.lang),emailmarketing:a("emailmarketing",this.lang)},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)}))}}handleNewTranslations(){r(this.translationUrl)}handleQueryResponse(){this.receivedQueryResponses===this.activeUserActions.length&&this.updateUserConsents()}userLegislationConsentHandler(t){const s=t.detail.type,e=t.detail.value;this.mandatoryActions.includes(s)&&!1===this.queryFired&&(!0===e?this.mandatoryActionsChecked++:this.mandatoryActionsChecked--),this.queryFired&&(this.userActions.push({tagCode:s,status:e?"Accepted":"Denied"}),this.receivedQueryResponses++)}determineUserActions(){const t=new URL(`${this.endpoint}/v1/player/${this.userId}/consent`),s=new Headers;let e;return s.append("X-SessionId",this.userSession),e={method:"GET",headers:s},t&&e?fetch(t.href,e).then((t=>t.json())).then((t=>{t.items.forEach((t=>{"Expired"===t.status&&this.activeUserActions.push(t.tagCode)})),this.isLoading=!1})).catch((t=>{console.error("Error fetching data:",t),this.isLoading=!1})):Promise.reject("Unsupported endpoint")}updateUserConsents(){let t,s;t="gmcore"===this.gmVersion?new URL(`${this.endpoint}/v1/player/${this.userId}/consent`):new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`),s={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-SessionId":`${this.userSession}`},body:JSON.stringify("gmcore"===this.gmVersion?{items:this.userActions}:{consents:[{tagCode:"termsandconditions",note:"",status:1}]})},t&&s&&fetch(t.href,s).then((t=>t.json())).then((()=>{window.postMessage({type:"WidgetNotification",data:{type:"success",message:"Consent update successful!"}},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}async componentWillLoad(){if("gmcore"===this.gmVersion)return this.determineUserActions();this.activeUserActions=["termsandconditions"],this.isLoading=!1,this.translationUrl.length>2&&await r(this.translationUrl)}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}render(){const t=this.mandatoryActions.every((t=>this.activeUserActions.includes(t)));return this.userActionsValidated=!(!t||this.mandatoryActionsChecked===this.mandatoryActions.length),e("div",{class:"QueryReferenceContainer",ref:t=>this.stylingContainer=t},this.isLoading?e("slot",{name:"spinner"})&&e("svg",{class:"spinner",viewBox:"0 0 50 50"},e("circle",{class:"path",cx:"25",cy:"25",r:"20",fill:"none","stroke-width":"5"})):e("div",{class:"UserActionController"},e("h2",{class:"UserConsentNotice"},this.userNoticeText),e("div",{class:"PlayerLegislationWrapper"},this.activeUserActions.map((t=>e("slot",{name:t},e("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&&e("button",{class:"ConsentSubmitButton",disabled:this.userActionsValidated,onClick:()=>this.handleApplyClick()},this.submitButtonText)))}static get watchers(){return{translationUrl:["handleNewTranslations"],receivedQueryResponses:["handleQueryResponse"]}}};h.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}}.spinner{animation:rotate 2s linear infinite;z-index:2;position:absolute;top:50%;left:50%;margin:-25px 0 0 -25px;width:50px;height:50px}.spinner .path{stroke:var(--emfe-w-login-color-primary, var(--emfe-w-color-primary, #D0046C));stroke-linecap:round;animation:dash 1.5s ease-in-out infinite}@keyframes rotate{100%{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1, 150;stroke-dashoffset:0}50%{stroke-dasharray:90, 150;stroke-dashoffset:-35}100%{stroke-dasharray:90, 150;stroke-dashoffset:-124}}";export{i as player_user_consents,h as user_action_controller}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,b as
|
|
1
|
+
import{p as t,b as n}from"./p-ba444709.js";(()=>{const n=import.meta.url,e={};return""!==n&&(e.resourcesUrl=new URL(".",n).href),t(e)})().then((t=>n([["p-711fa494",[[1,"user-action-controller",{endpoint:[513],userSession:[513,"user-session"],userId:[513,"user-id"],lang:[1537],includeSubmitButton:[516,"include-submit-button"],submitButtonText:[513,"submit-button-text"],userNoticeText:[513,"user-notice-text"],gmVersion:[1,"gm-version"],translationUrl:[513,"translation-url"],clientStyling:[1537,"client-styling"],clientStylingUrl:[513,"client-styling-url"],queryFired:[32],readyActionsCount:[32],activeUserActions:[32],userActionsValidated:[32],receivedQueryResponses:[32],limitStylingAppends:[32],isLoading:[32],mandatoryActionsChecked:[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[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 +0,0 @@
|
|
|
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,54 +0,0 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
-
|
|
3
|
-
const playerLegislationWrapperCss = ":host{display:block}";
|
|
4
|
-
|
|
5
|
-
const PlayerLegislationWrapper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
-
constructor() {
|
|
7
|
-
super();
|
|
8
|
-
this.__registerHost();
|
|
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
|
|
29
|
-
}
|
|
30
|
-
render() {
|
|
31
|
-
const activeUAList = this.activeUserActions.replace(/ /g, '').split(',');
|
|
32
|
-
return (h("div", { class: "PlayerLegislationWrapper", ref: el => this.stylingContainer = el }, activeUAList.map(action => (h("slot", { name: action })))));
|
|
33
|
-
}
|
|
34
|
-
static get style() { return playerLegislationWrapperCss; }
|
|
35
|
-
}, [1, "player-legislation-wrapper", {
|
|
36
|
-
"activeUserActions": [513, "active-user-actions"],
|
|
37
|
-
"clientStyling": [1, "client-styling"],
|
|
38
|
-
"limitStylingAppends": [32]
|
|
39
|
-
}]);
|
|
40
|
-
function defineCustomElement() {
|
|
41
|
-
if (typeof customElements === "undefined") {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const components = ["player-legislation-wrapper"];
|
|
45
|
-
components.forEach(tagName => { switch (tagName) {
|
|
46
|
-
case "player-legislation-wrapper":
|
|
47
|
-
if (!customElements.get(tagName)) {
|
|
48
|
-
customElements.define(tagName, PlayerLegislationWrapper);
|
|
49
|
-
}
|
|
50
|
-
break;
|
|
51
|
-
} });
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export { PlayerLegislationWrapper as P, defineCustomElement as d };
|
|
@@ -1 +0,0 @@
|
|
|
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.activeUserActions="",this.gmVersion="",this.clientStyling="",this.clientStylingUrl="",this.queryFired=!1,this.readyActionsCount=0,this.receivedQueryResponses=0,this.limitStylingAppends=!1,this.isLoading=!0,this.mandatoryActions=["termsandconditions"],this.requiredActionsCount=0,this.expectedQueryResponses=0,this.userActions=[],this.consentTitles={termsandconditions:"Terms and Conditions",sms:"SMS marketing",emailmarketing:"Email marketing"},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)}))}}handleQueryResponse(){this.receivedQueryResponses===this.expectedQueryResponses&&this.updateUserConsents()}hasToSetConsentsHandler(t){this.hasToSetConsents=!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++)}determineMandatoryActions(){const t=new URL(`${this.endpoint}/v1/player/consentRequirements`);let s;return s={method:"GET",headers:{"X-SessionId":`${this.userSession}`}},t&&s?fetch(t.href,s).then((t=>t.json())).then((t=>{(t.consents||[]).forEach((t=>t.mustAccept&&this.mandatoryActions.push(t.tagCode))),console.log(this.mandatoryActions),this.isLoading=!1})).catch((t=>{console.error("Error fetching data:",t),this.isLoading=!1})):Promise.reject("Unsupported endpoint")}updateUserConsents(){let t,s;t="gmcore"===this.gmVersion?new URL(`${this.endpoint}/v1/player/${this.userId}/consent`):new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`),s={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-SessionId":`${this.userSession}`},body:JSON.stringify("gmcore"===this.gmVersion?{items:this.userActions}:{consents:[{tagCode:"termsandconditions",note:"",status:1}]})},t&&s&&fetch(t.href,s).then((t=>t.json())).then((()=>{window.postMessage({type:"WidgetNotification",data:{type:"success",message:"Consent update successful!"}},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}componentWillLoad(){if("gmcore"===this.gmVersion)return this.determineMandatoryActions();this.activeUserActions="termsandconditions",this.isLoading=!1}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}render(){const t=this.hasToSetConsents?["termsandconditions"]: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},this.isLoading&&s("slot",{name:"spinner"})&&s("svg",{class:"spinner",viewBox:"0 0 50 50"},s("circle",{class:"path",cx:"25",cy:"25",r:"20",fill:"none","stroke-width":"5"})),!this.isLoading&&s("div",{class:"UserActionController"},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}}.spinner{animation:rotate 2s linear infinite;z-index:2;position:absolute;top:50%;left:50%;margin:-25px 0 0 -25px;width:50px;height:50px}.spinner .path{stroke:var(--emfe-w-login-color-primary, var(--emfe-w-color-primary, #D0046C));stroke-linecap:round;animation:dash 1.5s ease-in-out infinite}@keyframes rotate{100%{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1, 150;stroke-dashoffset:0}50%{stroke-dasharray:90, 150;stroke-dashoffset:-35}100%{stroke-dasharray:90, 150;stroke-dashoffset:-124}}";export{i as player_legislation_wrapper,n as player_user_consents,o as user_action_controller}
|