@everymatrix/user-action-controller 0.0.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/generic-user-consent_3.cjs.entry.js +182 -0
- package/dist/cjs/index-4a3038bd.js +1255 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/user-action-controller.cjs.js +19 -0
- package/dist/collection/collection-manifest.json +25 -0
- package/dist/collection/components/user-action-controller/user-action-controller.css +48 -0
- package/dist/collection/components/user-action-controller/user-action-controller.js +237 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/utils.js +3 -0
- package/dist/components/generic-user-consent.js +6 -0
- package/dist/components/generic-user-consent2.js +93 -0
- package/dist/components/index.d.ts +26 -0
- package/dist/components/index.js +1 -0
- package/dist/components/legislation-wrapper.js +6 -0
- package/dist/components/legislation-wrapper2.js +33 -0
- package/dist/components/user-action-controller.d.ts +11 -0
- package/dist/components/user-action-controller.js +137 -0
- package/dist/esm/generic-user-consent_3.entry.js +176 -0
- package/dist/esm/index-9eef5ef8.js +1229 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/user-action-controller.js +17 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.js +22 -0
- package/dist/types/Users/user/workspace/everymatrix/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 +55 -0
- package/dist/types/components.d.ts +93 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1565 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/dist/user-action-controller/index.esm.js +0 -0
- package/dist/user-action-controller/p-013051ff.entry.js +1 -0
- package/dist/user-action-controller/p-54386d36.js +1 -0
- package/dist/user-action-controller/user-action-controller.esm.js +1 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +19 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-4a3038bd.js');
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
9
|
+
*/
|
|
10
|
+
const patchEsm = () => {
|
|
11
|
+
return index.promiseResolve();
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const defineCustomElements = (win, options) => {
|
|
15
|
+
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
|
+
return patchEsm().then(() => {
|
|
17
|
+
return index.bootstrapLazy([["generic-user-consent_3.cjs",[[1,"user-action-controller",{"endpoint":[1],"userSession":[1,"user-session"],"userId":[1,"user-id"],"includeSubmitButton":[4,"include-submit-button"],"submitButtonText":[1,"submit-button-text"],"userNoticeText":[1,"user-notice-text"],"activeUserActions":[1,"active-user-actions"],"queryFired":[32],"readyActionsCount":[32],"receivedQueryResponses":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[1,"generic-user-consent",{"queried":[4],"consentType":[1,"consent-type"],"mandatory":[4],"consentTitle":[1,"consent-title"],"tcLink":[1,"tc-link"],"privacyLink":[1,"privacy-link"],"textContent":[32]}],[1,"legislation-wrapper",{"activeUserActions":[1,"active-user-actions"]}]]]], options);
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.defineCustomElements = defineCustomElements;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-4a3038bd.js');
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
7
|
+
*/
|
|
8
|
+
const patchBrowser = () => {
|
|
9
|
+
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('user-action-controller.cjs.js', document.baseURI).href));
|
|
10
|
+
const opts = {};
|
|
11
|
+
if (importMeta !== '') {
|
|
12
|
+
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
13
|
+
}
|
|
14
|
+
return index.promiseResolve(opts);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
patchBrowser().then(options => {
|
|
18
|
+
return index.bootstrapLazy([["generic-user-consent_3.cjs",[[1,"user-action-controller",{"endpoint":[1],"userSession":[1,"user-session"],"userId":[1,"user-id"],"includeSubmitButton":[4,"include-submit-button"],"submitButtonText":[1,"submit-button-text"],"userNoticeText":[1,"user-notice-text"],"activeUserActions":[1,"active-user-actions"],"queryFired":[32],"readyActionsCount":[32],"receivedQueryResponses":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[1,"generic-user-consent",{"queried":[4],"consentType":[1,"consent-type"],"mandatory":[4],"consentTitle":[1,"consent-title"],"tcLink":[1,"tc-link"],"privacyLink":[1,"privacy-link"],"textContent":[32]}],[1,"legislation-wrapper",{"activeUserActions":[1,"active-user-actions"]}]]]], options);
|
|
19
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"entries": [
|
|
3
|
+
"./components/user-action-controller/user-action-controller.js"
|
|
4
|
+
],
|
|
5
|
+
"compiler": {
|
|
6
|
+
"name": "@stencil/core",
|
|
7
|
+
"version": "2.15.2",
|
|
8
|
+
"typescriptVersion": "4.5.4"
|
|
9
|
+
},
|
|
10
|
+
"collections": [
|
|
11
|
+
{
|
|
12
|
+
"name": "@everymatrix/generic-user-consent",
|
|
13
|
+
"tags": [
|
|
14
|
+
"generic-user-consent"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "@everymatrix/legislation-wrapper",
|
|
19
|
+
"tags": [
|
|
20
|
+
"legislation-wrapper"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"bundles": []
|
|
25
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.QueryReferenceContainer {
|
|
6
|
+
height: 100%;
|
|
7
|
+
width: 100%;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.UserConsentNotice {
|
|
11
|
+
font-size: 1.2rem;
|
|
12
|
+
font-weight: 200;
|
|
13
|
+
text-align: center;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.UserActionController {
|
|
17
|
+
font-family: Arial, Helvetica, sans-serif;
|
|
18
|
+
font-weight: 100;
|
|
19
|
+
height: 100%;
|
|
20
|
+
width: 100%;
|
|
21
|
+
padding: 1rem 1.5rem 2rem;
|
|
22
|
+
background-color: #fff;
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
justify-content: space-between;
|
|
26
|
+
border-radius: 5%;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.ConsentSubmitButton {
|
|
30
|
+
font-size: 1rem;
|
|
31
|
+
padding: 0.4rem 1.4rem;
|
|
32
|
+
background: #fff;
|
|
33
|
+
border: 2px solid #000;
|
|
34
|
+
color: #000;
|
|
35
|
+
border-radius: 5px;
|
|
36
|
+
align-self: flex-end;
|
|
37
|
+
}
|
|
38
|
+
.ConsentSubmitButton:disabled {
|
|
39
|
+
border: 2px solid #ccc;
|
|
40
|
+
color: #ccc;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@media screen and (max-width: 320px) {
|
|
44
|
+
.QueryReferenceContainer {
|
|
45
|
+
font-size: 0.8rem;
|
|
46
|
+
color: blue;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { Component, h, Prop, Listen, State, Watch } from '@stencil/core';
|
|
2
|
+
import '@everymatrix/legislation-wrapper';
|
|
3
|
+
import '@everymatrix/generic-user-consent';
|
|
4
|
+
export class UserActionController {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.consentTitles = {
|
|
7
|
+
termsandconditions: "Terms and Conditions",
|
|
8
|
+
sms: "SMS marketing",
|
|
9
|
+
emailmarketing: "Email marketing"
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Which actions are required in order to activate the "Apply" button. Other actions are considered optional.
|
|
13
|
+
*/
|
|
14
|
+
this.queryFired = false;
|
|
15
|
+
this.readyActionsCount = 0;
|
|
16
|
+
this.receivedQueryResponses = 0;
|
|
17
|
+
this.mandatoryActions = ['termsandconditions'];
|
|
18
|
+
this.requiredActionsCount = 0;
|
|
19
|
+
this.expectedQueryResponses = 0;
|
|
20
|
+
this.userActions = [];
|
|
21
|
+
}
|
|
22
|
+
determineMandatoryActions() {
|
|
23
|
+
let url = new URL(`${this.endpoint}v1/player/consentRequirements`);
|
|
24
|
+
return fetch(url.href)
|
|
25
|
+
.then(res => res.json())
|
|
26
|
+
.then(data => {
|
|
27
|
+
data.items.forEach(action => {
|
|
28
|
+
action.mustAccept && this.mandatoryActions.push(action.tagCode);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
handleQueryResponse() {
|
|
33
|
+
if (this.receivedQueryResponses === this.expectedQueryResponses) {
|
|
34
|
+
this.updateUserConsents();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
updateUserConsents() {
|
|
38
|
+
const url = new URL(`${this.endpoint}v1/player/${this.userId}/consent`);
|
|
39
|
+
let body = {
|
|
40
|
+
items: this.userActions
|
|
41
|
+
};
|
|
42
|
+
let options = {
|
|
43
|
+
method: 'POST',
|
|
44
|
+
headers: {
|
|
45
|
+
'Content-Type': 'application/json',
|
|
46
|
+
'Accept': 'application/json',
|
|
47
|
+
'X-SessionId': `${this.userSession}`,
|
|
48
|
+
},
|
|
49
|
+
body: JSON.stringify(body)
|
|
50
|
+
};
|
|
51
|
+
fetch(url.href, options)
|
|
52
|
+
.then(res => res.json())
|
|
53
|
+
// .then(data => {
|
|
54
|
+
// console.log(data);
|
|
55
|
+
// })
|
|
56
|
+
.finally(() => {
|
|
57
|
+
window.postMessage({ type: "UserActionsCompleted" }, window.location.href);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
handleApplyClick() {
|
|
61
|
+
this.queryFired = true;
|
|
62
|
+
}
|
|
63
|
+
userLegislationConsentHandler(event) {
|
|
64
|
+
// Increase / Decrease the amount of mandatory actions taken
|
|
65
|
+
if (this.mandatoryActions.includes(event.detail.type)) {
|
|
66
|
+
if (event.detail.value)
|
|
67
|
+
this.readyActionsCount++;
|
|
68
|
+
else
|
|
69
|
+
this.readyActionsCount--;
|
|
70
|
+
}
|
|
71
|
+
// Register final user choices only if we're ready to update
|
|
72
|
+
if (this.queryFired) {
|
|
73
|
+
this.userActions.push({ tagCode: event.detail.type, status: event.detail.value ? 'Accepted' : 'Denied' });
|
|
74
|
+
this.receivedQueryResponses++;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Returning a promise here will ensure that the fetch completes before we render the component
|
|
78
|
+
componentWillLoad() {
|
|
79
|
+
return this.determineMandatoryActions();
|
|
80
|
+
}
|
|
81
|
+
render() {
|
|
82
|
+
const activeUAList = this.activeUserActions.replace(/ /g, '').split(',');
|
|
83
|
+
this.requiredActionsCount = activeUAList.filter(action => this.mandatoryActions.includes(action)).length;
|
|
84
|
+
this.expectedQueryResponses = activeUAList.length;
|
|
85
|
+
return (h("div", { class: "QueryReferenceContainer" },
|
|
86
|
+
h("div", { class: "UserActionController" },
|
|
87
|
+
h("h2", { class: "UserConsentNotice" }, this.userNoticeText),
|
|
88
|
+
h("legislation-wrapper", { "active-user-actions": this.activeUserActions }, activeUAList.map(item => (h("generic-user-consent", { slot: item, consentType: item, consentTitle: this.consentTitles[item], queried: this.queryFired, mandatory: this.mandatoryActions.includes(item) })))),
|
|
89
|
+
this.includeSubmitButton &&
|
|
90
|
+
h("button", { class: "ConsentSubmitButton", disabled: this.readyActionsCount === this.requiredActionsCount ? false : true, onClick: () => this.handleApplyClick() }, this.submitButtonText))));
|
|
91
|
+
}
|
|
92
|
+
static get is() { return "user-action-controller"; }
|
|
93
|
+
static get encapsulation() { return "shadow"; }
|
|
94
|
+
static get originalStyleUrls() { return {
|
|
95
|
+
"$": ["user-action-controller.scss"]
|
|
96
|
+
}; }
|
|
97
|
+
static get styleUrls() { return {
|
|
98
|
+
"$": ["user-action-controller.css"]
|
|
99
|
+
}; }
|
|
100
|
+
static get properties() { return {
|
|
101
|
+
"endpoint": {
|
|
102
|
+
"type": "string",
|
|
103
|
+
"mutable": false,
|
|
104
|
+
"complexType": {
|
|
105
|
+
"original": "string",
|
|
106
|
+
"resolved": "string",
|
|
107
|
+
"references": {}
|
|
108
|
+
},
|
|
109
|
+
"required": true,
|
|
110
|
+
"optional": false,
|
|
111
|
+
"docs": {
|
|
112
|
+
"tags": [],
|
|
113
|
+
"text": "the endpoint required for the update call"
|
|
114
|
+
},
|
|
115
|
+
"attribute": "endpoint",
|
|
116
|
+
"reflect": false
|
|
117
|
+
},
|
|
118
|
+
"userSession": {
|
|
119
|
+
"type": "string",
|
|
120
|
+
"mutable": false,
|
|
121
|
+
"complexType": {
|
|
122
|
+
"original": "string",
|
|
123
|
+
"resolved": "string",
|
|
124
|
+
"references": {}
|
|
125
|
+
},
|
|
126
|
+
"required": true,
|
|
127
|
+
"optional": false,
|
|
128
|
+
"docs": {
|
|
129
|
+
"tags": [],
|
|
130
|
+
"text": "user session required for the update call"
|
|
131
|
+
},
|
|
132
|
+
"attribute": "user-session",
|
|
133
|
+
"reflect": false
|
|
134
|
+
},
|
|
135
|
+
"userId": {
|
|
136
|
+
"type": "string",
|
|
137
|
+
"mutable": false,
|
|
138
|
+
"complexType": {
|
|
139
|
+
"original": "string",
|
|
140
|
+
"resolved": "string",
|
|
141
|
+
"references": {}
|
|
142
|
+
},
|
|
143
|
+
"required": true,
|
|
144
|
+
"optional": false,
|
|
145
|
+
"docs": {
|
|
146
|
+
"tags": [],
|
|
147
|
+
"text": "user id required for the update call"
|
|
148
|
+
},
|
|
149
|
+
"attribute": "user-id",
|
|
150
|
+
"reflect": false
|
|
151
|
+
},
|
|
152
|
+
"includeSubmitButton": {
|
|
153
|
+
"type": "boolean",
|
|
154
|
+
"mutable": false,
|
|
155
|
+
"complexType": {
|
|
156
|
+
"original": "boolean",
|
|
157
|
+
"resolved": "boolean",
|
|
158
|
+
"references": {}
|
|
159
|
+
},
|
|
160
|
+
"required": true,
|
|
161
|
+
"optional": false,
|
|
162
|
+
"docs": {
|
|
163
|
+
"tags": [],
|
|
164
|
+
"text": "wether or not to include the submit button (in case we want to compose a different )"
|
|
165
|
+
},
|
|
166
|
+
"attribute": "include-submit-button",
|
|
167
|
+
"reflect": false
|
|
168
|
+
},
|
|
169
|
+
"submitButtonText": {
|
|
170
|
+
"type": "string",
|
|
171
|
+
"mutable": false,
|
|
172
|
+
"complexType": {
|
|
173
|
+
"original": "string",
|
|
174
|
+
"resolved": "string",
|
|
175
|
+
"references": {}
|
|
176
|
+
},
|
|
177
|
+
"required": false,
|
|
178
|
+
"optional": false,
|
|
179
|
+
"docs": {
|
|
180
|
+
"tags": [],
|
|
181
|
+
"text": "the text of the button, if button is enabled"
|
|
182
|
+
},
|
|
183
|
+
"attribute": "submit-button-text",
|
|
184
|
+
"reflect": false
|
|
185
|
+
},
|
|
186
|
+
"userNoticeText": {
|
|
187
|
+
"type": "string",
|
|
188
|
+
"mutable": false,
|
|
189
|
+
"complexType": {
|
|
190
|
+
"original": "string",
|
|
191
|
+
"resolved": "string",
|
|
192
|
+
"references": {}
|
|
193
|
+
},
|
|
194
|
+
"required": false,
|
|
195
|
+
"optional": false,
|
|
196
|
+
"docs": {
|
|
197
|
+
"tags": [],
|
|
198
|
+
"text": "the title of the action group"
|
|
199
|
+
},
|
|
200
|
+
"attribute": "user-notice-text",
|
|
201
|
+
"reflect": false
|
|
202
|
+
},
|
|
203
|
+
"activeUserActions": {
|
|
204
|
+
"type": "string",
|
|
205
|
+
"mutable": false,
|
|
206
|
+
"complexType": {
|
|
207
|
+
"original": "string",
|
|
208
|
+
"resolved": "string",
|
|
209
|
+
"references": {}
|
|
210
|
+
},
|
|
211
|
+
"required": true,
|
|
212
|
+
"optional": false,
|
|
213
|
+
"docs": {
|
|
214
|
+
"tags": [],
|
|
215
|
+
"text": "which user action widgets are included"
|
|
216
|
+
},
|
|
217
|
+
"attribute": "active-user-actions",
|
|
218
|
+
"reflect": false
|
|
219
|
+
}
|
|
220
|
+
}; }
|
|
221
|
+
static get states() { return {
|
|
222
|
+
"queryFired": {},
|
|
223
|
+
"readyActionsCount": {},
|
|
224
|
+
"receivedQueryResponses": {}
|
|
225
|
+
}; }
|
|
226
|
+
static get watchers() { return [{
|
|
227
|
+
"propName": "receivedQueryResponses",
|
|
228
|
+
"methodName": "handleQueryResponse"
|
|
229
|
+
}]; }
|
|
230
|
+
static get listeners() { return [{
|
|
231
|
+
"name": "userLegislationConsent",
|
|
232
|
+
"method": "userLegislationConsentHandler",
|
|
233
|
+
"target": undefined,
|
|
234
|
+
"capture": false,
|
|
235
|
+
"passive": false
|
|
236
|
+
}]; }
|
|
237
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
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
|
+
|
|
5
|
+
const GenericUserConsent = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.__registerHost();
|
|
9
|
+
this.__attachShadow();
|
|
10
|
+
this.userLegislationConsent = createEvent(this, "userLegislationConsent", 7);
|
|
11
|
+
/**
|
|
12
|
+
* 'true' when parent expects component to emit it's current value
|
|
13
|
+
*/
|
|
14
|
+
this.queried = false;
|
|
15
|
+
/**
|
|
16
|
+
* the type of the consent, used to determine render details
|
|
17
|
+
*/
|
|
18
|
+
this.consentType = '';
|
|
19
|
+
/**
|
|
20
|
+
* wether or not this consent is mandatory. Used for render details
|
|
21
|
+
*/
|
|
22
|
+
this.mandatory = false;
|
|
23
|
+
/**
|
|
24
|
+
* the title of the consent to be displayed
|
|
25
|
+
*/
|
|
26
|
+
this.consentTitle = '';
|
|
27
|
+
/**
|
|
28
|
+
* link to the t&c page
|
|
29
|
+
*/
|
|
30
|
+
this.tcLink = '#';
|
|
31
|
+
/**
|
|
32
|
+
* link to privacy policy page
|
|
33
|
+
*/
|
|
34
|
+
this.privacyLink = '#';
|
|
35
|
+
/**
|
|
36
|
+
* the text content to be rendered by the component. Determined at runtime
|
|
37
|
+
*/
|
|
38
|
+
this.textContent = '';
|
|
39
|
+
// Maybe switch this out with a localization source
|
|
40
|
+
this.stringVariants = {
|
|
41
|
+
termsandconditions1: "I accept the ",
|
|
42
|
+
termsandconditions2: ", I have read and understood the ",
|
|
43
|
+
termsandconditions3: " as published on this site and confirm that I am over 18 years old.",
|
|
44
|
+
tc: "Terms and Conditions",
|
|
45
|
+
privacy: "Privacy Policy",
|
|
46
|
+
sms: "I consent to receive marketing communication via SMS.",
|
|
47
|
+
emailmarketing: "I consent to receive marketing communication via Email."
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
determineTextContent() {
|
|
51
|
+
let result = this.consentType === 'termsandconditions' ?
|
|
52
|
+
h("span", null, this.stringVariants['termsandconditions1'], h("a", { href: this.tcLink }, this.stringVariants['tc']), this.stringVariants['termsandconditions2'], h("a", { href: this.privacyLink }, this.stringVariants['privacy']), this.stringVariants['termsandconditions3'])
|
|
53
|
+
: h("span", null, this.stringVariants[this.consentType]);
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
userLegislationConsentHandler() {
|
|
57
|
+
this.userLegislationConsent.emit({
|
|
58
|
+
type: this.consentType,
|
|
59
|
+
value: this.checkboxInput.checked
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
render() {
|
|
63
|
+
if (this.queried) {
|
|
64
|
+
this.userLegislationConsentHandler();
|
|
65
|
+
}
|
|
66
|
+
this.textContent = this.determineTextContent();
|
|
67
|
+
return (h("div", null, h("p", { class: "ConsentTitle" }, this.consentTitle), h("label", { class: "userConsent", htmlFor: "userConsent" }, h("input", { ref: el => this.checkboxInput = el, id: "userConsent", type: "checkbox", onInput: () => this.userLegislationConsentHandler() }), this.textContent, this.mandatory && h("span", { class: "MandatoryItem" }, "*"))));
|
|
68
|
+
}
|
|
69
|
+
static get style() { return genericUserConsentCss; }
|
|
70
|
+
}, [1, "generic-user-consent", {
|
|
71
|
+
"queried": [4],
|
|
72
|
+
"consentType": [1, "consent-type"],
|
|
73
|
+
"mandatory": [4],
|
|
74
|
+
"consentTitle": [1, "consent-title"],
|
|
75
|
+
"tcLink": [1, "tc-link"],
|
|
76
|
+
"privacyLink": [1, "privacy-link"],
|
|
77
|
+
"textContent": [32]
|
|
78
|
+
}]);
|
|
79
|
+
function defineCustomElement() {
|
|
80
|
+
if (typeof customElements === "undefined") {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const components = ["generic-user-consent"];
|
|
84
|
+
components.forEach(tagName => { switch (tagName) {
|
|
85
|
+
case "generic-user-consent":
|
|
86
|
+
if (!customElements.get(tagName)) {
|
|
87
|
+
customElements.define(tagName, GenericUserConsent);
|
|
88
|
+
}
|
|
89
|
+
break;
|
|
90
|
+
} });
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export { GenericUserConsent as G, defineCustomElement as d };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* UserActionController custom elements */
|
|
2
|
+
|
|
3
|
+
import type { Components, JSX } from "../types/components";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Used to manually set the base path where assets can be found.
|
|
7
|
+
* If the script is used as "module", it's recommended to use "import.meta.url",
|
|
8
|
+
* such as "setAssetPath(import.meta.url)". Other options include
|
|
9
|
+
* "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
|
|
10
|
+
* dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
|
|
11
|
+
* But do note that this configuration depends on how your script is bundled, or lack of
|
|
12
|
+
* bundling, and where your assets can be loaded from. Additionally custom bundling
|
|
13
|
+
* will have to ensure the static assets are copied to its build directory.
|
|
14
|
+
*/
|
|
15
|
+
export declare const setAssetPath: (path: string) => void;
|
|
16
|
+
|
|
17
|
+
export interface SetPlatformOptions {
|
|
18
|
+
raf?: (c: FrameRequestCallback) => number;
|
|
19
|
+
ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
20
|
+
rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
|
|
23
|
+
|
|
24
|
+
export type { Components, JSX };
|
|
25
|
+
|
|
26
|
+
export * from '../types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
const legislationWrapperCss = ":host{display:block}";
|
|
4
|
+
|
|
5
|
+
const LegislationWrapper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.__registerHost();
|
|
9
|
+
this.__attachShadow();
|
|
10
|
+
}
|
|
11
|
+
render() {
|
|
12
|
+
const activeUAList = this.activeUserActions.replace(/ /g, '').split(',');
|
|
13
|
+
return (h("div", { class: "LegislationWrapper" }, activeUAList.map(action => (h("slot", { name: action })))));
|
|
14
|
+
}
|
|
15
|
+
static get style() { return legislationWrapperCss; }
|
|
16
|
+
}, [1, "legislation-wrapper", {
|
|
17
|
+
"activeUserActions": [1, "active-user-actions"]
|
|
18
|
+
}]);
|
|
19
|
+
function defineCustomElement() {
|
|
20
|
+
if (typeof customElements === "undefined") {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const components = ["legislation-wrapper"];
|
|
24
|
+
components.forEach(tagName => { switch (tagName) {
|
|
25
|
+
case "legislation-wrapper":
|
|
26
|
+
if (!customElements.get(tagName)) {
|
|
27
|
+
customElements.define(tagName, LegislationWrapper);
|
|
28
|
+
}
|
|
29
|
+
break;
|
|
30
|
+
} });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { LegislationWrapper as L, defineCustomElement as d };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface UserActionController extends Components.UserActionController, HTMLElement {}
|
|
4
|
+
export const UserActionController: {
|
|
5
|
+
prototype: UserActionController;
|
|
6
|
+
new (): UserActionController;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|