@everymatrix/bonus-elevate-levels 1.31.2

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 (71) hide show
  1. package/dist/bonus-elevate-levels/bonus-elevate-levels.esm.js +1 -0
  2. package/dist/bonus-elevate-levels/index.esm.js +0 -0
  3. package/dist/bonus-elevate-levels/p-b4dbf9a0.entry.js +1 -0
  4. package/dist/bonus-elevate-levels/p-b93c42e2.js +1 -0
  5. package/dist/cjs/bonus-elevate-levels.cjs.js +19 -0
  6. package/dist/cjs/bonus-elevate-levels_5.cjs.entry.js +418 -0
  7. package/dist/cjs/index-3c66cec7.js +1682 -0
  8. package/dist/cjs/index.cjs.js +2 -0
  9. package/dist/cjs/loader.cjs.js +21 -0
  10. package/dist/collection/collection-manifest.json +22 -0
  11. package/dist/collection/components/bonus-elevate-levels/bonus-elevate-levels.css +18 -0
  12. package/dist/collection/components/bonus-elevate-levels/bonus-elevate-levels.js +240 -0
  13. package/dist/collection/components/elevate-level-list/elevate-level-list.css +70 -0
  14. package/dist/collection/components/elevate-level-list/elevate-level-list.js +223 -0
  15. package/dist/collection/components/elevate-level-presentation/elevate-level-presentation.css +21 -0
  16. package/dist/collection/components/elevate-level-presentation/elevate-level-presentation.js +39 -0
  17. package/dist/collection/components/elevate-levels-data/elevate-levels-data.css +3 -0
  18. package/dist/collection/components/elevate-levels-data/elevate-levels-data.js +79 -0
  19. package/dist/collection/index.js +1 -0
  20. package/dist/collection/models/elevate-levels.js +1 -0
  21. package/dist/collection/utils/locale.utils.js +27 -0
  22. package/dist/collection/utils/prototype-collector.js +5 -0
  23. package/dist/collection/utils/utils.js +44 -0
  24. package/dist/components/bonus-elevate-levels.d.ts +11 -0
  25. package/dist/components/bonus-elevate-levels.js +136 -0
  26. package/dist/components/elevate-level-list.d.ts +11 -0
  27. package/dist/components/elevate-level-list.js +6 -0
  28. package/dist/components/elevate-level-list2.js +177 -0
  29. package/dist/components/elevate-level-presentation.d.ts +11 -0
  30. package/dist/components/elevate-level-presentation.js +6 -0
  31. package/dist/components/elevate-level-presentation2.js +31 -0
  32. package/dist/components/elevate-levels-data.d.ts +11 -0
  33. package/dist/components/elevate-levels-data.js +6 -0
  34. package/dist/components/elevate-levels-data2.js +102 -0
  35. package/dist/components/general-styling-wrapper.js +6 -0
  36. package/dist/components/general-styling-wrapper2.js +103 -0
  37. package/dist/components/index.d.ts +26 -0
  38. package/dist/components/index.js +1 -0
  39. package/dist/esm/bonus-elevate-levels.js +17 -0
  40. package/dist/esm/bonus-elevate-levels_5.entry.js +410 -0
  41. package/dist/esm/index-2cb5433a.js +1654 -0
  42. package/dist/esm/index.js +1 -0
  43. package/dist/esm/loader.js +17 -0
  44. package/dist/esm/polyfills/core-js.js +11 -0
  45. package/dist/esm/polyfills/css-shim.js +1 -0
  46. package/dist/esm/polyfills/dom.js +79 -0
  47. package/dist/esm/polyfills/es5-html-element.js +1 -0
  48. package/dist/esm/polyfills/index.js +34 -0
  49. package/dist/esm/polyfills/system.js +6 -0
  50. package/dist/index.cjs.js +1 -0
  51. package/dist/index.js +1 -0
  52. package/dist/stencil.config.js +24 -0
  53. package/dist/types/Users/dragos.bodea/Documents/everymatrix-prjs/emfe-widgets/widgets-stencil/packages/bonus-elevate-levels/.stencil/packages/bonus-elevate-levels/stencil.config.d.ts +2 -0
  54. package/dist/types/components/bonus-elevate-levels/bonus-elevate-levels.d.ts +48 -0
  55. package/dist/types/components/elevate-level-list/elevate-level-list.d.ts +45 -0
  56. package/dist/types/components/elevate-level-presentation/elevate-level-presentation.d.ts +8 -0
  57. package/dist/types/components/elevate-levels-data/elevate-levels-data.d.ts +10 -0
  58. package/dist/types/components.d.ts +175 -0
  59. package/dist/types/index.d.ts +1 -0
  60. package/dist/types/models/elevate-levels.d.ts +12 -0
  61. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  62. package/dist/types/utils/locale.utils.d.ts +10 -0
  63. package/dist/types/utils/prototype-collector.d.ts +1 -0
  64. package/dist/types/utils/utils.d.ts +21 -0
  65. package/loader/cdn.js +3 -0
  66. package/loader/index.cjs.js +3 -0
  67. package/loader/index.d.ts +12 -0
  68. package/loader/index.es2017.js +3 -0
  69. package/loader/index.js +4 -0
  70. package/loader/package.json +10 -0
  71. package/package.json +22 -0
