@everymatrix/general-tutorial-slider 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 (26) hide show
  1. package/dist/cjs/general-tutorial-slider.cjs.entry.js +133 -44
  2. package/dist/cjs/general-tutorial-slider.cjs.js +3 -3
  3. package/dist/cjs/{index-e91cd3ca.js → index-bfd21506.js} +180 -77
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/collection/collection-manifest.json +1 -1
  6. package/dist/collection/components/general-tutorial-slider/general-tutorial-slider.js +124 -43
  7. package/dist/esm/general-tutorial-slider.entry.js +133 -44
  8. package/dist/esm/general-tutorial-slider.js +4 -4
  9. package/dist/esm/{index-8f6f886a.js → index-b8731ee9.js} +180 -77
  10. package/dist/esm/loader.js +3 -3
  11. package/dist/general-tutorial-slider/general-tutorial-slider.esm.js +1 -1
  12. package/dist/general-tutorial-slider/p-d3024419.entry.js +1 -0
  13. package/dist/general-tutorial-slider/p-e2d02089.js +2 -0
  14. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/general-tutorial-slider/.stencil/packages/stencil/general-tutorial-slider/stencil.config.d.ts +2 -0
  15. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/general-tutorial-slider/.stencil/packages/stencil/general-tutorial-slider/stencil.config.dev.d.ts +2 -0
  16. package/dist/types/components/general-tutorial-slider/general-tutorial-slider.d.ts +7 -3
  17. package/dist/types/components.d.ts +8 -0
  18. package/package.json +1 -1
  19. package/dist/general-tutorial-slider/p-61e877f0.entry.js +0 -1
  20. package/dist/general-tutorial-slider/p-f4302c55.js +0 -2
  21. package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/general-tutorial-slider/.stencil/packages/stencil/general-tutorial-slider/stencil.config.d.ts +0 -2
  22. package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/general-tutorial-slider/.stencil/packages/stencil/general-tutorial-slider/stencil.config.dev.d.ts +0 -2
  23. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/general-tutorial-slider/.stencil/tools/plugins/index.d.ts +0 -0
  24. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/general-tutorial-slider/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +0 -0
  25. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/general-tutorial-slider/.stencil/tools/plugins/vite-chunk-plugin.d.ts +0 -0
  26. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/general-tutorial-slider/.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-e91cd3ca.js');
5
+ const index = require('./index-bfd21506.js');
6
6
 
7
7
  const DEFAULT_LANGUAGE = 'en';
8
8
  const TRANSLATIONS = {
@@ -44,6 +44,63 @@ const translate = (key, customLang) => {
44
44
  return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
45
45
  };
46
46
 
47
+ /**
48
+ * @name setClientStyling
49
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
50
+ * @param {HTMLElement} stylingContainer The reference element of the widget
51
+ * @param {string} clientStyling The style content
52
+ */
53
+ function setClientStyling(stylingContainer, clientStyling) {
54
+ if (stylingContainer) {
55
+ const sheet = document.createElement('style');
56
+ sheet.innerHTML = clientStyling;
57
+ stylingContainer.appendChild(sheet);
58
+ }
59
+ }
60
+
61
+ /**
62
+ * @name setClientStylingURL
63
+ * @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
64
+ * @param {HTMLElement} stylingContainer The reference element of the widget
65
+ * @param {string} clientStylingUrl The URL of the style content
66
+ */
67
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
68
+ const url = new URL(clientStylingUrl);
69
+
70
+ fetch(url.href)
71
+ .then((res) => res.text())
72
+ .then((data) => {
73
+ const cssFile = document.createElement('style');
74
+ cssFile.innerHTML = data;
75
+ if (stylingContainer) {
76
+ stylingContainer.appendChild(cssFile);
77
+ }
78
+ })
79
+ .catch((err) => {
80
+ console.error('There was an error while trying to load client styling from URL', err);
81
+ });
82
+ }
83
+
84
+ /**
85
+ * @name setStreamLibrary
86
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
87
+ * @param {HTMLElement} stylingContainer The highest element of the widget
88
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
89
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
90
+ */
91
+ function setStreamStyling(stylingContainer, domain, subscription) {
92
+ if (window.emMessageBus) {
93
+ const sheet = document.createElement('style');
94
+
95
+ window.emMessageBus.subscribe(domain, (data) => {
96
+ sheet.innerHTML = data;
97
+ if (stylingContainer) {
98
+ stylingContainer.appendChild(sheet);
99
+ }
100
+ });
101
+ }
102
+ }
103
+
47
104
  /**
48
105
  * @name isMobile
49
106
  * @description A method that returns if the browser used to access the app is from a mobile device or not
@@ -90,55 +147,71 @@ const GeneralTutorialSliderStyle0 = generalTutorialSliderCss;
90
147
  const GeneralTutorialSlider = class {
91
148
  constructor(hostRef) {
92
149
  index.registerInstance(this, hostRef);
93
- this.userAgent = window.navigator.userAgent;
94
- this.isMobile = isMobile(this.userAgent);
95
- this.allElementsWidth = 0;
96
- this.xDown = null;
97
- this.yDown = null;
98
- this.resizeHandler = () => {
99
- this.recalculateItemsPerPage();
100
- };
101
- this.orientationChangeHandler = () => {
102
- setTimeout(() => {
103
- this.recalculateItemsPerPage();
104
- }, 10);
105
- };
106
- this.setClientStyling = () => {
107
- let sheet = document.createElement('style');
108
- sheet.innerHTML = this.clientStyling;
109
- this.stylingContainer.prepend(sheet);
110
- };
111
- this.setClientStylingURL = () => {
112
- let url = new URL(this.clientStylingUrl);
113
- let cssFile = document.createElement('style');
114
- fetch(url.href)
115
- .then((res) => res.text())
116
- .then((data) => {
117
- cssFile.innerHTML = data;
118
- setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
119
- })
120
- .catch((err) => {
121
- console.log('error ', err);
122
- });
123
- };
150
+ /**
151
+ * Client custom styling via inline style
152
+ */
124
153
  this.clientStyling = '';
