libreria-astro-lefebvre 0.1.16 → 0.1.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libreria-astro-lefebvre",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "Librería de componentes Astro, React y Vue para Lefebvre",
5
5
  "author": "Equipo web desarrollo Lefebvre",
6
6
  "type": "module",
@@ -3,11 +3,12 @@
3
3
  const {
4
4
  title = "Suscríbete ahora",
5
5
  description = "Recibe novedades de artículos que se publican en el blog",
6
- lf2FormTitle = "Formulario de contacto",
6
+ lf2FormTitle = "",
7
7
  businessAction = false,
8
8
  } = Astro.props;
9
9
 
10
10
  const idTargetLf2 = 'lf2-form-' + Math.random().toString(36).substring(2, 15);
11
+ const forceSkeleton = !lf2FormTitle;
11
12
 
12
13
  const escapeJson = (s = "") => String(s).replace(/<[^>]*>/g, '').replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/</g, '\\u003c').replace(/>/g, '\\u003e').replace(/[\n\r\t]+/g, ' ');
13
14
 
@@ -33,34 +34,49 @@ const structuredData = `<script type="application/ld+json">
33
34
  <p class="font-poppins text-xl font-normal text-[#363942]">{description}</p>
34
35
  </div>
35
36
  <div class="w-full flex flex-col md:flex-row items-start md:items-center gap-4">
36
- <div id={idTargetLf2} class="w-full flex flex-col mx-auto gap-3">
37
- <!-- FORMULARIO -->
38
- </div>
37
+ {forceSkeleton ? (
38
+ <div class="w-full flex flex-col mt-4 mx-auto gap-6 animate-pulse">
39
+ <div class="h-6 w-2/3 bg-gray-200 rounded"></div>
40
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
41
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
42
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
43
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
44
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
45
+ <div class="h-24 w-full bg-gray-200 rounded"></div>
46
+ <div class="h-10 w-1/3 bg-gray-300 rounded"></div>
47
+ </div>
48
+ ) : (
49
+ <div id={idTargetLf2} class="w-full flex flex-col mx-auto gap-3">
50
+ <!-- FORMULARIO -->
51
+ </div>
52
+ )}
39
53
  </div>
40
54
  </div>
41
55
 
42
- <script is:client define:vars={{ idTargetLf2 , lf2FormTitle, businessAction}}>
43
- document.addEventListener('DOMContentLoaded', () => {
56
+ {!forceSkeleton && (
57
+ <script is:client define:vars={{ idTargetLf2, lf2FormTitle, businessAction}}>
58
+ document.addEventListener('DOMContentLoaded', () => {
44
59
 
45
- let defaultParameters = {};
46
- if(businessAction) {
47
- defaultParameters.accioncomercial = businessAction;
48
- }
60
+ let defaultParameters = {};
61
+ if(businessAction) {
62
+ defaultParameters.accioncomercial = businessAction;
63
+ }
49
64
 
50
- let configLf2 = {
51
- fake: true,
52
- formulario: lf2FormTitle,
53
- bootstrap: true,
54
- target: '#'+idTargetLf2,
55
- defaultparameters: defaultParameters,
56
- };
57
- try {
58
- apiManager.pintarFormularioAutogestionado(configLf2);
59
- } catch (error) {
60
- var apiManager = new LeadformApiManagerClass();
61
- apiManager.pintarFormularioAutogestionado(configLf2);
62
- }
63
- });
64
- </script>
65
+ let configLf2 = {
66
+ fake: true,
67
+ formulario: lf2FormTitle,
68
+ bootstrap: true,
69
+ target: '#'+idTargetLf2,
70
+ defaultparameters: defaultParameters,
71
+ };
72
+ try {
73
+ apiManager.pintarFormularioAutogestionado(configLf2);
74
+ } catch (error) {
75
+ var apiManager = new LeadformApiManagerClass();
76
+ apiManager.pintarFormularioAutogestionado(configLf2);
77
+ }
78
+ });
79
+ </script>
80
+ )}
65
81
 
66
82
  <Fragment set:html={structuredData} />
@@ -7,13 +7,14 @@ const {
7
7
  showImage = false,
8
8
  orientation = "left",
9
9
  imageSrc,
10
- lf2FormTitle = "Formulario de contacto",
10
+ lf2FormTitle = "",
11
11
  businessAction = false,
12
12
  loading = "lazy"
13
13
  } = Astro.props;
14
14
 
15
15
  const imageSrcUrl = extractImageUrl(imageSrc);
16
16
  const idTargetLf2 = 'lf2-form-' + Math.random().toString(36).substring(2, 15);
17
+ const forceSkeleton = !lf2FormTitle;
17
18
 
18
19
  const escapeJson = (s = "") => String(s).replace(/<[^>]*>/g, '').replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/</g, '\\u003c').replace(/>/g, '\\u003e').replace(/[\n\r\t]+/g, ' ');
19
20
 
@@ -40,7 +41,20 @@ const structuredData = `<script type="application/ld+json">
40
41
  <article class="flex flex-col items-center justify-center">
