@gem-sdk/components 2.0.0-dev.346 → 2.0.0-dev.348

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 (60) hide show
  1. package/dist/cjs/carousel/components/plugins/AutoPlayPlugin.js +58 -17
  2. package/dist/cjs/countdown-timer/components/Countdown.js +103 -307
  3. package/dist/cjs/countdown-timer/components/Countdown.liquid.js +92 -56
  4. package/dist/cjs/countdown-timer/components/common/getAttr.js +15 -0
  5. package/dist/cjs/countdown-timer/components/common/getClasses.js +69 -0
  6. package/dist/cjs/countdown-timer/components/common/getStyle.js +66 -0
  7. package/dist/cjs/countdown-timer/components/hooks/useCountDownTimer.js +67 -0
  8. package/dist/cjs/countdown-timer/{hooks → components/hooks}/useTimeLeft.js +1 -1
  9. package/dist/cjs/countdown-timer/index.js +1 -1
  10. package/dist/cjs/countdown-timer/setting/Countdown.js +1 -1
  11. package/dist/cjs/countdown-timer/setting/configs/settings.js +1 -1
  12. package/dist/cjs/product/components/ProductProperties/ProductPropertyInput/ProductPropertyInput.liquid.js +1 -1
  13. package/dist/cjs/product/setting/product-properties/configs/settingsV2.js +43 -14
  14. package/dist/cjs/product/setting/product-properties/configs/uiV2.js +5 -2
  15. package/dist/cjs/third-party/components/AliReviews.liquid.js +1 -1
  16. package/dist/cjs/third-party/components/FeraReviews/FeraReviewsSampleContent.js +3 -3
  17. package/dist/cjs/third-party/components/FeraReviews/LiquidTemplateByWidget.js +2 -2
  18. package/dist/cjs/third-party/components/FeraReviews.js +0 -5
  19. package/dist/cjs/third-party/components/GoogleReviewsByReputon.liquid.js +2 -2
  20. package/dist/cjs/third-party/components/JudgemeReviews.liquid.js +5 -5
  21. package/dist/cjs/third-party/components/KachingBundles.liquid.js +1 -1
  22. package/dist/cjs/third-party/components/KingProductOptions.liquid.js +1 -1
  23. package/dist/cjs/third-party/components/LaiProductReviews/LiquidTemplateByWiget.js +3 -3
  24. package/dist/cjs/third-party/components/LooxReviews.liquid.js +1 -1
  25. package/dist/cjs/third-party/components/Ryviu.liquid.js +1 -1
  26. package/dist/cjs/third-party/components/Vitals.liquid.js +2 -2
  27. package/dist/cjs/third-party/setting/TrustshopProductReviews.js +3 -3
  28. package/dist/cjs/third-party/setting/WhatmoreShoppableVideosreel.js +36 -36
  29. package/dist/cjs/third-party/types/index.js +5 -0
  30. package/dist/esm/carousel/components/plugins/AutoPlayPlugin.js +58 -17
  31. package/dist/esm/countdown-timer/components/Countdown.js +104 -308
  32. package/dist/esm/countdown-timer/components/Countdown.liquid.js +93 -57
  33. package/dist/esm/countdown-timer/components/common/getAttr.js +12 -0
  34. package/dist/esm/countdown-timer/components/common/getClasses.js +61 -0
  35. package/dist/esm/countdown-timer/components/common/getStyle.js +60 -0
  36. package/dist/esm/countdown-timer/components/hooks/useCountDownTimer.js +63 -0
  37. package/dist/esm/countdown-timer/{hooks → components/hooks}/useTimeLeft.js +1 -1
  38. package/dist/esm/countdown-timer/index.js +1 -1
  39. package/dist/esm/countdown-timer/setting/Countdown.js +1 -1
  40. package/dist/esm/countdown-timer/setting/configs/settings.js +1 -1
  41. package/dist/esm/product/components/ProductProperties/ProductPropertyInput/ProductPropertyInput.liquid.js +1 -1
  42. package/dist/esm/product/setting/product-properties/configs/settingsV2.js +43 -14
  43. package/dist/esm/product/setting/product-properties/configs/uiV2.js +5 -2
  44. package/dist/esm/third-party/components/AliReviews.liquid.js +1 -1
  45. package/dist/esm/third-party/components/FeraReviews/FeraReviewsSampleContent.js +1 -1
  46. package/dist/esm/third-party/components/FeraReviews/LiquidTemplateByWidget.js +1 -1
  47. package/dist/esm/third-party/components/FeraReviews.js +1 -5
  48. package/dist/esm/third-party/components/GoogleReviewsByReputon.liquid.js +2 -2
  49. package/dist/esm/third-party/components/JudgemeReviews.liquid.js +5 -5
  50. package/dist/esm/third-party/components/KachingBundles.liquid.js +1 -1
  51. package/dist/esm/third-party/components/KingProductOptions.liquid.js +1 -1
  52. package/dist/esm/third-party/components/LaiProductReviews/LiquidTemplateByWiget.js +3 -3
  53. package/dist/esm/third-party/components/LooxReviews.liquid.js +1 -1
  54. package/dist/esm/third-party/components/Ryviu.liquid.js +1 -1
  55. package/dist/esm/third-party/components/Vitals.liquid.js +2 -2
  56. package/dist/esm/third-party/setting/TrustshopProductReviews.js +3 -3
  57. package/dist/esm/third-party/setting/WhatmoreShoppableVideosreel.js +36 -36
  58. package/dist/esm/third-party/types/index.js +5 -1
  59. package/dist/types/index.d.ts +1541 -1531
  60. package/package.json +1 -1
