@everymatrix/general-slider-navigation 1.55.0 → 1.56.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.
Files changed (27) hide show
  1. package/dist/cjs/carousel-component_2.cjs.entry.js +138 -20
  2. package/dist/cjs/general-slider-navigation.cjs.js +3 -3
  3. package/dist/cjs/{index-b79a855b.js → index-75dd98ba.js} +175 -72
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/collection/collection-manifest.json +1 -1
  6. package/dist/collection/components/carousel-component/carousel-component.js +38 -17
  7. package/dist/collection/components/general-slider-navigation/general-slider-navigation.js +103 -3
  8. package/dist/esm/carousel-component_2.entry.js +138 -20
  9. package/dist/esm/general-slider-navigation.js +4 -4
  10. package/dist/esm/{index-e155c85c.js → index-172d2d6e.js} +175 -72
  11. package/dist/esm/loader.js +3 -3
  12. package/dist/general-slider-navigation/general-slider-navigation.esm.js +1 -1
  13. package/dist/general-slider-navigation/p-5090827e.js +2 -0
  14. package/dist/general-slider-navigation/p-cbf1d138.entry.js +1 -0
  15. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/general-slider-navigation/.stencil/packages/stencil/general-slider-navigation/stencil.config.d.ts +2 -0
  16. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/general-slider-navigation/.stencil/packages/stencil/general-slider-navigation/stencil.config.dev.d.ts +2 -0
  17. package/dist/types/components/general-slider-navigation/general-slider-navigation.d.ts +10 -1
  18. package/dist/types/components.d.ts +8 -0
  19. package/package.json +1 -1
  20. package/dist/general-slider-navigation/p-0c4f790f.entry.js +0 -1
  21. package/dist/general-slider-navigation/p-65c898e4.js +0 -2
  22. package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/general-slider-navigation/.stencil/packages/stencil/general-slider-navigation/stencil.config.d.ts +0 -2
  23. package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/general-slider-navigation/.stencil/packages/stencil/general-slider-navigation/stencil.config.dev.d.ts +0 -2
  24. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/general-slider-navigation/.stencil/tools/plugins/index.d.ts +0 -0
  25. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/general-slider-navigation/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +0 -0
  26. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/general-slider-navigation/.stencil/tools/plugins/vite-chunk-plugin.d.ts +0 -0
  27. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/general-slider-navigation/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +0 -0
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-b79a855b.js');
5
+ const index = require('./index-75dd98ba.js');
6
6
 
7
7
  /**
8
8
  * @name isMobile
@@ -132,6 +132,29 @@ const CarouselComponentStyle0 = carouselComponentCss;
132
132
  const CarouselComponent = class {
133
133
  constructor(hostRef) {
134
134
  index.registerInstance(this, hostRef);
135
+ /**
136
+ * Client custom styling via inline style
137
+ */
138
+ this.clientStyling = '';
139
+ /**
140
+ * Client custom styling via url
141
+ */
142
+ this.clientStylingUrl = '';
143
+ /**
144
+ * Show bullet navigation under slides
145
+ */
146
+ this.bulletNavigation = true;
147
+ /**
148
+ * Language of the widget
149
+ */
150
+ this.language = 'en';
151
+ /**
152
+ * Translation via url
153
+ */
154
+ this.translationUrl = '';
155
+ this.currIndex = 0;
156
+ this.device = '';
157
+ this.stylingAppends = false;
135
158
  this.userAgent = window.navigator.userAgent;
136
159
  this.isMobile = isMobile(this.userAgent);
137
160
  this.touchStartX = 0;
@@ -198,22 +221,6 @@ const CarouselComponent = class {
198
221
  }
199
222
  return source;
200
223
  };
201
- this.clientStyling = '';
202
- this.clientStylingUrl = '';
203
- this.content = undefined;
204
- this.bulletNavigation = true;
205
- this.language = 'en';
206
- this.slideTimer = undefined;
207
- this.translationUrl = '';
208
- this.currIndex = 0;
209
- this.width = undefined;
210
- this.height = undefined;
211
- this.margin = undefined;
212
- this.sliderElement = undefined;
213
- this.totalWidth = undefined;
214
- this.device = '';
215
- this.stylingAppends = false;
216
- this.innerWidth = undefined;
217
224
  }