41
42
  <div class={`flex-col md:flex ${orientation === 'left' ? 'flex-row' : 'flex-row-reverse'} w-full items-start gap-4 justify-between`}>
42
43
  <div class="w-full flex justify-start mb-8 flex-col">
43
- <div id={idTargetLf2} class="w-full flex flex-col mx-auto gap-3"></div>
44
+ {forceSkeleton ? (
45
+ <div class="w-full flex flex-col mt-4 mx-auto gap-6 animate-pulse">
46
+ <div class="h-6 w-2/3 bg-gray-200 rounded"></div>
47
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
48
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
49
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
50
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
51
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
52
+ <div class="h-24 w-full bg-gray-200 rounded"></div>
53
+ <div class="h-10 w-1/3 bg-gray-300 rounded"></div>
54
+ </div>
55
+ ) : (
56
+ <div id={idTargetLf2} class="w-full flex flex-col mx-auto gap-3"></div>
57
+ )}
44
58
  </div>
45
59
  <div class={`w-full p-0 md:p-4 flex items-center ${orientation === 'left' ? 'justify-end' : 'justify-start'}`}>
46
60
  <img src={imageSrcUrl} alt={title} width="600" height="650" class="w-full md:w-4/5 min-h-auto md:min-h-[650px] object-cover rounded-lg" loading={loading}/>
@@ -55,7 +69,20 @@ const structuredData = `<script type="application/ld+json">
55
69
  <p class="text-[#363942] font-poppins text-xl">{description}</p>
56
70
  </div>
57
71
  <div class={`w-full md:w-1/2 p-0 md:p-4 flex items-center ${orientation === 'left' ? 'justify-end' : 'justify-start'}`}>
58
- <div id={idTargetLf2} class="w-full flex flex-col mx-auto gap-3"></div>
72
+ {forceSkeleton ? (
73
+ <div class="w-full flex flex-col mt-4 mx-auto gap-6 animate-pulse">
74
+ <div class="h-6 w-2/3 bg-gray-200 rounded"></div>
75
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
76
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
77
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
78
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
79
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
80
+ <div class="h-24 w-full bg-gray-200 rounded"></div>
81
+ <div class="h-10 w-1/3 bg-gray-300 rounded"></div>
82
+ </div>
83
+ ) : (
84
+ <div id={idTargetLf2} class="w-full flex flex-col mx-auto gap-3"></div>
85
+ )}
59
86
  </div>
60
87
  </div>
61
88
  </article>
@@ -64,28 +91,30 @@ const structuredData = `<script type="application/ld+json">
64
91
  </div>
65
92
 
66
93
 
67
- <script is:client define:vars={{ idTargetLf2 , lf2FormTitle, businessAction}}>
68
- document.addEventListener('DOMContentLoaded', () => {
94
+ {!forceSkeleton && (
95
+ <script is:client define:vars={{ idTargetLf2, lf2FormTitle, businessAction}}>
96
+ document.addEventListener('DOMContentLoaded', () => {
69
97
 
70
- let defaultParameters = {};
71
- if(businessAction) {
72
- defaultParameters.accioncomercial = businessAction;
73
- }
98
+ let defaultParameters = {};
99
+ if(businessAction) {
100
+ defaultParameters.accioncomercial = businessAction;
101
+ }
74
102
 
75
- let configLf2 = {
76
- fake: true,
77
- formulario: lf2FormTitle,
78
- bootstrap: true,
79
- target: '#'+idTargetLf2,
80
- defaultparameters: defaultParameters,
81
- };
82
- try {
83
- apiManager.pintarFormularioAutogestionado(configLf2);
84
- } catch (error) {
85
- var apiManager = new LeadformApiManagerClass();
86
- apiManager.pintarFormularioAutogestionado(configLf2);
87
- }
88
- });
89
- </script>
103
+ let configLf2 = {
104
+ fake: true,
105
+ formulario: lf2FormTitle,
106
+ bootstrap: true,
107
+ target: '#'+idTargetLf2,
108
+ defaultparameters: defaultParameters,
109
+ };
110
+ try {
111
+ apiManager.pintarFormularioAutogestionado(configLf2);
112
+ } catch (error) {
113
+ var apiManager = new LeadformApiManagerClass();
114
+ apiManager.pintarFormularioAutogestionado(configLf2);
115
+ }
116
+ });
117
+ </script>
118
+ )}
90
119
 
