@teddy-dev/frontend 1.0.1

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 (112) hide show
  1. package/algolia/algolia-loader.js +56 -0
  2. package/algolia/algolia-search.js +222 -0
  3. package/auth/teddy-auth-login.js +29 -0
  4. package/auth/teddy-auth-profile.js +58 -0
  5. package/auth/teddy-auth-register.js +52 -0
  6. package/auth/teddy-auth-reset.js +39 -0
  7. package/auth/teddy-auth.js +92 -0
  8. package/bantoa/bantoa-product.js +64 -0
  9. package/bantoa/bantoa-search.js +46 -0
  10. package/bantoa/bantoa-stylemix.js +43 -0
  11. package/bantoa/bantoa.js +21 -0
  12. package/cart/teddy-cart-controller.js +163 -0
  13. package/cart/teddy-cart-customer.js +86 -0
  14. package/cart/teddy-cart-discounts.js +55 -0
  15. package/cart/teddy-cart-promo-apply.js +24 -0
  16. package/cart/teddy-cart-promo-error.js +38 -0
  17. package/cart/teddy-cart-promo-loading.js +20 -0
  18. package/cart/teddy-cart-promo.js +96 -0
  19. package/components/mc-btn.js +38 -0
  20. package/components/mc-card-render.js +33 -0
  21. package/components/mc-cart-counter.js +14 -0
  22. package/components/mc-cart-error.js +35 -0
  23. package/components/mc-cart-quantity.js +43 -0
  24. package/components/mc-cart-remove.js +32 -0
  25. package/components/mc-copy.js +33 -0
  26. package/components/mc-element.js +84 -0
  27. package/components/mc-form-errors.js +35 -0
  28. package/components/mc-form-success.js +31 -0
  29. package/components/mc-form.js +223 -0
  30. package/components/mc-input-area.js +13 -0
  31. package/components/mc-input-checkbox-group.js +52 -0
  32. package/components/mc-input-checkbox.js +12 -0
  33. package/components/mc-input-password.js +39 -0
  34. package/components/mc-input-places.js +43 -0
  35. package/components/mc-input-quantity.js +43 -0
  36. package/components/mc-input-select.js +14 -0
  37. package/components/mc-input-text.js +12 -0
  38. package/components/mc-input.js +137 -0
  39. package/components/mc-loader.js +21 -0
  40. package/components/mc-modal.js +69 -0
  41. package/components/mc-password-eye.js +24 -0
  42. package/components/mc-password-tips.js +60 -0
  43. package/components/mc-qrcode.js +41 -0
  44. package/components/mc-range.js +108 -0
  45. package/components/mc-read-more.js +56 -0
  46. package/components/mc-recommended.js +50 -0
  47. package/components/mc-referrer.js +20 -0
  48. package/components/mc-splash-controller.js +32 -0
  49. package/components/mc-splash-link.js +65 -0
  50. package/components/mc-stoq.js +30 -0
  51. package/components/mc-swiper.js +333 -0
  52. package/components/mc-video.js +61 -0
  53. package/css/bootstrap-lg.css +2762 -0
  54. package/css/bootstrap-lg.min.css +1 -0
  55. package/css/bootstrap-md.css +2762 -0
  56. package/css/bootstrap-md.min.css +1 -0
  57. package/css/bootstrap-sm.css +2762 -0
  58. package/css/bootstrap-sm.min.css +1 -0
  59. package/css/bootstrap-xl.css +2790 -0
  60. package/css/bootstrap-xl.min.css +1 -0
  61. package/css/bootstrap-xxl.css +2762 -0
  62. package/css/bootstrap-xxl.min.css +1 -0
  63. package/css/bootstrap.css +9824 -0
  64. package/css/bootstrap.min.css +5 -0
  65. package/css/mc-form-errors.css +3 -0
  66. package/css/mc-loader.css +6 -0
  67. package/css/mc-password-eye.css +6 -0
  68. package/css/mc-password-tips.css +6 -0
  69. package/css/mc-read-more.css +14 -0
  70. package/css/mc-video.css +4 -0
  71. package/css/mc-wishlist-hero-btn.css +7 -0
  72. package/loader.js +110 -0
  73. package/loyalty/teddy-loyalty-create.js +40 -0
  74. package/loyalty/teddy-loyalty-redeem.js +38 -0
  75. package/loyalty/teddy-loyalty.js +214 -0
  76. package/package.json +20 -0
  77. package/res/mc-events.js +43 -0
  78. package/res/mc-shopify.js +439 -0
  79. package/res/mc-utils.js +119 -0
  80. package/res/mc-vue.js +9350 -0
  81. package/returns/teddy-return-iban.js +115 -0
  82. package/returns/teddy-return-list.js +165 -0
  83. package/returns/teddy-return-request.js +353 -0
  84. package/scripts/publish-store.js +62 -0
  85. package/test/auth-login-error.json +4 -0
  86. package/test/auth-login-success.json +13 -0
  87. package/test/auth-password-change-error.json +4 -0
  88. package/test/auth-password-change-success.json +3 -0
  89. package/test/auth-register-error.json +4 -0
  90. package/test/auth-register-success.json +12 -0
  91. package/test/auth-reset-error.json +4 -0
  92. package/test/auth-reset-success.json +3 -0
  93. package/test/loyalty-error.json +4 -0
  94. package/test/loyalty-noinfo.json +18 -0
  95. package/test/loyalty-redeem-error.json +4 -0
  96. package/test/loyalty-redeem-success.json +11 -0
  97. package/test/loyalty-success.json +143 -0
  98. package/test/returns-create-success.json +1 -0
  99. package/test/returns-get-success.json +35 -0
  100. package/test/returns-get-tracking.json +30 -0
  101. package/test/returns-list-empty.json +4 -0
  102. package/test/returns-list-success.json +59 -0
  103. package/test/returns-search-manual.json +67 -0
  104. package/test/returns-search-success.json +76 -0
  105. package/test/wishlist-error.json +4 -0
  106. package/test/wishlist-success.json +3 -0
  107. package/wishlist/teddy-wishlist-btn.js +55 -0
  108. package/wishlist/teddy-wishlist-clear.js +18 -0
  109. package/wishlist/teddy-wishlist-counter.js +35 -0
  110. package/wishlist/teddy-wishlist-item.js +46 -0
  111. package/wishlist/teddy-wishlist-page.js +59 -0
  112. package/wishlist/teddy-wishlist.js +131 -0