218
225
  handleNewTranslations() {
219
226
  getTranslations(this.translationUrl);
@@ -351,27 +358,120 @@ const CarouselComponent = class {
351
358
  };
352
359
  CarouselComponent.style = CarouselComponentStyle0;
353
360
 
361
+ /**
362
+ * @name setClientStyling
363
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
364
+ * @param {HTMLElement} stylingContainer The reference element of the widget
365
+ * @param {string} clientStyling The style content
366
+ */
367
+ function setClientStyling(stylingContainer, clientStyling) {
368
+ if (stylingContainer) {
369
+ const sheet = document.createElement('style');
370
+ sheet.innerHTML = clientStyling;
371
+ stylingContainer.appendChild(sheet);
372
+ }
373
+ }
374
+
375
+ /**
376
+ * @name setClientStylingURL
377
+ * @description Method used to create and append to the passed element of the widget a style element with the content fetched from a given URL
378
+ * @param {HTMLElement} stylingContainer The reference element of the widget
379
+ * @param {string} clientStylingUrl The URL of the style content
380
+ */
381
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
382
+ const url = new URL(clientStylingUrl);
383
+
384
+ fetch(url.href)
385
+ .then((res) => res.text())
386
+ .then((data) => {
387
+ const cssFile = document.createElement('style');
388
+ cssFile.innerHTML = data;
389
+ if (stylingContainer) {
390
+ stylingContainer.appendChild(cssFile);
391
+ }
392
+ })
393
+ .catch((err) => {
394
+ console.error('There was an error while trying to load client styling from URL', err);
395
+ });
396
+ }
397
+
398
+ /**
399
+ * @name setStreamLibrary
400
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
401
+ * @param {HTMLElement} stylingContainer The highest element of the widget
402
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
403
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
404
+ */
405
+ function setStreamStyling(stylingContainer, domain, subscription) {
406
+ if (window.emMessageBus) {
407
+ const sheet = document.createElement('style');
408
+
409
+ window.emMessageBus.subscribe(domain, (data) => {
410
+ sheet.innerHTML = data;
411
+ if (stylingContainer) {
412
+ stylingContainer.appendChild(sheet);
413
+ }
414
+ });
415
+ }
416
+ }
417
+
354
418
  const generalSliderNavigationCss = "";
355
419
  const GeneralSliderNavigationStyle0 = generalSliderNavigationCss;
356
420
 
357
421
  const GeneralSliderNavigation = class {
358
422
  constructor(hostRef) {
359
423
  index.registerInstance(this, hostRef);
424
+ /**
425
+ * Client custom styling via inline style
426
+ */
360
427
  this.clientStyling = '';
428
+ /**
429
+ * Client custom styling via url
430
+ */
361
431
  this.clientStylingUrl = '';
362
- this.cmsEndpoint = undefined;
432
+ /**
433
+ * CMS Endpoint stage
434
+ */
363
435
  this.cmsEnv = 'stage';
436
+ /**
437
+ * Language of the widget
438
+ */
364
439
  this.language = 'en';
440
+ /**
441
+ * User roles
442
+ */
365
443
  this.userRoles = 'everyone';
444
+ /**
445
+ * Show bullet navigation under slides
446
+ */
366
447
  this.bulletNavigation = true;
367
- this.slideTimer = undefined;
448
+ /**
449
+ * Mobile width for sliders
450
+ */
368
451
  this.sliderMobileWidth = 200;
452
+ /**
453
+ * Desktop width for sliders
454
+ */
369
455
  this.sliderDesktopWidth = 300;
456
+ /**
457
+ * Translation via url
458
+ */
370
459
  this.translationUrl = '';
371
460
  this.isLoading = true;
372
461
  this.hasErrors = false;
373
462
  this.device = '';
374
463
  }
464
+ handleClientStylingChange(newValue, oldValue) {
465
+ if (newValue != oldValue) {
466
+ setClientStyling(this.stylingContainer, this.clientStyling);
467
+ }
468
+ }
469
+ handleClientStylingChangeURL(newValue, oldValue) {
470
+ if (newValue != oldValue) {
471
+ if (this.clientStylingUrl)
472
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
473
+ }
474
+ }
375
475
  handleNewTranslations() {
376
476
  getTranslations(this.translationUrl);
377
477
  }
@@ -392,6 +492,22 @@ const GeneralSliderNavigation = class {
392
492
  });
393
493
  }
394
494
  }
