easyorders 0.1.15 → 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.
Files changed (46) hide show
  1. package/README.md +2 -2
  2. package/dist/bin/cli.js +22 -8
  3. package/dist/server/index.js +10 -7
  4. package/dist/template/theme/config.json +19 -3
  5. package/dist/template/theme/home-sections/Tilted-Scrolling-Marque/config.json +107 -0
  6. package/dist/template/theme/home-sections/Tilted-Scrolling-Marque/template.liquid +171 -0
  7. package/dist/template/theme/home-sections/category-mosaic/config.json +89 -4
  8. package/dist/template/theme/home-sections/category-mosaic/template.liquid +84 -69
  9. package/dist/template/theme/home-sections/different-hero/config.json +199 -0
  10. package/dist/template/theme/home-sections/different-hero/template.liquid +219 -0
  11. package/dist/template/theme/home-sections/editorial-feature/config.json +27 -1
  12. package/dist/template/theme/home-sections/editorial-feature/template.liquid +11 -10
  13. package/dist/template/theme/home-sections/newsletter-luxe/config.json +28 -2
  14. package/dist/template/theme/home-sections/newsletter-luxe/template.liquid +19 -13
  15. package/dist/template/theme/home-sections/runway-hero/config.json +87 -30
  16. package/dist/template/theme/home-sections/runway-hero/template.liquid +59 -29
  17. package/dist/template/theme/home-sections/shop-the-look/config.json +93 -1
  18. package/dist/template/theme/home-sections/shop-the-look/template.liquid +41 -19
  19. package/dist/template/theme/home-sections/slider-before-after/config.json +213 -0
  20. package/dist/template/theme/home-sections/slider-before-after/template.liquid +336 -0
  21. package/dist/template/theme/home-sections/test-hero-allbird/config.json +130 -0
  22. package/dist/template/theme/home-sections/test-hero-allbird/template.liquid +149 -0
  23. package/dist/template/theme/home-sections/trust-promise/config.json +76 -2
  24. package/dist/template/theme/home-sections/trust-promise/template.liquid +34 -11
  25. package/dist/template/theme/home-sections/zoom-parallax/config.json +48 -0
  26. package/dist/template/theme/home-sections/zoom-parallax/template.liquid +135 -0
  27. package/dist/template/theme/product-data-schema.json +27 -0
  28. package/dist/template/theme/schema.json +114 -129
  29. package/dist/template/theme/script.js +694 -185
  30. package/dist/template/theme/sections/categories.liquid +20 -4
  31. package/dist/template/theme/sections/featured-products.liquid +65 -32
  32. package/dist/template/theme/sections/fixed-buy-button.liquid +6 -1
  33. package/dist/template/theme/sections/footer.liquid +90 -91
  34. package/dist/template/theme/sections/gallery.liquid +37 -33
  35. package/dist/template/theme/sections/header.liquid +105 -25
  36. package/dist/template/theme/sections/home-products-grid.liquid +68 -10
  37. package/dist/template/theme/sections/list-products.liquid +73 -30
  38. package/dist/template/theme/sections/order-invoice.liquid +39 -91
  39. package/dist/template/theme/sections/product-description.liquid +18 -8
  40. package/dist/template/theme/sections/product-details.liquid +9 -24
  41. package/dist/template/theme/sections/products-grid.liquid +102 -54
  42. package/dist/template/theme/sections/related-products.liquid +124 -60
  43. package/dist/template/theme/sections/reviews.liquid +43 -28
  44. package/dist/template/theme/style.css +2283 -589
  45. package/dist/template/theme/theme-data.json +25 -8
  46. package/package.json +2 -2
@@ -1,4 +1,5 @@
1
1
  !(function () {
2
+ var EO_STORE_API_FALLBACK = "https://api.easy-orders.net/api/v1";
2
3
  function e() {
3
4
  var e = document.querySelector(".ab-header");
4
5
  if (e && !e.dataset.scrollInit) {
@@ -148,63 +149,118 @@
148
149
  });
149
150
  }
150
151
  }
