@everymatrix/pam-consent-modal 0.1.0

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 (56) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/index-9dbdce4a.js +1303 -0
  3. package/dist/cjs/index.cjs.js +10 -0
  4. package/dist/cjs/loader.cjs.js +15 -0
  5. package/dist/cjs/pam-consent-item_2.cjs.entry.js +481 -0
  6. package/dist/cjs/pam-consent-modal-bc9246fa.js +401 -0
  7. package/dist/cjs/pam-consent-modal.cjs.js +25 -0
  8. package/dist/collection/collection-manifest.json +19 -0
  9. package/dist/collection/components/pam-consent-modal/index.js +1 -0
  10. package/dist/collection/components/pam-consent-modal/pam-consent-modal.css +102 -0
  11. package/dist/collection/components/pam-consent-modal/pam-consent-modal.js +454 -0
  12. package/dist/collection/index.js +1 -0
  13. package/dist/collection/utils/locale.utils.js +97 -0
  14. package/dist/collection/utils/types.js +1 -0
  15. package/dist/esm/app-globals-0f993ce5.js +3 -0
  16. package/dist/esm/index-f4cffab8.js +1276 -0
  17. package/dist/esm/index.js +2 -0
  18. package/dist/esm/loader.js +11 -0
  19. package/dist/esm/pam-consent-item_2.entry.js +477 -0
  20. package/dist/esm/pam-consent-modal-be38f983.js +396 -0
  21. package/dist/esm/pam-consent-modal.js +20 -0
  22. package/dist/index.cjs.js +1 -0
  23. package/dist/index.js +1 -0
  24. package/dist/pam-consent-modal/index.esm.js +1 -0
  25. package/dist/pam-consent-modal/p-2af7b124.js +1 -0
  26. package/dist/pam-consent-modal/p-46389116.js +2 -0
  27. package/dist/pam-consent-modal/p-da3e62e4.entry.js +1 -0
  28. package/dist/pam-consent-modal/p-e1255160.js +1 -0
  29. package/dist/pam-consent-modal/pam-consent-modal.esm.js +1 -0
  30. package/dist/stencil.config.dev.js +19 -0
  31. package/dist/stencil.config.js +18 -0
  32. package/dist/storybook/main.js +43 -0
  33. package/dist/storybook/preview.js +9 -0
  34. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-consent-modal/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
  35. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-consent-modal/.stencil/packages/stencil/pam-consent-modal/stencil.config.d.ts +2 -0
  36. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-consent-modal/.stencil/packages/stencil/pam-consent-modal/stencil.config.dev.d.ts +2 -0
  37. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-consent-modal/.stencil/packages/stencil/pam-consent-modal/storybook/main.d.ts +3 -0
  38. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-consent-modal/.stencil/packages/stencil/pam-consent-modal/storybook/preview.d.ts +70 -0
  39. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-consent-modal/.stencil/tools/plugins/index.d.ts +3 -0
  40. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-consent-modal/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
  41. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-consent-modal/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  42. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-consent-modal/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  43. package/dist/types/components/pam-consent-modal/index.d.ts +1 -0
  44. package/dist/types/components/pam-consent-modal/pam-consent-modal.d.ts +69 -0
  45. package/dist/types/components.d.ts +125 -0
  46. package/dist/types/index.d.ts +1 -0
  47. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  48. package/dist/types/utils/locale.utils.d.ts +2 -0
  49. package/dist/types/utils/types.d.ts +12 -0
  50. package/loader/cdn.js +1 -0
  51. package/loader/index.cjs.js +1 -0
  52. package/loader/index.d.ts +24 -0
  53. package/loader/index.es2017.js +1 -0
  54. package/loader/index.js +2 -0
  55. package/loader/package.json +11 -0
  56. package/package.json +27 -0