91
120
  <Fragment set:html={structuredData} />
@@ -26,6 +26,7 @@ const {
26
26
  const imageSrcUrl = extractImageUrl(imageSrc);
27
27
  const imageModalUrl = extractImageUrl(imageModal);
28
28
  const randomId = Math.floor(Math.random() * 1000);
29
+ const forceSkeleton = !lf2FormTitle;
29
30
 
30
31
 
31
32
  ---
@@ -75,16 +76,29 @@ const randomId = Math.floor(Math.random() * 1000);
75
76
  <h2 class="font-poppins text-[#262626] text-[28px] lg:text-[32px] font-normal text-left leading-10 mb-8">{titleModal}</h2>
76
77
  <!-- <h3 class="font-poppins text-[#262626] text-[20px] lg:text-[24px] font-semibold text-left leading-[32px] mb-[8px]">{subtitleModal}</h3> -->
77
78
  <div class="font-inter text-base font-normal leading-6 mb-8" set:html={descriptionModal} />
78
- <div id={`lf2-form-container-${randomId}`} class="w-full">
79
- <!--FORMULARIO -->
80
- </div>
79
+ {forceSkeleton ? (
80
+ <div class="w-full flex flex-col mt-4 mx-auto gap-6 animate-pulse">
81
+ <div class="h-6 w-2/3 bg-gray-200 rounded"></div>
82
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
83
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
84
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
85
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
86
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
87
+ <div class="h-24 w-full bg-gray-200 rounded"></div>
88
+ <div class="h-10 w-1/3 bg-gray-300 rounded"></div>
89
+ </div>
90
+ ) : (
91
+ <div id={`lf2-form-container-${randomId}`} class="w-full">
92
+ <!--FORMULARIO -->
93
+ </div>
94
+ )}
81
95
  </div>
82
96
  </div>
83
97
  </div>
84
98
  </div>
85
99
 
86
100
 
87
- <script is:inline define:vars={{ randomId, lf2FormTitle }}>
101
+ <script is:inline define:vars={{ randomId, lf2FormTitle, forceSkeleton }}>
88
102
 
89
103
  document.addEventListener('DOMContentLoaded', () => {
90
104
 
@@ -95,18 +109,20 @@ const randomId = Math.floor(Math.random() * 1000);
95
109
  target: '#'+ `lf2-form-container-${randomId}`
96
110
  };
97
111
 
98
- try {
99
- apiManager.pintarFormularioAutogestionado(configLf2);
100
- } catch (error) {
101
- var apiManager = new LeadformApiManagerClass();
112
+ if (!forceSkeleton) {
113
+ try {
114
+ apiManager.pintarFormularioAutogestionado(configLf2);
115
+ } catch (error) {
116
+ var apiManager = new LeadformApiManagerClass();
117
+ }
102
118
  }
103
119
 
104
120
 
105
121
  const teruelModalButton = document.getElementById(`js-open-teruel-popup-${randomId}`);
106
-
122
+
107
123
  teruelModalButton.addEventListener('click', (e) => {
108
124
  e.preventDefault();
109
-
125
+
110
126
  const modalPopup = document.getElementById(`teruel-popup-modal-${randomId}`);
111
127
  const articleElement = document.getElementById(`article-${randomId}`);
112
128
  const parentElement = articleElement ? articleElement.parentElement : null;
@@ -114,9 +130,11 @@ const randomId = Math.floor(Math.random() * 1000);
114
130
  if (modalPopup && parentElement && parentElement.parentNode) {
115
131
  parentElement.parentNode.insertBefore(modalPopup, parentElement.nextSibling);
116
132
  }
117
-
133
+
118
134
  if (modalPopup) {
119
- apiManager.pintarFormularioAutogestionado(configLf2);
135
+ if (!forceSkeleton) {
136
+ apiManager.pintarFormularioAutogestionado(configLf2);
137
+ }
120
138
  modalPopup.classList.remove('hidden');
121
139
  document.body.style.overflow = 'hidden';
122
140
  if (parentElement) {
@@ -2,36 +2,52 @@
2
2
  import { resolveLf2ResourceUrl } from '../../lib/functions.js';
3
3
 
4
4
  const {
5
- lf2FormTitle = "Formulario de contacto",
5
+ lf2FormTitle = "",
6
6
  cargarDependencias = false,
7
7
  isProd = true,
8
8
  } = Astro.props;
9
9
 
10
10
  const idTargetLf2 = 'lf2-form-' + Math.random().toString(36).substring(2, 15);
11
11
  const LF2_RESOURCE_URL = resolveLf2ResourceUrl(isProd);
12
+ const forceSkeleton = !lf2FormTitle;
12
13
  ---
13
- <div id={idTargetLf2} class="w-full flex flex-col mx-auto gap-3"></div>
14
+ {forceSkeleton ? (
15
+ <div class="w-full flex flex-col mt-4 mx-auto gap-6 animate-pulse">
16
+ <div class="h-6 w-2/3 bg-gray-200 rounded"></div>
17
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
18
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
19
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
20
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
21
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
22
+ <div class="h-24 w-full bg-gray-200 rounded"></div>
23
+ <div class="h-10 w-1/3 bg-gray-300 rounded"></div>
24
+ </div>
25
+ ) : (
26
+ <div id={idTargetLf2} class="w-full flex flex-col mx-auto gap-3"></div>
27
+ )}
14
28
  {cargarDependencias && (
15
29
  <script src={LF2_RESOURCE_URL} is:inline></script>
16
30
  )}
17
31
 
18
- <script is:client define:vars={{ idTargetLf2 , lf2FormTitle}}>
19
- document.addEventListener('DOMContentLoaded', () => {
32
+ {!forceSkeleton && (
33
+ <script is:client define:vars={{ idTargetLf2, lf2FormTitle}}>
34
+ document.addEventListener('DOMContentLoaded', () => {
20
35
 
21
- let defaultParameters = {};
36
+ let defaultParameters = {};
22
37
 
23
- let configLf2 = {
24
- fake: true,
25
- formulario: lf2FormTitle,
26
- bootstrap: true,
27
- target: '#'+idTargetLf2,
28
- defaultparameters: defaultParameters,
29
- };
30
- try {
31
- apiManager.pintarFormularioAutogestionado(configLf2);
32
- } catch (error) {
33
- var apiManager = new LeadformApiManagerClass();
34
- apiManager.pintarFormularioAutogestionado(configLf2);
35
- }
36
- });
37
- </script>
38
+ let configLf2 = {
39
+ fake: true,
40
+ formulario: lf2FormTitle,
41
+ bootstrap: true,
42
+ target: '#'+idTargetLf2,
43
+ defaultparameters: defaultParameters,
44
+ };
45
+ try {
46
+ apiManager.pintarFormularioAutogestionado(configLf2);
47
+ } catch (error) {
48
+ var apiManager = new LeadformApiManagerClass();
49
+ apiManager.pintarFormularioAutogestionado(configLf2);
50
+ }
51
+ });
52
+ </script>
53
+ )}
@@ -7,11 +7,12 @@ const {
7
7
  description = "",
8
8
  mainContent="",
9
9
  orientation = "left",
10
- lf2FormTitle = "Formulario de contacto",
10
+ lf2FormTitle = "",
11
11
  businessAction = false,
12
12
  } = Astro.props;
13
13
 
14
14
  const idTargetLf2 = 'lf2-form-' + Math.random().toString(36).substring(2, 15);
15
+ const forceSkeleton = !lf2FormTitle;
15
16
 
16
17
  const escapeJson = (s = "") => String(s).replace(/<[^>]*>/g, '').replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/</g, '\\u003c').replace(/>/g, '\\u003e').replace(/[\n\r\t]+/g, ' ');
17
18
 
@@ -31,7 +32,7 @@ const structuredData = `<script type="application/ld+json">
31
32
  ---
32
33
 
33
34
  <div class="w-full flex flex-col md:flex-row px-6 md:px-4 lg:px-0 gap-8">
34
- <div class="max-w-7xl w-full mx-auto flex justify-start flex-col px-12 bg-[linear-gradient(to_right,#E3E3EE,#FFFFFF,#D7EBF5)]">
35
+ <div class="max-w-7xl w-full mx-auto flex justify-start flex-col px-12 bg-[linear-gradient(to_left,#E3E3EE,#FFFFFF,#D7EBF5)]">
35
36
  <article class="flex flex-col items-center justify-center">
36
37
  <div class={`flex-col md:flex ${orientation === 'left' ? 'flex-row' : 'flex-row-reverse'} w-full items-start gap-4 justify-center`}>
37
38
  <div class="w-full md:w-1/3 flex justify-start mt-12 mb-8 flex-col">
@@ -41,7 +42,22 @@ const structuredData = `<script type="application/ld+json">
41
42
  <div class="text-sm font-inter" set:html={mainContent}></div>
42
43
  </div>
43
44
  <div class={`w-full md:w-1/2 p-0 md:p-4 flex items-center ${orientation === 'left' ? 'justify-end' : 'justify-start'}`}>
44
- <div id={idTargetLf2} class="w-full flex flex-col mx-auto gap-3"></div>
45
+ <div class="flex w-full md:w-[500px] flex-col items-start gap-6 p-8 rounded-2xl border border-[#B6B7BB] bg-white shadow-[0_8px_8px_-4px_rgba(0,0,0,0.04),0_20px_24px_-4px_rgba(0,0,0,0.08)]">
46
+ {forceSkeleton ? (
47
+ <div class="w-full flex flex-col mx-auto gap-6 animate-pulse">
48
+ <div class="h-6 w-2/3 bg-gray-200 rounded"></div>
49
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
50
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
51
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
52
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
53
+ <div class="h-10 w-full bg-gray-200 rounded"></div>
54
+ <div class="h-24 w-full bg-gray-200 rounded"></div>
55
+ <div class="h-10 w-1/3 bg-gray-300 rounded"></div>
56
+ </div>
57
+ ) : (
58
+ <div id={idTargetLf2} class="w-full flex flex-col mx-auto gap-3"></div>
59
+ )}
60
+ </div>
45
61
  </div>
46
62
  </div>
47
63
  </article>
@@ -49,28 +65,30 @@ const structuredData = `<script type="application/ld+json">
49
65
  </div>
50
66
 
51
67
 
52
- <script is:client define:vars={{ idTargetLf2 , lf2FormTitle, businessAction}}>
53
- document.addEventListener('DOMContentLoaded', () => {
68
+ {!forceSkeleton && (
69
+ <script is:client define:vars={{ idTargetLf2, lf2FormTitle, businessAction}}>
70
+ document.addEventListener('DOMContentLoaded', () => {
54
71
 
55
- let defaultParameters = {};
56
- if(businessAction) {
57
- defaultParameters.accioncomercial = businessAction;
58
- }
72
+ let defaultParameters = {};
73
+ if(businessAction) {
74
+ defaultParameters.accioncomercial = businessAction;
75
+ }
59
76
 
60
- let configLf2 = {
61
- fake: true,
62
- formulario: lf2FormTitle,
63
- bootstrap: true,
64
- target: '#'+idTargetLf2,
65
- defaultparameters: defaultParameters,
66
- };
67
- try {
68
- apiManager.pintarFormularioAutogestionado(configLf2);
69
- } catch (error) {
70
- var apiManager = new LeadformApiManagerClass();
71
- apiManager.pintarFormularioAutogestionado(configLf2);
72
- }
73
- });
74
- </script>
77
+ let configLf2 = {
78
+ fake: true,
79
+ formulario: lf2FormTitle,
80
+ bootstrap: true,
81
+ target: '#'+idTargetLf2,
82
+ defaultparameters: defaultParameters,
83
+ };
84
+ try {
85
+ apiManager.pintarFormularioAutogestionado(configLf2);
86
+ } catch (error) {
87
+ var apiManager = new LeadformApiManagerClass();
88
+ apiManager.pintarFormularioAutogestionado(configLf2);
89
+ }
90
+ });
91
+ </script>
92
+ )}
75
93
 
76
94
  <Fragment set:html={structuredData} />