@@ -0,0 +1,79 @@
1
+ import { Component, Event, Prop } from '@stencil/core';
2
+ import "@everymatrix/general-styling-wrapper";
3
+ import fetch from "node-fetch";
4
+ export class ElevateLevelsData {
5
+ async componentWillLoad() {
6
+ //load data
7
+ if (!this.scopeParams.endpoint) {
8
+ return;
9
+ }
10
+ const endpoint = this.scopeParams.endpoint;
11
+ let url = new URL(`${endpoint}/v1/elevate/levels?language=${this.scopeParams.language}`);
12
+ await fetch(url.href)
13
+ .then((res) => res.json())
14
+ .then((res) => {
15
+ const elevateLevels = res.data.sort((a, b) => {
16
+ return a.firstEntryPoints < b.firstEntryPoints ? -1 : 1;
17
+ });
18
+ let selectedLevelId = this.scopeParams.selectedLevelId;
19
+ // if selected level is not set, set first(basic) as default
20
+ if (!selectedLevelId && this.scopeParams.showDefault && elevateLevels.length > 0) {
21
+ selectedLevelId = elevateLevels[0].id;
22
+ }
23
+ if (selectedLevelId) {
24
+ // get current level by name
25
+ const currentLevel = elevateLevels.filter((item) => {
26
+ return item.id == selectedLevelId;
27
+ })[0];
28
+ this.elevateLevelsDataChange.emit({ currentLevel: currentLevel });
29
+ }
30
+ this.elevateLevelsDataChange.emit({ 'clearError': true });
31
+ this.elevateLevelsDataChange.emit({ 'elevateLevels': elevateLevels });
32
+ }).catch((err) => {
33
+ this.elevateLevelsDataChange.emit({ errorMessage: { type: 'errorWhenLoadElevateLevels', err } });
34
+ console.error(err);
35
+ });
36
+ }
37
+ static get is() { return "elevate-levels-data"; }
38
+ static get originalStyleUrls() { return {
39
+ "$": ["elevate-levels-data.scss"]
40
+ }; }
41
+ static get styleUrls() { return {
42
+ "$": ["elevate-levels-data.css"]
43
+ }; }
44
+ static get properties() { return {
45
+ "scopeParams": {
46
+ "type": "any",
47
+ "mutable": true,
48
+ "complexType": {
49
+ "original": "any",
50
+ "resolved": "any",
51
+ "references": {}
52
+ },
53
+ "required": true,
54
+ "optional": false,
55
+ "docs": {
56
+ "tags": [],
57
+ "text": "Params from parent"
58
+ },
59
+ "attribute": "scope-params",
60
+ "reflect": true
61
+ }
62
+ }; }
63
+ static get events() { return [{
64
+ "method": "elevateLevelsDataChange",
65
+ "name": "elevateLevelsDataChange",
66
+ "bubbles": true,
67
+ "cancelable": true,
68
+ "composed": true,
69
+ "docs": {
70
+ "tags": [],
71
+ "text": ""
72
+ },
73
+ "complexType": {
74
+ "original": "any",
75
+ "resolved": "any",
76
+ "references": {}
77
+ }
78
+ }]; }
79
+ }
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,27 @@
1
+ const DEFAULT_LANGUAGE = 'en';
2
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hu', 'hr'];
3
+ export const TRANSLATIONS = {
4
+ en: {
5
+ seeAll: 'See All',
6
+ termsAndConditions: 'Terms & Conditions',
7
+ loadElevateLevelErrorMessage: 'Error when load elevate levels',
8
+ noLevelsSet: 'There is no level set',
9
+ },
10
+ fr: {
11
+ seeAll: 'See All',
12
+ termsAndConditions: 'Terms & Conditions',
13
+ loadElevateLevelErrorMessage: 'Error when load elevate levels',
14
+ noLevelsSet: 'There is no level set',
15
+ },
16
+ hr: {
17
+ level: 'Razina',
18
+ seeAll: 'Vidi sve',
19
+ privilegesFor: 'Privilegije za',
20
+ termsAndConditions: 'Uvjeti i odredbe',
21
+ noLevelsSet: 'There is no level set',
22
+ }
23
+ };
24
+ export const translate = (key, customLang) => {
25
+ const lang = customLang;
26
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
27
+ };
@@ -0,0 +1,5 @@
1
+ export const PrototypeDecorator = (target) => {
2
+ target.prototype.getProps = () => {
3
+ console.log(target);
4
+ };
5
+ };
@@ -0,0 +1,44 @@
1
+ export function format(first, middle, last) {
2
+ return ((first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : ''));
3
+ }
4
+ export function getValueByLangFromPresentation(presentation, keyName, lang) {
5
+ if (!presentation || !presentation[keyName]) {
6
+ return '';
7
+ }
8
+ return presentation[keyName][lang] ? presentation[keyName][lang] : presentation[keyName]['*'];
9
+ }
10
+ /**
11
+ * @name isMobile
12
+ * @description A method that returns if the browser used to access the app is from a mobile device or not
13
+ * @param {String} userAgent window.navigator.userAgent
14
+ * @returns {Boolean} true or false
15
+ */
16
+ export const isMobile = (userAgent) => {
17
+ return !!(userAgent.toLowerCase().match(/android/i) ||
18
+ userAgent.toLowerCase().match(/blackberry|bb/i) ||
19
+ userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
20
+ userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
21
+ };
22
+ /**
23
+ * @name getDevice
24
+ * @description A method that returns the type of the device
25
+ * @param {String} userAgent window.navigator.userAgent
26
+ * @returns {String} Android/iPhone/iPad/PC
27
+ */
28
+ export const getDevice = (userAgent) => {
29
+ if (userAgent.toLowerCase().match(/android/i)) {
30
+ return 'Android';
31
+ }
32
+ if (userAgent.toLowerCase().match(/iphone/i)) {
33
+ return 'iPhone';
34
+ }
35
+ if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
36
+ return 'iPad';
37
+ }
38
+ return 'PC';
39
+ };
40
+ export var MOVE_TO;
41
+ (function (MOVE_TO) {
42
+ MOVE_TO[MOVE_TO["slideToRight"] = 1] = "slideToRight";
43
+ MOVE_TO[MOVE_TO["slideToLeft"] = -1] = "slideToLeft";
44
+ })(MOVE_TO || (MOVE_TO = {}));
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface BonusElevateLevels extends Components.BonusElevateLevels, HTMLElement {}
4
+ export const BonusElevateLevels: {
5
+ prototype: BonusElevateLevels;
6
+ new (): BonusElevateLevels;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,136 @@
1
+ import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
+ import { t as translate, T as TRANSLATIONS, d as defineCustomElement$5 } from './elevate-level-list2.js';
3
+ import { d as defineCustomElement$4 } from './elevate-level-presentation2.js';
4
+ import { d as defineCustomElement$3 } from './elevate-levels-data2.js';
5
+ import { d as defineCustomElement$2 } from './general-styling-wrapper2.js';
6
+
7
+ const bonusElevateLevelsCss = ":host{display:block}.ElevateLevelContent{padding:20px;position:relative}.ElevateLevelContent .Privileges{padding-bottom:30px}.ElevateLevelContent .tc{position:absolute;right:10px;bottom:10px;text-align:right;display:none}";
8
+
9
+ const BonusElevateLevels$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
10
+ constructor() {
11
+ super();
12
+ this.__registerHost();
13
+ this.__attachShadow();
14
+ /**
15
+ * Client custom styling via string
16
+ */
17
+ this.clientStyling = '';
18
+ /**
19
+ * Client custom styling via url
20
+ */
21
+ this.clientStylingUrl = '';
22
+ /**
23
+ * Language of the widget
24
+ */
25
+ this.language = 'en';
26
+ /**
27
+ * The translationUrl
28
+ */
29
+ this.translationUrl = '';
30
+ /**
31
+ * Used in elevate level list
32
+ */
33
+ this.elevateLevels = [];
34
+ }
35
+ selectedLevelChangedHandler(event) {
36
+ if (event.detail) {
37
+ this.currentLevel = Object.assign({}, event.detail.level);
38
+ }
39
+ }
40
+ selectedLevelIdChangedHandler() {
41
+ if (this.selectedLevelId && this.elevateLevels) {
42
+ const currentLevel = this.elevateLevels.filter((item) => {
43
+ return item.id == this.selectedLevelId;
44
+ })[0];
45
+ this.currentLevel = Object.assign({}, currentLevel);
46
+ }
47
+ }
48
+ elevateLevelsDataChangeHandler(event) {
49
+ if (!event.detail) {
50
+ return;
51
+ }
52
+ if (event.detail.currentLevel) {
53
+ this.currentLevel = Object.assign({}, event.detail.currentLevel);
54
+ }
55
+ if (event.detail.elevateLevels) {
56
+ this.elevateLevels = [...event.detail.elevateLevels];
57
+ }
58
+ if (event.detail.clearError) {
59
+ this.errorMessage = null;
60
+ }
61
+ if (event.detail.errorMessage) {
62
+ if (event.detail.errorMessage['errorWhenLoadElevateLevels']) {
63
+ this.errorMessage = translate('loadElevateLevelErrorMessage', this.language);
64
+ }
65
+ }
66
+ }
67
+ onTCClick() {
68
+ window.postMessage({ type: 'termAndConditionClicked' }, window.location.href);
69
+ }
70
+ componentWillLoad() {
71
+ this.elevateLevelParamProxy = {
72
+ endpoint: this.endpoint, language: this.language, selectedLevelId: this.selectedLevelId,
73
+ showDefault: this.showDefault
74
+ };
75
+ }
76
+ render() {
77
+ return (h("div", { class: "ElevateLevelContent" }, h("elevate-levels-data", { scopeParams: this.elevateLevelParamProxy }), h("div", { class: "LevelContent" }, this.elevateLevels ?
78
+ h("elevate-level-list", { language: this.language, selectedLevelId: this.selectedLevelId, levels: this.elevateLevels }) : translate('noLevelsSet', this.language), this.currentLevel &&
79
+ h("elevate-level-presentation", { elevateLevel: this.currentLevel }), h("div", { class: "tc", onClick: this.onTCClick }, translate('termsAndConditions', this.language), ' ')), this.errorMessage && h("div", null, this.errorMessage), h("general-styling-wrapper", { clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, targetTranslations: TRANSLATIONS, translationUrl: this.translationUrl })));
80
+ }
81
+ static get watchers() { return {
82
+ "selectedLevelId": ["selectedLevelIdChangedHandler"],
83
+ "elevateLevels": ["selectedLevelIdChangedHandler"]
84
+ }; }
85
+ static get style() { return bonusElevateLevelsCss; }
86
+ }, [1, "bonus-elevate-levels", {
87
+ "clientStyling": [513, "client-styling"],
88
+ "clientStylingUrl": [513, "client-styling-url"],
89
+ "endpoint": [513],
90
+ "language": [513],
91
+ "translationUrl": [513, "translation-url"],
92
+ "selectedLevelId": [1537, "selected-level-id"],
93
+ "showDefault": [4, "show-default"],
94
+ "elevateLevelParamProxy": [32],
95
+ "elevateLevels": [32],
96
+ "currentLevel": [32],
97
+ "errorMessage": [32]
98
+ }, [[0, "selectedLevelChanged", "selectedLevelChangedHandler"], [2, "elevateLevelsDataChange", "elevateLevelsDataChangeHandler"]]]);
99
+ function defineCustomElement$1() {
100
+ if (typeof customElements === "undefined") {
101
+ return;
102
+ }
103
+ const components = ["bonus-elevate-levels", "elevate-level-list", "elevate-level-presentation", "elevate-levels-data", "general-styling-wrapper"];
104
+ components.forEach(tagName => { switch (tagName) {
105
+ case "bonus-elevate-levels":
106
+ if (!customElements.get(tagName)) {
107
+ customElements.define(tagName, BonusElevateLevels$1);
108
+ }
109
+ break;
110
+ case "elevate-level-list":
111
+ if (!customElements.get(tagName)) {
112
+ defineCustomElement$5();
113
+ }
114
+ break;
115
+ case "elevate-level-presentation":
116
+ if (!customElements.get(tagName)) {
117
+ defineCustomElement$4();
118
+ }
119
+ break;
120
+ case "elevate-levels-data":
121
+ if (!customElements.get(tagName)) {
122
+ defineCustomElement$3();
123
+ }
124
+ break;
125
+ case "general-styling-wrapper":
126
+ if (!customElements.get(tagName)) {
127
+ defineCustomElement$2();
128
+ }
129
+ break;
130
+ } });
131
+ }
132
+
133
+ const BonusElevateLevels = BonusElevateLevels$1;
134
+ const defineCustomElement = defineCustomElement$1;
135
+
136
+ export { BonusElevateLevels, defineCustomElement };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface ElevateLevelList extends Components.ElevateLevelList, HTMLElement {}
4
+ export const ElevateLevelList: {
5
+ prototype: ElevateLevelList;
6
+ new (): ElevateLevelList;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { E as ElevateLevelList$1, d as defineCustomElement$1 } from './elevate-level-list2.js';
2
+
3
+ const ElevateLevelList = ElevateLevelList$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { ElevateLevelList, defineCustomElement };
@@ -0,0 +1,177 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
+
3
+ const DEFAULT_LANGUAGE = 'en';
4
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hu', 'hr'];
5
+ const TRANSLATIONS = {
6
+ en: {
7
+ seeAll: 'See All',
8
+ termsAndConditions: 'Terms & Conditions',
9
+ loadElevateLevelErrorMessage: 'Error when load elevate levels',
10
+ noLevelsSet: 'There is no level set',
11
+ },
12
+ fr: {
13
+ seeAll: 'See All',
14
+ termsAndConditions: 'Terms & Conditions',
15
+ loadElevateLevelErrorMessage: 'Error when load elevate levels',
16
+ noLevelsSet: 'There is no level set',
17
+ },
18
+ hr: {
19
+ level: 'Razina',
20
+ seeAll: 'Vidi sve',
21
+ privilegesFor: 'Privilegije za',
22
+ termsAndConditions: 'Uvjeti i odredbe',
23
+ noLevelsSet: 'There is no level set',
24
+ }
25
+ };
26
+ const translate = (key, customLang) => {
27
+ const lang = customLang;
28
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
29
+ };
30
+
31
+ /**
32
+ * @name isMobile
33
+ * @description A method that returns if the browser used to access the app is from a mobile device or not
34
+ * @param {String} userAgent window.navigator.userAgent
35
+ * @returns {Boolean} true or false
36
+ */
37
+ const isMobile = (userAgent) => {
38
+ return !!(userAgent.toLowerCase().match(/android/i) ||
39
+ userAgent.toLowerCase().match(/blackberry|bb/i) ||
40
+ userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
41
+ userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
42
+ };
43
+ var MOVE_TO;
44
+ (function (MOVE_TO) {
45
+ MOVE_TO[MOVE_TO["slideToRight"] = 1] = "slideToRight";
46
+ MOVE_TO[MOVE_TO["slideToLeft"] = -1] = "slideToLeft";
47
+ })(MOVE_TO || (MOVE_TO = {}));
48
+
49
+ const elevateLevelListCss = "elevate-level-list{display:flex;flex-direction:row}.LevelItemsWrapper{display:flex;flex:1;margin-top:10px;min-height:30px;transition-property:all;position:relative;height:138px;overflow-x:hidden}.Mobile.LevelItems{overflow-x:hidden}.LevelItems{overflow-x:auto;display:flex;flex-direction:row;gap:10px;left:0;position:absolute;transition:left 0.5s ease-in-out}.LevelItems .Item:hover,.LevelItems .Item.Active{background-color:var(--emfe-w-color-gray-50, #f4f4f4);box-shadow:0px 4px 13px 0px rgba(0, 0, 0, 0.25)}.LevelItems .Item{width:86px;height:125px;border-radius:15px;text-align:center;display:flex;flex-direction:column;cursor:pointer}.LevelItems .Item .LevelName{font-size:13px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.LevelItems .Item .LevelPoints{color:var(--emfe-w-color-gray-100, #767171);font-size:10px}.LevelItems .Item .LevelImg{width:65px;height:68px;margin:11px auto}.SliderButton{display:flex;width:29px;align-items:center;cursor:pointer}.SliderButton.Disabled svg{stroke:var(--emfe-w-color-gray-50, #cbc5c5)}.SliderButton.Hidden{display:none}";
50
+
51
+ const ElevateLevelList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
52
+ constructor() {
53
+ super();
54
+ this.__registerHost();
55
+ this.selectedLevelChanged = createEvent(this, "selectedLevelChanged", 7);
56
+ this.isShowSliderButton = false;
57
+ this.offset = 0;
58
+ this.minOffset = 0;
59
+ this.isMobile = isMobile(window.navigator.userAgent);
60
+ }
61
+ onLevelClicked(elevateLevel) {
62
+ this.selectedLevelChanged.emit({ level: elevateLevel });
63
+ this.selectedLevelId = elevateLevel.id;
64
+ }
65
+ levelsChangedHandler() {
66
+ this.initOffsetOfLevelItems();
67
+ }
68
+ initOffsetOfLevelItems() {
69
+ if (!this.levels || this.levels.length == 0 || !this.selectedLevelId) {
70
+ return;
71
+ }
72
+ const currentLevelIndex = this.levels.findIndex((item) => {
73
+ return this.selectedLevelId == item.id;
74
+ });
75
+ this.onLevelClicked(this.levels[currentLevelIndex == -1 ? 0 : currentLevelIndex]);
76
+ //do not need change the slider offset when level items less than moveCountForOneTouch
77
+ if (this.levels.length <= this.moveCountForOneTouch) {
78
+ return;
79
+ }
80
+ //to avoid the slider do not move when currentLevelIndex = moveCountForOneTouch - 1
81
+ let newOffset = Math.floor((currentLevelIndex == -1 ? 1 : currentLevelIndex + 1) / this.moveCountForOneTouch)
82
+ * this.moveCountForOneTouch * this.childElementWidth * (-1);
83
+ this.offset = newOffset <= this.minOffset ? this.minOffset : (newOffset >= 0 ? 0 : newOffset);
84
+ }
85
+ onTouchStart(e) {
86
+ this.touchPosStart = { clientX: e.touches[0].clientX, clientY: e.touches[0].clientY };
87
+ }
88
+ onTouchMove(e) {
89
+ this.touchPosEnd = { clientX: e.touches[0].clientX, clientY: e.touches[0].clientY };
90
+ const diffX = this.touchPosEnd.clientX - this.touchPosStart.clientX;
91
+ const diffY = this.touchPosEnd.clientY - this.touchPosStart.clientY;
92
+ if (Math.abs(diffX) > Math.abs(diffY)) {
93
+ this.slideTo(diffX > 0 ? MOVE_TO.slideToRight : MOVE_TO.slideToLeft);
94
+ }
95
+ }
96
+ slideTo(direction) {
97
+ let newOffset = this.levelsElement.offsetLeft +
98
+ (this.childElementWidth) * this.moveCountForOneTouch * direction;
99
+ if (newOffset % this.childElementWidth != 0) {
100
+ const leftOfPreNode = (Math.floor(newOffset / this.childElementWidth)) * this.childElementWidth;
101
+ const leftOfNextNode = (Math.ceil(newOffset / this.childElementWidth)) * this.childElementWidth;
102
+ //touchmove to right, get left of pre-node; touchmove to left, get left of next-node
103
+ newOffset = direction == MOVE_TO.slideToRight ? leftOfPreNode : leftOfNextNode;
104
+ }
105
+ this.offset = newOffset < this.minOffset ? this.minOffset : (newOffset >= 0 ? 0 : newOffset);
106
+ }
107
+ initLevelSlider() {
108
+ var _a;
109
+ if (!((_a = this.levelsElement) === null || _a === void 0 ? void 0 : _a.firstElementChild)) {
110
+ console.log('Widget[elevate-level-list] DOM is not ready.');
111
+ return;
112
+ }
113
+ this.isShowSliderButton = !this.isMobile && (this.levelsElement.clientWidth > this.levelsElement.parentElement.clientWidth);
114
+ this.minOffset = this.levelsElement.parentElement.clientWidth - this.levelsElement.clientWidth;
115
+ this.childElementWidth = this.levelsElement.firstElementChild.clientWidth;
116
+ this.moveCountForOneTouch = Math.ceil(this.levelsElement.parentElement.clientWidth / this.childElementWidth) - 1;
117
+ const childElementCount = this.levelsElement.childElementCount;
118
+ this.childElementWidth += (this.levelsElement.clientWidth - this.childElementWidth * childElementCount) / (childElementCount - 1);
119
+ }
120
+ debounce(callback, delay) {
121
+ {
122
+ let timer;
123
+ return () => {
124
+ clearTimeout(timer);
125
+ timer = setTimeout(() => {
126
+ callback();
127
+ }, delay);
128
+ };
129
+ }
130
+ }
131
+ ;
132
+ handleResize() {
133
+ this.debounce(this.initLevelSlider.bind(this), 200)();
134
+ }
135
+ componentDidRender() {
136
+ this.host.componentOnReady().then(() => {
137
+ this.initLevelSlider();
138
+ });
139
+ }
140
+ render() {
141
+ return (h(Host, null, this.levels && [
142
+ h("div", { class: `SliderButton LeftButton ${this.offset == 0 ? 'Disabled' : ''} ${this.isShowSliderButton ? '' : 'Hidden'}`, onClick: () => this.slideTo(MOVE_TO.slideToRight) }, h("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M15 19l-7-7 7-7" }))),
143
+ h("div", { class: 'LevelItemsWrapper' }, h("div", { style: { 'left': `${this.offset}px` }, class: `LevelItems ${this.isMobile ? 'Mobile' : ''}`, id: 'levelItems', ref: (el) => { this.levelsElement = el; } }, this.levels.map((level, idx) => {
144
+ return (h("div", { class: `Item ${this.selectedLevelId == level.id ? 'Active' : ''}`, onClick: this.onLevelClicked.bind(this, level) }, h("img", { alt: `Presentation Icon for ${level.presentation.displayName}`, class: "LevelImg", src: level.presentation.asset }), h("span", { class: "LevelName", title: level.presentation.displayName }, level.presentation.displayName), h("span", { class: "LevelPoints" }, idx == 0 ? '' : '>', level.firstEntryPoints, ' ', translate('points', this.language))));
145
+ }))),
146
+ h("div", { class: `SliderButton RightButton ${this.offset <= this.minOffset ? 'Disabled' : ''} ${this.isShowSliderButton ? '' : 'Hidden'}`, onClick: () => this.slideTo(MOVE_TO.slideToLeft) }, h("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M9 5l7 7-7 7" })))
147
+ ]));
148
+ }
149
+ get host() { return this; }
150
+ static get watchers() { return {
151
+ "selectedLevelId": ["levelsChangedHandler"]
152
+ }; }
153
+ static get style() { return elevateLevelListCss; }
154
+ }, [0, "elevate-level-list", {
155
+ "levels": [16],
156
+ "language": [1],
157
+ "selectedLevelId": [1537, "selected-level-id"],
158
+ "isShowSliderButton": [32],
159
+ "touchPosStart": [32],
160
+ "touchPosEnd": [32],
161
+ "offset": [32]
162
+ }, [[1, "touchstart", "onTouchStart"], [1, "touchmove", "onTouchMove"], [9, "resize", "handleResize"]]]);
163
+ function defineCustomElement() {
164
+ if (typeof customElements === "undefined") {
165
+ return;
166
+ }
167
+ const components = ["elevate-level-list"];
168
+ components.forEach(tagName => { switch (tagName) {
169
+ case "elevate-level-list":
170
+ if (!customElements.get(tagName)) {
171
+ customElements.define(tagName, ElevateLevelList);
172
+ }
173
+ break;
174
+ } });
175
+ }
176
+
177
+ export { ElevateLevelList as E, TRANSLATIONS as T, defineCustomElement as d, translate as t };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface ElevateLevelPresentation extends Components.ElevateLevelPresentation, HTMLElement {}
4
+ export const ElevateLevelPresentation: {
5
+ prototype: ElevateLevelPresentation;
6
+ new (): ElevateLevelPresentation;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { E as ElevateLevelPresentation$1, d as defineCustomElement$1 } from './elevate-level-presentation2.js';
2
+
3
+ const ElevateLevelPresentation = ElevateLevelPresentation$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { ElevateLevelPresentation, defineCustomElement };
@@ -0,0 +1,31 @@
1
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
+
3
+ const elevateLevelPresentationCss = ":host{display:block}.PriviliegeList{padding-inline-start:5px}.PriviliegeList li{display:flex}.PriviliegeList li .Img{width:80px}.PriviliegeList li .Img img{width:60px;margin:10px}.PriviliegeList li .Content h4{text-transform:capitalize;margin-block-start:10px}";
4
+
5
+ const ElevateLevelPresentation = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
6
+ constructor() {
7
+ super();
8
+ this.__registerHost();
9
+ }
10
+ render() {
11
+ return h(Host, null, h("div", { class: "Row Desc" }, h("h3", null, this.elevateLevel.presentation.displayName), h("p", null, h("span", { class: "TxtDesc", innerHTML: this.elevateLevel.presentation.description }))));
12
+ }
13
+ static get style() { return elevateLevelPresentationCss; }
14
+ }, [0, "elevate-level-presentation", {
15
+ "elevateLevel": [16]
16
+ }]);
17
+ function defineCustomElement() {
18
+ if (typeof customElements === "undefined") {
19
+ return;
20
+ }
21
+ const components = ["elevate-level-presentation"];
22
+ components.forEach(tagName => { switch (tagName) {
23
+ case "elevate-level-presentation":
24
+ if (!customElements.get(tagName)) {
25
+ customElements.define(tagName, ElevateLevelPresentation);
26
+ }
27
+ break;
28
+ } });
29
+ }
30
+
31
+ export { ElevateLevelPresentation as E, defineCustomElement as d };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface ElevateLevelsData extends Components.ElevateLevelsData, HTMLElement {}
4
+ export const ElevateLevelsData: {
5
+ prototype: ElevateLevelsData;
6
+ new (): ElevateLevelsData;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { E as ElevateLevelsData$1, d as defineCustomElement$1 } from './elevate-levels-data2.js';
2
+
3
+ const ElevateLevelsData = ElevateLevelsData$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { ElevateLevelsData, defineCustomElement };