@@ -0,0 +1,454 @@
1
+ import { h } from "@stencil/core";
2
+ import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
3
+ import { dispatchCustomEvent } from "../../../../../../../../libs/custom-events/src/index";
4
+ import { getTranslations, translate } from "../../utils/locale.utils";
5
+ import "../../../../../pam-consent-item/dist/types/index";
6
+ export class PamConsentModal {
7
+ constructor() {
8
+ /** This obj is passed to the api on consent update */
9
+ this.userConsents = [];
10
+ /** Constant. All possible mandatory consent tag codes */
11
+ this.mandatoryConsentTagCodes = ['termsandconditions', 'privacypolicy'];
12
+ /** Categories that are allowed to form groups */
13
+ this.allowedCategoryGroups = ['Sports', 'Casino', 'VirtualSports'];
14
+ /** Used to render consents */
15
+ this.consentConfig = [];
16
+ this.handleApplyClick = () => {
17
+ this.isQueryFired = true;
18
+ };
19
+ this.handleReject = () => {
20
+ const url = new URL('v1/player/session/player/', this.endpoint);
21
+ const headers = new Headers();
22
+ headers.append('Content-type', 'application/json');
23
+ headers.append('X-SessionID', this.session);
24
+ const options = {
25
+ method: 'DELETE',
26
+ headers: headers
27
+ };
28
+ fetch(url.href, options)
29
+ .then(() => {
30
+ window.postMessage({ type: 'LogoutSuccessfull' }, window.location.href);
31
+ dispatchCustomEvent('logged_out', {});
32
+ });
33
+ };
34
+ this.endpoint = undefined;
35
+ this.session = undefined;
36
+ this.userId = undefined;
37
+ this.language = 'en';
38
+ this.includeSubmitButton = undefined;
39
+ this.includeRejectButton = undefined;
40
+ this.includeRejectText = undefined;
41
+ this.translationUrl = '';
42
+ this.clientStyling = '';
43
+ this.clientStylingUrl = '';
44
+ this.mbSource = undefined;
45
+ this.isLoading = true;
46
+ this.isValid = true;
47
+ this.isQueryFired = false;
48
+ this.receivedQueryResponses = 0;
49
+ this.mandatoryConsentsChecked = 0;
50
+ this.mandatoryConsentsCount = 0;
51
+ this.userConsentTagCodes = [];
52
+ }
53
+ handleClientStylingChange(newValue, oldValue) {
54
+ if (newValue != oldValue) {
55
+ setClientStyling(this.stylingContainer, this.clientStyling);
56
+ }
57
+ }
58
+ handleClientStylingUrlChange(newValue, oldValue) {
59
+ if (newValue != oldValue) {
60
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
61
+ }
62
+ }
63
+ handleMbSourceChange(newValue, oldValue) {
64
+ if (newValue != oldValue) {
65
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
66
+ }
67
+ }
68
+ handleQueryResponse() {
69
+ if (this.receivedQueryResponses === this.consentConfig.length) {
70
+ this.updateConsents();
71
+ }
72
+ }
73
+ userLegislationConsentHandler(event) {
74
+ for (const consent of event.detail) {
75
+ if (this.mandatoryConsentTagCodes.includes(consent.type) && this.isQueryFired === false) {
76
+ consent.value === true ? this.mandatoryConsentsChecked++ : this.mandatoryConsentsChecked--;
77
+ }
78
+ // Register final user choices only if we're ready to update
79
+ if (this.isQueryFired) {
80
+ this.userConsents.push({
81
+ tagCode: consent.type,
82
+ status: Number(consent.value),
83
+ note: ''
84
+ });
85
+ this.receivedQueryResponses++;
86
+ }
87
+ }
88
+ }
89
+ async componentWillLoad() {
90
+ this.getConsents().then(consents => this.setConsentConfig(consents));
91
+ if (this.translationUrl.length > 2) {
92
+ await getTranslations(this.translationUrl);
93
+ }
94
+ }
95
+ componentDidLoad() {
96
+ if (this.stylingContainer) {
97
+ if (this.mbSource)
98
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
99
+ if (this.clientStyling)
100
+ setClientStyling(this.stylingContainer, this.clientStyling);
101
+ if (this.clientStylingUrl)
102
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
103
+ }
104
+ }
105
+ disconnectedCallback() {
106
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
107
+ }
108
+ getConsents() {
109
+ const url = new URL(`/v1/player/${this.userId}/legislation/consents/`, this.endpoint);
110
+ const headers = new Headers({ 'X-SessionId': this.session });
111
+ const options = { method: 'GET', headers };
112
+ return fetch(url.href, options)
113
+ .then(res => {
114
+ if (res.status === 200) {
115
+ return res.json();
116
+ }
117
+ throw new Error(String(res.status));
118
+ })
119
+ .then((data) => {
120
+ return data.consents;
121
+ })
122
+ .catch(error => {
123
+ console.error('Error fetching data:', error);
124
+ return null;
125
+ })
126
+ .finally(() => {
127
+ window.postMessage({
128
+ type: 'UserActionsExists',
129
+ displayUserActions: this.mandatoryConsentsCount > 0
130
+ }, window.location.href);
131
+ this.isLoading = false;
132
+ });
133
+ }
134
+ setConsentConfig(consents) {
135
+ for (const consent of consents) {
136
+ if (consent.status !== 2 || consent.tagCode === 'pepconsent') {
137
+ return;
138
+ }
139
+ const mandatory = this.mandatoryConsentTagCodes.includes(consent.tagCode);
140
+ if (mandatory) {
141
+ ++this.mandatoryConsentsCount;
142
+ }
143
+ if (this.allowedCategoryGroups.includes(consent.category)) {
144
+ const target = this.consentConfig.find(c => c.group === consent.category.toLowerCase());
145
+ if (target) {
146
+ target.consentTypes += (',' + consent.tagCode);
147
+ target.mandatory += (',' + String(mandatory));
148
+ }
149
+ else {
150
+ this.consentConfig.push({
151
+ consentTypes: consent.tagCode,
152
+ group: consent.category.toLowerCase(),
153
+ mandatory: String(mandatory)
154
+ });
155
+ }
156
+ }
157
+ else {
158
+ this.consentConfig.push({
159
+ consentTypes: consent.tagCode,
160
+ group: '',
161
+ mandatory: String(mandatory)
162
+ });
163
+ }
164
+ }
165
+ }
166
+ updateConsents() {
167
+ const url = new URL(`/v1/player/${this.userId}/legislation/consents/`, this.endpoint);
168
+ const headers = new Headers();
169
+ headers.append('Content-Type', 'application/json');
170
+ headers.append('Accept', 'application/json');
171
+ headers.append('X-SessionId', this.session);
172
+ const body = JSON.stringify({ consents: this.userConsents });
173
+ const options = {
174
+ method: 'POST',
175
+ headers,
176
+ body
177
+ };
178
+ fetch(url.href, options)
179
+ .then(res => res.json())
180
+ .then(() => {
181
+ window.postMessage({
182
+ type: 'WidgetNotification',
183
+ data: {
184
+ type: 'success',
185
+ message: 'Consent update successful!'
186
+ }
187
+ }, window.location.href);
188
+ })
189
+ .catch((err) => {
190
+ window.postMessage({
191
+ type: 'WidgetNotification',
192
+ data: {
193
+ type: 'error',
194
+ message: 'Server might not be responding',
195
+ err
196
+ }
197
+ }, window.location.href);
198
+ })
199
+ .finally(() => {
200
+ window.postMessage({ type: 'UserActionsCompleted' }, window.location.href);
201
+ });
202
+ }
203
+ render() {
204
+ if (this.mandatoryConsentsCount === 0) {
205
+ return;
206
+ }
207
+ this.isValid = this.mandatoryConsentsChecked === this.mandatoryConsentsCount;
208
+ return (h("div", { class: "QueryReferenceContainer", ref: el => this.stylingContainer = el }, this.isLoading ? (h("div", null, h("slot", { name: 'spinner' }), h("svg", { class: "spinner", viewBox: "0 0 50 50" }, h("circle", { class: "path", cx: "25", cy: "25", r: "20", fill: "none", "stroke-width": "5" })))) : (h("div", { class: "PamConsentModal" }, h("h2", { class: "ConsentNotice" }, translate('userNoticeText', this.language)), h("div", { class: "ConsentsWrapper" }, this.consentConfig.map(consent => (h("slot", { name: consent.group || consent.consentTypes }, h("pam-consent-item", { language: this.language, "translation-url": this.translationUrl, group: consent.group, consentTypes: consent.consentTypes, queried: this.isQueryFired, mandatory: consent.mandatory, "client-styling-url": this.clientStylingUrl, "mb-source": this.mbSource, "client-styling": this.clientStyling }))))), h("div", { class: "ButtonsWrapper" }, this.includeRejectButton &&
209
+ h("button", { class: "ConsentRejectButton", onClick: this.handleReject }, translate('rejectButtonText', this.language)), this.includeSubmitButton &&
210
+ h("button", { class: "ConsentSubmitButton", disabled: !this.isValid, onClick: this.handleApplyClick }, translate('submitButtonText', this.language))), this.includeRejectText && h("p", { class: "RejectText" }, translate('rejectText', this.language))))));
211
+ }
212
+ static get is() { return "pam-consent-modal"; }
213
+ static get encapsulation() { return "shadow"; }
214
+ static get originalStyleUrls() {
215
+ return {
216
+ "$": ["pam-consent-modal.scss"]
217
+ };
218
+ }
219
+ static get styleUrls() {
220
+ return {
221
+ "$": ["pam-consent-modal.css"]
222
+ };
223
+ }
224
+ static get properties() {
225
+ return {
226
+ "endpoint": {
227
+ "type": "string",
228
+ "mutable": false,
229
+ "complexType": {
230
+ "original": "string",
231
+ "resolved": "string",
232
+ "references": {}
233
+ },
234
+ "required": true,
235
+ "optional": false,
236
+ "docs": {
237
+ "tags": [],
238
+ "text": "the endpoint required for the update call"
239
+ },
240
+ "attribute": "endpoint",
241
+ "reflect": true
242
+ },
243
+ "session": {
244
+ "type": "string",
245
+ "mutable": false,
246
+ "complexType": {
247
+ "original": "string",
248
+ "resolved": "string",
249
+ "references": {}
250
+ },
251
+ "required": true,
252
+ "optional": false,
253
+ "docs": {
254
+ "tags": [],
255
+ "text": "user session required for the update call"
256
+ },
257
+ "attribute": "session",
258
+ "reflect": true
259
+ },
260
+ "userId": {
261
+ "type": "string",
262
+ "mutable": false,
263
+ "complexType": {
264
+ "original": "string",
265
+ "resolved": "string",
266
+ "references": {}
267
+ },
268
+ "required": true,
269
+ "optional": false,
270
+ "docs": {
271
+ "tags": [],
272
+ "text": "user id required for the update call"
273
+ },
274
+ "attribute": "user-id",
275
+ "reflect": true
276
+ },
277
+ "language": {
278
+ "type": "string",
279
+ "mutable": true,
280
+ "complexType": {
281
+ "original": "string",
282
+ "resolved": "string",
283
+ "references": {}
284
+ },
285
+ "required": false,
286
+ "optional": false,
287
+ "docs": {
288
+ "tags": [],
289
+ "text": "language"
290
+ },
291
+ "attribute": "language",
292
+ "reflect": true,
293
+ "defaultValue": "'en'"
294
+ },
295
+ "includeSubmitButton": {
296
+ "type": "boolean",
297
+ "mutable": false,
298
+ "complexType": {
299
+ "original": "boolean",
300
+ "resolved": "boolean",
301
+ "references": {}
302
+ },
303
+ "required": true,
304
+ "optional": false,
305
+ "docs": {
306
+ "tags": [],
307
+ "text": "whether or not to include the submit button (in case we want to compose a different )"
308
+ },
309
+ "attribute": "include-submit-button",
310
+ "reflect": true
311
+ },
312
+ "includeRejectButton": {
313
+ "type": "boolean",
314
+ "mutable": false,
315
+ "complexType": {
316
+ "original": "boolean",
317
+ "resolved": "boolean",
318
+ "references": {}
319
+ },
320
+ "required": true,
321
+ "optional": false,
322
+ "docs": {
323
+ "tags": [],
324
+ "text": "whether or not to include the reject button"
325
+ },
326
+ "attribute": "include-reject-button",
327
+ "reflect": true
328
+ },
329
+ "includeRejectText": {
330
+ "type": "boolean",
331
+ "mutable": false,
332
+ "complexType": {
333
+ "original": "boolean",
334
+ "resolved": "boolean",
335
+ "references": {}
336
+ },
337
+ "required": true,
338
+ "optional": false,
339
+ "docs": {
340
+ "tags": [],
341
+ "text": "whether or not to include the reject desctiption text"
342
+ },
343
+ "attribute": "include-reject-text",
344
+ "reflect": true
345
+ },
346
+ "translationUrl": {
347
+ "type": "string",
348
+ "mutable": false,
349
+ "complexType": {
350
+ "original": "string",
351
+ "resolved": "string",
352
+ "references": {}
353
+ },
354
+ "required": false,
355
+ "optional": false,
356
+ "docs": {
357
+ "tags": [],
358
+ "text": "Translation url"
359
+ },
360
+ "attribute": "translation-url",
361
+ "reflect": true,
362
+ "defaultValue": "''"
363
+ },
364
+ "clientStyling": {
365
+ "type": "string",
366
+ "mutable": true,
367
+ "complexType": {
368
+ "original": "string",
369
+ "resolved": "string",
370
+ "references": {}
371
+ },
372
+ "required": false,
373
+ "optional": false,
374
+ "docs": {
375
+ "tags": [],
376
+ "text": "Client custom styling via inline style"
377
+ },
378
+ "attribute": "client-styling",
379
+ "reflect": true,
380
+ "defaultValue": "''"
381
+ },
382
+ "clientStylingUrl": {
383
+ "type": "string",
384
+ "mutable": false,
385
+ "complexType": {
386
+ "original": "string",
387
+ "resolved": "string",
388
+ "references": {}
389
+ },
390
+ "required": false,
391
+ "optional": false,
392
+ "docs": {
393
+ "tags": [],
394
+ "text": "Client custom styling via url"
395
+ },
396
+ "attribute": "client-styling-url",
397
+ "reflect": true,
398
+ "defaultValue": "''"
399
+ },
400
+ "mbSource": {
401
+ "type": "string",
402
+ "mutable": false,
403
+ "complexType": {
404
+ "original": "string",
405
+ "resolved": "string",
406
+ "references": {}
407
+ },
408
+ "required": false,
409
+ "optional": false,
410
+ "docs": {
411
+ "tags": [],
412
+ "text": "mbSource"
413
+ },
414
+ "attribute": "mb-source",
415
+ "reflect": true
416
+ }
417
+ };
418
+ }
419
+ static get states() {
420
+ return {
421
+ "isLoading": {},
422
+ "isValid": {},
423
+ "isQueryFired": {},
424
+ "receivedQueryResponses": {},
425
+ "mandatoryConsentsChecked": {},
426
+ "mandatoryConsentsCount": {},
427
+ "userConsentTagCodes": {}
428
+ };
429
+ }
430
+ static get watchers() {
431
+ return [{
432
+ "propName": "clientStyling",
433
+ "methodName": "handleClientStylingChange"
434
+ }, {
435
+ "propName": "clientStylingUrl",
436
+ "methodName": "handleClientStylingUrlChange"
437
+ }, {
438
+ "propName": "mbSource",
439
+ "methodName": "handleMbSourceChange"
440
+ }, {
441
+ "propName": "receivedQueryResponses",
442
+ "methodName": "handleQueryResponse"
443
+ }];
444
+ }
445
+ static get listeners() {
446
+ return [{
447
+ "name": "userLegislationConsent",
448
+ "method": "userLegislationConsentHandler",
449
+ "target": undefined,
450
+ "capture": false,
451
+ "passive": false
452
+ }];
453
+ }
454
+ }
@@ -0,0 +1 @@
1
+ export * from './components/pam-consent-modal';
@@ -0,0 +1,97 @@
1
+ const DEFAULT_LANGUAGE = 'en';
2
+ const TRANSLATIONS = {
3
+ en: {
4
+ userNoticeText: 'Before you can proceed you must consent to the following',
5
+ submitButtonText: 'Submit',
6
+ rejectButtonText: 'Reject',
7
+ rejectText: 'Rejecting new consents will result in the inability to continue the login process and you will be logged out.'
8
+ },
9
+ 'en-us': {
10
+ userNoticeText: 'Before you can proceed you must consent to the following',
11
+ submitButtonText: 'Submit',
12
+ rejectButtonText: 'Reject',
13
+ rejectText: 'Rejecting new consents will result in the inability to continue the login process and you will be logged out.'
14
+ },
15
+ ro: {
16
+ userNoticeText: 'Înainte de a continua, trebuie să vă dați consimțământul pentru următoarele',
17
+ submitButtonText: 'Trimite',
18
+ rejectButtonText: 'Respinge',
19
+ rejectText: 'Respingerea noilor consimțăminte va duce la imposibilitatea de a continua procesul de autentificare și veți fi deconectat.'
20
+ },
21
+ hr: {
22
+ userNoticeText: 'Prije nego što možete nastaviti, morate pristati na sljedeće',
23
+ submitButtonText: 'Pošalji',
24
+ rejectButtonText: 'Odbij',
25
+ rejectText: 'Odbijanje novih pristanka rezultirat će nemogućnošću nastavka procesa prijave i bit ćete odjavljeni.'
26
+ },
27
+ fr: {
28
+ userNoticeText: 'Avant de continuer, vous devez consentir aux éléments suivants',
29
+ submitButtonText: 'Soumettre',
30
+ rejectButtonText: 'Rejeter',
31
+ rejectText: 'Le rejet des nouveaux consentements entraînera l\'impossibilité de continuer le processus de connexion et vous serez déconnecté.'
32
+ },
33
+ cs: {
34
+ userNoticeText: 'Než budete moci pokračovat, musíte souhlasit s následujícím',
35
+ submitButtonText: 'Odeslat',
36
+ rejectButtonText: 'Odmítnout',
37
+ rejectText: 'Odmítnutí nových souhlasů povede k nemožnosti pokračovat v procesu přihlášení a budete odhlášeni.'
38
+ },
39
+ de: {
40
+ userNoticeText: 'Bevor Sie fortfahren können, müssen Sie den folgenden Punkten zustimmen',
41
+ submitButtonText: 'Absenden',
42
+ rejectButtonText: 'Ablehnen',
43
+ rejectText: 'Das Ablehnen neuer Zustimmungen führt dazu, dass der Anmeldevorgang nicht fortgesetzt werden kann und Sie abgemeldet werden.'
44
+ },
45
+ es: {
46
+ userNoticeText: 'Antes de continuar, debe dar su consentimiento a lo siguiente',
47
+ submitButtonText: 'Enviar',
48
+ rejectButtonText: 'Rechazar',
49
+ rejectText: 'Rechazar nuevos consentimientos resultará en la imposibilidad de continuar el proceso de inicio de sesión y se cerrará la sesión.'
50
+ },
51
+ pt: {
52
+ userNoticeText: 'Antes de continuar, você deve consentir com o seguinte',
53
+ submitButtonText: 'Enviar',
54
+ rejectButtonText: 'Rejeitar',
55
+ rejectText: 'Rejeitar novos consentimentos resultará na impossibilidade de continuar o processo de login e você será desconectado.'
56
+ },
57
+ 'es-mx': {
58
+ userNoticeText: 'Antes de continuar, debe dar su consentimiento a lo siguiente',
59
+ submitButtonText: 'Enviar',
60
+ rejectButtonText: 'Rechazar',
61
+ rejectText: 'Rechazar nuevos consentimientos resultará en la imposibilidad de continuar el proceso de inicio de sesión y se cerrará la sesión.'
62
+ },
63
+ 'pt-br': {
64
+ userNoticeText: 'Antes de continuar, você deve consentir com o seguinte',
65
+ submitButtonText: 'Enviar',
66
+ rejectButtonText: 'Rejeitar',
67
+ rejectText: 'Rejeitar novos consentimentos resultará na impossibilidade de continuar o processo de login e você será desconectado.'
68
+ }
69
+ };
70
+ export const getTranslations = (url) => {
71
+ return new Promise((resolve) => {
72
+ fetch(url)
73
+ .then((res) => res.json())
74
+ .then((data) => {
75
+ Object.keys(data).forEach((lang) => {
76
+ if (!TRANSLATIONS[lang]) {
77
+ TRANSLATIONS[lang] = {};
78
+ }
79
+ for (let key in data[lang]) {
80
+ TRANSLATIONS[lang][key] = data[lang][key];
81
+ }
82
+ });
83
+ resolve(true);
84
+ });
85
+ });
86
+ };
87
+ export const translate = (key, customLang, values) => {
88
+ const lang = customLang;
89
+ let translation = TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
90
+ if (values !== undefined) {
91
+ for (const [key, value] of Object.entries(values.values)) {
92
+ const regex = new RegExp(`{${key}}`, 'g');
93
+ translation = translation.replace(regex, value);
94
+ }
95
+ }
96
+ return translation;
97
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ const globalScripts = () => {};
2
+
3
+ export { globalScripts as g };