@everymatrix/temporary-consents 1.44.0 → 1.45.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/index-73481e72.js +1148 -0
  3. package/dist/cjs/loader.cjs.js +6 -12
  4. package/dist/cjs/temporary-consents.cjs.entry.js +175 -178
  5. package/dist/cjs/temporary-consents.cjs.js +16 -10
  6. package/dist/collection/collection-manifest.json +3 -3
  7. package/dist/collection/components/temporary-consents/index.js +1 -0
  8. package/dist/collection/components/temporary-consents/temporary-consents.js +282 -289
  9. package/dist/collection/utils/locale.utils.js +50 -50
  10. package/dist/collection/utils/utils.js +3 -0
  11. package/dist/esm/app-globals-0f993ce5.js +3 -0
  12. package/dist/esm/index-6b1e7208.js +1122 -0
  13. package/dist/esm/loader.js +6 -12
  14. package/dist/esm/temporary-consents.entry.js +175 -178
  15. package/dist/esm/temporary-consents.js +13 -10
  16. package/dist/stencil.config.dev.js +17 -0
  17. package/dist/stencil.config.js +14 -19
  18. package/dist/temporary-consents/p-607ca69d.entry.js +1 -0
  19. package/dist/temporary-consents/p-e0f94cfb.js +2 -0
  20. package/dist/temporary-consents/p-e1255160.js +1 -0
  21. package/dist/temporary-consents/temporary-consents.esm.js +1 -1
  22. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/temporary-consents/.stencil/packages/stencil/temporary-consents/stencil.config.d.ts +2 -0
  23. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/temporary-consents/.stencil/packages/stencil/temporary-consents/stencil.config.dev.d.ts +2 -0
  24. package/dist/types/components/temporary-consents/index.d.ts +1 -0
  25. package/dist/types/components/temporary-consents/temporary-consents.d.ts +45 -45
  26. package/dist/types/components/temporary-consents/temporary-consents.type.d.ts +4 -4
  27. package/dist/types/stencil-public-runtime.d.ts +142 -33
  28. package/dist/types/utils/utils.d.ts +1 -0
  29. package/loader/cdn.js +1 -3
  30. package/loader/index.cjs.js +1 -3
  31. package/loader/index.d.ts +13 -1
  32. package/loader/index.es2017.js +1 -3
  33. package/loader/index.js +1 -3
  34. package/loader/package.json +1 -0
  35. package/package.json +8 -1
  36. package/dist/cjs/index-51051de1.js +0 -1163
  37. package/dist/components/index.d.ts +0 -26
  38. package/dist/components/index.js +0 -1
  39. package/dist/components/temporary-consents.d.ts +0 -11
  40. package/dist/components/temporary-consents.js +0 -227
  41. package/dist/esm/index-0f95c245.js +0 -1138
  42. package/dist/esm/polyfills/core-js.js +0 -11
  43. package/dist/esm/polyfills/css-shim.js +0 -1
  44. package/dist/esm/polyfills/dom.js +0 -79
  45. package/dist/esm/polyfills/es5-html-element.js +0 -1
  46. package/dist/esm/polyfills/index.js +0 -34
  47. package/dist/esm/polyfills/system.js +0 -6
  48. package/dist/temporary-consents/p-c8fa79f6.js +0 -1
  49. package/dist/temporary-consents/p-e9beb1df.entry.js +0 -1
  50. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/temporary-consents/.stencil/packages/temporary-consents/stencil.config.d.ts +0 -2