152
+ function runwayAnim() {
153
+ document.querySelectorAll("[data-section-anim]:not(.ab-anim-init)").forEach(function (h) {
154
+ h.classList.add("ab-anim-init");
155
+ if (!("IntersectionObserver" in window)) {
156
+ h.classList.add("ab-anim-visible");
157
+ return;
158
+ }
159
+ var io = new IntersectionObserver(function (entries) {
160
+ entries.forEach(function (entry) {
161
+ if (entry.isIntersecting) {
162
+ entry.target.classList.add("ab-anim-visible");
163
+ io.unobserve(entry.target);
164
+ }
165
+ });
166
+ }, { threshold: 0.15 });
167
+ io.observe(h);
168
+ });
169
+ }
151
170
  function o() {
152
- document.querySelectorAll(".ab-gallery").forEach(function (e) {
153
- if (!e.dataset.galleryInit) {
154
- e.dataset.galleryInit = "1";
155
- var t = e.querySelector(".ab-gallery-main-media"),
156
- a = e.querySelectorAll(".ab-gallery-thumb"),
157
- n = [];
158
- a.forEach(function (e) {
159
- e.dataset.src && n.push(e.dataset.src);
160
- }),
161
- 0 === n.length && t && n.push(t.src),
162
- document.querySelectorAll("body > .ab-lightbox").forEach(function (e) {
163
- e.remove();
164
- });
165
- var r = e.querySelector("[data-lightbox]");
166
- r && document.body.appendChild(r);
167
- var o = r && r.querySelector("[data-lightbox-img]"),
168
- i = r && r.querySelector("[data-lightbox-counter]"),
169
- c = 0;
170
- a.forEach(function (n) {
171
- n.addEventListener("click", function () {
172
- var r = n.dataset.src;
173
- r &&
174
- t &&
175
- ((t.src = r),
176
- a.forEach(function (e) {
177
- e.classList.remove("ab-active");
178
- }),
179
- n.classList.add("ab-active"));
180
- });
181
- }),
182
- e.querySelectorAll("[data-gallery-open]").forEach(function (e) {
183
- e.addEventListener("click", function (e) {
184
- if (!e.target.closest("[data-src]") && r) {
185
- var a = t ? n.indexOf(t.src) : 0;
186
- l(-1 === a ? 0 : a),
187
- r.classList.add("ab-open"),
188
- (document.body.style.overflow = "hidden");
189
- }
190
- });
191
- }),
192
- r &&
193
- r.addEventListener("click", function (e) {
194
- var t = e.target;
195
- if (t.closest("[data-lightbox-close]"))
196
- return (
197
- r.classList.remove("ab-open"), void (document.body.style.overflow = "")
198
- );
199
- t.closest("[data-lightbox-prev]")
200
- ? l(c - 1)
201
- : t.closest("[data-lightbox-next]") && l(c + 1);
202
- });
171
+ document.querySelectorAll(".ab-gallery").forEach(function (el) {
172
+ if (el.dataset.galleryInit) return;
173
+ el.dataset.galleryInit = "1";
174
+ var track = el.querySelector("[data-gallery-track]"),
175
+ slides = el.querySelectorAll(".ab-gallery-slide"),
176
+ dots = el.querySelectorAll(".ab-gallery-dot"),
177
+ srcs = [];
178
+ slides.forEach(function (s) {
179
+ if (s.dataset.src) srcs.push(s.dataset.src);
180
+ });
181
+ document.querySelectorAll("body > .ab-lightbox").forEach(function (e) {
182
+ e.remove();
183
+ });
184
+ var lb = el.querySelector("[data-lightbox]");
185
+ if (lb) document.body.appendChild(lb);
186
+ var lbImg = lb && lb.querySelector("[data-lightbox-img]"),
187
+ lbVideo = lb && lb.querySelector("[data-lightbox-video]"),
188
+ lbCnt = lb && lb.querySelector("[data-lightbox-counter]"),
189
+ idx = 0;
190
+ function isVideoSrc(u) {
191
+ if (!u) return false;
192
+ var p = u.split("?")[0].toLowerCase();
193
+ return p.endsWith(".mp4") || p.endsWith(".webm") || p.endsWith(".ogg");
203
194
  }
204
- function l(e) {
205
- (c = ((e % n.length) + n.length) % n.length),
206
- o && (o.src = n[c]),
207
- i && (i.textContent = c + 1 + " / " + n.length);
195
+ function stopLbVideo() {
196
+ if (!lbVideo) return;
197
+ lbVideo.pause();
198
+ lbVideo.removeAttribute("src");
199
+ lbVideo.load();
200
+ lbVideo.style.display = "none";
201
+ }
202
+ function show(i) {
203
+ if (!srcs.length) return;
204
+ idx = ((i % srcs.length) + srcs.length) % srcs.length;
205
+ var url = srcs[idx];
206
+ if (isVideoSrc(url)) {
207
+ if (lbImg) { lbImg.removeAttribute("src"); lbImg.style.display = "none"; }
208
+ if (lbVideo) { lbVideo.style.display = "block"; lbVideo.src = url; lbVideo.play().catch(function(){}); }
209
+ } else {
210
+ stopLbVideo();
211
+ if (lbImg) { lbImg.style.display = ""; lbImg.src = url; }
212
+ }
213
+ if (lbCnt) lbCnt.textContent = idx + 1 + " / " + srcs.length;
214
+ }
215
+ slides.forEach(function (s) {
216
+ s.addEventListener("click", function () {
217
+ if (!lb) return;
218
+ var v = s.querySelector("video");
219
+ if (v) v.pause();
220
+ show(Number(s.dataset.slideIndex) || 0);
221
+ lb.classList.add("ab-open");
222
+ document.body.style.overflow = "hidden";
223
+ });
224
+ });
225
+ if (lb)
226
+ lb.addEventListener("click", function (e) {
227
+ var t = e.target;
228
+ if (t.closest("[data-lightbox-close]")) {
229
+ stopLbVideo();
230
+ lb.classList.remove("ab-open");
231
+ document.body.style.overflow = "";
232
+ return;
233
+ }
234
+ if (t.closest("[data-lightbox-prev]")) show(idx - 1);
235
+ else if (t.closest("[data-lightbox-next]")) show(idx + 1);
236
+ });
237
+ dots.forEach(function (d) {
238
+ d.addEventListener("click", function () {
239
+ var i = Number(d.dataset.dotIndex) || 0,
240
+ s = slides[i];
241
+ if (track && s)
242
+ track.scrollTo({ left: s.offsetLeft, behavior: "smooth" });
243
+ });
244
+ });
245
+ if (track && dots.length) {
246
+ var ticking = false;
247
+ track.addEventListener(
248
+ "scroll",
249
+ function () {
250
+ if (ticking) return;
251
+ ticking = true;
252
+ requestAnimationFrame(function () {
253
+ ticking = false;
254
+ var w = track.clientWidth;
255
+ if (!w) return;
256
+ var i = Math.round(track.scrollLeft / w);
257
+ dots.forEach(function (d, j) {
258
+ d.classList.toggle("ab-active", j === i);
259
+ });
260
+ });
261
+ },
262
+ { passive: true }
263
+ );
208
264
  }
209
265
  });
210
266
  }
@@ -357,6 +413,7 @@
357
413
  e.dataset.marqueeInit = "1";
358
414
  var t = e.querySelector(".ab-ann-marquee-track");
359
415
  if (!t) return;
416
+ var isArabic = !!e.closest(".ab-announce--arabic");
360
417
  var a = t.innerHTML,
361
418
  n = t.scrollWidth,
362
419
  r = e.offsetWidth;
@@ -368,140 +425,264 @@
368
425
  var c = t.scrollWidth / o,
369
426
  l = Math.max(c / 40, 5);
370
427
  t.style.setProperty("--marquee-dur", l + "s"),
371
- t.style.setProperty("--marquee-offset", "-" + c + "px"),
428
+ t.style.setProperty("--marquee-offset", (isArabic ? c : -c) + "px"),
372
429
  t.classList.add("ab-running");
373
430
  }
374
431
  });
375
432
  }
