fhdp-extenders 4.10.6-SNAPSHOT-1696606565019 → 4.10.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.
@@ -1,217 +1,217 @@
1
- // import {FhContainer, FHML} from "fh-forms-handler";
2
- import {ComponentExtender} from "fh-forms-handler";
3
- import {addRule, excludeRule} from "./extenders/DynamicRelocator"
4
-
5
- export let BORDER_WINDOW_WIDTH = 768;
6
-
7
- export const SET_BORDER_WINDOW_WIDHT = (width: number) => {
8
- BORDER_WINDOW_WIDTH = width;
9
- }
10
-
11
- const MOBILE_MENU_CLICK_HANDLER = (ev) => {
12
- if (document.body.offsetWidth < BORDER_WINDOW_WIDTH) {
13
- }
14
- }
15
-
16
- const componentExtender = ComponentExtender.getInstance();
17
-
18
- export const initMobileNavbarRules = () => {
19
- addRule(
20
- '#navbarFormDesktop',
21
- async (mutation) => !!document.getElementById('navbarFormDesktop') && mutation.target.id === 'navbarFormDesktop',
22
- async (mutation) => {
23
- if (document.body.offsetWidth < BORDER_WINDOW_WIDTH) {
24
- mutation.target.style.display = 'none';
25
- document.getElementById('fhFooterContent').style.textAlign = 'left';
26
- document.getElementById('version').style.textAlign = 'right';
27
- } else {
28
- mutation.target.style.display = 'inline-block';
29
- document.getElementById('fhFooterContent').style.textAlign = 'center';
30
- document.getElementById('version').style.textAlign = 'center';
31
- }
32
- }
33
- );
34
-
35
- addRule(
36
- '#navbarFormMobile',
37
- async (mutation) => !!document.getElementById('navbarFormMobile') && mutation.target.id === 'navbarFormMobile',
38
- async (mutation) => {
39
- if (document.body.offsetWidth < BORDER_WINDOW_WIDTH) {
40
- mutation.target.style.display = 'flex';
41
- mutation.target.style.flexDirection = 'column-reverse';
42
-
43
- let prevScrollpos = window.pageYOffset;
44
- window.onscroll = () => {
45
- const useerMenuMobile = (document.querySelector('#menuFormMobile') as any);
46
- const mainMenuMobile = (document.querySelector('#mainMenuRowMobile') as any);
47
- if (!(window as any).menuClickedLock && useerMenuMobile && useerMenuMobile.offsetParent) {
48
- (window as any).menuClickedLock = true;
49
- (document.querySelector('#mobileUserMenuButton') as any).click();
50
- setTimeout(() => {
51
- (window as any).menuClickedLock = false;
52
- }, 800);
53
- }
54
- if (!(window as any).menuClickedLock && mainMenuMobile && mainMenuMobile.offsetParent) {
55
- (window as any).menuClickedLock = true;
56
- (document.querySelector('#mobileMainMenuButton') as any).click();
57
- setTimeout(() => {
58
- (window as any).menuClickedLock = false;
59
- }, 800);
60
- }
61
- const currentScrollPos = window.pageYOffset;
62
- if ((window as any).scrollCounter === true) {
63
- let cs = document.querySelector('.counter-scroll') as any;
64
- if (!cs) {
65
- cs = document.createElement('span') as any;
66
- cs.style.position = 'fixed';
67
- cs.style.left = 0;
68
- cs.style.top = 0;
69
- cs.style.fontSize = 15;
70
- cs.style.zIndex = 200;
71
- cs.classList.add('counter-scroll');
72
- document.body.appendChild(cs);
73
- }
74
- cs.innerText = window.pageYOffset;
75
- console.log(window.pageYOffset);
76
- }
77
- if (prevScrollpos > currentScrollPos || currentScrollPos <= 0) {
78
- (document.querySelector(".header-wrapper") as any).style.top = "0";
79
- } else {
80
- (document.querySelector(".header-wrapper") as any).style.top = "-86px";
81
- }
82
- prevScrollpos = currentScrollPos;
83
- }
84
- (window as any).handlerImplemented = true;
85
- } else {
86
- mutation.target.style.display = 'none';
87
- mutation.target.style.flexDirection = 'unset';
88
- window.onscroll = () => {}
89
- (document.querySelector(".header-wrapper") as any).style.top = "0";
90
- (window as any).handlerImplemented = false;
91
- }
92
- }
93
- );
94
- }
95
-
96
- export const initErrorBelowFieldRule = () => {
97
- addRule(
98
- '.form-control.border-danger',
99
- async (mutation) => {
100
- const selector = document.querySelector('.form-control.border-danger')
101
- if (!!selector) {
102
- const title = selector.getAttribute('title');
103
- if (!!title && title !== null && title !== 'null') {
104
- return true;
105
- }
106
- }
107
- return false;
108
- },
109
- async (mutation) => {
110
- const allData = Array.from(document.querySelectorAll('.form-control.border-danger') as any);
111
- for (const fl of allData) {
112
- const field = fl as any;
113
- const title = field.getAttribute('title');
114
- if (!!title && title !== null && title !== 'null') {
115
- field.removeAttribute('title');
116
- let errorSpan = field.parentElement.parentElement.querySelector('.bap-error-span');
117
- if (!errorSpan) {
118
- errorSpan = document.createElement('span');
119
- errorSpan.classList.add('bap-error-span');
120
- field.parentElement.parentElement.appendChild(errorSpan);
121
- }
122
- errorSpan.innerText = title;
123
- }
124
- }
125
- }
126
- )
127
-
128
- addRule(
129
- '.bap-error-span',
130
- async (mutation) => {
131
- return !!document.querySelector('.bap-error-span') &&
132
- !document.querySelector('.bap-error-span').parentElement.querySelector('.form-control').classList.contains('border-danger')
133
-
134
- },
135
- async (mutation) => {
136
- const allElements = Array.from(document.querySelectorAll('.bap-error-span') as any);
137
- for (const el of allElements) {
138
- const element = el as any;
139
- if (!element.parentElement.querySelector('.form-control').classList.contains('border-danger')) {
140
- element.remove();
141
- }
142
- }
143
- }
144
- );
145
- }
146
- export const initDynamicFooterPositionRule = () => {
147
- addRule(
148
- '#fh-layout-standard',
149
- async (mutation) => {
150
- return document.getElementById('fh-layout-standard').offsetHeight + 90 + document.getElementById('fhFooter').offsetHeight > document.body.offsetHeight
151
- },
152
- async (muataion) => {
153
- let mobileOffset = 0;
154
- if (document.body.offsetWidth < BORDER_WINDOW_WIDTH) {
155
- mobileOffset = document.getElementById('fhFooter').offsetHeight;
156
- }
157
- document.documentElement.style.setProperty('--footer-position', `${document.getElementById('fh-layout-standard').offsetHeight + mobileOffset}px`)
158
- }
159
- )
160
-
161
- addRule(
162
- '#fh-layout-standard',
163
- async (mutation) => {
164
- return document.getElementById('fh-layout-standard').offsetHeight + document.getElementById('fhFooter').offsetHeight + Number(getComputedStyle(document.getElementById('fhFooter')).marginTop.replace('px', '')) + 90 <= document.body.offsetHeight
165
- },
166
- async (muataion) => {
167
- let mobileOffset = 0;
168
- if (document.body.offsetWidth < BORDER_WINDOW_WIDTH) {
169
- mobileOffset = 16;
170
- }
171
- document.documentElement.style.setProperty('--footer-position', `${(document.body.offsetHeight + mobileOffset) - document.getElementById('fhFooter').offsetHeight - Number(getComputedStyle(document.getElementById('fhFooter')).marginTop.replace('px', ''))}px`)
172
- }
173
- )
174
- }
175
-
176
- export const initCurrentMenuElementHighlightRule = (borderBottomStyle: string) => {
177
- const handlerFunc = (params, obj) => {
178
- const cel = obj.container.querySelector(`${obj.id} .current-menu-el:not(.highlighted)`);
179
- if (cel && getComputedStyle(cel.parentElement.parentElement.parentElement).display !== 'none') {
180
- cel.classList.add('highlighted');
181
- cel.parentElement.style.setProperty('border-bottom', borderBottomStyle, 'important');
182
- }
183
- const ncel = obj.container.querySelector(`${obj.id} .not-current-menu-el`);
184
- if (ncel) {
185
- ncel.parentElement.style.borderBottom = '';
186
- ncel.classList.remove('highlighted');
187
- }
188
- };
189
- componentExtender.addStaticExtender({
190
- componentName: 'Button',
191
- create: handlerFunc,
192
- update: (chParams, params, obj) => {
193
- handlerFunc(params, obj);
194
- }
195
-
196
- });
197
- }
198
-
199
- export const initHomeAutoSelectRule = () => {
200
- addRule(
201
- '.--home',
202
- async (mutation) => mutation.target.querySelector('.--home') && localStorage.getItem('homeClicked') !== 'true',
203
- async (mutation) => {
204
- localStorage.setItem('homeClicked', 'true');
205
- let el = document.querySelector('.--home');
206
- while (el.tagName !== 'BUTTON' && !!el.parentElement) {
207
- el = el.parentElement;
208
- }
209
- if (el.tagName === 'BUTTON') {
210
- (el as HTMLElement).click();
211
- }
212
- window.onbeforeunload = () => {
213
- localStorage.removeItem('homeClicked');
214
- }
215
- }
216
- )
1
+ // import {FhContainer, FHML} from "fh-forms-handler";
2
+ import {ComponentExtender} from "fh-forms-handler";
3
+ import {addRule, excludeRule} from "./extenders/DynamicRelocator"
4
+
5
+ export let BORDER_WINDOW_WIDTH = 768;
6
+
7
+ export const SET_BORDER_WINDOW_WIDHT = (width: number) => {
8
+ BORDER_WINDOW_WIDTH = width;
9
+ }
10
+
11
+ const MOBILE_MENU_CLICK_HANDLER = (ev) => {
12
+ if (document.body.offsetWidth < BORDER_WINDOW_WIDTH) {
13
+ }
14
+ }
15
+
16
+ const componentExtender = ComponentExtender.getInstance();
17
+
18
+ export const initMobileNavbarRules = () => {
19
+ addRule(
20
+ '#navbarFormDesktop',
21
+ async (mutation) => !!document.getElementById('navbarFormDesktop') && mutation.target.id === 'navbarFormDesktop',
22
+ async (mutation) => {
23
+ if (document.body.offsetWidth < BORDER_WINDOW_WIDTH) {
24
+ mutation.target.style.display = 'none';
25
+ document.getElementById('fhFooterContent').style.textAlign = 'left';
26
+ document.getElementById('version').style.textAlign = 'right';
27
+ } else {
28
+ mutation.target.style.display = 'inline-block';
29
+ document.getElementById('fhFooterContent').style.textAlign = 'center';
30
+ document.getElementById('version').style.textAlign = 'center';
31
+ }
32
+ }
33
+ );
34
+
35
+ addRule(
36
+ '#navbarFormMobile',
37
+ async (mutation) => !!document.getElementById('navbarFormMobile') && mutation.target.id === 'navbarFormMobile',
38
+ async (mutation) => {
39
+ if (document.body.offsetWidth < BORDER_WINDOW_WIDTH) {
40
+ mutation.target.style.display = 'flex';
41
+ mutation.target.style.flexDirection = 'column-reverse';
42
+
43
+ let prevScrollpos = window.pageYOffset;
44
+ window.onscroll = () => {
45
+ const useerMenuMobile = (document.querySelector('#menuFormMobile') as any);
46
+ const mainMenuMobile = (document.querySelector('#mainMenuRowMobile') as any);
47
+ if (!(window as any).menuClickedLock && useerMenuMobile && useerMenuMobile.offsetParent) {
48
+ (window as any).menuClickedLock = true;
49
+ (document.querySelector('#mobileUserMenuButton') as any).click();
50
+ setTimeout(() => {
51
+ (window as any).menuClickedLock = false;
52
+ }, 800);
53
+ }
54
+ if (!(window as any).menuClickedLock && mainMenuMobile && mainMenuMobile.offsetParent) {
55
+ (window as any).menuClickedLock = true;
56
+ (document.querySelector('#mobileMainMenuButton') as any).click();
57
+ setTimeout(() => {
58
+ (window as any).menuClickedLock = false;
59
+ }, 800);
60
+ }
61
+ const currentScrollPos = window.pageYOffset;
62
+ if ((window as any).scrollCounter === true) {
63
+ let cs = document.querySelector('.counter-scroll') as any;
64
+ if (!cs) {
65
+ cs = document.createElement('span') as any;
66
+ cs.style.position = 'fixed';
67
+ cs.style.left = 0;
68
+ cs.style.top = 0;
69
+ cs.style.fontSize = 15;
70
+ cs.style.zIndex = 200;
71
+ cs.classList.add('counter-scroll');
72
+ document.body.appendChild(cs);
73
+ }
74
+ cs.innerText = window.pageYOffset;
75
+ console.log(window.pageYOffset);
76
+ }
77
+ if (prevScrollpos > currentScrollPos || currentScrollPos <= 0) {
78
+ (document.querySelector(".header-wrapper") as any).style.top = "0";
79
+ } else {
80
+ (document.querySelector(".header-wrapper") as any).style.top = "-86px";
81
+ }
82
+ prevScrollpos = currentScrollPos;
83
+ }
84
+ (window as any).handlerImplemented = true;
85
+ } else {
86
+ mutation.target.style.display = 'none';
87
+ mutation.target.style.flexDirection = 'unset';
88
+ window.onscroll = () => {}
89
+ (document.querySelector(".header-wrapper") as any).style.top = "0";
90
+ (window as any).handlerImplemented = false;
91
+ }
92
+ }
93
+ );
94
+ }
95
+
96
+ export const initErrorBelowFieldRule = () => {
97
+ addRule(
98
+ '.form-control.border-danger',
99
+ async (mutation) => {
100
+ const selector = document.querySelector('.form-control.border-danger')
101
+ if (!!selector) {
102
+ const title = selector.getAttribute('title');
103
+ if (!!title && title !== null && title !== 'null') {
104
+ return true;
105
+ }
106
+ }
107
+ return false;
108
+ },
109
+ async (mutation) => {
110
+ const allData = Array.from(document.querySelectorAll('.form-control.border-danger') as any);
111
+ for (const fl of allData) {
112
+ const field = fl as any;
113
+ const title = field.getAttribute('title');
114
+ if (!!title && title !== null && title !== 'null') {
115
+ field.removeAttribute('title');
116
+ let errorSpan = field.parentElement.parentElement.querySelector('.bap-error-span');
117
+ if (!errorSpan) {
118
+ errorSpan = document.createElement('span');
119
+ errorSpan.classList.add('bap-error-span');
120
+ field.parentElement.parentElement.appendChild(errorSpan);
121
+ }
122
+ errorSpan.innerText = title;
123
+ }
124
+ }
125
+ }
126
+ )
127
+
128
+ addRule(
129
+ '.bap-error-span',
130
+ async (mutation) => {
131
+ return !!document.querySelector('.bap-error-span') &&
132
+ !document.querySelector('.bap-error-span').parentElement.querySelector('.form-control').classList.contains('border-danger')
133
+
134
+ },
135
+ async (mutation) => {
136
+ const allElements = Array.from(document.querySelectorAll('.bap-error-span') as any);
137
+ for (const el of allElements) {
138
+ const element = el as any;
139
+ if (!element.parentElement.querySelector('.form-control').classList.contains('border-danger')) {
140
+ element.remove();
141
+ }
142
+ }
143
+ }
144
+ );
145
+ }
146
+ export const initDynamicFooterPositionRule = () => {
147
+ addRule(
148
+ '#fh-layout-standard',
149
+ async (mutation) => {
150
+ return document.getElementById('fh-layout-standard').offsetHeight + 90 + document.getElementById('fhFooter').offsetHeight > document.body.offsetHeight
151
+ },
152
+ async (muataion) => {
153
+ let mobileOffset = 0;
154
+ if (document.body.offsetWidth < BORDER_WINDOW_WIDTH) {
155
+ mobileOffset = document.getElementById('fhFooter').offsetHeight;
156
+ }
157
+ document.documentElement.style.setProperty('--footer-position', `${document.getElementById('fh-layout-standard').offsetHeight + mobileOffset}px`)
158
+ }
159
+ )
160
+
161
+ addRule(
162
+ '#fh-layout-standard',
163
+ async (mutation) => {
164
+ return document.getElementById('fh-layout-standard').offsetHeight + document.getElementById('fhFooter').offsetHeight + Number(getComputedStyle(document.getElementById('fhFooter')).marginTop.replace('px', '')) + 90 <= document.body.offsetHeight
165
+ },
166
+ async (muataion) => {
167
+ let mobileOffset = 0;
168
+ if (document.body.offsetWidth < BORDER_WINDOW_WIDTH) {
169
+ mobileOffset = 16;
170
+ }
171
+ document.documentElement.style.setProperty('--footer-position', `${(document.body.offsetHeight + mobileOffset) - document.getElementById('fhFooter').offsetHeight - Number(getComputedStyle(document.getElementById('fhFooter')).marginTop.replace('px', ''))}px`)
172
+ }
173
+ )
174
+ }
175
+
176
+ export const initCurrentMenuElementHighlightRule = (borderBottomStyle: string) => {
177
+ const handlerFunc = (params, obj) => {
178
+ const cel = obj.container.querySelector(`${obj.id} .current-menu-el:not(.highlighted)`);
179
+ if (cel && getComputedStyle(cel.parentElement.parentElement.parentElement).display !== 'none') {
180
+ cel.classList.add('highlighted');
181
+ cel.parentElement.style.setProperty('border-bottom', borderBottomStyle, 'important');
182
+ }
183
+ const ncel = obj.container.querySelector(`${obj.id} .not-current-menu-el`);
184
+ if (ncel) {
185
+ ncel.parentElement.style.borderBottom = '';
186
+ ncel.classList.remove('highlighted');
187
+ }
188
+ };
189
+ componentExtender.addStaticExtender({
190
+ componentName: 'Button',
191
+ create: handlerFunc,
192
+ update: (chParams, params, obj) => {
193
+ handlerFunc(params, obj);
194
+ }
195
+
196
+ });
197
+ }
198
+
199
+ export const initHomeAutoSelectRule = () => {
200
+ addRule(
201
+ '.--home',
202
+ async (mutation) => mutation.target.querySelector('.--home') && localStorage.getItem('homeClicked') !== 'true',
203
+ async (mutation) => {
204
+ localStorage.setItem('homeClicked', 'true');
205
+ let el = document.querySelector('.--home');
206
+ while (el.tagName !== 'BUTTON' && !!el.parentElement) {
207
+ el = el.parentElement;
208
+ }
209
+ if (el.tagName === 'BUTTON') {
210
+ (el as HTMLElement).click();
211
+ }
212
+ window.onbeforeunload = () => {
213
+ localStorage.removeItem('homeClicked');
214
+ }
215
+ }
216
+ )
217
217
  }
@@ -1,9 +1,9 @@
1
- const fromEntries = (entries: Array<Array<any>>): {[key: string]: any} => {
2
- const result: {[key: string]: any} = {};
3
- for (const entry of entries) {
4
- result[entry[0]] = entry[1];
5
- }
6
- return result;
7
- }
8
-
1
+ const fromEntries = (entries: Array<Array<any>>): {[key: string]: any} => {
2
+ const result: {[key: string]: any} = {};
3
+ for (const entry of entries) {
4
+ result[entry[0]] = entry[1];
5
+ }
6
+ return result;
7
+ }
8
+
9
9
  export const getCookie = () => fromEntries(document.cookie.split('; ').map(el => (el.split('='))) as any);
@@ -1,102 +1,102 @@
1
- let currentLang = 'en';
2
- let subscribed = false;
3
- const langContent = {
4
- en: {
5
- warning: 'Attention.',
6
- message: 'Our website uses cookies. By continuing you agree to their use.',
7
- close: 'Close'
8
- },
9
- lt: {
10
- warning: 'Dėmesio.',
11
- message: 'Svetainė naudoja slapukus. Toliau naršydami Jūs sutinkate su jų naudojimu.',
12
- close: 'Uždaryti'
13
- }
14
- }
15
-
16
- export const addTranslationForCookiePolitics = (
17
- lang: string,
18
- element: {
19
- warning: string,
20
- message: string,
21
- close: string
22
- }
23
- ) => {
24
- langContent[lang] = element;
25
- }
26
-
27
- const removeCookieAlert = () => {
28
- const container = document.querySelector('.gdpr-outer');
29
- if (container) {
30
- (container as any).remove();
31
- }
32
- }
33
-
34
- const closeClick = () => {
35
- window.localStorage.setItem('cookieHandled', 'true');
36
- removeCookieAlert();
37
- }
38
-
39
- const renderCookieAlert = () => {
40
- if (window.localStorage.getItem('cookieHandled') !== 'true') {
41
- const container = document.createElement('div');
42
- container.classList.add('gdpr-outer');
43
-
44
- const containerInner = document.createElement('div');
45
- containerInner.classList.add('gdpr-inner');
46
- containerInner.classList.add('align-items-center');
47
- containerInner.classList.add('col-12');
48
-
49
- const row = document.createElement('div');
50
- row.classList.add('row');
51
-
52
- const text = document.createElement('div');
53
- text.classList.add('col-12');
54
- text.classList.add('col-sm-8');
55
- text.classList.add('col-md-9');
56
- text.classList.add('col-lg-10');
57
- text.classList.add('pb-2');
58
- text.innerHTML = `
59
- <span class="bap-dark-text gdpr-text">
60
- <b>${langContent[currentLang].warning}</b>
61
- ${langContent[currentLang].message}
62
- </span>`;
63
-
64
- row.appendChild(text);
65
-
66
- const buttonWrapper = document.createElement('div');
67
- buttonWrapper.classList.add('col-12');
68
- buttonWrapper.classList.add('col-sm-4');
69
- buttonWrapper.classList.add('col-md-3');
70
- buttonWrapper.classList.add('col-lg-2');
71
- buttonWrapper.classList.add('align-items-center');
72
- buttonWrapper.classList.add('d-flex');
73
-
74
- const button = document.createElement('button');
75
- button.classList.add('btn');
76
- button.classList.add('btn-primary');
77
- button.classList.add('w-100');
78
- button.innerText = langContent[currentLang].close;
79
- button.onclick = closeClick;
80
-
81
- buttonWrapper.appendChild(button);
82
-
83
- row.appendChild(buttonWrapper);
84
-
85
- containerInner.appendChild(row);
86
- container.appendChild(containerInner);
87
- document.body.appendChild(container);
88
- }
89
- }
90
-
91
- export const rerenderCookieAlert = (i18n: any) => {
92
- if (!subscribed) {
93
- i18n.subscribe({languageChanged: (code) => {
94
- currentLang = Object.keys(langContent).indexOf(code) > -1 ? code : 'en';
95
- removeCookieAlert();
96
- renderCookieAlert();
97
- }});
98
- subscribed = true;
99
- }
100
- removeCookieAlert();
101
- renderCookieAlert();
1
+ let currentLang = 'en';
2
+ let subscribed = false;
3
+ const langContent = {
4
+ en: {
5
+ warning: 'Attention.',
6
+ message: 'Our website uses cookies. By continuing you agree to their use.',
7
+ close: 'Close'
8
+ },
9
+ lt: {
10
+ warning: 'Dėmesio.',
11
+ message: 'Svetainė naudoja slapukus. Toliau naršydami Jūs sutinkate su jų naudojimu.',
12
+ close: 'Uždaryti'
13
+ }
14
+ }
15
+
16
+ export const addTranslationForCookiePolitics = (
17
+ lang: string,
18
+ element: {
19
+ warning: string,
20
+ message: string,
21
+ close: string
22
+ }
23
+ ) => {
24
+ langContent[lang] = element;
25
+ }
26
+
27
+ const removeCookieAlert = () => {
28
+ const container = document.querySelector('.gdpr-outer');
29
+ if (container) {
30
+ (container as any).remove();
31
+ }
32
+ }
33
+
34
+ const closeClick = () => {
35
+ window.localStorage.setItem('cookieHandled', 'true');
36
+ removeCookieAlert();
37
+ }
38
+
39
+ const renderCookieAlert = () => {
40
+ if (window.localStorage.getItem('cookieHandled') !== 'true') {
41
+ const container = document.createElement('div');
42
+ container.classList.add('gdpr-outer');
43
+
44
+ const containerInner = document.createElement('div');
45
+ containerInner.classList.add('gdpr-inner');
46
+ containerInner.classList.add('align-items-center');
47
+ containerInner.classList.add('col-12');
48
+
49
+ const row = document.createElement('div');
50
+ row.classList.add('row');
51
+
52
+ const text = document.createElement('div');
53
+ text.classList.add('col-12');
54
+ text.classList.add('col-sm-8');
55
+ text.classList.add('col-md-9');
56
+ text.classList.add('col-lg-10');
57
+ text.classList.add('pb-2');
58
+ text.innerHTML = `
59
+ <span class="bap-dark-text gdpr-text">
60
+ <b>${langContent[currentLang].warning}</b>
61
+ ${langContent[currentLang].message}
62
+ </span>`;
63
+
64
+ row.appendChild(text);
65
+
66
+ const buttonWrapper = document.createElement('div');
67
+ buttonWrapper.classList.add('col-12');
68
+ buttonWrapper.classList.add('col-sm-4');
69
+ buttonWrapper.classList.add('col-md-3');
70
+ buttonWrapper.classList.add('col-lg-2');
71
+ buttonWrapper.classList.add('align-items-center');
72
+ buttonWrapper.classList.add('d-flex');
73
+
74
+ const button = document.createElement('button');
75
+ button.classList.add('btn');
76
+ button.classList.add('btn-primary');
77
+ button.classList.add('w-100');
78
+ button.innerText = langContent[currentLang].close;
79
+ button.onclick = closeClick;
80
+
81
+ buttonWrapper.appendChild(button);
82
+
83
+ row.appendChild(buttonWrapper);
84
+
85
+ containerInner.appendChild(row);
86
+ container.appendChild(containerInner);
87
+ document.body.appendChild(container);
88
+ }
89
+ }
90
+
91
+ export const rerenderCookieAlert = (i18n: any) => {
92
+ if (!subscribed) {
93
+ i18n.subscribe({languageChanged: (code) => {
94
+ currentLang = Object.keys(langContent).indexOf(code) > -1 ? code : 'en';
95
+ removeCookieAlert();
96
+ renderCookieAlert();
97
+ }});
98
+ subscribed = true;
99
+ }
100
+ removeCookieAlert();
101
+ renderCookieAlert();
102
102
  }