495
+ componentDidLoad() {
496
+ if (this.stylingContainer) {
497
+ if (window.emMessageBus != undefined) {
498
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
499
+ }
500
+ else {
501
+ if (this.clientStyling)
502
+ setClientStyling(this.stylingContainer, this.clientStyling);
503
+ if (this.clientStylingUrl)
504
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
505
+ }
506
+ }
507
+ }
508
+ disconnectedCallback() {
509
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
510
+ }
395
511
  getGeneralSliderNavigation() {
396
512
  let url = new URL(`${this.cmsEndpoint}/${this.language}/homepage`);
397
513
  url.searchParams.append('env', this.cmsEnv);
@@ -418,10 +534,12 @@ const GeneralSliderNavigation = class {
418
534
  return (index.h("div", { class: "PageError" }, index.h("div", { class: "TitleError" }, translate('error', this.language))));
419
535
  }
420
536
  if (!this.isLoading) {
421
- return (index.h("div", null, index.h("carousel-component", { content: this.sliderData, language: this.language, "client-styling": this.clientStyling, "client-styling-url": this.clientStylingUrl, "bullet-navigation": this.bulletNavigation, "slide-timer": this.slideTimer, "translation-url": this.translationUrl, "slider-mobile-width": this.sliderMobileWidth, "slider-desktop-width": this.sliderDesktopWidth })));
537
+ return (index.h("div", { ref: el => this.stylingContainer = el }, index.h("carousel-component", { content: this.sliderData, language: this.language, "mb-source": this.mbSource, "client-styling": this.clientStyling, "client-styling-url": this.clientStylingUrl, "bullet-navigation": this.bulletNavigation, "slide-timer": this.slideTimer, "translation-url": this.translationUrl, "slider-mobile-width": this.sliderMobileWidth, "slider-desktop-width": this.sliderDesktopWidth })));
422
538
  }
423
539
  }
424
540
  static get watchers() { return {
541
+ "clientStyling": ["handleClientStylingChange"],
542
+ "clientStylingUrl": ["handleClientStylingChangeURL"],
425
543
  "translationUrl": ["handleNewTranslations"],
426
544
  "cmsEndpoint": ["watchEndpoint"],
427
545
  "language": ["watchEndpoint"]
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-b79a855b.js');
5
+ const index = require('./index-75dd98ba.js');
6
6
  const appGlobals = require('./app-globals-3a1e7e63.js');
7
7
 
8
8
  /*
9
- Stencil Client Patch Browser v4.22.3 | MIT Licensed | https://stenciljs.com
9
+ Stencil Client Patch Browser v4.26.0 | MIT Licensed | https://stenciljs.com
10
10
  */
11
11
  var patchBrowser = () => {
12
12
  const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('general-slider-navigation.cjs.js', document.baseURI).href));
@@ -19,7 +19,7 @@ var patchBrowser = () => {
19
19
 
20
20
  patchBrowser().then(async (options) => {
21
21
  await appGlobals.globalScripts();
22
- return index.bootstrapLazy([["carousel-component_2.cjs",[[1,"general-slider-navigation",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"cmsEndpoint":[513,"cms-endpoint"],"cmsEnv":[513,"cms-env"],"language":[513],"userRoles":[513,"user-roles"],"bulletNavigation":[516,"bullet-navigation"],"slideTimer":[514,"slide-timer"],"sliderMobileWidth":[514,"slider-mobile-width"],"sliderDesktopWidth":[514,"slider-desktop-width"],"translationUrl":[513,"translation-url"],"isLoading":[32],"hasErrors":[32],"device":[32]},null,{"translationUrl":["handleNewTranslations"],"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"]}],[1,"carousel-component",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"content":[16],"bulletNavigation":[516,"bullet-navigation"],"language":[513],"slideTimer":[514,"slide-timer"],"translationUrl":[513,"translation-url"],"currIndex":[32],"width":[32],"height":[32],"margin":[32],"sliderElement":[32],"totalWidth":[32],"device":[32],"stylingAppends":[32],"innerWidth":[32]},null,{"translationUrl":["handleNewTranslations"]}]]]], options);
22
+ return index.bootstrapLazy([["carousel-component_2.cjs",[[1,"general-slider-navigation",{"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"cmsEndpoint":[513,"cms-endpoint"],"cmsEnv":[513,"cms-env"],"language":[513],"userRoles":[513,"user-roles"],"bulletNavigation":[516,"bullet-navigation"],"slideTimer":[514,"slide-timer"],"sliderMobileWidth":[514,"slider-mobile-width"],"sliderDesktopWidth":[514,"slider-desktop-width"],"translationUrl":[513,"translation-url"],"isLoading":[32],"hasErrors":[32],"device":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"],"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"]}],[1,"carousel-component",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"content":[16],"bulletNavigation":[516,"bullet-navigation"],"language":[513],"slideTimer":[514,"slide-timer"],"translationUrl":[513,"translation-url"],"currIndex":[32],"width":[32],"height":[32],"margin":[32],"sliderElement":[32],"totalWidth":[32],"device":[32],"stylingAppends":[32],"innerWidth":[32]},null,{"translationUrl":["handleNewTranslations"]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;