@@ -1,296 +1,289 @@
1
- import { Component, h, Prop, State } from '@stencil/core';
2
- import { getTranslations, translate } from '../../utils/locale.utils';
1
+ import { h } from "@stencil/core";
2
+ import { getTranslations, translate } from "../../utils/locale.utils";
3
3
  export class TemporaryConsents {
4
- constructor() {
5
- /**
6
- * Client custom styling via inline styles
7
- */
8
- this.clientStyling = '';
9
- /**
10
- * Client custom styling via url
11
- */
12
- this.clientStylingUrl = '';
13
- /**
14
- * Translation via url
15
- */
16
- this.translationUrl = '';
17
- this.stylingAppends = false;
18
- this.isLoading = false;
19
- this.setClientStyling = () => {
20
- let sheet = document.createElement('style');
21
- sheet.innerHTML = this.clientStyling;
22
- this.stylingContainer.prepend(sheet);
23
- };
24
- this.setClientStylingURL = () => {
25
- let url = new URL(this.clientStylingUrl);
26
- let cssFile = document.createElement('style');
27
- fetch(url.href)
28
- .then((res) => res.text())
29
- .then((data) => {
30
- cssFile.innerHTML = data;
31
- setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
32
- })
33
- .catch((err) => {
34
- console.log('error ', err);
35
- });
36
- };
37
- }
38
- componentWillLoad() {
39
- const promises = [];
40
- if (this.endpoint && this.userId) {
41
- const consentsPromise = this.getConsents().then((consents) => {
42
- this.temporaryAccountConsent = consents.consents.some((consent) => consent.tagCode == 'temporaryaccountconsent');
43
- });
44
- promises.push(consentsPromise);
4
+ constructor() {
5
+ this.isLoading = false;
6
+ this.setClientStyling = () => {
7
+ let sheet = document.createElement('style');
8
+ sheet.innerHTML = this.clientStyling;
9
+ this.stylingContainer.prepend(sheet);
10
+ };
11
+ this.setClientStylingURL = () => {
12
+ let url = new URL(this.clientStylingUrl);
13
+ let cssFile = document.createElement('style');
14
+ fetch(url.href)
15
+ .then((res) => res.text())
16
+ .then((data) => {
17
+ cssFile.innerHTML = data;
18
+ setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
19
+ })
20
+ .catch((err) => {
21
+ console.log('error ', err);
22
+ });
23
+ };
24
+ this.endpoint = undefined;
25
+ this.userId = undefined;
26
+ this.sessionId = undefined;
27
+ this.daysUntilLockout = undefined;
28
+ this.lang = undefined;
29
+ this.clientStyling = '';
30
+ this.clientStylingUrl = '';
31
+ this.translationUrl = '';
32
+ this.stylingAppends = false;
45
33
  }
46
- if (this.translationUrl) {
47
- const translationPromise = getTranslations(this.translationUrl);
48
- promises.push(translationPromise);
34
+ componentWillLoad() {
35
+ const promises = [];
36
+ if (this.endpoint && this.userId) {
37
+ const consentsPromise = this.getConsents().then((consents) => {
38
+ this.temporaryAccountConsent = consents.consents.some((consent) => consent.tagCode == 'temporaryaccountconsent');
39
+ });
40
+ promises.push(consentsPromise);
41
+ }
42
+ if (this.translationUrl) {
43
+ const translationPromise = getTranslations(this.translationUrl);
44
+ promises.push(translationPromise);
45
+ }
46
+ return Promise.all(promises);
49
47
  }
50
- return Promise.all(promises);
51
- }
52
- componentDidRender() {
53
- // start custom styling area
54
- if (!this.stylingAppends && this.stylingContainer) {
55
- if (this.clientStyling)
56
- this.setClientStyling();
57
- if (this.clientStylingUrl)
58
- this.setClientStylingURL();
59
- this.stylingAppends = true;
48
+ componentDidRender() {
49
+ // start custom styling area
50
+ if (!this.stylingAppends && this.stylingContainer) {
51
+ if (this.clientStyling)
52
+ this.setClientStyling();
53
+ if (this.clientStylingUrl)
54
+ this.setClientStylingURL();
55
+ this.stylingAppends = true;
56
+ }
57
+ // end custom styling area
60
58
  }
61
- // end custom styling area
62
- }
63
- getConsents() {
64
- const url = new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
65
- const headers = new Headers();
66
- headers.append('X-SessionId', this.sessionId);
67
- headers.append('Accept', 'application/json');
68
- const options = {
69
- method: 'GET',
70
- headers
71
- };
72
- return new Promise((resolve, reject) => {
73
- this.isLoading = true;
74
- fetch(url.href, options)
75
- .then((res) => res.json())
76
- .then((consents) => {
77
- resolve(consents);
78
- }).catch((err) => {
79
- console.error(err);
80
- reject(err);
81
- }).finally(() => {
82
- this.isLoading = false;
83
- });
84
- });
85
- }
86
- setConsents() {
87
- const url = new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
88
- const headers = new Headers();
89
- headers.append('X-SessionId', this.sessionId);
90
- headers.append('Accept', 'application/json');
91
- headers.append('Content-Type', 'application/json');
92
- const body = {
93
- consents: [{
94
- tagCode: 'temporaryaccountconsent',
95
- note: '',
96
- status: 1
97
- }]
98
- };
99
- const options = {
100
- method: 'POST',
101
- headers,
102
- body: JSON.stringify(body)
103
- };
104
- return new Promise((resolve, reject) => {
105
- this.isLoading = true;
106
- fetch(url.href, options)
107
- .then((res) => res.json())
108
- .then((res) => {
109
- resolve(res);
110
- }).catch((err) => {
111
- console.error(err);
112
- reject(err);
113
- }).finally(() => {
114
- this.isLoading = false;
115
- });
116
- });
117
- }
118
- handleDecline() {
119
- window.postMessage({ type: 'TemporaryConsentsDeclined' }, window.location.href);
120
- }
121
- handleAccept() {
122
- this.setConsents();
123
- window.postMessage({ type: 'TemporaryConsentsAccepted' }, window.location.href);
124
- }
125
- render() {
126
- if (this.temporaryAccountConsent) {
127
- if (this.isLoading) {
128
- return h("p", null, translate('loading', this.lang));
129
- }
130
- return h("div", { class: 'TemporaryConsents', ref: el => this.stylingContainer = el },
131
- h("h2", { class: 'TemporaryConsentsTitle' },
132
- " ",
133
- translate('title', this.lang),
134
- " "),
135
- h("p", { class: 'TemporaryConsentsText' },
136
- " ",
137
- translate('description', this.lang, { values: { daysUntilLockout: this.daysUntilLockout } }),
138
- " "),
139
- h("div", { class: 'TemporaryConsentsButtonsWrapper' },
140
- h("button", { class: 'TemporaryConsentsButton TemporaryConsentsButtonDecline', onClick: () => this.handleDecline() }, translate('declineButton', this.lang)),
141
- h("button", { class: 'TemporaryConsentsButton TemporaryConsentsButtonAccept', onClick: this.handleAccept }, translate('acceptButton', this.lang))));
59
+ getConsents() {
60
+ const url = new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
61
+ const headers = new Headers();
62
+ headers.append('X-SessionId', this.sessionId);
63
+ headers.append('Accept', 'application/json');
64
+ const options = {
65
+ method: 'GET',
66
+ headers
67
+ };
68
+ return new Promise((resolve, reject) => {
69
+ this.isLoading = true;
70
+ fetch(url.href, options)
71
+ .then((res) => res.json())
72
+ .then((consents) => {
73
+ resolve(consents);
74
+ }).catch((err) => {
75
+ console.error(err);
76
+ reject(err);
77
+ }).finally(() => {
78
+ this.isLoading = false;
79
+ });
80
+ });
81
+ }
82
+ setConsents() {
83
+ const url = new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
84
+ const headers = new Headers();
85
+ headers.append('X-SessionId', this.sessionId);
86
+ headers.append('Accept', 'application/json');
87
+ headers.append('Content-Type', 'application/json');
88
+ const body = {
89
+ consents: [{
90
+ tagCode: 'temporaryaccountconsent',
91
+ note: '',
92
+ status: 1
93
+ }]
94
+ };
95
+ const options = {
96
+ method: 'POST',
97
+ headers,
98
+ body: JSON.stringify(body)
99
+ };
100
+ return new Promise((resolve, reject) => {
101
+ this.isLoading = true;
102
+ fetch(url.href, options)
103
+ .then((res) => res.json())
104
+ .then((res) => {
105
+ resolve(res);
106
+ }).catch((err) => {
107
+ console.error(err);
108
+ reject(err);
109
+ }).finally(() => {
110
+ this.isLoading = false;
111
+ });
112
+ });
113
+ }
114
+ handleDecline() {
115
+ window.postMessage({ type: 'TemporaryConsentsDeclined' }, window.location.href);
116
+ }
117
+ handleAccept() {
118
+ this.setConsents();
119
+ window.postMessage({ type: 'TemporaryConsentsAccepted' }, window.location.href);
120
+ }
121
+ render() {
122
+ if (this.temporaryAccountConsent) {
123
+ if (this.isLoading) {
124
+ return h("p", null, translate('loading', this.lang));
125
+ }
126
+ return h("div", { class: 'TemporaryConsents', ref: el => this.stylingContainer = el }, h("h2", { class: 'TemporaryConsentsTitle' }, " ", translate('title', this.lang), " "), h("p", { class: 'TemporaryConsentsText' }, " ", translate('description', this.lang, { values: { daysUntilLockout: this.daysUntilLockout } }), " "), h("div", { class: 'TemporaryConsentsButtonsWrapper' }, h("button", { class: 'TemporaryConsentsButton TemporaryConsentsButtonDecline', onClick: () => this.handleDecline() }, translate('declineButton', this.lang)), h("button", { class: 'TemporaryConsentsButton TemporaryConsentsButtonAccept', onClick: this.handleAccept }, translate('acceptButton', this.lang))));
127
+ }
128
+ }
129
+ static get is() { return "temporary-consents"; }
130
+ static get encapsulation() { return "shadow"; }
131
+ static get originalStyleUrls() {
132
+ return {
133
+ "$": ["temporary-consents.scss"]
134
+ };
135
+ }
136
+ static get styleUrls() {
137
+ return {
138
+ "$": ["temporary-consents.css"]
139
+ };
140
+ }
141
+ static get properties() {
142
+ return {
143
+ "endpoint": {
144
+ "type": "string",
145
+ "mutable": false,
146
+ "complexType": {
147
+ "original": "string",
148
+ "resolved": "string",
149
+ "references": {}
150
+ },
151
+ "required": true,
152
+ "optional": false,
153
+ "docs": {
154
+ "tags": [],
155
+ "text": "The NWA endpoint"
156
+ },
157
+ "attribute": "endpoint",
158
+ "reflect": true
159
+ },
160
+ "userId": {
161
+ "type": "string",
162
+ "mutable": false,
163
+ "complexType": {
164
+ "original": "string",
165
+ "resolved": "string",
166
+ "references": {}
167
+ },
168
+ "required": true,
169
+ "optional": false,
170
+ "docs": {
171
+ "tags": [],
172
+ "text": "The NWA user id"
173
+ },
174
+ "attribute": "user-id",
175
+ "reflect": true
176
+ },
177
+ "sessionId": {
178
+ "type": "string",
179
+ "mutable": false,
180
+ "complexType": {
181
+ "original": "string",
182
+ "resolved": "string",
183
+ "references": {}
184
+ },
185
+ "required": true,
186
+ "optional": false,
187
+ "docs": {
188
+ "tags": [],
189
+ "text": "The NWA session for the logged in user"
190
+ },
191
+ "attribute": "session-id",
192
+ "reflect": true
193
+ },
194
+ "daysUntilLockout": {
195
+ "type": "string",
196
+ "mutable": false,
197
+ "complexType": {
198
+ "original": "string",
199
+ "resolved": "string",
200
+ "references": {}
201
+ },
202
+ "required": false,
203
+ "optional": false,
204
+ "docs": {
205
+ "tags": [],
206
+ "text": "The language of the integrator"
207
+ },
208
+ "attribute": "days-until-lockout",
209
+ "reflect": true
210
+ },
211
+ "lang": {
212
+ "type": "string",
213
+ "mutable": false,
214
+ "complexType": {
215
+ "original": "string",
216
+ "resolved": "string",
217
+ "references": {}
218
+ },
219
+ "required": false,
220
+ "optional": false,
221
+ "docs": {
222
+ "tags": [],
223
+ "text": "The language of the integrator"
224
+ },
225
+ "attribute": "lang",
226
+ "reflect": true
227
+ },
228
+ "clientStyling": {
229
+ "type": "string",
230
+ "mutable": false,
231
+ "complexType": {
232
+ "original": "string",
233
+ "resolved": "string",
234
+ "references": {}
235
+ },
236
+ "required": false,
237
+ "optional": false,
238
+ "docs": {
239
+ "tags": [],
240
+ "text": "Client custom styling via inline styles"
241
+ },
242
+ "attribute": "client-styling",
243
+ "reflect": true,
244
+ "defaultValue": "''"
245
+ },
246
+ "clientStylingUrl": {
247
+ "type": "string",
248
+ "mutable": false,
249
+ "complexType": {
250
+ "original": "string",
251
+ "resolved": "string",
252
+ "references": {}
253
+ },
254
+ "required": false,
255
+ "optional": false,
256
+ "docs": {
257
+ "tags": [],
258
+ "text": "Client custom styling via url"
259
+ },
260
+ "attribute": "client-styling-url",
261
+ "reflect": true,
262
+ "defaultValue": "''"
263
+ },
264
+ "translationUrl": {
265
+ "type": "string",
266
+ "mutable": false,
267
+ "complexType": {
268
+ "original": "string",
269
+ "resolved": "string",
270
+ "references": {}
271
+ },
272
+ "required": false,
273
+ "optional": false,
274
+ "docs": {
275
+ "tags": [],
276
+ "text": "Translation via url"
277
+ },
278
+ "attribute": "translation-url",
279
+ "reflect": true,
280
+ "defaultValue": "''"
281
+ }
282
+ };
142
283
  }
143
- }
144
- static get is() { return "temporary-consents"; }
145
- static get encapsulation() { return "shadow"; }
146
- static get originalStyleUrls() { return {
147
- "$": ["temporary-consents.scss"]
148
- }; }
149
- static get styleUrls() { return {
150
- "$": ["temporary-consents.css"]
151
- }; }
152
- static get properties() { return {
153
- "endpoint": {
154
- "type": "string",
155
- "mutable": false,
156
- "complexType": {
157
- "original": "string",
158
- "resolved": "string",
159
- "references": {}
160
- },
161
- "required": true,
162
- "optional": false,
163
- "docs": {
164
- "tags": [],
165
- "text": "The NWA endpoint"
166
- },
167
- "attribute": "endpoint",
168
- "reflect": true
169
- },
170
- "userId": {
171
- "type": "string",
172
- "mutable": false,
173
- "complexType": {
174
- "original": "string",
175
- "resolved": "string",
176
- "references": {}
177
- },
178
- "required": true,
179
- "optional": false,
180
- "docs": {
181
- "tags": [],
182
- "text": "The NWA user id"
183
- },
184
- "attribute": "user-id",
185
- "reflect": true
186
- },
187
- "sessionId": {
188
- "type": "string",
189
- "mutable": false,
190
- "complexType": {
191
- "original": "string",
192
- "resolved": "string",
193
- "references": {}
194
- },
195
- "required": true,
196
- "optional": false,
197
- "docs": {
198
- "tags": [],
199
- "text": "The NWA session for the logged in user"
200
- },
201
- "attribute": "session-id",
202
- "reflect": true
203
- },
204
- "daysUntilLockout": {
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": "The language of the integrator"
217
- },
218
- "attribute": "days-until-lockout",
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": "The language of the integrator"
234
- },
235
- "attribute": "lang",
236
- "reflect": true
237
- },
238
- "clientStyling": {
239
- "type": "string",
240
- "mutable": false,
241
- "complexType": {
242
- "original": "string",
243
- "resolved": "string",
244
- "references": {}
245
- },
246
- "required": false,
247
- "optional": false,
248
- "docs": {
249
- "tags": [],
250
- "text": "Client custom styling via inline styles"
251
- },
252
- "attribute": "client-styling",
253
- "reflect": true,
254
- "defaultValue": "''"
255
- },
256
- "clientStylingUrl": {
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 url"
269
- },
270
- "attribute": "client-styling-url",
271
- "reflect": true,
272
- "defaultValue": "''"
273
- },
274
- "translationUrl": {
275
- "type": "string",
276
- "mutable": false,
277
- "complexType": {
278
- "original": "string",
279
- "resolved": "string",
280
- "references": {}
281
- },
282
- "required": false,
283
- "optional": false,
284
- "docs": {
285
- "tags": [],
286
- "text": "Translation via url"
287
- },
288
- "attribute": "translation-url",
289
- "reflect": true,
290
- "defaultValue": "''"
284
+ static get states() {
285
+ return {
286
+ "stylingAppends": {}
287
+ };
291
288
  }
292
- }; }
293
- static get states() { return {
294
- "stylingAppends": {}
295
- }; }
296
289
  }