geeparts-js 1.3.21 → 1.4.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.
- package/dist/geeparts-newsletter.min.js +277 -0
- package/dist/geeparts-newsletter.min.js.map +7 -0
- package/index.js +11 -0
- package/package.json +17 -4
- package/styles.css +0 -1090
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
/*! Geeparts Newsletter Widget v1.3.22 | MIT License | https://github.com/johnsi15/geeparts-js */
|
|
2
|
+
(()=>{var f=(m,b,a)=>new Promise((d,n)=>{var g=s=>{try{c(a.next(s))}catch(u){n(u)}},l=s=>{try{c(a.throw(s))}catch(u){n(u)}},c=s=>s.done?d(s.value):Promise.resolve(s.value).then(g,l);c((a=a.apply(m,b)).next())});(function(){"use strict";let m=`* {
|
|
3
|
+
margin: 0;
|
|
4
|
+
padding: 0;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
--main-color: #e6c626;
|
|
7
|
+
--secondary-color: #a08604;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.demo-btn {
|
|
11
|
+
padding: 15px 30px;
|
|
12
|
+
font-size: 16px;
|
|
13
|
+
font-weight: 600;
|
|
14
|
+
background: white;
|
|
15
|
+
color: var(--main-color);
|
|
16
|
+
border: none;
|
|
17
|
+
border-radius: 8px;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
|
|
20
|
+
transition: transform 0.2s;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.demo-btn:hover {
|
|
24
|
+
transform: translateY(-2px);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.modal-overlay {
|
|
28
|
+
display: none;
|
|
29
|
+
position: fixed;
|
|
30
|
+
top: 0;
|
|
31
|
+
left: 0;
|
|
32
|
+
width: 100%;
|
|
33
|
+
height: 100%;
|
|
34
|
+
background: rgba(0, 0, 0, 0.6);
|
|
35
|
+
backdrop-filter: blur(5px);
|
|
36
|
+
z-index: 1000;
|
|
37
|
+
animation: fadeIn 0.3s ease;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.modal-overlay.active {
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@keyframes fadeIn {
|
|
47
|
+
from {
|
|
48
|
+
opacity: 0;
|
|
49
|
+
}
|
|
50
|
+
to {
|
|
51
|
+
opacity: 1;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@keyframes slideUp {
|
|
56
|
+
from {
|
|
57
|
+
opacity: 0;
|
|
58
|
+
transform: translateY(30px);
|
|
59
|
+
}
|
|
60
|
+
to {
|
|
61
|
+
opacity: 1;
|
|
62
|
+
transform: translateY(0);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.modal {
|
|
67
|
+
background: white;
|
|
68
|
+
border-radius: 16px;
|
|
69
|
+
padding: 40px;
|
|
70
|
+
max-width: 500px;
|
|
71
|
+
width: 100%;
|
|
72
|
+
position: relative;
|
|
73
|
+
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
|
74
|
+
animation: slideUp 0.4s ease;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.close-btn {
|
|
78
|
+
position: absolute;
|
|
79
|
+
top: 20px;
|
|
80
|
+
right: 20px;
|
|
81
|
+
background: none;
|
|
82
|
+
border: none;
|
|
83
|
+
font-size: 24px;
|
|
84
|
+
color: #999;
|
|
85
|
+
cursor: pointer;
|
|
86
|
+
width: 32px;
|
|
87
|
+
height: 32px;
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
justify-content: center;
|
|
91
|
+
border-radius: 50%;
|
|
92
|
+
transition: all 0.2s;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.close-btn:hover {
|
|
96
|
+
background: #f5f5f5;
|
|
97
|
+
color: #333;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.modal-content {
|
|
101
|
+
text-align: center;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.modal-title {
|
|
105
|
+
font-size: 28px;
|
|
106
|
+
font-weight: 700;
|
|
107
|
+
color: #333;
|
|
108
|
+
margin-bottom: 15px;
|
|
109
|
+
line-height: 1.3;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.modal-description {
|
|
113
|
+
font-size: 16px;
|
|
114
|
+
color: #666;
|
|
115
|
+
line-height: 1.6;
|
|
116
|
+
margin-bottom: 30px;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.form-group {
|
|
120
|
+
margin-bottom: 20px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.email-input {
|
|
124
|
+
width: 100%;
|
|
125
|
+
padding: 15px 20px;
|
|
126
|
+
font-size: 16px;
|
|
127
|
+
border: 2px solid #e0e0e0;
|
|
128
|
+
border-radius: 8px;
|
|
129
|
+
outline: none;
|
|
130
|
+
transition: border-color 0.3s;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.email-input:focus {
|
|
134
|
+
border-color: var(--main-color);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.submit-btn {
|
|
138
|
+
width: 100%;
|
|
139
|
+
padding: 15px;
|
|
140
|
+
font-size: 16px;
|
|
141
|
+
font-weight: 600;
|
|
142
|
+
background: linear-gradient(135deg, var(--main-color) 0%, var(--secondary-color) 100%);
|
|
143
|
+
color: white;
|
|
144
|
+
border: none;
|
|
145
|
+
border-radius: 8px;
|
|
146
|
+
cursor: pointer;
|
|
147
|
+
transition: all 0.2s;
|
|
148
|
+
transform: scale(1);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.submit-btn:hover:not(:disabled) {
|
|
152
|
+
transform: scale(1.05);
|
|
153
|
+
box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.submit-btn:active {
|
|
157
|
+
transform: scale(0.95);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.submit-btn:disabled {
|
|
161
|
+
opacity: 0.5;
|
|
162
|
+
cursor: not-allowed;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.submit-btn:disabled:hover {
|
|
166
|
+
transform: scale(1);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.success-content {
|
|
170
|
+
display: none;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.success-content.active {
|
|
174
|
+
display: block;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.coupon-box {
|
|
178
|
+
background: #f8f9fa;
|
|
179
|
+
border: 2px dashed var(--main-color);
|
|
180
|
+
border-radius: 8px;
|
|
181
|
+
padding: 20px;
|
|
182
|
+
margin-top: 25px;
|
|
183
|
+
display: flex;
|
|
184
|
+
align-items: center;
|
|
185
|
+
justify-content: space-between;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.coupon-code {
|
|
189
|
+
font-size: 24px;
|
|
190
|
+
font-weight: 700;
|
|
191
|
+
color: var(--secondary-color);
|
|
192
|
+
letter-spacing: 2px;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.copy-btn {
|
|
196
|
+
background: var(--main-color);
|
|
197
|
+
color: white;
|
|
198
|
+
border: none;
|
|
199
|
+
width: 40px;
|
|
200
|
+
height: 40px;
|
|
201
|
+
border-radius: 8px;
|
|
202
|
+
cursor: pointer;
|
|
203
|
+
display: flex;
|
|
204
|
+
align-items: center;
|
|
205
|
+
justify-content: center;
|
|
206
|
+
transition: background 0.2s;
|
|
207
|
+
font-size: 18px;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.copy-btn:hover {
|
|
211
|
+
background: #5568d3;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.copy-btn.copied {
|
|
215
|
+
background: #10b981;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.error-message {
|
|
219
|
+
color: #ef4444;
|
|
220
|
+
font-size: 14px;
|
|
221
|
+
margin-top: 10px;
|
|
222
|
+
display: none;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.error-message.active {
|
|
226
|
+
display: block;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.loading {
|
|
230
|
+
display: inline-block;
|
|
231
|
+
width: 20px;
|
|
232
|
+
height: 20px;
|
|
233
|
+
border: 3px solid rgba(255, 255, 255, 0.3);
|
|
234
|
+
border-radius: 50%;
|
|
235
|
+
border-top-color: white;
|
|
236
|
+
animation: spin 1s ease-in-out infinite;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
@keyframes spin {
|
|
240
|
+
to {
|
|
241
|
+
transform: rotate(360deg);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
`,b=`<div class="modal-overlay" id="modalOverlay">
|
|
245
|
+
<div class="modal">
|
|
246
|
+
<button class="close-btn" onclick="closeModal()">×</button>
|
|
247
|
+
|
|
248
|
+
<!-- Contenido inicial: Formulario -->
|
|
249
|
+
<div class="modal-content" id="formContent">
|
|
250
|
+
<h2 class="modal-title">5% de descuento para la primera compra</h2>
|
|
251
|
+
<p class="modal-description">
|
|
252
|
+
Suscr\xEDbete a nuestro newsletter y recibe un 5% de descuento en toda la tienda en tu primera compra.
|
|
253
|
+
</p>
|
|
254
|
+
|
|
255
|
+
<form id="newsletterForm">
|
|
256
|
+
<div class="form-group">
|
|
257
|
+
<input class="email-input" id="emailInput" placeholder="tu@email.com" />
|
|
258
|
+
</div>
|
|
259
|
+
<button type="submit" class="submit-btn" id="submitBtn">5% de descuento</button>
|
|
260
|
+
<div class="error-message" id="errorMessage"></div>
|
|
261
|
+
</form>
|
|
262
|
+
</div>
|
|
263
|
+
|
|
264
|
+
<!-- Contenido de \xE9xito -->
|
|
265
|
+
<div class="success-content" id="successContent">
|
|
266
|
+
<h2 class="modal-title">\xA1Gracias por unirte!</h2>
|
|
267
|
+
<p class="modal-description">
|
|
268
|
+
Ya puedes usar el cup\xF3n de 5% en tu primera compra. Esperamos que lo disfrutes.
|
|
269
|
+
</p>
|
|
270
|
+
|
|
271
|
+
<div class="coupon-box">
|
|
272
|
+
<span class="coupon-code" id="couponCode">WELCOME15</span>
|
|
273
|
+
<button class="copy-btn" onclick="copyCoupon()" id="copyBtn">\u{1F4CB}</button>
|
|
274
|
+
</div>
|
|
275
|
+
</div>
|
|
276
|
+
</div>`;if(!document.getElementById("geeparts-newsletter-styles")){let d=document.createElement("style");d.id="geeparts-newsletter-styles",d.textContent=m,document.head.appendChild(d)}function a(){document.getElementById("modalOverlay")||document.body.insertAdjacentHTML("beforeend",b);let n=Object.assign({},{autoOpen:!0,autoOpenDelay:3e3,couponCode:"WELCOME5",listId:12},window.geepartsNewsletterConfig||{}),g={listId:n.listId,apiUrl:"https://api.brevo.com/v3/contacts"};function l(){document.getElementById("modalOverlay").classList.add("active")}function c(){document.getElementById("modalOverlay").classList.remove("active"),setTimeout(()=>{s()},300)}function s(){document.getElementById("formContent").style.display="block",document.getElementById("successContent").classList.remove("active"),document.getElementById("newsletterForm").reset(),document.getElementById("errorMessage").classList.remove("active"),document.getElementById("submitBtn").disabled=!1}document.getElementById("modalOverlay").addEventListener("click",function(e){e.target===this&&c()});function u(){let e=document.getElementById("couponCode").textContent,t=document.getElementById("copyBtn");navigator.clipboard.writeText(e).then(()=>{t.textContent="\u2713",t.classList.add("copied"),setTimeout(()=>{t.textContent="\u{1F4CB}",t.classList.remove("copied")},2e3)})}function h(e){return f(this,null,function*(){let t="https://shy-fire-438e.jandreys15.workers.dev";try{let o=yield fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,listId:g.listId})}),r=yield o.json();if(!o.ok)throw new Error(r.error||"Error al suscribir");return r}catch(o){throw console.error("Error al suscribir:",o),o}})}document.getElementById("newsletterForm").addEventListener("submit",function(e){return f(this,null,function*(){e.preventDefault();let t=document.getElementById("emailInput"),o=document.getElementById("submitBtn"),r=t.value.trim();if(!r||!w(r)){y("Por favor, ingresa un email v\xE1lido");return}o.disabled=!0,o.innerHTML='<span class="loading"></span>';try{let i=yield h(r);console.log({result:i});let{message:p,success:C,duplicate:v}=i;if(!C)throw new Error(i.message||"Error al suscribir");if(v){x({message:p,duplicate:v}),localStorage.setItem("newsletterSubmitted","true");return}x({message:p}),localStorage.setItem("newsletterSubmitted","true")}catch(i){console.error("Error:",i),y("Hubo un error al procesar tu suscripci\xF3n. Por favor, intenta de nuevo."),o.disabled=!1,o.textContent="5% de descuento"}})});function w(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}function y(e){let t=document.getElementById("errorMessage");t.textContent=e,t.classList.add("active"),setTimeout(()=>{t.classList.remove("active")},3e3)}function x({message:e,duplicate:t=!1}){let o=document.getElementById("couponCode"),r=document.querySelector(".coupon-box"),i=document.querySelector("#successContent .modal-title");if(t){let p=document.querySelector("#successContent .modal-title");p&&(p.textContent=e),r&&(r.style.display="none")}else o&&n.couponCode&&(o.textContent=n.couponCode),e&&i&&(i.textContent=e);document.getElementById("formContent").style.display="none",document.getElementById("successContent").classList.add("active")}n.autoOpen&&!localStorage.getItem("newsletterSubmitted")&&setTimeout(()=>{l()},n.autoOpenDelay),window.openModal=l,window.closeModal=c,window.copyCoupon=u,window.geepartsNewsletter={config:n,openModal:l,closeModal:c}}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",a):a()})();})();
|
|
277
|
+
//# sourceMappingURL=geeparts-newsletter.min.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../newsletter/bundle-temp.js"],
|
|
4
|
+
"sourcesContent": ["\n (function() {\n 'use strict';\n \n const CSS = `* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n --main-color: #e6c626;\n --secondary-color: #a08604;\n}\n\n.demo-btn {\n padding: 15px 30px;\n font-size: 16px;\n font-weight: 600;\n background: white;\n color: var(--main-color);\n border: none;\n border-radius: 8px;\n cursor: pointer;\n box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);\n transition: transform 0.2s;\n}\n\n.demo-btn:hover {\n transform: translateY(-2px);\n}\n\n.modal-overlay {\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.6);\n backdrop-filter: blur(5px);\n z-index: 1000;\n animation: fadeIn 0.3s ease;\n}\n\n.modal-overlay.active {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n@keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n@keyframes slideUp {\n from {\n opacity: 0;\n transform: translateY(30px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n.modal {\n background: white;\n border-radius: 16px;\n padding: 40px;\n max-width: 500px;\n width: 100%;\n position: relative;\n box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);\n animation: slideUp 0.4s ease;\n}\n\n.close-btn {\n position: absolute;\n top: 20px;\n right: 20px;\n background: none;\n border: none;\n font-size: 24px;\n color: #999;\n cursor: pointer;\n width: 32px;\n height: 32px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n transition: all 0.2s;\n}\n\n.close-btn:hover {\n background: #f5f5f5;\n color: #333;\n}\n\n.modal-content {\n text-align: center;\n}\n\n.modal-title {\n font-size: 28px;\n font-weight: 700;\n color: #333;\n margin-bottom: 15px;\n line-height: 1.3;\n}\n\n.modal-description {\n font-size: 16px;\n color: #666;\n line-height: 1.6;\n margin-bottom: 30px;\n}\n\n.form-group {\n margin-bottom: 20px;\n}\n\n.email-input {\n width: 100%;\n padding: 15px 20px;\n font-size: 16px;\n border: 2px solid #e0e0e0;\n border-radius: 8px;\n outline: none;\n transition: border-color 0.3s;\n}\n\n.email-input:focus {\n border-color: var(--main-color);\n}\n\n.submit-btn {\n width: 100%;\n padding: 15px;\n font-size: 16px;\n font-weight: 600;\n background: linear-gradient(135deg, var(--main-color) 0%, var(--secondary-color) 100%);\n color: white;\n border: none;\n border-radius: 8px;\n cursor: pointer;\n transition: all 0.2s;\n transform: scale(1);\n}\n\n.submit-btn:hover:not(:disabled) {\n transform: scale(1.05);\n box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);\n}\n\n.submit-btn:active {\n transform: scale(0.95);\n}\n\n.submit-btn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.submit-btn:disabled:hover {\n transform: scale(1);\n}\n\n.success-content {\n display: none;\n}\n\n.success-content.active {\n display: block;\n}\n\n.coupon-box {\n background: #f8f9fa;\n border: 2px dashed var(--main-color);\n border-radius: 8px;\n padding: 20px;\n margin-top: 25px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n.coupon-code {\n font-size: 24px;\n font-weight: 700;\n color: var(--secondary-color);\n letter-spacing: 2px;\n}\n\n.copy-btn {\n background: var(--main-color);\n color: white;\n border: none;\n width: 40px;\n height: 40px;\n border-radius: 8px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: background 0.2s;\n font-size: 18px;\n}\n\n.copy-btn:hover {\n background: #5568d3;\n}\n\n.copy-btn.copied {\n background: #10b981;\n}\n\n.error-message {\n color: #ef4444;\n font-size: 14px;\n margin-top: 10px;\n display: none;\n}\n\n.error-message.active {\n display: block;\n}\n\n.loading {\n display: inline-block;\n width: 20px;\n height: 20px;\n border: 3px solid rgba(255, 255, 255, 0.3);\n border-radius: 50%;\n border-top-color: white;\n animation: spin 1s ease-in-out infinite;\n}\n\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n`;\n const HTML = `<div class=\"modal-overlay\" id=\"modalOverlay\">\n <div class=\"modal\">\n <button class=\"close-btn\" onclick=\"closeModal()\">×</button>\n\n <!-- Contenido inicial: Formulario -->\n <div class=\"modal-content\" id=\"formContent\">\n <h2 class=\"modal-title\">5% de descuento para la primera compra</h2>\n <p class=\"modal-description\">\n Suscr\u00EDbete a nuestro newsletter y recibe un 5% de descuento en toda la tienda en tu primera compra.\n </p>\n\n <form id=\"newsletterForm\">\n <div class=\"form-group\">\n <input class=\"email-input\" id=\"emailInput\" placeholder=\"tu@email.com\" />\n </div>\n <button type=\"submit\" class=\"submit-btn\" id=\"submitBtn\">5% de descuento</button>\n <div class=\"error-message\" id=\"errorMessage\"></div>\n </form>\n </div>\n\n <!-- Contenido de \u00E9xito -->\n <div class=\"success-content\" id=\"successContent\">\n <h2 class=\"modal-title\">\u00A1Gracias por unirte!</h2>\n <p class=\"modal-description\">\n Ya puedes usar el cup\u00F3n de 5% en tu primera compra. Esperamos que lo disfrutes.\n </p>\n\n <div class=\"coupon-box\">\n <span class=\"coupon-code\" id=\"couponCode\">WELCOME15</span>\n <button class=\"copy-btn\" onclick=\"copyCoupon()\" id=\"copyBtn\">\uD83D\uDCCB</button>\n </div>\n </div>\n </div>`;\n\n if (!document.getElementById('geeparts-newsletter-styles')) {\n const style = document.createElement('style');\n style.id = 'geeparts-newsletter-styles';\n style.textContent = CSS;\n document.head.appendChild(style);\n }\n\n function init() {\n if (!document.getElementById('modalOverlay')) {\n document.body.insertAdjacentHTML('beforeend', HTML);\n }\n\n // ============================================\n// CONFIGURACI\u00D3N DEL WIDGET\n// ============================================\nconst defaultConfig = {\n autoOpen: true,\n autoOpenDelay: 3000,\n couponCode: 'WELCOME5',\n listId: 12,\n}\n\n// Merge con configuraci\u00F3n del usuario\nconst config = Object.assign({}, defaultConfig, window.geepartsNewsletterConfig || {})\n\n// ============================================\n// CONFIGURACI\u00D3N DE BREVO\n// ============================================\nconst BREVO_CONFIG = {\n listId: config.listId,\n apiUrl: 'https://api.brevo.com/v3/contacts',\n}\n\n// ============================================\n// FUNCIONES DEL MODAL\n// ============================================\nfunction openModal() {\n document.getElementById('modalOverlay').classList.add('active')\n}\n\nfunction closeModal() {\n document.getElementById('modalOverlay').classList.remove('active')\n // Reiniciar el modal despu\u00E9s de cerrar\n setTimeout(() => {\n resetModal()\n }, 300)\n}\n\nfunction resetModal() {\n document.getElementById('formContent').style.display = 'block'\n document.getElementById('successContent').classList.remove('active')\n document.getElementById('newsletterForm').reset()\n document.getElementById('errorMessage').classList.remove('active')\n document.getElementById('submitBtn').disabled = false\n}\n\n// Cerrar modal al hacer clic fuera de \u00E9l\ndocument.getElementById('modalOverlay').addEventListener('click', function (e) {\n if (e.target === this) {\n closeModal()\n }\n})\n\n// ============================================\n// FUNCI\u00D3N PARA COPIAR CUP\u00D3N\n// ============================================\nfunction copyCoupon() {\n const couponCode = document.getElementById('couponCode').textContent\n const copyBtn = document.getElementById('copyBtn')\n\n navigator.clipboard.writeText(couponCode).then(() => {\n copyBtn.textContent = '\u2713'\n copyBtn.classList.add('copied')\n\n setTimeout(() => {\n copyBtn.textContent = '\uD83D\uDCCB'\n copyBtn.classList.remove('copied')\n }, 2000)\n })\n}\n\n// ============================================\n// INTEGRACI\u00D3N CON BREVO\n// ============================================\nasync function addContactToBrevo(email) {\n const WORKER_URL = 'https://shy-fire-438e.jandreys15.workers.dev'\n\n try {\n const response = await fetch(WORKER_URL, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n email: email,\n listId: BREVO_CONFIG.listId,\n }),\n })\n\n const data = await response.json()\n\n if (!response.ok) {\n throw new Error(data.error || 'Error al suscribir')\n }\n\n return data\n } catch (error) {\n console.error('Error al suscribir:', error)\n throw error\n }\n}\n\n// ============================================\n// MANEJO DEL FORMULARIO\n// ============================================\ndocument.getElementById('newsletterForm').addEventListener('submit', async function (e) {\n e.preventDefault()\n\n const emailInput = document.getElementById('emailInput')\n const submitBtn = document.getElementById('submitBtn')\n // const errorMessage = document.getElementById('errorMessage')\n const email = emailInput.value.trim()\n\n // Validar email\n if (!email || !isValidEmail(email)) {\n showError('Por favor, ingresa un email v\u00E1lido')\n return\n }\n\n // Deshabilitar bot\u00F3n y mostrar loading\n submitBtn.disabled = true\n submitBtn.innerHTML = '<span class=\"loading\"></span>'\n\n try {\n const result = await addContactToBrevo(email)\n\n console.log({ result })\n const { message, success, duplicate } = result\n\n if (!success) {\n throw new Error(result.message || 'Error al suscribir')\n }\n\n if (duplicate) {\n showSuccess({ message, duplicate })\n localStorage.setItem('newsletterSubmitted', 'true')\n return\n }\n\n showSuccess({ message })\n localStorage.setItem('newsletterSubmitted', 'true')\n } catch (error) {\n console.error('Error:', error)\n showError('Hubo un error al procesar tu suscripci\u00F3n. Por favor, intenta de nuevo.')\n submitBtn.disabled = false\n submitBtn.textContent = '5% de descuento'\n }\n})\n\nfunction isValidEmail(email) {\n const regex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/\n return regex.test(email)\n}\n\nfunction showError(message) {\n const errorMessage = document.getElementById('errorMessage')\n errorMessage.textContent = message\n errorMessage.classList.add('active')\n\n setTimeout(() => {\n errorMessage.classList.remove('active')\n }, 3000)\n}\n\nfunction showSuccess({ message, duplicate = false }) {\n const couponElement = document.getElementById('couponCode')\n const couponBox = document.querySelector('.coupon-box')\n const successTitle = document.querySelector('#successContent .modal-title')\n\n if (duplicate) {\n const successTitle = document.querySelector('#successContent .modal-title')\n if (successTitle) {\n successTitle.textContent = message\n }\n\n if (couponBox) {\n couponBox.style.display = 'none'\n }\n } else {\n if (couponElement && config.couponCode) {\n couponElement.textContent = config.couponCode\n }\n\n if (message && successTitle) {\n successTitle.textContent = message\n }\n }\n\n document.getElementById('formContent').style.display = 'none'\n document.getElementById('successContent').classList.add('active')\n}\n\n// ============================================\n// AUTO-ABRIR MODAL\n// ============================================\nif (config.autoOpen && !localStorage.getItem('newsletterSubmitted')) {\n setTimeout(() => {\n openModal()\n }, config.autoOpenDelay)\n}\n\n\n window.openModal = openModal;\n window.closeModal = closeModal;\n window.copyCoupon = copyCoupon;\n \n window.geepartsNewsletter = {\n config: config,\n openModal: openModal,\n closeModal: closeModal,\n };\n }\n\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', init);\n } else {\n init();\n }\n })();\n "],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AAE,MAAM,QAAU,OACvD,SAAS,eAAe,gBAAgB,EAAE,UAAU,IAAI,QAAQ,CAClE,CAKIpB,EAAO,UAAY,CAAC,aAAa,QAAQ,qBAAqB,GAChE,WAAW,IAAM,CACfE,EAAU,CACZ,EAAGF,EAAO,aAAa,EAIjB,OAAO,UAAYE,EACnB,OAAO,WAAaC,EACpB,OAAO,WAAaE,EAEpB,OAAO,mBAAqB,CAC1B,OAAQL,EACR,UAAWE,EACX,WAAYC,CACd,CACF,CAEI,SAAS,aAAe,UAC1B,SAAS,iBAAiB,mBAAoBJ,CAAI,EAElDA,EAAK,CAET,GAAG",
|
|
6
|
+
"names": ["CSS", "HTML", "style", "init", "config", "BREVO_CONFIG", "openModal", "closeModal", "resetModal", "copyCoupon", "couponCode", "copyBtn", "addContactToBrevo", "email", "__async", "WORKER_URL", "response", "data", "error", "emailInput", "submitBtn", "isValidEmail", "showError", "result", "message", "success", "duplicate", "showSuccess", "errorMessage", "couponElement", "couponBox", "successTitle"]
|
|
7
|
+
}
|
package/index.js
CHANGED
|
@@ -635,6 +635,14 @@ if (pathName === '/hero/' || pathName === '/hero') {
|
|
|
635
635
|
</div>
|
|
636
636
|
</a>
|
|
637
637
|
</li>
|
|
638
|
+
<li class="moto">
|
|
639
|
+
<a href="https://www.geeparts.co/honda/xre-300-sahara/" class="link_marca">
|
|
640
|
+
<img src="https://download.geeparts.co/xre-300-sahara.webp" alt="XRE 300 SAHARA">
|
|
641
|
+
<div class="info">
|
|
642
|
+
<p>XRE 300 SAHARA</p>
|
|
643
|
+
</div>
|
|
644
|
+
</a>
|
|
645
|
+
</li>
|
|
638
646
|
<li class="moto">
|
|
639
647
|
<a href="https://www.geeparts.co/honda/xr-190/" class="link_marca">
|
|
640
648
|
<img src="https://res.cloudinary.com/multiparts-colombia/image/upload/v1663685101/multiparts-colombia/honda/XR190_k4xnfy.png" alt="XR 190">
|
|
@@ -1509,6 +1517,9 @@ if (window.matchMedia('(min-width: 768px)').matches) {
|
|
|
1509
1517
|
<li>
|
|
1510
1518
|
<a href="https://www.geeparts.co/honda/xre-300/">XRE 300</a>
|
|
1511
1519
|
</li>
|
|
1520
|
+
<li>
|
|
1521
|
+
<a href="https://www.geeparts.co/honda/xre-300-sahara/">XRE 300 SAHARA</a>
|
|
1522
|
+
</li>
|
|
1512
1523
|
<li>
|
|
1513
1524
|
<a href="https://www.geeparts.co/honda/cb-110/">CB 110</a>
|
|
1514
1525
|
</li>
|
package/package.json
CHANGED
|
@@ -1,22 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "geeparts-js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Code main page Geeparts",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "echo 'Hello world'"
|
|
7
|
+
"test": "echo 'Hello world'",
|
|
8
|
+
"build": "node build.js"
|
|
8
9
|
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist/",
|
|
12
|
+
"index.js"
|
|
13
|
+
],
|
|
9
14
|
"repository": {
|
|
10
15
|
"type": "git",
|
|
11
16
|
"url": "git+https://github.com/johnsi15/geeparts-js.git"
|
|
12
17
|
},
|
|
13
18
|
"keywords": [
|
|
14
|
-
"geeparts"
|
|
19
|
+
"geeparts",
|
|
20
|
+
"newsletter",
|
|
21
|
+
"modal",
|
|
22
|
+
"widget",
|
|
23
|
+
"subscription",
|
|
24
|
+
"brevo"
|
|
15
25
|
],
|
|
16
26
|
"author": "John Serrano",
|
|
17
27
|
"license": "MIT",
|
|
18
28
|
"bugs": {
|
|
19
29
|
"url": "https://github.com/johnsi15/geeparts-js/issues"
|
|
20
30
|
},
|
|
21
|
-
"homepage": "https://github.com/johnsi15/geeparts-js#readme"
|
|
31
|
+
"homepage": "https://github.com/johnsi15/geeparts-js#readme",
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"esbuild": "^0.25.10"
|
|
34
|
+
}
|
|
22
35
|
}
|