@@ -18,7 +18,7 @@ const AliReviews = ({ setting, advanced })=>{
18
18
  {% when 'starRating' %}
19
19
  <div class='alireviews-review-star-rating' product-handle='{{product.handle}}' product-id='{{product.id}}'> </div >
20
20
  {% when 'reviewBox' %}
21
- <div class="alireviews-review-box"> </div
21
+ <div class="alireviews-review-box"> </div
22
22
  {% endcase %}
23
23
  </div>
24
24
  `;
@@ -4,10 +4,10 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
- var FeraReviews$1 = require('../FeraReviews.js');
8
7
  var ThirdPartyPreview = require('../ThirdPartyPreview.js');
9
8
  var FeraReviews = require('../../configs/FeraReviews.js');
10
9
  var React = require('react');
10
+ var index = require('../../types/index.js');
11
11
 
12
12
  const mapWidgetLabelV2 = {
13
13
  productReviews: 'Product Reviews',
@@ -28,8 +28,8 @@ const mapWidgetLabelV3 = {
28
28
  otherWidget: 'Other'
29
29
  };
30
30
  const FeraReviewsSampleContent = ({ setting })=>{
31
- const feraVersion = setting?.feraVersion || FeraReviews$1.FERA_VERSION.V2;
32
- const widgetLabel = feraVersion === FeraReviews$1.FERA_VERSION.V3 ? mapWidgetLabelV3[setting?.widgetTypeV3 || 'allReviews'] : mapWidgetLabelV2[setting?.widgetType || 'allReviews'];
31
+ const feraVersion = setting?.feraVersion || index.FERA_VERSION.V2;
32
+ const widgetLabel = feraVersion === index.FERA_VERSION.V3 ? mapWidgetLabelV3[setting?.widgetTypeV3 || 'allReviews'] : mapWidgetLabelV2[setting?.widgetType || 'allReviews'];
33
33
  const label = React.useMemo(()=>{
34
34
  return widgetLabel ? `${FeraReviews.default.label} - ${feraVersion} - ${widgetLabel}` : FeraReviews.default.label;
35
35
  }, [
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var FeraReviews = require('../FeraReviews.js');
4
3
  var core = require('@gem-sdk/core');
4
+ var index = require('../../types/index.js');
5
5
 
6
6
  const getTemplateByWidget = (setting)=>{
7
7
  switch(setting?.feraVersion){
8
- case FeraReviews.FERA_VERSION['V3']:
8
+ case index.FERA_VERSION['V3']:
9
9
  return liquidTemplateFeraV3(setting);
10
10
  default:
11
11
  return liquidTemplateFeraV2(setting);
@@ -8,10 +8,6 @@ var core = require('@gem-sdk/core');
8
8
  var dynamic = require('next/dynamic');
9
9
 
10
10
  const FeraReviewsSampleContent = dynamic(()=>Promise.resolve().then(function () { return require('./FeraReviews/FeraReviewsSampleContent.js'); }));
11
- const FERA_VERSION = {
12
- V2: 'V2',
13
- V3: 'V3'
14
- };
15
11
  const FeraReviews = ({ setting })=>{
16
12
  const mode = core.useEditorMode();
17
13
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
@@ -24,5 +20,4 @@ const FeraReviews = ({ setting })=>{
24
20
  });
25
21
  };
26
22
 
27
- exports.FERA_VERSION = FERA_VERSION;
28
23
  exports.default = FeraReviews;
@@ -80,8 +80,8 @@ const GoogleReviewsByReputon = ({ setting, advanced })=>{
80
80
  data-type="basic_slide"
81
81
  data-sticky="true"
82
82
  {% endcase %}
83
- <script
84
- type="text/javascript"
83
+ <script
84
+ type="text/javascript"
85
85
  src="https://cdn.grw.reputon.com/assets/widget.js?shop={{shop.domain}}" defer></script>
86
86
  </div>
87
87
  `;
@@ -19,7 +19,7 @@ const JudgemeReviews = ({ setting, advanced })=>{
19
19
  {% when "single_product_preview_badge" %}
20
20
  <div style='{{ jm_style }}' class='jdgm-widget jdgm-preview-badge' data-id='{{ product.id }}'>
21
21
  {{ product.metafields.judgeme.badge }}
22
- </div>
22
+ </div>
23
23
  {% when "review_widget" %}
24
24
  <div style='clear:both'></div>
25
25
  <div id='judgeme_product_reviews' class='jdgm-widget jdgm-review-widget' data-id='{{ product.id }}'>
@@ -27,7 +27,7 @@ const JudgemeReviews = ({ setting, advanced })=>{
27
27
  </div>
28
28
  {% when "reviews_carousel" %}
29
29
  <div class='jdgm-carousel-wrapper'>
30
- {% assign jm_metafields = shop.metafields.judgeme %}
30
+ {% assign jm_metafields = shop.metafields.judgeme %}
31
31
  <div class='jdgm-carousel-title-and-link'>
32
32
  <h2 class='jdgm-carousel-title'>Let customers speak for us</h2>
33
33
  <span class='jdgm-all-reviews-rating-wrapper' href='javascript:void(0)'>
@@ -35,7 +35,7 @@ const JudgemeReviews = ({ setting, advanced })=>{
35
35
  <span style='display: block' class='jdgm-carousel-number-of-reviews' data-number-of-reviews='{{ jm_metafields.all_reviews_count }}'>
36
36
  from {{ shop.metafields.judgeme.all_reviews_count }} reviews
37
37
  </span>
38
- </span>
38
+ </span>
39
39
  </div>
40
40
  {{ jm_metafields.featured_carousel }}
41
41
  </div>
@@ -48,14 +48,14 @@ const JudgemeReviews = ({ setting, advanced })=>{
48
48
  Customers rate us {{ shop.metafields.judgeme.all_reviews_rating | round: 1 }}/5 based on {{ shop.metafields.judgeme.all_reviews_count }} reviews.
49
49
  </span>
50
50
  </a>
51
- </div>
51
+ </div>
52
52
  </div>
53
53
  {% when "section_for_medals" %}
54
54
  {{ shop.metafields.judgeme.medals }}
55
55
  {% when "ugc_media_grid" %}
56
56
  <div class='jdgm-widget jdgm-ugc-media-wrapper'>
57
57
  {{ shop.metafields.judgeme.ugc_media_grid }}
58
- </div>
58
+ </div>
59
59
  {% when "verified_reviews_count_badge" %}
60
60
  <div style='clear:both'></div>
61
61
  <div style='text-align: center'>
@@ -14,7 +14,7 @@ const KachingBundles = ({ setting, advanced })=>{
14
14
  ...core.makeStyleResponsive('ta', align)
15
15
  }}"
16
16
  >
17
- <kaching-bundle product-id="{{ product.id }}"></kaching-bundle>
17
+ <kaching-bundle product-id="{{ product.id }}"></kaching-bundle>
18
18
  </div>
19
19
  <script>
20
20
  window.kachingBundlesDisableAddToCartHandling = true;
@@ -13,7 +13,7 @@ const KingProductOptions = ({ setting, advanced })=>{
13
13
  ...core.makeStyleResponsive('ta', align)
14
14
  }}"
15
15
  >
16
- <variant-selects
16
+ <variant-selects
17
17
  id="variant-selects-{{ section.id }}"
18
18
  data-section="{{ section.id }}"
19
19
  data-url="{{ product.url }}"
@@ -47,7 +47,7 @@ const productReviewWidget = `
47
47
  </div>
48
48
  `;
49
49
  const starRatings = `
50
- <div class="scm-reviews-rate" data-rate-version2="{{ product.metafields.scm_review_importer.reviewsData.reviewCountInfo | json | escape}}" data-product-id="{{ product.id }}"></div>
50
+ <div class="scm-reviews-rate" data-rate-version2="{{ product.metafields.scm_review_importer.reviewsData.reviewCountInfo | json | escape}}" data-product-id="{{ product.id }}"></div>
51
51
  `;
52
52
  // Advanced
53
53
  const cardCarousel = `
@@ -80,8 +80,8 @@ const happyCustomerReviews = `
80
80
  {% endunless %}
81
81
  `;
82
82
  const starRatingsInList = `
83
- <div class="scm-reviews-rate"
84
- data-rate-version2="{{ product.metafields.scm_review_importer.reviewsData.reviewCountInfo | json | escape }}"
83
+ <div class="scm-reviews-rate"
84
+ data-rate-version2="{{ product.metafields.scm_review_importer.reviewsData.reviewCountInfo | json | escape }}"
85
85
  data-product-id="{{ product.id }}"></div>
86
86
  `;
87
87
 
@@ -43,7 +43,7 @@ const LooxReviews = ({ setting, advanced })=>{
43
43
  {% if '${widgetType}' == "rating_widget" %}
44
44
  {% if '${showRatingWidgetAllReviews}' == 'true' %}
45
45
  {% if shop.metafields.loox["global_stats"] %}
46
- {% assign looxstats = shop.metafields.loox["global_stats"] | split: ',' %}
46
+ {% assign looxstats = shop.metafields.loox["global_stats"] | split: ',' %}
47
47
  <a href="#looxReviews">
48
48
  <div class="loox-rating" data-rating="{{ looxstats[0] }}" data-raters="{{ looxstats[1] }}"></div>
49
49
  </a>
@@ -16,7 +16,7 @@ const Ryviu = ({ setting, advanced })=>{
16
16
  {% assign widget = '${widgetType}' %}
17
17
  {% case widget %}
18
18
  {% when "reviews" %}
19
- <div class="lt-block-reviews">
19
+ <div class="lt-block-reviews">
20
20
  <ryviu-widget handle="{{product.handle}}" product_id="{{product.id}}" title_product="{{product.title}}" total_meta="{{ product.metafields.ryviu.r_count }}" image_product="{{ product.featured_image.src | img_url: '100x' }}"></ryviu-widget>
21
21
  </div>
22
22
  {% when "badge" %}
@@ -36,9 +36,9 @@ const Vitals = ({ setting, advanced })=>{
36
36
  {% when "stockScarcity" %}
37
37
  <div id="vitals-stock-urgency"></div>
38
38
  {% when "sizeChart" %}
39
- <div id="vitals-size_chart"></div>
39
+ <div id="vitals-size_chart"></div>
40
40
  {% when "upsellBuilderBogo" %}
41
- <div id="vitals-upsell-builder-bogo"></div>
41
+ <div id="vitals-upsell-builder-bogo"></div>
42
42
  {% when "bundleCountdownBox" %}
43
43
  <div id="bundle-countdown_box"></div>
44
44
  {% when "reviewsUnderTitle" %}
@@ -130,12 +130,12 @@ const config = {
130
130
  }
131
131
  },
132
132
  {
133
- type: "control",
133
+ type: 'control',
134
134
  label: {
135
- en: "Choose widget"
135
+ en: 'Choose widget'
136
136
  },
137
137
  setting: {
138
- id: "widgetType"
138
+ id: 'widgetType'
139
139
  }
140
140
  },
141
141
  {
@@ -67,65 +67,65 @@ const config = {
67
67
  default: 'app-block'
68
68
  },
69
69
  {
70
- id: "whatMoreSettings",
71
- type: "group",
70
+ id: 'whatMoreSettings',
71
+ type: 'group',
72
72
  controls: [
73
73
  {
74
- id: "heading",
75
- type: "input",
76
- default: "Watch and Buy"
74
+ id: 'heading',
75
+ type: 'input',
76
+ default: 'Watch and Buy'
77
77
  },
78
78
  {
79
- id: "templateType",
79
+ id: 'templateType',
80
80
  label: 'Choose widget',
81
81
  type: 'select',
82
82
  options: [
83
83
  {
84
- label: "Video-Card",
85
- value: "template-a"
84
+ label: 'Video-Card',
85
+ value: 'template-a'
86
86
  },
87
87
  {
88
- label: "Video-Card feed",
89
- value: "template-feed-a"
88
+ label: 'Video-Card feed',
89
+ value: 'template-feed-a'
90
90
  },
91
91
  {
92
- label: "Video-Card with see-more option.",
93
- value: "template-a-1"
92
+ label: 'Video-Card with see-more option.',
93
+ value: 'template-a-1'
94
94
  },
95
95
  {
96
- label: "Product-Video-Card",
97
- value: "template-b"
96
+ label: 'Product-Video-Card',
97
+ value: 'template-b'
98
98
  },
99
99
  {
100
- label: "Grid Style - Theme Border",
101
- value: "template-c"
100
+ label: 'Grid Style - Theme Border',
101
+ value: 'template-c'
102
102
  },
103
103
  {
104
- label: "Grid Style - No Border",
105
- value: "template-d"
104
+ label: 'Grid Style - No Border',
105
+ value: 'template-d'
106
106
  },
107
107
  {
108
- label: "Single Tile",
109
- value: "template-e"
108
+ label: 'Single Tile',
109
+ value: 'template-e'
110
110
  },
111
111
  {
112
- label: "Video-card with product-info",
113
- value: "template-f"
112
+ label: 'Video-card with product-info',
113
+ value: 'template-f'
114
114
  },
115
115
  {
116
- label: "Video-card with text-overlay",
117
- value: "template-g"
116
+ label: 'Video-card with text-overlay',
117
+ value: 'template-g'
118
118
  },
119
119
  {
120
- label: "Focussed-video-card with product-info",
121
- value: "template-h"
120
+ label: 'Focussed-video-card with product-info',
121
+ value: 'template-h'
122
122
  },
123
123
  {
124
- label: "Video-stories",
125
- value: "template-stories"
124
+ label: 'Video-stories',
125
+ value: 'template-stories'
126
126
  }
127
127
  ],
128
- default: "template-f"
128
+ default: 'template-f'
129
129
  },
130
130
  {
131
131
  id: 'showViews',
@@ -248,24 +248,24 @@ const config = {
248
248
  }
249
249
  },
250
250
  {
251
- type: "group",
251
+ type: 'group',
252
252
  controls: [
253
253
  {
254
- type: "control",
254
+ type: 'control',
255
255
  label: {
256
- en: "Heading"
256
+ en: 'Heading'
257
257
  },
258
258
  setting: {
259
- id: "heading"
259
+ id: 'heading'
260
260
  }
261
261
  },
262
262
  {
263
- type: "control",
263
+ type: 'control',
264
264
  label: {
265
- en: "Tile Type"
265
+ en: 'Tile Type'
266
266
  },
267
267
  setting: {
268
- id: "templateType"
268
+ id: 'templateType'
269
269
  }
270
270
  },
271
271
  {
@@ -4,5 +4,10 @@ const WISER_VERSION = {
4
4
  V1: 'V1',
5
5
  V2: 'V2'
6
6
  };
7
+ const FERA_VERSION = {
8
+ V2: 'V2',
9
+ V3: 'V3'
10
+ };
7
11
 
12
+ exports.FERA_VERSION = FERA_VERSION;
8
13
  exports.WISER_VERSION = WISER_VERSION;
@@ -2,15 +2,41 @@ const AutoPlayPlugin = (slider)=>{
2
2
  let autoplay = slider.options.autoplay ?? {};
3
3
  let timeout;
4
4
  let mouseOver = false;
5
+ let inViewport = false;
6
+ let observer = null;
7
+ // Thêm sự kiện cho dot nếu có
8
+ const $dots = slider?.container?.closest('[data-component-type="component"]')?.querySelector('.carousel-dots');
9
+ // Callback của IntersectionObserver
10
+ function handleIntersection(entries) {
11
+ entries.forEach((entry)=>{
12
+ // Với threshold 0, chỉ cần một phần bất kỳ hiển thị sẽ đánh dấu isIntersecting
13
+ inViewport = entry.isIntersecting;
14
+ if (inViewport) {
15
+ nextTimeout();
16
+ } else {
17
+ clearNextTimeout();
18
+ }
19
+ });
20
+ }
21
+ function initIntersectionObserver() {
22
+ // Nếu đã có observer hoặc không có container thì không khởi tạo lại
23
+ if (observer || !slider.container) return;
24
+ observer = new IntersectionObserver(handleIntersection, {
25
+ root: null,
26
+ threshold: 0
27
+ });
28
+ observer.observe(slider.container);
29
+ }
5
30
  function clearNextTimeout() {
6
31
  clearTimeout(timeout);
7
32
  }
8
33
  function nextTimeout() {
9
- clearTimeout(timeout);
34
+ clearNextTimeout();
10
35
  timeout = setTimeout(()=>{
11
- if (mouseOver || !autoplay.enable) return;
36
+ // Nếu đang hover, autoplay bị tắt hoặc slider không trong viewport thì không chuyển slide
37
+ if (mouseOver || !autoplay.enable || !inViewport) return;
12
38
  slider.next();
13
- }, autoplay?.delay ?? 2000);
39
+ }, autoplay.delay ?? 2000);
14
40
  }
15
41
  function onMouseOver() {
16
42
  mouseOver = true;
@@ -21,11 +47,15 @@ const AutoPlayPlugin = (slider)=>{
21
47
  nextTimeout();
22
48
  }
23
49
  slider.on('created', ()=>{
24
- if (autoplay.pauseOnHover) {
50
+ $dots?.addEventListener('mouseover', onMouseOver);
51
+ $dots?.addEventListener('mouseout', onMouseOut);
52
+ // Nếu tùy chọn pauseOnHover bật thì thêm sự kiện hover cho container slider
53
+ if (autoplay.pauseOnHover && slider.container) {
25
54
  slider.container.addEventListener('mouseover', onMouseOver);
26
55
  slider.container.addEventListener('mouseout', onMouseOut);
27
56
  }
28
- if (slider.options.autoplay?.enable) {
57
+ if (autoplay.enable) {
58
+ initIntersectionObserver();
29
59
  nextTimeout();
30
60
  }
31
61
  });
@@ -33,29 +63,40 @@ const AutoPlayPlugin = (slider)=>{
33
63
  slider.on('animationEnded', nextTimeout);
34
64
  slider.on('updated', (newOptions)=>{
35
65
  autoplay = newOptions.options?.autoplay ?? {};
36
- nextTimeout();
37
- });
38
- slider.on('destroyed', ()=>{
39
- slider.container.removeEventListener('mouseover', onMouseOver);
40
- slider.container.removeEventListener('mouseout', onMouseOut);
66
+ if (autoplay.enable) {
67
+ initIntersectionObserver();
68
+ nextTimeout();
69
+ }
41
70
  });
42
71
  slider.on('optionsChanged', (newOptions)=>{
43
- const $dots = slider?.container?.closest('[data-component-type="component"]')?.querySelector('.carousel-dots');
44
- $dots?.addEventListener('mouseover', onMouseOver);
45
- $dots?.addEventListener('mouseout', onMouseOut);
46
- if (newOptions.options.autoplay?.pauseOnHover !== autoplay.pauseOnHover) {
72
+ if (newOptions.options.autoplay?.pauseOnHover !== autoplay.pauseOnHover && slider.container) {
47
73
  if (newOptions.options.autoplay?.pauseOnHover) {
48
74
  slider.container.addEventListener('mouseover', onMouseOver);
49
75
  slider.container.addEventListener('mouseout', onMouseOut);
50
- }
51
- if (!newOptions.options.autoplay?.pauseOnHover) {
76
+ } else {
52
77
  slider.container.removeEventListener('mouseover', onMouseOver);
53
78
  slider.container.removeEventListener('mouseout', onMouseOut);
54
79
  mouseOver = false;
55
80
  }
56
81
  }
57
- nextTimeout();
58
82
  autoplay = newOptions.options.autoplay ?? {};
83
+ if (autoplay.enable) {
84
+ initIntersectionObserver();
85
+ nextTimeout();
86
+ }
87
+ });
88
+ slider.on('destroyed', ()=>{
89
+ if (slider.container) {
90
+ slider.container.removeEventListener('mouseover', onMouseOver);
91
+ slider.container.removeEventListener('mouseout', onMouseOut);
92
+ }
93
+ $dots?.removeEventListener('mouseover', onMouseOver);
94
+ $dots?.removeEventListener('mouseout', onMouseOut);
95
+ clearNextTimeout();
96
+ if (observer) {
97
+ observer.disconnect();
98
+ observer = null;
99
+ }
59
100
  });
60
101
  };
61
102