154
+ /**
155
+ * Client custom styling via url
156
+ */
125
157
  this.clientStylingUrl = '';
158
+ /**
159
+ * Language of the widget
160
+ */
126
161
  this.language = 'en';
127
- this.cmsEndpoint = undefined;
162
+ /**
163
+ * User roles
164
+ */
128
165
  this.userRoles = 'everyone';
166
+ /**
167
+ * CMS Endpoint stage
168
+ */
129
169
  this.cmsEnv = 'stage';
170
+ /**
171
+ * Show slider dots
172
+ */
130
173
  this.showSliderDots = true;
174
+ /**
175
+ * Show slider navigate arrows
176
+ */
131
177
  this.showSliderArrows = true;
178
+ /**
179
+ * Show slider navigate arrows on mobile
180
+ */
132
181
  this.showSliderArrowsMobile = false;
182
+ /**
183
+ * Auto-scroll will only function if it is set to true, and otherwise it will be ignored.
184
+ */
133
185
  this.enableAutoScroll = false;
186
+ /**
187
+ * Set interval period for slider
188
+ */
134
189
  this.intervalPeriod = 5000;
190
+ /**
191
+ * Set the number of slides you wish to display.
192
+ */
135
193
  this.scrollItems = 1;
194
+ /**
195
+ * Set the number of slides you wish to display.
196
+ */
136
197
  this.itemsPerPage = 1;
137
198
  this.hasErrors = false;
138
- this.limitStylingAppends = false;
139
199
  this.isLoading = true;
140
200
  this.activeIndex = 0;
141
201
  this.tutorialElementWidth = 0;
202
+ this.userAgent = window.navigator.userAgent;
203
+ this.isMobile = isMobile(this.userAgent);
204
+ this.allElementsWidth = 0;
205
+ this.xDown = null;
206
+ this.yDown = null;
207
+ this.resizeHandler = () => {
208
+ this.recalculateItemsPerPage();
209
+ };
210
+ this.orientationChangeHandler = () => {
211
+ setTimeout(() => {
212
+ this.recalculateItemsPerPage();
213
+ }, 10);
214
+ };
142
215
  }
143
216
  watchEndpoint(newValue, oldValue) {
144
217
  if (newValue && newValue != oldValue && this.cmsEndpoint) {
@@ -147,6 +220,17 @@ const GeneralTutorialSlider = class {
147
220
  });
148
221
  }
149
222
  }
