@everymatrix/pam-profile-consents 1.90.6
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/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/index-80e34705.js +1227 -0
- package/dist/cjs/index.cjs.js +10 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/cjs/pam-profile-consents-e63c25d8.js +399 -0
- package/dist/cjs/pam-profile-consents.cjs.js +25 -0
- package/dist/cjs/pam-profile-consents_2.cjs.entry.js +183 -0
- package/dist/collection/collection-manifest.json +19 -0
- package/dist/collection/components/pam-profile-consents/index.js +1 -0
- package/dist/collection/components/pam-profile-consents/pam-profile-consents.css +202 -0
- package/dist/collection/components/pam-profile-consents/pam-profile-consents.js +328 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +98 -0
- package/dist/collection/utils/utils.js +12 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/index-76d86c0b.js +1200 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/pam-profile-consents-363e3230.js +397 -0
- package/dist/esm/pam-profile-consents.js +20 -0
- package/dist/esm/pam-profile-consents_2.entry.js +178 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/pam-profile-consents/app-globals-0f993ce5.js +1 -0
- package/dist/pam-profile-consents/index-76d86c0b.js +2 -0
- package/dist/pam-profile-consents/index.esm.js +1 -0
- package/dist/pam-profile-consents/pam-profile-consents-363e3230.js +1 -0
- package/dist/pam-profile-consents/pam-profile-consents.esm.js +1 -0
- package/dist/pam-profile-consents/pam-profile-consents_2.entry.js +1 -0
- package/dist/stencil.config.dev.js +17 -0
- package/dist/stencil.config.js +19 -0
- package/dist/storybook/main.js +46 -0
- package/dist/storybook/preview.js +9 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-profile-consents/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-profile-consents/.stencil/packages/stencil/pam-profile-consents/stencil.config.d.ts +2 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-profile-consents/.stencil/packages/stencil/pam-profile-consents/stencil.config.dev.d.ts +2 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-profile-consents/.stencil/packages/stencil/pam-profile-consents/storybook/main.d.ts +3 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-profile-consents/.stencil/packages/stencil/pam-profile-consents/storybook/preview.d.ts +70 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-profile-consents/.stencil/tools/plugins/index.d.ts +4 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-profile-consents/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-profile-consents/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-profile-consents/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-profile-consents/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
- package/dist/types/components/pam-profile-consents/index.d.ts +1 -0
- package/dist/types/components/pam-profile-consents/pam-profile-consents.d.ts +54 -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 +1674 -0
- package/dist/types/utils/locale.utils.d.ts +23 -0
- package/dist/types/utils/utils.d.ts +7 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +26 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PamProfileConsents } from './pam-profile-consents';
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
button {
|
|
6
|
+
font-family: var(--emw--button-typography);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.errorContainer {
|
|
10
|
+
font-family: "Roboto", sans-serif;
|
|
11
|
+
font-style: normal;
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
gap: 24px;
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 100%;
|
|
17
|
+
}
|
|
18
|
+
.errorContainer .errorMessage {
|
|
19
|
+
color: var(--emw--color-error, var(--emw--color-red, #ed0909));
|
|
20
|
+
font-size: var(--emw-font-size-small, 13px);
|
|
21
|
+
display: block;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
text-align: center;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.PamProfileConsentsWrapper {
|
|
27
|
+
color: var(--emw--pam-typography, var(--emw-color-contrast, #07072A));
|
|
28
|
+
background: var(--emw-color-pale, var(--emw--color-gray-50, #F1F1F1));
|
|
29
|
+
padding: 50px;
|
|
30
|
+
height: 100%;
|
|
31
|
+
border-radius: var(--emw--border-radius-large, 10px);
|
|
32
|
+
container-type: inline-size;
|
|
33
|
+
opacity: 1;
|
|
34
|
+
animation-name: fadeIn;
|
|
35
|
+
animation-iteration-count: 1;
|
|
36
|
+
animation-timing-function: ease-in;
|
|
37
|
+
animation-duration: 0.3s;
|
|
38
|
+
}
|
|
39
|
+
.PamProfileConsentsWrapper .HeaderArea {
|
|
40
|
+
margin-bottom: 20px;
|
|
41
|
+
}
|
|
42
|
+
.PamProfileConsentsWrapper .HeaderText {
|
|
43
|
+
font-size: var(--emw--font-size-x-large, 24px);
|
|
44
|
+
color: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));
|
|
45
|
+
text-transform: capitalize;
|
|
46
|
+
font-weight: var(--emw--font-weight-semibold, 500);
|
|
47
|
+
margin: 0;
|
|
48
|
+
}
|
|
49
|
+
.PamProfileConsentsWrapper .CategoriesGrid {
|
|
50
|
+
display: grid;
|
|
51
|
+
grid-template-columns: 1fr 1fr;
|
|
52
|
+
gap: 20px;
|
|
53
|
+
margin-bottom: 20px;
|
|
54
|
+
}
|
|
55
|
+
.PamProfileConsentsWrapper .CategoryCard {
|
|
56
|
+
background: var(--emw-color-pale, var(--emw--color-gray-100, #E6E6E6));
|
|
57
|
+
border-radius: var(--emw--border-radius-large, 10px);
|
|
58
|
+
padding: 15px;
|
|
59
|
+
}
|
|
60
|
+
.PamProfileConsentsWrapper .CategoryTitle {
|
|
61
|
+
font-size: var(--emw--font-size-large, 20px);
|
|
62
|
+
color: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));
|
|
63
|
+
font-weight: var(--emw--font-weight-semibold, 500);
|
|
64
|
+
margin: 0 0 15px 0;
|
|
65
|
+
}
|
|
66
|
+
.PamProfileConsentsWrapper .UngroupedSection {
|
|
67
|
+
background: var(--emw-color-pale, var(--emw--color-gray-100, #E6E6E6));
|
|
68
|
+
border-radius: var(--emw--border-radius-large, 10px);
|
|
69
|
+
padding: 15px;
|
|
70
|
+
margin-bottom: 20px;
|
|
71
|
+
}
|
|
72
|
+
.PamProfileConsentsWrapper .ConsentItem {
|
|
73
|
+
display: flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
gap: 10px;
|
|
76
|
+
padding: 8px 0;
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
user-select: none;
|
|
79
|
+
}
|
|
80
|
+
.PamProfileConsentsWrapper .Checkbox {
|
|
81
|
+
width: 22px;
|
|
82
|
+
height: 22px;
|
|
83
|
+
min-width: 22px;
|
|
84
|
+
border: 2px solid var(--emw--color-gray-300, #58586B);
|
|
85
|
+
border-radius: var(--emw--border-radius-small, 4px);
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
justify-content: center;
|
|
89
|
+
transition: all var(--emw--transition-medium, 250ms);
|
|
90
|
+
background: transparent;
|
|
91
|
+
}
|
|
92
|
+
.PamProfileConsentsWrapper .Checkbox svg {
|
|
93
|
+
width: 14px;
|
|
94
|
+
height: 14px;
|
|
95
|
+
color: #FFFFFF;
|
|
96
|
+
}
|
|
97
|
+
.PamProfileConsentsWrapper .Checkbox.Checked {
|
|
98
|
+
background: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));
|
|
99
|
+
border-color: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));
|
|
100
|
+
}
|
|
101
|
+
.PamProfileConsentsWrapper .ConsentLabel {
|
|
102
|
+
font-size: var(--emw--size-small, 14px);
|
|
103
|
+
font-weight: var(--emw--font-weight-normal, 400);
|
|
104
|
+
color: var(--emw--pam-typography, var(--emw-color-contrast, #07072A));
|
|
105
|
+
}
|
|
106
|
+
.PamProfileConsentsWrapper .ButtonsArea {
|
|
107
|
+
margin-top: 20px;
|
|
108
|
+
width: 50%;
|
|
109
|
+
}
|
|
110
|
+
.PamProfileConsentsWrapper .ButtonsArea .SaveButton {
|
|
111
|
+
display: flex;
|
|
112
|
+
align-items: center;
|
|
113
|
+
justify-content: center;
|
|
114
|
+
box-sizing: border-box;
|
|
115
|
+
cursor: pointer;
|
|
116
|
+
background-image: linear-gradient(to bottom, color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, black 20%), var(--emw--color-primary, #22B04E), color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, white 30%));
|
|
117
|
+
border: 2px solid var(--emw--button-border-color, #0E5924);
|
|
118
|
+
color: var(--emw--button-text-color, #FFFFFF);
|
|
119
|
+
border-radius: var(--emw--button-border-radius, 10px);
|
|
120
|
+
font-size: var(--emw--size-standard, 16px);
|
|
121
|
+
text-transform: uppercase;
|
|
122
|
+
transition-duration: var(--emw--transition-medium, 250ms);
|
|
123
|
+
max-width: 400px;
|
|
124
|
+
min-width: 200px;
|
|
125
|
+
padding: 13px 0;
|
|
126
|
+
width: 100%;
|
|
127
|
+
}
|
|
128
|
+
.PamProfileConsentsWrapper .ButtonsArea .SaveButton:active {
|
|
129
|
+
background: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));
|
|
130
|
+
}
|
|
131
|
+
.PamProfileConsentsWrapper .ButtonsArea .SaveButton.Disabled {
|
|
132
|
+
opacity: 0.3;
|
|
133
|
+
cursor: not-allowed;
|
|
134
|
+
}
|
|
135
|
+
.PamProfileConsentsWrapper.skeleton .HeaderArea {
|
|
136
|
+
margin-bottom: 20px;
|
|
137
|
+
}
|
|
138
|
+
.PamProfileConsentsWrapper.skeleton .CategoriesGrid {
|
|
139
|
+
overflow: hidden;
|
|
140
|
+
}
|
|
141
|
+
.PamProfileConsentsWrapper.skeleton .CategoryCard {
|
|
142
|
+
overflow: hidden;
|
|
143
|
+
}
|
|
144
|
+
.PamProfileConsentsWrapper.skeleton .ButtonsArea .SaveButton {
|
|
145
|
+
width: 500px;
|
|
146
|
+
border-radius: 30px;
|
|
147
|
+
overflow: hidden;
|
|
148
|
+
display: block;
|
|
149
|
+
background-image: none;
|
|
150
|
+
border: none;
|
|
151
|
+
}
|
|
152
|
+
@container (max-width: 425px) {
|
|
153
|
+
.PamProfileConsentsWrapper {
|
|
154
|
+
padding: 20px 15px;
|
|
155
|
+
background: var(--emw-color-gray-50, #F9F8F8);
|
|
156
|
+
max-width: unset;
|
|
157
|
+
border-radius: var(--emw--border-radius-small, 5px);
|
|
158
|
+
}
|
|
159
|
+
.PamProfileConsentsWrapper .HeaderText {
|
|
160
|
+
font-size: var(--emw--font-size-large, 20px);
|
|
161
|
+
}
|
|
162
|
+
.PamProfileConsentsWrapper .CategoriesGrid {
|
|
163
|
+
grid-template-columns: 1fr;
|
|
164
|
+
}
|
|
165
|
+
.PamProfileConsentsWrapper .CategoryTitle {
|
|
166
|
+
font-size: var(--emw--font-size-medium, 16px);
|
|
167
|
+
}
|
|
168
|
+
.PamProfileConsentsWrapper .ConsentLabel {
|
|
169
|
+
font-size: var(--emw--size-x-small, 12px);
|
|
170
|
+
}
|
|
171
|
+
.PamProfileConsentsWrapper .ButtonsArea {
|
|
172
|
+
width: 100%;
|
|
173
|
+
}
|
|
174
|
+
.PamProfileConsentsWrapper .ButtonsArea .SaveButton {
|
|
175
|
+
font-size: var(--emw--size-x-small, 12px);
|
|
176
|
+
height: 40px;
|
|
177
|
+
color: var(--emw-button-typography, var(--emw-color-white, #FFFFFF));
|
|
178
|
+
}
|
|
179
|
+
.PamProfileConsentsWrapper .ButtonsArea .SaveButton.Disabled {
|
|
180
|
+
color: var(--emw-color-gray-300, #58586B);
|
|
181
|
+
}
|
|
182
|
+
.PamProfileConsentsWrapper.skeleton .ButtonsArea .SaveButton {
|
|
183
|
+
width: 100%;
|
|
184
|
+
height: 100%;
|
|
185
|
+
border-radius: 20px;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@keyframes fadeIn {
|
|
190
|
+
0% {
|
|
191
|
+
opacity: 0.01;
|
|
192
|
+
}
|
|
193
|
+
1% {
|
|
194
|
+
opacity: 0;
|
|
195
|
+
}
|
|
196
|
+
50% {
|
|
197
|
+
opacity: 0;
|
|
198
|
+
}
|
|
199
|
+
100% {
|
|
200
|
+
opacity: 1;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { translate } from "../../utils/locale.utils";
|
|
3
|
+
import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
|
|
4
|
+
import { isMobile } from "../../utils/utils";
|
|
5
|
+
import "../../../../../ui-skeleton/dist/types/index";
|
|
6
|
+
export class PamProfileConsents {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.isMobileDevice = false;
|
|
9
|
+
this.allConsents = [];
|
|
10
|
+
this.categories = [];
|
|
11
|
+
this.ungroupedConsents = [];
|
|
12
|
+
this.handleFetchResponse = async (res) => {
|
|
13
|
+
var _a;
|
|
14
|
+
if (res.status >= 300) {
|
|
15
|
+
this.isError = true;
|
|
16
|
+
let response = await res.json();
|
|
17
|
+
const errorCode = (_a = response.thirdPartyResponse) === null || _a === void 0 ? void 0 : _a.errorCode;
|
|
18
|
+
this.errorMessage = errorCode ? translate(errorCode, this.lang) : translate('errorMessageFetch', this.lang);
|
|
19
|
+
return Promise.reject(this.errorMessage);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
this.isError = false;
|
|
23
|
+
if (res.headers.get('content-type')) {
|
|
24
|
+
let response = await res.json();
|
|
25
|
+
return Promise.resolve(response);
|
|
26
|
+
}
|
|
27
|
+
return Promise.resolve();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
this.getConsentsData = () => {
|
|
31
|
+
const url = new URL(`/api/pam/v1/player-consents?IncludeUnset=true`, this.endpoint);
|
|
32
|
+
const headers = new Headers();
|
|
33
|
+
headers.append('X-SessionID', this.session);
|
|
34
|
+
const options = {
|
|
35
|
+
method: 'GET',
|
|
36
|
+
headers: headers
|
|
37
|
+
};
|
|
38
|
+
return new Promise((resolve, reject) => {
|
|
39
|
+
fetch(url.href, options)
|
|
40
|
+
.then((res) => this.handleFetchResponse(res))
|
|
41
|
+
.then(res => {
|
|
42
|
+
this.allConsents = res;
|
|
43
|
+
resolve();
|
|
44
|
+
})
|
|
45
|
+
.catch((error) => {
|
|
46
|
+
console.error(error);
|
|
47
|
+
reject(error);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
this.processConsents = () => {
|
|
52
|
+
const optionalConsents = this.allConsents.filter(c => !c.mustAccept);
|
|
53
|
+
const categoryMap = {};
|
|
54
|
+
const ungrouped = [];
|
|
55
|
+
optionalConsents.forEach(consent => {
|
|
56
|
+
if (consent.category) {
|
|
57
|
+
const code = consent.category.categoryTagCode;
|
|
58
|
+
if (!categoryMap[code]) {
|
|
59
|
+
categoryMap[code] = {
|
|
60
|
+
categoryTagCode: code,
|
|
61
|
+
friendlyName: consent.category.friendlyName,
|
|
62
|
+
consents: []
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
categoryMap[code].consents.push(consent);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
ungrouped.push(consent);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
this.categories = Object.values(categoryMap);
|
|
72
|
+
this.ungroupedConsents = ungrouped;
|
|
73
|
+
const newState = {};
|
|
74
|
+
optionalConsents.forEach(consent => {
|
|
75
|
+
newState[consent.tagCode] = consent.status === 'Accepted';
|
|
76
|
+
});
|
|
77
|
+
this.consentsState = newState;
|
|
78
|
+
this.hasChanges = false;
|
|
79
|
+
};
|
|
80
|
+
this.toggleConsent = (tagCode) => {
|
|
81
|
+
this.consentsState = Object.assign(Object.assign({}, this.consentsState), { [tagCode]: !this.consentsState[tagCode] });
|
|
82
|
+
this.hasChanges = true;
|
|
83
|
+
};
|
|
84
|
+
this.saveConsents = () => {
|
|
85
|
+
if (!this.hasChanges || this.isSaving)
|
|
86
|
+
return;
|
|
87
|
+
this.isSaving = true;
|
|
88
|
+
const userConsents = Object.entries(this.consentsState).map(([tagCode, accepted]) => ({
|
|
89
|
+
tagCode,
|
|
90
|
+
status: accepted ? 'Accepted' : 'Denied'
|
|
91
|
+
}));
|
|
92
|
+
const url = new URL(`/api/pam/v1/player-consents`, this.endpoint);
|
|
93
|
+
const headers = new Headers();
|
|
94
|
+
headers.append('X-SessionID', this.session);
|
|
95
|
+
headers.append('Content-Type', 'application/json');
|
|
96
|
+
fetch(url.href, {
|
|
97
|
+
method: 'PATCH',
|
|
98
|
+
headers,
|
|
99
|
+
body: JSON.stringify({ note: '', userConsents })
|
|
100
|
+
})
|
|
101
|
+
.then(res => this.handleFetchResponse(res))
|
|
102
|
+
.then(() => {
|
|
103
|
+
return this.getConsentsData()
|
|
104
|
+
.then(() => this.processConsents());
|
|
105
|
+
})
|
|
106
|
+
.catch((error) => {
|
|
107
|
+
console.error(error);
|
|
108
|
+
})
|
|
109
|
+
.finally(() => {
|
|
110
|
+
this.isSaving = false;
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
this.renderCheckbox = (consent) => {
|
|
114
|
+
const checked = this.consentsState[consent.tagCode];
|
|
115
|
+
return (h("div", { class: "ConsentItem", onClick: () => this.toggleConsent(consent.tagCode) }, h("div", { class: `Checkbox ${checked ? 'Checked' : ''}` }, checked &&
|
|
116
|
+
h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "3", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("polyline", { points: "20 6 9 17 4 12" }))), h("span", { class: "ConsentLabel" }, consent.friendlyName)));
|
|
117
|
+
};
|
|
118
|
+
this.session = undefined;
|
|
119
|
+
this.endpoint = undefined;
|
|
120
|
+
this.lang = 'en';
|
|
121
|
+
this.mbSource = undefined;
|
|
122
|
+
this.clientStyling = undefined;
|
|
123
|
+
this.clientStylingUrl = undefined;
|
|
124
|
+
this.translationUrl = undefined;
|
|
125
|
+
this.skeletonLoading = true;
|
|
126
|
+
this.isError = false;
|
|
127
|
+
this.errorMessage = '';
|
|
128
|
+
this.hasChanges = false;
|
|
129
|
+
this.isSaving = false;
|
|
130
|
+
this.consentsState = {};
|
|
131
|
+
}
|
|
132
|
+
handleStylingChange(newValue, oldValue) {
|
|
133
|
+
if (newValue !== oldValue)
|
|
134
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
135
|
+
}
|
|
136
|
+
handleStylingUrlChange(newValue, oldValue) {
|
|
137
|
+
if (newValue !== oldValue)
|
|
138
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
139
|
+
}
|
|
140
|
+
async componentWillLoad() {
|
|
141
|
+
this.isMobileDevice = isMobile(window.navigator.userAgent);
|
|
142
|
+
await this.getConsentsData()
|
|
143
|
+
.then(() => {
|
|
144
|
+
this.processConsents();
|
|
145
|
+
})
|
|
146
|
+
.finally(() => this.skeletonLoading = false);
|
|
147
|
+
}
|
|
148
|
+
componentDidLoad() {
|
|
149
|
+
if (this.stylingContainer) {
|
|
150
|
+
if (window.emMessageBuss != undefined) {
|
|
151
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
if (this.clientStyling)
|
|
155
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
156
|
+
if (this.clientStylingUrl)
|
|
157
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
disconnectedCallback() {
|
|
162
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
163
|
+
}
|
|
164
|
+
render() {
|
|
165
|
+
if (!this.skeletonLoading && this.isError) {
|
|
166
|
+
return (h("div", { class: "errorContainer" }, h("p", { class: "errorMessage", innerHTML: this.errorMessage })));
|
|
167
|
+
}
|
|
168
|
+
return (h("div", { ref: el => this.stylingContainer = el }, this.skeletonLoading
|
|
169
|
+
? h("div", { class: "PamProfileConsentsWrapper skeleton" }, h("div", { class: "HeaderArea" }, h("ui-skeleton", { structure: "title", width: "200px", height: "30px" })), h("div", { class: "CategoriesGrid" }, [...Array(4).keys()].map(() => h("div", { class: "CategoryCard" }, h("ui-skeleton", { structure: "text", width: "150px", height: "16px", "margin-bottom": "10px" }), h("ui-skeleton", { structure: "rectangle", width: "100%", height: "20px", "margin-bottom": "8px" }), h("ui-skeleton", { structure: "rectangle", width: "100%", height: "20px", "margin-bottom": "8px" })))), h("div", { class: "ButtonsArea" }, h("div", { class: "SaveButton" }, h("ui-skeleton", { structure: "rectangle", width: "auto", height: "50px" }))))
|
|
170
|
+
: h("div", { class: `PamProfileConsentsWrapper ${this.isMobileDevice ? 'Mobile' : ''}` }, h("div", { class: "HeaderArea" }, h("h2", { class: "HeaderText" }, translate('title', this.lang))), h("div", { class: "CategoriesGrid" }, this.categories.map(category => h("div", { class: "CategoryCard" }, h("h3", { class: "CategoryTitle" }, category.friendlyName), category.consents.map(consent => this.renderCheckbox(consent))))), this.ungroupedConsents.length > 0 &&
|
|
171
|
+
h("div", { class: "UngroupedSection" }, this.ungroupedConsents.map(consent => this.renderCheckbox(consent))), h("section", { class: "ButtonsArea" }, h("button", { class: `SaveButton ${!this.hasChanges || this.isSaving ? 'Disabled' : ''}`, onClick: this.saveConsents }, translate('saveButton', this.lang))))));
|
|
172
|
+
}
|
|
173
|
+
static get is() { return "pam-profile-consents"; }
|
|
174
|
+
static get encapsulation() { return "shadow"; }
|
|
175
|
+
static get originalStyleUrls() {
|
|
176
|
+
return {
|
|
177
|
+
"$": ["pam-profile-consents.scss"]
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
static get styleUrls() {
|
|
181
|
+
return {
|
|
182
|
+
"$": ["pam-profile-consents.css"]
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
static get properties() {
|
|
186
|
+
return {
|
|
187
|
+
"session": {
|
|
188
|
+
"type": "string",
|
|
189
|
+
"mutable": false,
|
|
190
|
+
"complexType": {
|
|
191
|
+
"original": "string",
|
|
192
|
+
"resolved": "string",
|
|
193
|
+
"references": {}
|
|
194
|
+
},
|
|
195
|
+
"required": false,
|
|
196
|
+
"optional": false,
|
|
197
|
+
"docs": {
|
|
198
|
+
"tags": [],
|
|
199
|
+
"text": "User session required for the API calls"
|
|
200
|
+
},
|
|
201
|
+
"attribute": "session",
|
|
202
|
+
"reflect": true
|
|
203
|
+
},
|
|
204
|
+
"endpoint": {
|
|
205
|
+
"type": "string",
|
|
206
|
+
"mutable": false,
|
|
207
|
+
"complexType": {
|
|
208
|
+
"original": "string",
|
|
209
|
+
"resolved": "string",
|
|
210
|
+
"references": {}
|
|
211
|
+
},
|
|
212
|
+
"required": false,
|
|
213
|
+
"optional": false,
|
|
214
|
+
"docs": {
|
|
215
|
+
"tags": [],
|
|
216
|
+
"text": "Endpoint URL for the source of data"
|
|
217
|
+
},
|
|
218
|
+
"attribute": "endpoint",
|
|
219
|
+
"reflect": true
|
|
220
|
+
},
|
|
221
|
+
"lang": {
|
|
222
|
+
"type": "string",
|
|
223
|
+
"mutable": false,
|
|
224
|
+
"complexType": {
|
|
225
|
+
"original": "string",
|
|
226
|
+
"resolved": "string",
|
|
227
|
+
"references": {}
|
|
228
|
+
},
|
|
229
|
+
"required": false,
|
|
230
|
+
"optional": false,
|
|
231
|
+
"docs": {
|
|
232
|
+
"tags": [],
|
|
233
|
+
"text": "Language of the widget"
|
|
234
|
+
},
|
|
235
|
+
"attribute": "lang",
|
|
236
|
+
"reflect": true,
|
|
237
|
+
"defaultValue": "'en'"
|
|
238
|
+
},
|
|
239
|
+
"mbSource": {
|
|
240
|
+
"type": "string",
|
|
241
|
+
"mutable": false,
|
|
242
|
+
"complexType": {
|
|
243
|
+
"original": "string",
|
|
244
|
+
"resolved": "string",
|
|
245
|
+
"references": {}
|
|
246
|
+
},
|
|
247
|
+
"required": false,
|
|
248
|
+
"optional": false,
|
|
249
|
+
"docs": {
|
|
250
|
+
"tags": [],
|
|
251
|
+
"text": "mbSource"
|
|
252
|
+
},
|
|
253
|
+
"attribute": "mb-source",
|
|
254
|
+
"reflect": true
|
|
255
|
+
},
|
|
256
|
+
"clientStyling": {
|
|
257
|
+
"type": "string",
|
|
258
|
+
"mutable": false,
|
|
259
|
+
"complexType": {
|
|
260
|
+
"original": "string",
|
|
261
|
+
"resolved": "string",
|
|
262
|
+
"references": {}
|
|
263
|
+
},
|
|
264
|
+
"required": false,
|
|
265
|
+
"optional": false,
|
|
266
|
+
"docs": {
|
|
267
|
+
"tags": [],
|
|
268
|
+
"text": "Client custom styling via inline style"
|
|
269
|
+
},
|
|
270
|
+
"attribute": "client-styling",
|
|
271
|
+
"reflect": true
|
|
272
|
+
},
|
|
273
|
+
"clientStylingUrl": {
|
|
274
|
+
"type": "string",
|
|
275
|
+
"mutable": false,
|
|
276
|
+
"complexType": {
|
|
277
|
+
"original": "string",
|
|
278
|
+
"resolved": "string",
|
|
279
|
+
"references": {}
|
|
280
|
+
},
|
|
281
|
+
"required": false,
|
|
282
|
+
"optional": false,
|
|
283
|
+
"docs": {
|
|
284
|
+
"tags": [],
|
|
285
|
+
"text": "Client custom styling via url"
|
|
286
|
+
},
|
|
287
|
+
"attribute": "client-styling-url",
|
|
288
|
+
"reflect": true
|
|
289
|
+
},
|
|
290
|
+
"translationUrl": {
|
|
291
|
+
"type": "string",
|
|
292
|
+
"mutable": false,
|
|
293
|
+
"complexType": {
|
|
294
|
+
"original": "string",
|
|
295
|
+
"resolved": "string",
|
|
296
|
+
"references": {}
|
|
297
|
+
},
|
|
298
|
+
"required": false,
|
|
299
|
+
"optional": false,
|
|
300
|
+
"docs": {
|
|
301
|
+
"tags": [],
|
|
302
|
+
"text": "Translation url"
|
|
303
|
+
},
|
|
304
|
+
"attribute": "translation-url",
|
|
305
|
+
"reflect": true
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
static get states() {
|
|
310
|
+
return {
|
|
311
|
+
"skeletonLoading": {},
|
|
312
|
+
"isError": {},
|
|
313
|
+
"errorMessage": {},
|
|
314
|
+
"hasChanges": {},
|
|
315
|
+
"isSaving": {},
|
|
316
|
+
"consentsState": {}
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
static get watchers() {
|
|
320
|
+
return [{
|
|
321
|
+
"propName": "clientStyling",
|
|
322
|
+
"methodName": "handleStylingChange"
|
|
323
|
+
}, {
|
|
324
|
+
"propName": "clientStylingUrl",
|
|
325
|
+
"methodName": "handleStylingUrlChange"
|
|
326
|
+
}];
|
|
327
|
+
}
|
|
328
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/pam-profile-consents';
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
export const DEFAULT_LANGUAGE = 'en';
|
|
2
|
+
export const TRANSLATIONS = {
|
|
3
|
+
"en": {
|
|
4
|
+
"title": "Notifications",
|
|
5
|
+
"saveButton": "Save Changes",
|
|
6
|
+
"successMessage": "Your consent preferences have been saved!",
|
|
7
|
+
"errorMessageFetch": "An error has occurred when attempting to fetch consent preferences",
|
|
8
|
+
"errorMessageSave": "An error has occurred when attempting to save consent preferences"
|
|
9
|
+
},
|
|
10
|
+
"zh-hk": {
|
|
11
|
+
"title": "通知",
|
|
12
|
+
"saveButton": "保存更改",
|
|
13
|
+
"successMessage": "您的同意偏好已保存!",
|
|
14
|
+
"errorMessageFetch": "嘗試獲取同意偏好時發生錯誤",
|
|
15
|
+
"errorMessageSave": "嘗試保存同意偏好時發生錯誤"
|
|
16
|
+
},
|
|
17
|
+
"fr": {
|
|
18
|
+
"title": "Notifications",
|
|
19
|
+
"saveButton": "Enregistrer les modifications",
|
|
20
|
+
"successMessage": "Vos préférences de consentement ont été enregistrées !",
|
|
21
|
+
"errorMessageFetch": "Une erreur est survenue lors de la récupération des préférences de consentement",
|
|
22
|
+
"errorMessageSave": "Une erreur est survenue lors de l'enregistrement des préférences de consentement"
|
|
23
|
+
},
|
|
24
|
+
"ro": {
|
|
25
|
+
"title": "Notificări",
|
|
26
|
+
"saveButton": "Salvează modificările",
|
|
27
|
+
"successMessage": "Preferințele dvs. de consimțământ au fost salvate!",
|
|
28
|
+
"errorMessageFetch": "A apărut o eroare la încercarea de a obține preferințele de consimțământ",
|
|
29
|
+
"errorMessageSave": "A apărut o eroare la încercarea de a salva preferințele de consimțământ"
|
|
30
|
+
},
|
|
31
|
+
"tr": {
|
|
32
|
+
"title": "Bildirimler",
|
|
33
|
+
"saveButton": "Değişiklikleri Kaydet",
|
|
34
|
+
"successMessage": "Onay tercihleriniz kaydedildi!",
|
|
35
|
+
"errorMessageFetch": "Onay tercihlerini almaya çalışırken bir hata oluştu",
|
|
36
|
+
"errorMessageSave": "Onay tercihlerini kaydetmeye çalışırken bir hata oluştu"
|
|
37
|
+
},
|
|
38
|
+
"es": {
|
|
39
|
+
"title": "Notificaciones",
|
|
40
|
+
"saveButton": "Guardar cambios",
|
|
41
|
+
"successMessage": "¡Tus preferencias de consentimiento han sido guardadas!",
|
|
42
|
+
"errorMessageFetch": "Se ha producido un error al intentar obtener las preferencias de consentimiento",
|
|
43
|
+
"errorMessageSave": "Se ha producido un error al intentar guardar las preferencias de consentimiento"
|
|
44
|
+
},
|
|
45
|
+
"pt": {
|
|
46
|
+
"title": "Notificações",
|
|
47
|
+
"saveButton": "Salvar alterações",
|
|
48
|
+
"successMessage": "Suas preferências de consentimento foram salvas!",
|
|
49
|
+
"errorMessageFetch": "Ocorreu um erro ao tentar buscar as preferências de consentimento",
|
|
50
|
+
"errorMessageSave": "Ocorreu um erro ao tentar salvar as preferências de consentimento"
|
|
51
|
+
},
|
|
52
|
+
"hr": {
|
|
53
|
+
"title": "Obavijesti",
|
|
54
|
+
"saveButton": "Spremi promjene",
|
|
55
|
+
"successMessage": "Vaše postavke privola su spremljene!",
|
|
56
|
+
"errorMessageFetch": "Došlo je do greške prilikom pokušaja dobivanja postavki privola",
|
|
57
|
+
"errorMessageSave": "Došlo je do greške prilikom pokušaja spremanja postavki privola"
|
|
58
|
+
},
|
|
59
|
+
"pt-br": {
|
|
60
|
+
"title": "Notificações",
|
|
61
|
+
"saveButton": "Salvar alterações",
|
|
62
|
+
"successMessage": "Suas preferências de consentimento foram salvas!",
|
|
63
|
+
"errorMessageFetch": "Ocorreu um erro ao tentar buscar as preferências de consentimento",
|
|
64
|
+
"errorMessageSave": "Ocorreu um erro ao tentar salvar as preferências de consentimento"
|
|
65
|
+
},
|
|
66
|
+
"es-mx": {
|
|
67
|
+
"title": "Notificaciones",
|
|
68
|
+
"saveButton": "Guardar cambios",
|
|
69
|
+
"successMessage": "¡Tus preferencias de consentimiento han sido guardadas!",
|
|
70
|
+
"errorMessageFetch": "Se ha producido un error al intentar obtener las preferencias de consentimiento",
|
|
71
|
+
"errorMessageSave": "Se ha producido un error al intentar guardar las preferencias de consentimiento"
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
export const getTranslations = (url) => {
|
|
75
|
+
return new Promise((resolve) => {
|
|
76
|
+
fetch(url)
|
|
77
|
+
.then((res) => res.json())
|
|
78
|
+
.then((data) => {
|
|
79
|
+
Object.keys(data).forEach((item) => {
|
|
80
|
+
for (let key in data[item]) {
|
|
81
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
resolve(true);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
export const translate = (key, customLang, values) => {
|
|
89
|
+
let lang = TRANSLATIONS[customLang] ? customLang : DEFAULT_LANGUAGE;
|
|
90
|
+
let translation = TRANSLATIONS[lang][key];
|
|
91
|
+
if (values !== undefined) {
|
|
92
|
+
for (const [key, value] of Object.entries(values.values)) {
|
|
93
|
+
const regex = new RegExp(`{${key}}`, 'g');
|
|
94
|
+
translation = translation.replace(regex, value);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return translation;
|
|
98
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name isMobile
|
|
3
|
+
* @description A method that returns if the browser used to access the app is from a mobile device or not
|
|
4
|
+
* @param {String} userAgent window.navigator.userAgent
|
|
5
|
+
* @returns {Boolean} true or false
|
|
6
|
+
*/
|
|
7
|
+
export const isMobile = (userAgent) => {
|
|
8
|
+
return !!(userAgent.toLowerCase().match(/android/i) ||
|
|
9
|
+
userAgent.toLowerCase().match(/blackberry|bb/i) ||
|
|
10
|
+
userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
|
|
11
|
+
userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
|
|
12
|
+
};
|