376
- function h() {
377
- function m(root) {
378
- var wrap = root.closest("[data-eo-api-base]");
379
- if (wrap && wrap.getAttribute("data-eo-api-base")) {
380
- return wrap.getAttribute("data-eo-api-base").replace(/\/$/, "");
433
+ function w() {
434
+ document.querySelectorAll(".ab-comparison-slider").forEach(function (slider) {
435
+ if (slider.dataset.compInit) return;
436
+ slider.dataset.compInit = "1";
437
+ var range = slider.querySelector(".ab-comp-range"),
438
+ before = slider.querySelector(".ab-before-image"),
439
+ handle = slider.querySelector(".ab-comp-handle");
440
+ if (!range || !before || !handle) return;
441
+ range.style.pointerEvents = "none";
442
+ function setPosition(val) {
443
+ var t = Math.max(0, Math.min(100, Number(val) || 0));
444
+ range.value = String(t);
445
+ before.style.clipPath = "inset(0 " + (100 - t) + "% 0 0)";
446
+ handle.style.left = t + "%";
447
+ handle.style.top = "";
448
+ handle.style.transform = "translateX(-50%)";
381
449
  }
382
- if (typeof window.__EO_STORE_API_BASE__ === "string" && window.__EO_STORE_API_BASE__) {
383
- return window.__EO_STORE_API_BASE__.replace(/\/$/, "");
450
+ setPosition(Number(range.value) || 50);
451
+ range.addEventListener("input", function (ev) {
452
+ setPosition(ev.target.value);
453
+ });
454
+ function updateFromClient(clientX, clientY) {
455
+ var rect = slider.getBoundingClientRect();
456
+ if (rect.width <= 0 || rect.height <= 0) return;
457
+ var t = ((clientX - rect.left) / rect.width) * 100;
458
+ setPosition(t);
384
459
  }
385
- return "https://api.easyorders.dev/api/v1";
460
+ var dragPid = null;
461
+ handle.addEventListener("pointerdown", function (ev) {
462
+ if (ev.pointerType === "mouse" && ev.button !== 0) return;
463
+ dragPid = ev.pointerId;
464
+ try {
465
+ slider.setPointerCapture(ev.pointerId);
466
+ } catch (err) {}
467
+ updateFromClient(ev.clientX, ev.clientY);
468
+ });
469
+ slider.addEventListener("pointermove", function (ev) {
470
+ if (dragPid !== ev.pointerId) return;
471
+ updateFromClient(ev.clientX, ev.clientY);
472
+ });
473
+ function endDrag(ev) {
474
+ if (dragPid !== ev.pointerId) return;
475
+ try {
476
+ slider.releasePointerCapture(ev.pointerId);
477
+ } catch (err) {}
478
+ dragPid = null;
479
+ }
480
+ slider.addEventListener("pointerup", endDrag);
481
+ slider.addEventListener("pointercancel", endDrag);
482
+ });
483
+ }
484
+ function moveStockToAccordion() {
485
+ const stockElement = document.querySelector('.ab-fake-visitor');
486
+ const accordionElement = document.querySelector('.mt-5.flex.flex-col.flex-col-reverse.gap-3');
487
+
488
+ // غيرنا previous لـ next عشان نتأكد إنه مش موجود "بعد" العنصر بالفعل
489
+ if (stockElement && accordionElement && !accordionElement.nextElementSibling?.classList.contains('stock-moved')) {
490
+
491
+ stockElement.classList.add('stock-moved');
492
+
493
+ // الدالة دي بتحط العنصر بعد الـ accordionElement مباشرة
494
+ accordionElement.after(stockElement);
495
+
496
+ stockElement.style.marginTop = '8px';
497
+ }
498
+ }
499
+ function restructureCartCounter() {
500
+ document.querySelectorAll('.cart-item-quantity-counter').forEach((container) => {
501
+ if (container.querySelector('.qty-box-wrapper')) return;
502
+ const deleteBtn = container.querySelector('button.ms-2');
503
+ if (!deleteBtn) return;
504
+ const qtyWrapper = document.createElement('div');
505
+ qtyWrapper.className = 'qty-box-wrapper';
506
+ Array.from(container.childNodes).forEach(node => {
507
+ if (node !== deleteBtn) {
508
+ qtyWrapper.appendChild(node);
509
+ }
510
+ });
511
+ container.innerHTML = '';
512
+ container.appendChild(qtyWrapper);
513
+ container.appendChild(deleteBtn);
514
+ container.classList.add('flex-split-layout');
515
+ deleteBtn.classList.add('custom-trash-btn');
516
+ });
517
+ }
518
+ function syncArabicUiDirection() {
519
+ const el = document.getElementById("__NEXT_DATA__");
520
+ let lang = "en";
521
+ if (el) {
522
+ try {
523
+ const data = JSON.parse(el.textContent);
524
+ lang =
525
+ data?.props?.pageProps?.appSettings?.lang ||
526
+ data?.props?.pageProps?.locale ||
527
+ "en";
528
+ } catch (e) {}
386
529
  }
387
- function p(body) {
388
- if (Array.isArray(body)) return body;
389
- if (body && Array.isArray(body.data)) return body.data;
390
- return [];
530
+ lang = String(lang || "en")
531
+ .toLowerCase()
532
+ .split("-")[0];
533
+ const isArabic = lang === "ar";
534
+ document.documentElement.classList.toggle("ab-lang-ar", isArabic);
535
+ if (document.body) {
536
+ document.body.classList.toggle("ab-lang-ar", isArabic);
391
537
  }
392
- document.querySelectorAll("[data-eo-hs-entity]:not([data-eo-hs-done])").forEach(function (root) {
393
- var base = m(root);
394
- var mount = root.querySelector("[data-eo-hs-mount]");
395
- var idsStr = root.getAttribute("data-eo-hs-ids") || "";
396
- var ids = idsStr
397
- .split(",")
398
- .map(function (s) {
399
- return s.trim();
400
- })
401
- .filter(Boolean);
402
- if (!base || !mount || ids.length === 0) {
403
- root.setAttribute("data-eo-hs-done", "1");
404
- return;
538
+ document.querySelectorAll(".ab-pd-star-half").forEach((star) => {
539
+ star.style.transform = isArabic ? "scaleX(-1)" : "";
540
+ star.style.transformOrigin = isArabic ? "center" : "";
541
+ });
542
+ document.querySelectorAll(".ab-footer-subscribe-btn svg").forEach((icon) => {
543
+ icon.style.transform = isArabic ? "scaleX(-1)" : "";
544
+ icon.style.transformOrigin = isArabic ? "center" : "";
545
+ });
546
+ document.querySelectorAll(".ab-mobile-nav > a svg").forEach((icon) => {
547
+ icon.style.transform = isArabic ? "scaleX(-1)" : "";
548
+ icon.style.transformOrigin = isArabic ? "center" : "";
549
+ });
550
+ }
551
+ function updateReviewTitle() {
552
+ const el = document.getElementById('__NEXT_DATA__');
553
+ if (!el) return;
554
+
555
+ let lang = 'en';
556
+ try {
557
+ const data = JSON.parse(el.textContent);
558
+ lang =
559
+ data?.props?.pageProps?.appSettings?.lang ||
560
+ data?.props?.pageProps?.locale ||
561
+ 'en';
562
+ } catch (e) {
563
+ console.error("Error parsing __NEXT_DATA__", e);
564
+ }
565
+ lang = String(lang || 'en').toLowerCase().split('-')[0];
566
+
567
+ const titles = {
568
+ 'ar': 'آراء لعملائنا',
569
+ 'fr': 'Véritables avis clients',
570
+ 'es': 'Opiniones reales',
571
+ 'en': 'Join our happy customers'
572
+ };
573
+ const verifiedLabels = {
574
+ 'ar': 'مشتري موثّق',
575
+ 'fr': 'Acheteur vérifié',
576
+ 'es': 'Comprador verificado',
577
+ 'en': 'Verified Buyer'
578
+ };
579
+ const addToCartLabels = {
580
+ 'ar': 'أضف إلى السلة',
581
+ 'fr': 'Ajouter au panier',
582
+ 'es': 'Agregar al carrito',
583
+ 'en': 'ADD TO CART'
584
+ };
585
+
586
+ const newTitle = titles[lang] || titles['en'];
587
+ const newVerifiedLabel = verifiedLabels[lang] || verifiedLabels['en'];
588
+ const newAddToCartLabel = addToCartLabels[lang] || addToCartLabels['en'];
589
+ const titleElement = document.querySelector('.ab-reviews-title');
590
+ if (titleElement && titleElement.innerText !== newTitle) {
591
+ titleElement.innerText = newTitle;
592
+ }
593
+ document.querySelectorAll('.verified-badge').forEach((badge) => {
594
+ if (badge.innerText !== newVerifiedLabel) {
595
+ badge.innerText = newVerifiedLabel;
405
596
  }
406
- root.setAttribute("data-eo-hs-done", "1");
407
- var entity = root.getAttribute("data-eo-hs-entity") || "";
408
- var path =
409
- entity === "categories"
410
- ? "categories"
411
- : entity === "pages"
412
- ? "simple-pages"
413
- : "products";
414
- var url =
415
- base.replace(/\/$/, "") +
416
- "/" +
417
- path +
418
- "?filter=id||$in||" +
419
- ids.join(",") +
420
- "&limit=" +
421
- ids.length;
422
- mount.classList.add("eo-hs-loading");
423
- fetch(url, { credentials: "omit", headers: { Accept: "application/json" } })
424
- .then(function (res) {
425
- return res.ok ? res.json() : Promise.reject(new Error(String(res.status)));
426
- })
427
- .then(function (body) {
428
- var rows = p(body);
429
- var byId = {};
430
- rows.forEach(function (row) {
431
- if (row && row.id != null) byId[String(row.id)] = row;
432
- });
433
- var frag = document.createDocumentFragment();
434
- ids.forEach(function (id) {
435
- var row = byId[id];
436
- if (!row) return;
437
- if (entity === "products") {
438
- var slug = row.slug || "";
439
- var name = row.name || "";
440
- var thumb = row.thumb || "";
441
- var price =
442
- row.sale_price != null && row.price != null && row.sale_price < row.price
443
- ? row.sale_price
444
- : row.price;
445
- var el = document.createElement("a");
446
- el.className = "eo-hs-card eo-hs-card--product";
447
- el.href = slug ? "/products/" + encodeURIComponent(slug) : "#";
448
- el.innerHTML =
449
- (thumb
450
- ? '<span class="eo-hs-card__media"><img src="' +
451
- String(thumb).replace(/"/g, "") +
452
- '" alt="" loading="lazy" width="280" height="350" /></span>'
453
- : '<span class="eo-hs-card__media eo-hs-card__media--empty"></span>') +
454
- '<span class="eo-hs-card__body"><span class="eo-hs-card__title">' +
455
- String(name || "").replace(/</g, "&lt;") +
456
- "</span>" +
457
- (price != null
458
- ? '<span class="eo-hs-card__meta">' + String(price) + "</span>"
459
- : "") +
460
- "</span>";
461
- frag.appendChild(el);
462
- } else if (entity === "categories") {
463
- var cslug = row.slug || "";
464
- var cname = row.name || "";
465
- var cthumb = row.thumb || "";
466
- var ca = document.createElement("a");
467
- ca.className = "eo-hs-card eo-hs-card--category";
468
- ca.href = cslug ? "/collections/" + encodeURIComponent(cslug) : "#";
469
- ca.innerHTML =
470
- (cthumb
471
- ? '<span class="eo-hs-card__media"><img src="' +
472
- String(cthumb).replace(/"/g, "") +
473
- '" alt="" loading="lazy" width="320" height="200" /></span>'
474
- : '<span class="eo-hs-card__media eo-hs-card__media--empty"></span>') +
475
- '<span class="eo-hs-card__body"><span class="eo-hs-card__title">' +
476
- String(cname || "").replace(/</g, "&lt;") +
477
- "</span></span>";
478
- frag.appendChild(ca);
597
+ });
598
+ document.querySelectorAll('.ab-pgrid-cta-label').forEach((label) => {
599
+ if (label.innerText !== newAddToCartLabel) {
600
+ label.innerText = newAddToCartLabel;
601
+ }
602
+ });
603
+ document.querySelectorAll('.ab-pgrid-cta').forEach((btn) => {
604
+ btn.setAttribute('aria-label', newAddToCartLabel);
605
+ });
606
+ }
607
+ function updateCartButtonText() {
608
+ const el = document.getElementById("__NEXT_DATA__");
609
+ let lang = "en";
610
+ if (el) {
611
+ try {
612
+ const data = JSON.parse(el.textContent);
613
+ lang =
614
+ data?.props?.pageProps?.appSettings?.lang ||
615
+ data?.props?.pageProps?.locale ||
616
+ "en";
617
+ } catch (e) {
618
+ console.error("Error parsing __NEXT_DATA__ for checkout locale", e);
619
+ }
620
+ }
621
+ lang = String(lang || "en")
622
+ .toLowerCase()
623
+ .split("-")[0];
624
+
625
+ const cartLabels = {
626
+ ar: "إتمام الشراء",
627
+ en: "CHECK OUT",
628
+ fr: "Payer",
629
+ es: "Finalizar compra",
630
+ };
631
+ const shippingNotes = {
632
+ ar: "يتم احتساب الشحن والخصم عند إتمام الطلب.",
633
+ en: "Shipping and discount calculated at checkout.",
634
+ fr: "Frais de port et remise calculés au paiement.",
635
+ es: "Envío y descuento calculados al finalizar la compra.",
636
+ };
637
+
638
+ const cartText = cartLabels[lang] || cartLabels.en;
639
+ const shippingText = shippingNotes[lang] || shippingNotes.en;
640
+
641
+ const cartButton = document.querySelector(
642
+ ".bg-white.shadow-xl button.bg-skin-primary"
643
+ );
644
+ if (cartButton && cartButton.innerText.trim() !== cartText) {
645
+ cartButton.innerText = cartText;
646
+ cartButton.setAttribute("data-translated", "true");
647
+ }
648
+
649
+ document.documentElement.style.setProperty(
650
+ "--ab-checkout-shipping-note",
651
+ JSON.stringify(shippingText)
652
+ );
653
+ }
654
+ function wrapVariants() {
655
+ // العثور على كل حاويات معلومات المنتج
656
+ const itemInfoContainers = document.querySelectorAll('[data-cart="item-info"]');
657
+
658
+ itemInfoContainers.forEach(container => {
659
+ // التحقق مما إذا كان قد تم التغليف بالفعل لمنع التكرار
660
+ if (container.querySelector('.variants-wrapper')) return;
661
+
662
+ // العثور على كل الـ variants داخل هذه الحاوية
663
+ const variants = container.querySelectorAll('[data-cart="item-variant"]');
664
+
665
+ if (variants.length > 0) {
666
+ // إنشاء الحاوية الجديدة
667
+ const wrapper = document.createElement('div');
668
+ wrapper.className = 'variants-wrapper';
669
+
670
+ // نقل الـ variants إلى الحاوية الجديدة
671
+ variants.forEach(variant => {
672
+ wrapper.appendChild(variant);
673
+ });
674
+
675
+ // إضافة الحاوية الجديدة داخل الـ item-info بعد الـ header
676
+ const header = container.querySelector('[data-cart="item-header"]');
677
+ if (header) {
678
+ header.after(wrapper);
479
679
  } else {
480
- var pslug = row.slug || "";
481
- var ptitle = row.title || "";
482
- var pa = document.createElement("a");
483
- pa.className = "eo-hs-card eo-hs-card--page";
484
- pa.href = pslug ? "/pages/" + encodeURIComponent(pslug) : "#";
485
- pa.innerHTML =
486
- '<span class="eo-hs-card__body"><span class="eo-hs-card__title">' +
487
- String(ptitle || "").replace(/</g, "&lt;") +
488
- "</span></span>";
489
- frag.appendChild(pa);
680
+ container.prepend(wrapper);
490
681
  }
491
- });
492
- mount.textContent = "";
493
- mount.appendChild(frag);
494
- mount.classList.remove("eo-hs-loading");
495
- root.classList.remove("eo-hs--empty");
496
- })
497
- .catch(function () {
498
- mount.classList.remove("eo-hs-loading");
499
- mount.innerHTML =
500
- '<p class="eo-hs-error" role="status">Unable to load this block. Check your connection or try again later.</p>';
501
- });
682
+ }
502
683
  });
503
- }
504
- function d() {
684
+ }
685
+ function filterProductByCategory() {
505
686
  function b(el) {
506
687
  var wrap = el.closest("[data-eo-api-base]");
507
688
  if (wrap && wrap.getAttribute("data-eo-api-base")) {
@@ -510,7 +691,7 @@
510
691
  if (typeof window.__EO_STORE_API_BASE__ === "string" && window.__EO_STORE_API_BASE__) {
511
692
  return window.__EO_STORE_API_BASE__.replace(/\/$/, "");
512
693
  }
513
- return "https://api.easyorders.dev/api/v1";
694
+ return EO_STORE_API_FALLBACK;
514
695
  }
515
696
  document.querySelectorAll("a[data-eo-hs-cta]:not([data-eo-hs-cta-done])").forEach(function (a) {
516
697
  var id = String(a.getAttribute("data-eo-hs-cta-id") || "").trim();
@@ -545,25 +726,189 @@
545
726
  .catch(function () {});
546
727
  });
547
728
  }
729
+ filterProductByCategory();
730
+
731
+ var __eoHsCurrency = "";
732
+ function detectCurrency() {
733
+ if (__eoHsCurrency) return __eoHsCurrency;
734
+ try {
735
+ var nd = document.getElementById("__NEXT_DATA__");
736
+ if (nd) {
737
+ var j = JSON.parse(nd.textContent);
738
+ var s = j && j.props && j.props.pageProps && j.props.pageProps.appSettings;
739
+ if (s && s.currency_symbol) { __eoHsCurrency = s.currency_symbol; return __eoHsCurrency; }
740
+ }
741
+ } catch (e) {}
742
+ var priceEl = document.querySelector(".ab-pgrid-price, .ab-pd-price, .ab-plist-price, .ab-featured-price, .ab-price-old");
743
+ if (priceEl) {
744
+ var txt = (priceEl.textContent || "").replace(/[\d,.\s]/g, "").trim();
745
+ if (txt) { __eoHsCurrency = txt; return __eoHsCurrency; }
746
+ }
747
+ return "";
748
+ }
749
+
750
+ function fetchHsSectionProducts() {
751
+ function apiBase(el) {
752
+ var wrap = el.closest("[data-eo-api-base]");
753
+ if (wrap && wrap.getAttribute("data-eo-api-base"))
754
+ return wrap.getAttribute("data-eo-api-base").replace(/\/$/, "");
755
+ if (typeof window.__EO_STORE_API_BASE__ === "string" && window.__EO_STORE_API_BASE__)
756
+ return window.__EO_STORE_API_BASE__.replace(/\/$/, "");
757
+ return EO_STORE_API_FALLBACK;
758
+ }
759
+ var containers = document.querySelectorAll("[data-eo-hs-ids]:not([data-eo-hs-fetched])");
760
+ if (!containers.length) return;
761
+ var cur = detectCurrency();
762
+ containers.forEach(function (container) {
763
+ var ids = (container.getAttribute("data-eo-hs-ids") || "").trim();
764
+ if (!ids) return;
765
+ container.setAttribute("data-eo-hs-fetched", "1");
766
+ var mount = container.querySelector("[data-eo-hs-mount]");
767
+ if (!mount) return;
768
+ mount.classList.add("eo-hs-loading");
769
+ var base = apiBase(container);
770
+ var entity = container.getAttribute("data-eo-hs-entity") || "products";
771
+ var path = entity === "categories" ? "categories" : "products";
772
+ var url = base + "/" + path + "?filter=id||$in||" + ids + "&limit=20";
773
+ fetch(url, { credentials: "omit", headers: { Accept: "application/json" } })
774
+ .then(function (res) { return res.ok ? res.json() : Promise.reject(res.status); })
775
+ .then(function (body) {
776
+ var rows = Array.isArray(body) ? body : body && Array.isArray(body.data) ? body.data : [];
777
+ if (!rows.length) {
778
+ mount.innerHTML = '<p class="eo-hs-error">No products found.</p>';
779
+ return;
780
+ }
781
+ var html = "";
782
+ rows.forEach(function (p) {
783
+ var slug = p.slug || "";
784
+ var name = p.name || "";
785
+ var thumb = p.thumb || (p.images && p.images[0]) || "";
786
+ var price = p.sale_price && p.sale_price < p.price ? p.sale_price : p.price || 0;
787
+ var oldPrice = p.sale_price && p.sale_price < p.price ? p.price : 0;
788
+ var currency = cur || p.currency || "";
789
+ var mediaHtml = thumb
790
+ ? '<div class="eo-hs-card__media"><img src="' + thumb + '" alt="' + name.replace(/"/g, "&quot;") + '" loading="lazy" width="320" height="400" style="width:100%;height:100%;object-fit:cover;display:block;" /></div>'
791
+ : '<div class="eo-hs-card__media eo-hs-card__media--empty"></div>';
792
+ var priceHtml = '<span class="eo-hs-card__meta">';
793
+ if (oldPrice) {
794
+ priceHtml += '<del style="opacity:0.55;margin-inline-end:4px">' + oldPrice + " " + currency + "</del> ";
795
+ }
796
+ priceHtml += price + " " + currency + "</span>";
797
+ html +=
798
+ '<a class="eo-hs-card--product" href="/products/' + encodeURIComponent(slug) + '">' +
799
+ mediaHtml +
800
+ '<div class="eo-hs-card__body">' +
801
+ '<span class="eo-hs-card__title">' + name + "</span>" +
802
+ priceHtml +
803
+ "</div></a>";
804
+ });
805
+ mount.innerHTML = html;
806
+ mount.classList.remove("eo-hs-loading");
807
+ if (typeof initFormatPrices === "function") initFormatPrices();
808
+ })
809
+ .catch(function () {
810
+ mount.innerHTML = '<p class="eo-hs-error">Failed to load products.</p>';
811
+ mount.classList.remove("eo-hs-loading");
812
+ });
813
+ });
814
+ }
815
+ function initIOSHoverFix() {
816
+ if (!("ontouchstart" in window)) return;
817
+ document.querySelectorAll('.ab-pgrid-card:not([data-ios-fix]), .ab-plist-card:not([data-ios-fix]), .ab-featured-card:not([data-ios-fix]), .ab-pgrid-card-link:not([data-ios-fix])').forEach(function(card) {
818
+ card.dataset.iosFix = "1";
819
+ var isScrolling = false;
820
+
821
+ card.addEventListener("touchstart", function() {
822
+ isScrolling = false;
823
+ }, {passive: true});
824
+
825
+ card.addEventListener("touchmove", function() {
826
+ isScrolling = true;
827
+ }, {passive: true});
828
+
829
+ card.addEventListener("touchend", function(e) {
830
+ if (isScrolling) return;
831
+ if (!e.target.closest("button") && !e.target.closest(".ab-card-actions")) {
832
+ e.preventDefault();
833
+ var link = card.tagName === "A" ? card : card.querySelector("a[href]");
834
+ if (link && typeof link.click === "function") link.click();
835
+ else card.click();
836
+ }
837
+ });
838
+ });
839
+ }
840
+ function initZoomParallax() {
841
+ const sections = document.querySelectorAll('.zp-section:not([data-zp-init])');
842
+ sections.forEach(sec => {
843
+ sec.dataset.zpInit = '1';
844
+
845
+ const center = sec.querySelector('.zp-img-center');
846
+ const tl = sec.querySelector('.zp-img-tl');
847
+ const tr = sec.querySelector('.zp-img-tr');
848
+ const bl = sec.querySelector('.zp-img-bl');
849
+ const br = sec.querySelector('.zp-img-br');
850
+
851
+ let ticking = false;
852
+
853
+ function onScroll() {
854
+ const rect = sec.getBoundingClientRect();
855
+ const viewHeight = window.innerHeight;
856
+
857
+ let progress = -rect.top / (rect.height - viewHeight);
858
+ if (progress < 0) progress = 0;
859
+ if (progress > 1) progress = 1;
860
+
861
+ if (center) center.style.transform = `scale(${1 + progress * 3})`;
862
+ if (tl) tl.style.transform = `scale(${1 + progress * 4})`;
863
+ if (tr) tr.style.transform = `scale(${1 + progress * 5})`;
864
+ if (bl) bl.style.transform = `scale(${1 + progress * 7})`;
865
+ if (br) br.style.transform = `scale(${1 + progress * 8})`;
866
+ }
867
+
868
+ window.addEventListener('scroll', () => {
869
+ if (!ticking) {
870
+ window.requestAnimationFrame(() => {
871
+ onScroll();
872
+ ticking = false;
873
+ });
874
+ ticking = true;
875
+ }
876
+ }, { passive: true });
877
+
878
+ onScroll();
879
+ });
880
+ }
881
+ initZoomParallax();
882
+ fetchHsSectionProducts();
883
+ initIOSHoverFix();
884
+ wrapVariants();
885
+ updateCartButtonText();
886
+ syncArabicUiDirection();
887
+ updateReviewTitle();
888
+ moveStockToAccordion();
889
+ restructureCartCounter();
548
890
  e(),
549
891
  t(),
550
892
  a(),
551
893
  n(),
552
894
  r(),
895
+ runwayAnim(),
553
896
  o(),
554
897
  u(),
555
898
  v(),
556
- h(),
557
- d(),
899
+ w(),
558
900
  window.__abGalleryKeyInit ||
559
901
  ((window.__abGalleryKeyInit = !0),
560
902
  document.addEventListener("keydown", function (e) {
561
903
  var t = document.querySelector("body > .ab-lightbox.ab-open");
562
904
  if (t) {
563
- if ("Escape" === e.key)
564
- return (
565
- t.classList.remove("ab-open"), void (document.body.style.overflow = "")
566
- );
905
+ if ("Escape" === e.key) {
906
+ var vEl = t.querySelector("[data-lightbox-video]");
907
+ if (vEl) { vEl.pause(); vEl.removeAttribute("src"); vEl.load(); vEl.style.display = "none"; }
908
+ t.classList.remove("ab-open");
909
+ document.body.style.overflow = "";
910
+ return;
911
+ }
567
912
  if ("ArrowLeft" !== e.key)
568
913
  if ("ArrowRight" !== e.key);
569
914
  else {
@@ -581,6 +926,170 @@
581
926
  l(),
582
927
  s(),
583
928
  new MutationObserver(function () {
584
- e(), t(), a(), n(), r(), o(), u(), v(), h(), d(), i(), c(), l(), s();
929
+ e(), t(), a(), n(), r(), runwayAnim(), o(), u(), v(), w(), i(), c(), l(), s();moveStockToAccordion();restructureCartCounter();syncArabicUiDirection();updateReviewTitle();updateCartButtonText();wrapVariants();filterProductByCategory();fetchHsSectionProducts();initIOSHoverFix();initZoomParallax();
585
930
  }).observe(document.body, { childList: !0, subtree: !0 });
586
931
  })();
932
+
933
+ /* ── Fixed Buy Button: reveal after 10% scroll on mobile ── */
934
+ !(function () {
935
+ var MOBILE_MQ = "(max-width: 768px)";
936
+ var CLASS_SHOW = "show-btn";
937
+ var ticking = false;
938
+
939
+ function update() {
940
+ ticking = false;
941
+ var el = document.querySelector(".ab-fixed-buy");
942
+ if (!el) return;
943
+
944
+ if (!window.matchMedia(MOBILE_MQ).matches) {
945
+ el.classList.remove(CLASS_SHOW);
946
+ return;
947
+ }
948
+
949
+ var doc = document.documentElement;
950
+ var scrollable = (doc.scrollHeight || document.body.scrollHeight) - window.innerHeight;
951
+ if (scrollable <= 0) {
952
+ el.classList.remove(CLASS_SHOW);
953
+ return;
954
+ }
955
+
956
+ var y = window.pageYOffset || doc.scrollTop;
957
+ var threshold = scrollable * 0.3;
958
+
959
+ if (y > threshold) {
960
+ el.classList.add(CLASS_SHOW);
961
+ } else {
962
+ el.classList.remove(CLASS_SHOW);
963
+ }
964
+ }
965
+
966
+ function onScroll() {
967
+ if (ticking) return;
968
+ ticking = true;
969
+ window.requestAnimationFrame(update);
970
+ }
971
+
972
+ window.addEventListener("scroll", onScroll, { passive: true });
973
+ window.addEventListener("resize", onScroll, { passive: true });
974
+ window.addEventListener("load", update);
975
+ update();
976
+ })();
977
+
978
+ /* ── Footer details: mobile accordion, desktop/tablet always open ── */
979
+ !(function () {
980
+ var FOOTER_MQ = "(min-width: 768px)";
981
+
982
+ function syncFooterDetails() {
983
+ var isWide = window.matchMedia(FOOTER_MQ).matches,
984
+ items = document.querySelectorAll(".ab-footer .ab-footer-details");
985
+ if (!items.length) return !1;
986
+ items.forEach(function (el) {
987
+ if (isWide) el.setAttribute("open", "");
988
+ else el.removeAttribute("open");
989
+ });
990
+ return !0;
991
+ }
992
+
993
+ function syncFooterWhenReady(attempt) {
994
+ if (syncFooterDetails()) return;
995
+ attempt < 40 &&
996
+ setTimeout(function () {
997
+ syncFooterWhenReady(attempt + 1);
998
+ }, 50);
999
+ }
1000
+
1001
+ if (document.readyState === "loading") {
1002
+ document.addEventListener("DOMContentLoaded", function () {
1003
+ syncFooterWhenReady(0);
1004
+ });
1005
+ } else {
1006
+ syncFooterWhenReady(0);
1007
+ }
1008
+
1009
+ window.addEventListener("load", function () {
1010
+ syncFooterWhenReady(0);
1011
+ });
1012
+ window.addEventListener("resize", syncFooterDetails, { passive: true });
1013
+ var mq = window.matchMedia(FOOTER_MQ);
1014
+ if (mq.addEventListener) mq.addEventListener("change", syncFooterDetails);
1015
+ else mq.onchange = syncFooterDetails;
1016
+ })();
1017
+
1018
+ const initFormatPrices = () => {
1019
+ const formatPrices = () => {
1020
+ const priceSelectors = [
1021
+ '.ab-price-old',
1022
+ '.ab-plist-price',
1023
+ '.ab-pgrid-price',
1024
+ '.ab-pd-price',
1025
+ '.ab-pd-price-old',
1026
+ '.ab-fixed-buy-price',
1027
+ '.ab-fixed-buy-price-old',
1028
+ '.ab-featured-price',
1029
+ '.eo-hs-card__meta',
1030
+ '.shop-the-look__pick-price',
1031
+ '.ab-invoice-item-unit-price',
1032
+ '.ab-invoice-item-total',
1033
+ '.ab-invoice-totals dd',
1034
+ '.total_price',
1035
+ '[data-cart="item-price"]',
1036
+ '[data-invoice="invoice-subtotal-value"]',
1037
+ '.shipping_cost',
1038
+ '[data-invoice="invoice-total-value"]',
1039
+ 'p[class~="flex"][class*="text-gray-500"][class*="items-center"][class*="gap-0.5"]',
1040
+ 'div[class~="flex"][class~="items-center"][class~="gap-2.5"][class*="mt-3"] span[class~="flex"][class~="items-center"][class~="gap-1"]',
1041
+ 'div[class~="flex"][class~="items-center"][class~="gap-2.5"][class*="mt-3"] del[class~="flex"][class~="items-center"][class~="gap-1"]'
1042
+ ].join(', ');
1043
+
1044
+ document.querySelectorAll(priceSelectors).forEach(el => {
1045
+
1046
+ const walkTextNodes = (node) => {
1047
+ if (node.nodeType === Node.TEXT_NODE) {
1048
+ let text = node.textContent;
1049
+ const matches = text.match(/\d{4,}(\.\d+)?/g);
1050
+ if (matches) {
1051
+ let updated = false;
1052
+ matches.forEach(match => {
1053
+ const num = parseFloat(match);
1054
+ if (!isNaN(num)) {
1055
+ const formattedNum = num.toLocaleString('en-US');
1056
+ text = text.replace(match, formattedNum);
1057
+ updated = true;
1058
+ }
1059
+ });
1060
+ if (updated) node.textContent = text;
1061
+ }
1062
+ } else if (node.nodeType === Node.ELEMENT_NODE) {
1063
+ node.childNodes.forEach(walkTextNodes);
1064
+ }
1065
+ };
1066
+
1067
+ walkTextNodes(el);
1068
+ });
1069
+ };
1070
+
1071
+ formatPrices();
1072
+
1073
+ const observer = new MutationObserver((mutations) => {
1074
+ let shouldFormat = false;
1075
+ for (const m of mutations) {
1076
+ if (m.addedNodes.length > 0 || m.type === 'characterData') {
1077
+ shouldFormat = true;
1078
+ break;
1079
+ }
1080
+ }
1081
+ if (shouldFormat) formatPrices();
1082
+ });
1083
+
1084
+ observer.observe(document.body, {
1085
+ childList: true,
1086
+ subtree: true,
1087
+ characterData: true
1088
+ });
1089
+ };
1090
+
1091
+ if (document.readyState === 'loading') {
1092
+ document.addEventListener('DOMContentLoaded', initFormatPrices);
1093
+ } else {
1094
+ initFormatPrices();
1095
+ }