223
+ handleClientStylingChange(newValue, oldValue) {
224
+ if (newValue != oldValue) {
225
+ setClientStyling(this.stylingContainer, this.clientStyling);
226
+ }
227
+ }
228
+ handleClientStylingChangeURL(newValue, oldValue) {
229
+ if (newValue != oldValue) {
230
+ if (this.clientStylingUrl)
231
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
232
+ }
233
+ }
150
234
  connectedCallback() {
151
235
  window.screen.orientation.addEventListener('change', this.orientationChangeHandler);
152
236
  }
@@ -159,20 +243,22 @@ const GeneralTutorialSlider = class {
159
243
  }
160
244
  componentDidLoad() {
161
245
  window.addEventListener('resize', this.resizeHandler);
246
+ if (this.stylingContainer) {
247
+ if (window.emMessageBus != undefined) {
248
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
249
+ }
250
+ else {
251
+ if (this.clientStyling)
252
+ setClientStyling(this.stylingContainer, this.clientStyling);
253
+ if (this.clientStylingUrl)
254
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
255
+ }
256
+ }
162
257
  }
163
258
  componentDidRender() {
164
259
  this.el.addEventListener('touchstart', this.handleTouchStart.bind(this), { passive: true });
165
260
  this.el.addEventListener('touchmove', this.handleTouchMove.bind(this), { passive: true });
166
261
  this.recalculateItemsPerPage();
167
- // start custom styling area
168
- if (!this.limitStylingAppends && this.stylingContainer) {
169
- if (this.clientStyling)
170
- this.setClientStyling();
171
- if (this.clientStylingUrl)
172
- this.setClientStylingURL();
173
- this.limitStylingAppends = true;
174
- }
175
- // end custom styling area
176
262
  }
177
263
  componentDidUpdate() {
178
264
  this.recalculateItemsPerPage();
@@ -182,6 +268,7 @@ const GeneralTutorialSlider = class {
182
268
  this.el.removeEventListener('touchmove', this.handleTouchMove);
183
269
  window.screen.orientation.removeEventListener('change', this.orientationChangeHandler);
184
270
  window.removeEventListener('resize', this.resizeHandler);
271
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
185
272
  }
186
273
  getGeneralTutorialSlider() {
187
274
  let url = new URL(`${this.cmsEndpoint}/${this.language}/slider-onboarding`);
@@ -301,7 +388,9 @@ const GeneralTutorialSlider = class {
301
388
  get el() { return index.getElement(this); }
302
389
  static get watchers() { return {
303
390
  "cmsEndpoint": ["watchEndpoint"],
304
- "language": ["watchEndpoint"]
391
+ "language": ["watchEndpoint"],
392
+ "clientStyling": ["handleClientStylingChange"],
393
+ "clientStylingUrl": ["handleClientStylingChangeURL"]
305
394
  }; }
306
395
  };
307
396
  GeneralTutorialSlider.style = GeneralTutorialSliderStyle0;
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-e91cd3ca.js');
5
+ const index = require('./index-bfd21506.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-tutorial-slider.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([["general-tutorial-slider.cjs",[[1,"general-tutorial-slider",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[513],"cmsEndpoint":[513,"cms-endpoint"],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"showSliderDots":[516,"show-slider-dots"],"showSliderArrows":[516,"show-slider-arrows"],"showSliderArrowsMobile":[516,"show-slider-arrows-mobile"],"enableAutoScroll":[516,"enable-auto-scroll"],"intervalPeriod":[514,"interval-period"],"scrollItems":[520,"scroll-items"],"itemsPerPage":[514,"items-per-page"],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32],"activeIndex":[32],"tutorialElementWidth":[32]},null,{"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"]}]]]], options);
22
+ return index.bootstrapLazy([["general-tutorial-slider.cjs",[[1,"general-tutorial-slider",{"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[513],"cmsEndpoint":[513,"cms-endpoint"],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"showSliderDots":[516,"show-slider-dots"],"showSliderArrows":[516,"show-slider-arrows"],"showSliderArrowsMobile":[516,"show-slider-arrows-mobile"],"enableAutoScroll":[516,"enable-auto-scroll"],"intervalPeriod":[514,"interval-period"],"scrollItems":[520,"scroll-items"],"itemsPerPage":[514,"items-per-page"],"hasErrors":[32],"isLoading":[32],"activeIndex":[32],"tutorialElementWidth":[32]},null,{"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;