@@ -0,0 +1,32 @@
1
+ await loadComponent('./components/mc-splash-link.js', false);
2
+ class McSplashController extends HTMLElement {
3
+
4
+ connectedCallback() {
5
+ if (!this.dataset.homeLink) {
6
+ console.warn("McSplashController: 'data-home-link' attribute is required.");
7
+ return;
8
+ }
9
+ this.checkHomeLinks();
10
+ this.checkLinks();
11
+ }
12
+
13
+ // controlla se siamo in una pagina impostata come home
14
+ checkHomeLinks = () => {
15
+ const links = JSON.parse(localStorage.getItem(McSplashLink.HOME_KEY)) || [];
16
+ if (links.find(link => link == location.pathname)) {
17
+ localStorage.setItem(McSplashLink.STORAGE_KEY, location.pathname);
18
+ }
19
+ }
20
+
21
+ // sostituisce tutti i link alla home con il link salvato
22
+ checkLinks = () => {
23
+ const savedLink = localStorage.getItem(McSplashLink.STORAGE_KEY);
24
+ if (!savedLink) return;
25
+ document.querySelectorAll(`a[href="${this.dataset.homeLink}"]`).forEach(link => {
26
+ link.href = savedLink || this.dataset.homeLink;
27
+ });
28
+ }
29
+ }
30
+
31
+ customElements.define("mc-splash-controller", McSplashController);
32
+ window.McSplashController = McSplashController;
@@ -0,0 +1,65 @@
1
+ await loadComponent('./components/mc-loader.js', false);
2
+ class McSplashLink extends HTMLElement {
3
+
4
+ static STORAGE_KEY = "splash-visited-link";
5
+ static HOME_KEY = "splash-home-link";
6
+
7
+ connectedCallback() {
8
+ if (!this.dataset.link) {
9
+ console.warn("McSplashLink: 'data-link' attribute is required.");
10
+ return;
11
+ }
12
+ this.setHomeLinks();
13
+ this.addEventListener("click", this.handleClick.bind(this));
14
+ this.checkAndRedirect();
15
+ }
16
+
17
+ setHomeLinks = () => {
18
+ const links = JSON.parse(localStorage.getItem(McSplashLink.HOME_KEY)) || [];
19
+ if (!links.find(link => link == this.dataset.link)) {
20
+ links.push(this.dataset.link);
21
+ localStorage.setItem(McSplashLink.HOME_KEY, JSON.stringify(links));
22
+ }
23
+ }
24
+
25
+ checkAndRedirect = () => {
26
+ const savedLink = localStorage.getItem(McSplashLink.STORAGE_KEY);
27
+ if (savedLink) {
28
+ window.location.href = savedLink;
29
+ } else {
30
+ this.callExternal(this.hideLoader);
31
+ }
32
+ }
33
+
34
+ hideLoader = () => {
35
+ const loader = document.querySelector(this.dataset.loader);
36
+ if (loader) {
37
+ loader.deactivate();
38
+ }
39
+ }
40
+
41
+ callExternal = (callback) => {
42
+ setTimeout(() => {
43
+ if(customElements.get('mc-loader')){
44
+ callback(); return;
45
+ }
46
+
47
+ customElements.whenDefined('mc-loader').then(() => {
48
+ callback();
49
+ });
50
+ });
51
+ }
52
+
53
+ handleClick = (event) => {
54
+ if (!this.dataset.link) {
55
+ console.warn("McSplashLink: 'data-link' attribute is required on column.");
56
+ return;
57
+ }
58
+ event.preventDefault();
59
+ localStorage.setItem(McSplashLink.STORAGE_KEY, this.dataset.link);
60
+ window.location.href = this.dataset.link;
61
+ }
62
+ }
63
+
64
+ customElements.define("mc-splash-link", McSplashLink);
65
+ window.McSplashLink = McSplashLink;
@@ -0,0 +1,30 @@
1
+ await loadComponent('./components/mc-element.js', false);
2
+
3
+ class McStoq extends McElement {
4
+
5
+ connectedCallback() {
6
+ this.addEventListener('click', this.showModal.bind(this));
7
+ }
8
+
9
+ showModal = () => {
10
+ if(!this.dataset.productId || !this.dataset.variant) {
11
+ console.error('McStoq: Product ID or Variant not set on mc-stoq');
12
+ return;
13
+ }
14
+ if(!window._RestockRocket) {
15
+ console.error('McStoq: RestockRocket is not loaded');
16
+ return;
17
+ }
18
+ const productData = {
19
+ id: this.dataset.productId,
20
+ variants: [{ id: this.dataset.variant, available: false }],
21
+ };
22
+ window._RestockRocket.openModal(productData, this.dataset.variant);
23
+ }
24
+
25
+ }
26
+ if(!customElements.get('mc-stoq')){
27
+ customElements.define('mc-stoq', McStoq);
28
+ }
29
+ window.McStoq = McStoq;
30
+ export default McStoq;
@@ -0,0 +1,333 @@
1
+ import Swiper from 'https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.mjs'
2
+ await loadComponent('./components/mc-element.js', false);
3
+
4
+ class McSwiper extends McElement {
5
+ options; swiper;
6
+ paginationSelector = '.swiper-pagination';
7
+ navigationPrev = '.swiper-button-prev';
8
+ navigationNext = '.swiper-button-next';
9
+ scrollbarSelector = '.swiper-scrollbar';
10
+
11
+ connectedCallback() {
12
+ if(this.find != undefined){
13
+ this.swiper.destroy();
14
+ }
15
+ const breakpoints = this.querySelectorAll('mc-swiper-breakpoint');
16
+ if(breakpoints.length <= 0){
17
+ if(this.dataset.noinit === undefined || this.dataset.noinit === 'false')
18
+ this.init();
19
+ }
20
+ }
21
+
22
+ init = () => {
23
+ this.options = { };
24
+ this.paginationSelector = this.dataset.paginationSelector || this.paginationSelector;
25
+ this.navigationPrev = this.dataset.navigationPrev || this.navigationPrev;
26
+ this.navigationNext = this.dataset.navigationNext || this.navigationNext;
27
+ this.scrollbarSelector = this.dataset.scrollbarSelector || this.scrollbarSelector;
28
+
29
+ this.setNavigation(this.dataset.navigation !== undefined && this.dataset.navigation !== 'false');
30
+ this.setPagination(this.dataset.pagination !== undefined && this.dataset.pagination !== 'false');
31
+ this.setDynamicBullets(this.dataset.dynamicBullets !== undefined && this.dataset.dynamicBullets !== 'false');
32
+ this.setPaginationType(this.dataset.paginationType);
33
+ this.setPaginationCustom(this.dataset.paginationCustom);
34
+ this.setScrollbar(this.dataset.scrollbar !== undefined && this.dataset.scrollbar !== 'false');
35
+ this.setMousewheel(this.dataset.mousewheel !== undefined && this.dataset.mousewheel !== 'false');
36
+ this.setScrollbarHide(this.dataset.scrollbarHide !== undefined && this.dataset.scrollbarHide !== 'false');
37
+ this.setDirection(this.dataset.direction);
38
+ this.setSpaceBetween(this.dataset.spaceBetween);
39
+ this.setSlides(this.dataset.slides);
40
+ this.setCentered(this.dataset.centered !== undefined && this.dataset.centered !== 'false');
41
+ this.setFree(this.dataset.free !== undefined && this.dataset.free !== 'false');
42
+ this.setLoop(this.dataset.loop !== undefined && this.dataset.loop !== 'false');
43
+ this.setAutoplay(this.dataset.autoplay);
44
+ this.setAutoplayDisableInteraction(this.dataset.autoplayDisableInteraction !== undefined && this.dataset.autoplayDisableInteraction !== 'false');
45
+ this.setWatchProgress(this.dataset.watchProgress !== undefined && this.dataset.watchProgress !== 'false');
46
+ this.setThumbs(this.dataset.thumbs);
47
+ this.setInitialSlide(this.dataset.initialSlide);
48
+ this.setSlideGroups(this.dataset.slideGroups);
49
+ this.setAutoplayProgress(this.dataset.autoplayProgress);
50
+ this.setLoopAddBlankSlides(this.dataset.loopAddBlankSlides !== undefined && this.dataset.loopAddBlankSlides !== 'false');
51
+ this.setCssMode(this.dataset.cssMode !== undefined && this.dataset.cssMode !== 'false');
52
+ this.setLoopAdditionalSlides(this.dataset.loopAdditionalSlides);
53
+ this.setSpeed(this.dataset.speed);
54
+ this.setAllowTouchMove(this.dataset.allowTouchMove);
55
+ this.setBreakpoints();
56
+ if(this.dataset.log)
57
+ console.log('McSwiper options:', this.options);
58
+ this.swiper = new Swiper(this, this.options);
59
+ }
60
+
61
+ setOptions = (options) => {
62
+ this.options = options;
63
+ this.swiper = new Swiper(this, this.options);
64
+ }
65
+
66
+ setInitialSlide = (initialSlide) => {
67
+ const s = parseInt(initialSlide);
68
+ if(!isNaN(s)){
69
+ this.options.initialSlide = s;
70
+ }
71
+ }
72
+
73
+ setAutoplayProgress = (autoplayProgress) => {
74
+ if(autoplayProgress) {
75
+ const progressCircle = document.querySelector(autoplayProgress);
76
+ if(progressCircle) {
77
+ this.options.on = {
78
+ autoplayTimeLeft(s, time, progress) {
79
+ progressCircle.style.setProperty("--progress", 1 - progress);
80
+ }
81
+ }
82
+ }
83
+ }
84
+ }
85
+
86
+ setSpeed = (speed) => {
87
+ const s = parseInt(speed);
88
+ if(!isNaN(s)){
89
+ this.options.speed = s;
90
+ }
91
+ }
92
+
93
+ setCssMode = (cssMode) => {
94
+ if(cssMode) {
95
+ this.options.cssMode = true;
96
+ }
97
+ }
98
+
99
+ setSlideGroups = (slideGroups) => {
100
+ const s = parseInt(slideGroups);
101
+ if(!isNaN(s)){
102
+ this.options.slidesPerGroup = s;
103
+ }
104
+ }
105
+
106
+ setNavigation = (navigation) => {
107
+ if(navigation) {
108
+ this.options.navigation = {
109
+ nextEl: this.navigationNext,
110
+ prevEl: this.navigationPrev
111
+ }
112
+ }
113
+ }
114
+
115
+ setPagination = (pagination) => {
116
+ if(pagination) {
117
+ this.options.pagination = {
118
+ el: this.paginationSelector,
119
+ clickable: true
120
+ }
121
+ }
122
+ }
123
+
124
+ setDynamicBullets = (dynamicBullets) => {
125
+ if(dynamicBullets) {
126
+ this.options.pagination = this.options.pagination || {};
127
+ this.options.pagination.dynamicBullets = true;
128
+ }
129
+ }
130
+
131
+ setPaginationType = (type) => {
132
+ if(type != undefined){
133
+ this.options.pagination = this.options.pagination || {};
134
+ this.options.pagination.type = type;
135
+ }
136
+ }
137
+
138
+ setPaginationCustom = (custom) => {
139
+ if(custom != undefined){
140
+ this.options.pagination = this.options.pagination || {};
141
+ const parts = custom.split(',');
142
+ this.options.pagination.renderBullet = (i, c) => {
143
+ return `<span class="${c}">${parts[i]}</span>`;
144
+ } ;
145
+ }
146
+ }
147
+
148
+ setScrollbar = (scrollbar) => {
149
+ if(scrollbar) {
150
+ this.options.scrollbar = {
151
+ el: this.scrollbarSelector,
152
+ draggable: true
153
+ }
154
+ }
155
+ }
156
+
157
+ setScrollbarHide = (hide) => {
158
+ if(hide) {
159
+ this.options.scrollbar = this.options.scrollbar || {};
160
+ this.options.scrollbar.hide = true;
161
+ }
162
+ }
163
+
164
+ setDirection = (direction) => {
165
+ if(direction != undefined){
166
+ this.options.direction = direction;
167
+ }
168
+ }
169
+
170
+ setSpaceBetween = (spaceBetween) => {
171
+ const s = parseInt(spaceBetween);
172
+ if(!isNaN(s)){
173
+ this.options.spaceBetween = s;
174
+ }
175
+ }
176
+
177
+ setSlides = (slides) => {
178
+ if(slides != undefined){
179
+ this.options.slidesPerView = slides;
180
+ }
181
+ }
182
+
183
+ setCentered = (centered) => {
184
+ if(centered) {
185
+ this.options.centeredSlides = true;
186
+ }
187
+ }
188
+
189
+ setMousewheel = (mousewheel) => {
190
+ if(mousewheel) {
191
+ this.options.mousewheel = true;
192
+ }
193
+ }
194
+
195
+ setFree = (free) => {
196
+ if(free) {
197
+ this.options.freeMode = true;
198
+ }
199
+ }
200
+
201
+ setLoop = (loop) => {
202
+ if(loop) {
203
+ this.options.loop = true;
204
+ }
205
+ }
206
+
207
+ setAutoplay = (autoplay) => {
208
+ const s = parseInt(autoplay);
209
+ if(!isNaN(s)){
210
+ this.options.autoplay = {
211
+ delay: s
212
+ };
213
+ }
214
+ }
215
+
216
+ setAutoplayDisableInteraction = (autoplayDisableInteraction) => {
217
+ if(autoplayDisableInteraction){
218
+ this.options.autoplay = this.options.autoplay || {};
219
+ this.options.autoplay.disableOnInteraction = autoplayDisableInteraction;
220
+ }
221
+ }
222
+
223
+ setLoopAddBlankSlides = (loopAddBlankSlides) => {
224
+ if(this.options.loop)
225
+ this.options.loopAddBlankSlides = loopAddBlankSlides;
226
+ }
227
+
228
+ setAllowTouchMove = (allowTouchMove) => {
229
+ if(allowTouchMove == 'false')
230
+ this.options.allowTouchMove = false;
231
+ }
232
+
233
+ setWatchProgress = (watchProgress) => {
234
+ if(watchProgress) {
235
+ this.options.watchSlidesProgress = true;
236
+ }
237
+ }
238
+
239
+ setLoopAdditionalSlides = (loopAdditionalSlides) => {
240
+ const s = parseInt(loopAdditionalSlides);
241
+ if(!isNaN(s)){
242
+ this.options.loopAdditionalSlides = s;
243
+ }
244
+ }
245
+
246
+ setThumbs = (selector) => {
247
+ const thumbs = document.querySelector(selector);
248
+ if(thumbs != undefined && thumbs != null){
249
+ this.options.thumbs = {
250
+ swiper: thumbs
251
+ };
252
+ }
253
+ }
254
+
255
+ setBreakpoints = () => {
256
+ const breakpoints = this.querySelectorAll('mc-swiper-breakpoint');
257
+ if(breakpoints.length > 0){
258
+ let notFound = false;
259
+ this.options.breakpoints = {};
260
+ breakpoints.forEach(breakpoint => {
261
+ if (typeof breakpoint.getPointOptions === 'function') {
262
+ this.options.breakpoints[breakpoint.width] = breakpoint.getPointOptions();
263
+ } else {
264
+ notFound = true;
265
+ }
266
+ });
267
+ }
268
+ }
269
+
270
+ slideTo = (index, speed) => {
271
+ const s = this.swiper.slideTo(index, speed);
272
+ }
273
+
274
+ }
275
+ window.McSwiper = McSwiper;
276
+ export default McSwiper;
277
+
278
+ class McSwiperBreakpoint extends McElement {
279
+ options = {}; width; swiper; isConnected = false;
280
+
281
+ init = () => {
282
+ this.options = {};
283
+ this.width = parseInt(this.dataset.breakpoint);
284
+ this.setSlides(this.dataset.slides);
285
+ this.setSpaceBetween(this.dataset.spaceBetween);
286
+ this.setSlideGroups(this.dataset.slideGroups);
287
+ this.swiper = this.closest('mc-swiper');
288
+
289
+ const breakpoints = Array.from(this.swiper.querySelectorAll('mc-swiper-breakpoint'));
290
+ const allConnected = breakpoints.every(breakpoint => breakpoint.isConnected);
291
+
292
+ if (allConnected) {
293
+ this.swiper.init();
294
+ }
295
+ }
296
+
297
+ connectedCallback() {
298
+ this.isConnected = true;
299
+ this.init();
300
+ }
301
+
302
+ getPointOptions = () => {
303
+ return this.options;
304
+ }
305
+
306
+ setSpaceBetween = (spaceBetween) => {
307
+ const s = parseInt(spaceBetween);
308
+ if(!isNaN(s)){
309
+ this.options.spaceBetween = s;
310
+ }
311
+ }
312
+
313
+ setSlideGroups = (slideGroups) => {
314
+ const s = parseInt(slideGroups);
315
+ if(!isNaN(s)){
316
+ this.options.slidesPerGroup = s;
317
+ }
318
+ }
319
+
320
+ setSlides = (slides) => {
321
+ if(slides != undefined){
322
+ this.options.slidesPerView = slides;
323
+ }
324
+ }
325
+ }
326
+ window.McSwiperBreakpoint = McSwiperBreakpoint;
327
+ if (!window.customElements.get("mc-swiper")) {
328
+ window.customElements.define("mc-swiper", McSwiper);
329
+ McUtils.addCss('https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css');
330
+ }
331
+ if (!window.customElements.get("mc-swiper-breakpoint")) {
332
+ window.customElements.define("mc-swiper-breakpoint", McSwiperBreakpoint);
333
+ }
@@ -0,0 +1,61 @@
1
+ await loadComponent('./components/mc-element.js', false);
2
+
3
+ class McVideo extends McElement {
4
+ video; icon; image;
5
+
6
+ connectedCallback() {
7
+ setTimeout(() => {
8
+
9
+ this.video = this.querySelector('video');
10
+ if(!this.video) return;
11
+
12
+ // iOS: lascia passare i tap all’overlay
13
+ this.video.style.pointerEvents = 'none';
14
+
15
+ this.icon = this.querySelector('[data-icon]');
16
+ this.image = this.querySelector('[data-image]');
17
+
18
+ // usa anche touch/pointer, non solo click
19
+ const bind = (el) => {
20
+ if(!el) return;
21
+ el.addEventListener('pointerup', this.play, { passive: true });
22
+ el.addEventListener('touchend', this.play, { passive: true });
23
+ el.addEventListener('click', this.play);
24
+ };
25
+ bind(this.image);
26
+ bind(this.icon);
27
+
28
+ this.video.addEventListener('playing', () => {
29
+ // ora il video può ricevere interazioni
30
+ this.video.style.pointerEvents = 'auto';
31
+ this.activate(); // eredita: aggiunge la classe che nasconde l'immagine
32
+ });
33
+
34
+ this.video.addEventListener('pause', () => {
35
+ // se vuoi che torni cliccabile l’overlay quando metti in pausa:
36
+ this.video.style.pointerEvents = 'none';
37
+ this.deactivate();
38
+ });
39
+
40
+ // opzionale: rimuovi i controls finché non parte (intercettano tap)
41
+ this.video.removeAttribute('controls');
42
+ });
43
+ }
44
+
45
+ _onFirstVisual = () => {
46
+ this.activate();
47
+ // non serve più ascoltare
48
+ this.video.removeEventListener('playing', this._onFirstVisual);
49
+ this.video.removeEventListener('loadeddata', this._onFirstVisual);
50
+ }
51
+
52
+ play = () => this.video.play();
53
+ pause = () => this.video.pause();
54
+ }
55
+
56
+ if (!window.customElements.get("mc-video")) {
57
+ window.customElements.define("mc-video", McVideo);
58
+ McUtils.addCss(`https://cdn.jsdelivr.net/npm/teddy-frontend@${theme.version}/css/mc-video.css`);
59
+ }
60
+ window.McVideo = McVideo;
61
+ export default McVideo;