@everymatrix/casino-engagement-suite-container 1.35.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 (49) hide show
  1. package/dist/casino-engagement-suite-container/casino-engagement-suite-container.esm.js +1 -0
  2. package/dist/casino-engagement-suite-container/index.esm.js +0 -0
  3. package/dist/casino-engagement-suite-container/p-94a35541.js +1 -0
  4. package/dist/casino-engagement-suite-container/p-fbddcb5b.entry.js +1 -0
  5. package/dist/cjs/casino-engagement-suite-bar_2.cjs.entry.js +246 -0
  6. package/dist/cjs/casino-engagement-suite-container.cjs.js +19 -0
  7. package/dist/cjs/index-e8d404e4.js +1242 -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 +19 -0
  11. package/dist/collection/components/casino-engagement-suite-container/casino-engagement-suite-container.css +36 -0
  12. package/dist/collection/components/casino-engagement-suite-container/casino-engagement-suite-container.js +218 -0
  13. package/dist/collection/index.js +1 -0
  14. package/dist/collection/models/casino-engagement-suite-config.js +15 -0
  15. package/dist/collection/utils/utils.js +24 -0
  16. package/dist/components/casino-engagement-suite-bar.js +6 -0
  17. package/dist/components/casino-engagement-suite-bar2.js +99 -0
  18. package/dist/components/casino-engagement-suite-container.d.ts +11 -0
  19. package/dist/components/casino-engagement-suite-container.js +202 -0
  20. package/dist/components/index.d.ts +26 -0
  21. package/dist/components/index.js +1 -0
  22. package/dist/esm/casino-engagement-suite-bar_2.entry.js +241 -0
  23. package/dist/esm/casino-engagement-suite-container.js +17 -0
  24. package/dist/esm/index-fef3ac09.js +1216 -0
  25. package/dist/esm/index.js +1 -0
  26. package/dist/esm/loader.js +17 -0
  27. package/dist/esm/polyfills/core-js.js +11 -0
  28. package/dist/esm/polyfills/css-shim.js +1 -0
  29. package/dist/esm/polyfills/dom.js +79 -0
  30. package/dist/esm/polyfills/es5-html-element.js +1 -0
  31. package/dist/esm/polyfills/index.js +34 -0
  32. package/dist/esm/polyfills/system.js +6 -0
  33. package/dist/index.cjs.js +1 -0
  34. package/dist/index.js +1 -0
  35. package/dist/stencil.config.js +22 -0
  36. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/casino-engagement-suite-container/.stencil/packages/casino-engagement-suite-container/stencil.config.d.ts +2 -0
  37. package/dist/types/components/casino-engagement-suite-container/casino-engagement-suite-container.d.ts +38 -0
  38. package/dist/types/components.d.ts +59 -0
  39. package/dist/types/index.d.ts +1 -0
  40. package/dist/types/models/casino-engagement-suite-config.d.ts +65 -0
  41. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  42. package/dist/types/utils/utils.d.ts +2 -0
  43. package/loader/cdn.js +3 -0
  44. package/loader/index.cjs.js +3 -0
  45. package/loader/index.d.ts +12 -0
  46. package/loader/index.es2017.js +3 -0
  47. package/loader/index.js +4 -0
  48. package/loader/package.json +10 -0
  49. package/package.json +19 -0
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-e8d404e4.js');
6
+
7
+ /*
8
+ Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
9
+ */
10
+ const patchEsm = () => {
11
+ return index.promiseResolve();
12
+ };
13
+
14
+ const defineCustomElements = (win, options) => {
15
+ if (typeof window === 'undefined') return Promise.resolve();
16
+ return patchEsm().then(() => {
17
+ return index.bootstrapLazy([["casino-engagement-suite-bar_2.cjs",[[1,"casino-engagement-suite-container",{"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"orientation":[32],"device":[32],"showChallengesList":[32],"challengePercent":[32],"limitStylingAppends":[32],"activeWidget":[32],"challenges":[32],"init":[64]},[[8,"message","handleEvent"]]],[1,"casino-engagement-suite-bar",{"activeWidget":[1537,"active-widget"],"challengePercent":[1,"challenge-percent"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"orientation":[1],"limitStylingAppends":[32]}]]]], options);
18
+ });
19
+ };
20
+
21
+ exports.defineCustomElements = defineCustomElements;
@@ -0,0 +1,19 @@
1
+ {
2
+ "entries": [
3
+ "./components/casino-engagement-suite-container/casino-engagement-suite-container.js"
4
+ ],
5
+ "compiler": {
6
+ "name": "@stencil/core",
7
+ "version": "2.15.2",
8
+ "typescriptVersion": "4.5.4"
9
+ },
10
+ "collections": [
11
+ {
12
+ "name": "@everymatrix/casino-engagement-suite-bar",
13
+ "tags": [
14
+ "casino-engagement-suite-bar"
15
+ ]
16
+ }
17
+ ],
18
+ "bundles": []
19
+ }
@@ -0,0 +1,36 @@
1
+ :host {
2
+ display: inline-block;
3
+ font-family: inherit;
4
+ }
5
+
6
+ .Backdrop {
7
+ padding: 20px 20px 20px 172px;
8
+ display: none;
9
+ position: fixed;
10
+ inset: 0;
11
+ height: 100dvh;
12
+ width: 100vw;
13
+ }
14
+ .Backdrop.Opened {
15
+ display: block;
16
+ }
17
+ .Backdrop .CasinoEngagementSuiteDialog {
18
+ height: calc(100dvh - 40px);
19
+ max-width: 600px;
20
+ }
21
+
22
+ .CasinoEngagementSuiteContainer.Portrait {
23
+ width: 100vw;
24
+ }
25
+ .CasinoEngagementSuiteContainer.Portrait .Backdrop {
26
+ padding: 104px 0 20px;
27
+ }
28
+ .CasinoEngagementSuiteContainer.Portrait .Backdrop .CasinoEngagementSuiteDialog {
29
+ max-width: initial;
30
+ padding: 0 4px;
31
+ margin: 0 auto;
32
+ height: calc(100dvh - 124px);
33
+ }
34
+ .CasinoEngagementSuiteContainer.Landscape.Mobile .CasinoEngagementSuiteDialog {
35
+ max-width: 366px;
36
+ }
@@ -0,0 +1,218 @@
1
+ import { Component, Element, h, Listen, Method, State, Prop } from '@stencil/core';
2
+ import '@everymatrix/casino-engagement-suite-bar';
3
+ import '@everymatrix/casino-engagement-suite-challenges-list';
4
+ import { ChallengeLevelProgressStatus, ChallengeProgressStatus } from '../../models/casino-engagement-suite-config';
5
+ import { getDeviceType, getScreenOrientation } from '../../utils/utils';
6
+ export class CasinoEngagementSuiteContainer {
7
+ constructor() {
8
+ /**
9
+ * Client custom styling via string
10
+ */
11
+ this.clientStyling = '';
12
+ /**
13
+ * Client custom styling via url
14
+ */
15
+ this.clientStylingUrl = '';
16
+ this.orientation = 'Landscape';
17
+ this.device = 'Mobile';
18
+ this.showChallengesList = false;
19
+ this.limitStylingAppends = false;
20
+ this.handleChallengeListClose = () => {
21
+ this.showChallengesList = false;
22
+ this.activeWidget = '';
23
+ };
24
+ this.orientationChangeHandler = () => {
25
+ this.orientation = getScreenOrientation();
26
+ };
27
+ this.setClientStyling = () => {
28
+ let sheet = document.createElement('style');
29
+ sheet.innerHTML = this.clientStyling;
30
+ this.host.prepend(sheet);
31
+ };
32
+ this.setClientStylingURL = () => {
33
+ let url = new URL(this.clientStylingUrl);
34
+ let cssFile = document.createElement('style');
35
+ fetch(url.href)
36
+ .then((res) => res.text())
37
+ .then((data) => {
38
+ cssFile.innerHTML = data;
39
+ setTimeout(() => { this.host.prepend(cssFile); }, 1);
40
+ })
41
+ .catch((err) => {
42
+ console.log('Error ', err);
43
+ });
44
+ };
45
+ }
46
+ handleEvent(e) {
47
+ const type = e.data.type;
48
+ switch (type) {
49
+ case 'ChallengeHasExpired': {
50
+ this.setChallengePercent();
51
+ break;
52
+ }
53
+ case 'BarChallengesClick': {
54
+ this.showChallengesList = true;
55
+ this.activeWidget = 'Challenges';
56
+ break;
57
+ }
58
+ case 'UpdateChallengeProgress': {
59
+ this.updateChallengeProgress(e.data.data);
60
+ }
61
+ }
62
+ }
63
+ componentDidLoad() {
64
+ this.orientation = getScreenOrientation();
65
+ this.device = getDeviceType();
66
+ window.screen.orientation.addEventListener('change', this.orientationChangeHandler);
67
+ }
68
+ componentDidRender() {
69
+ // start custom styling area
70
+ if (!this.limitStylingAppends && this.host) {
71
+ if (this.clientStyling)
72
+ this.setClientStyling();
73
+ if (this.clientStylingUrl)
74
+ this.setClientStylingURL();
75
+ this.limitStylingAppends = true;
76
+ }
77
+ // end custom styling area
78
+ }
79
+ disconnectedCallback() {
80
+ window.screen.orientation.removeEventListener('change', this.orientationChangeHandler);
81
+ }
82
+ /**
83
+ * Called to initialize widget
84
+ * @param config
85
+ */
86
+ async init(config) {
87
+ this.challenges = config.challenges;
88
+ this.setChallengePercent();
89
+ }
90
+ setChallengePercent() {
91
+ if (!this.challenges)
92
+ return;
93
+ const activeChallenge = this.challenges
94
+ .find(challenge => challenge.Status === ChallengeProgressStatus.InProgress);
95
+ if (activeChallenge) {
96
+ const activeLevel = activeChallenge.LevelProgresses
97
+ .find(progress => progress.ProgressStatus === ChallengeLevelProgressStatus.InProgress);
98
+ if (activeLevel) {
99
+ this.challengePercent = `${activeLevel.ProgressPercentage}%`;
100
+ }
101
+ }
102
+ else {
103
+ this.challengePercent = '—';
104
+ }
105
+ }
106
+ updateChallengeProgress(data) {
107
+ var _a;
108
+ const challenge = (_a = this.challenges) === null || _a === void 0 ? void 0 : _a.find(challenge => challenge.Id === data.ChallengeId);
109
+ if (challenge) {
110
+ challenge.LevelProgresses = data.LevelProgresses;
111
+ this.challenges = [...this.challenges];
112
+ }
113
+ this.setChallengePercent();
114
+ }
115
+ getChallengesWidgets() {
116
+ return h("div", { class: this.showChallengesList ? 'Backdrop Opened' : 'Backdrop' },
117
+ h("casino-engagement-suite-challenges-list", { device: this.device, class: "CasinoEngagementSuiteDialog", onClose: this.handleChallengeListClose, challenges: this.challenges }));
118
+ }
119
+ render() {
120
+ return h("div", { class: `CasinoEngagementSuiteContainer ${this.device} ${this.orientation}` },
121
+ h("casino-engagement-suite-bar", { orientation: this.orientation, "active-widget": this.activeWidget, "challenge-percent": this.challengePercent }),
122
+ this.challenges && this.getChallengesWidgets());
123
+ }
124
+ static get is() { return "casino-engagement-suite-container"; }
125
+ static get encapsulation() { return "shadow"; }
126
+ static get originalStyleUrls() { return {
127
+ "$": ["casino-engagement-suite-container.scss"]
128
+ }; }
129
+ static get styleUrls() { return {
130
+ "$": ["casino-engagement-suite-container.css"]
131
+ }; }
132
+ static get properties() { return {
133
+ "clientStyling": {
134
+ "type": "string",
135
+ "mutable": false,
136
+ "complexType": {
137
+ "original": "string",
138
+ "resolved": "string",
139
+ "references": {}
140
+ },
141
+ "required": false,
142
+ "optional": false,
143
+ "docs": {
144
+ "tags": [],
145
+ "text": "Client custom styling via string"
146
+ },
147
+ "attribute": "client-styling",
148
+ "reflect": true,
149
+ "defaultValue": "''"
150
+ },
151
+ "clientStylingUrl": {
152
+ "type": "string",
153
+ "mutable": false,
154
+ "complexType": {
155
+ "original": "string",
156
+ "resolved": "string",
157
+ "references": {}
158
+ },
159
+ "required": false,
160
+ "optional": false,
161
+ "docs": {
162
+ "tags": [],
163
+ "text": "Client custom styling via url"
164
+ },
165
+ "attribute": "client-styling-url",
166
+ "reflect": true,
167
+ "defaultValue": "''"
168
+ }
169
+ }; }
170
+ static get states() { return {
171
+ "orientation": {},
172
+ "device": {},
173
+ "showChallengesList": {},
174
+ "challengePercent": {},
175
+ "limitStylingAppends": {},
176
+ "activeWidget": {},
177
+ "challenges": {}
178
+ }; }
179
+ static get methods() { return {
180
+ "init": {
181
+ "complexType": {
182
+ "signature": "(config: CasinoEngagementSuiteConfig) => Promise<void>",
183
+ "parameters": [{
184
+ "tags": [{
185
+ "name": "param",
186
+ "text": "config"
187
+ }],
188
+ "text": ""
189
+ }],
190
+ "references": {
191
+ "Promise": {
192
+ "location": "global"
193
+ },
194
+ "CasinoEngagementSuiteConfig": {
195
+ "location": "import",
196
+ "path": "../../models/casino-engagement-suite-config"
197
+ }
198
+ },
199
+ "return": "Promise<void>"
200
+ },
201
+ "docs": {
202
+ "text": "Called to initialize widget",
203
+ "tags": [{
204
+ "name": "param",
205
+ "text": "config"
206
+ }]
207
+ }
208
+ }
209
+ }; }
210
+ static get elementRef() { return "host"; }
211
+ static get listeners() { return [{
212
+ "name": "message",
213
+ "method": "handleEvent",
214
+ "target": "window",
215
+ "capture": false,
216
+ "passive": false
217
+ }]; }
218
+ }
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,15 @@
1
+ export var ChallengeLevelProgressStatus;
2
+ (function (ChallengeLevelProgressStatus) {
3
+ ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["Closed"] = 0] = "Closed";
4
+ ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["InProgress"] = 1] = "InProgress";
5
+ ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["Fillup"] = 2] = "Fillup";
6
+ ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["Completed"] = 3] = "Completed";
7
+ })(ChallengeLevelProgressStatus || (ChallengeLevelProgressStatus = {}));
8
+ export var ChallengeProgressStatus;
9
+ (function (ChallengeProgressStatus) {
10
+ ChallengeProgressStatus[ChallengeProgressStatus["Started"] = 0] = "Started";
11
+ ChallengeProgressStatus[ChallengeProgressStatus["InProgress"] = 1] = "InProgress";
12
+ ChallengeProgressStatus[ChallengeProgressStatus["PendingLevelReward"] = 2] = "PendingLevelReward";
13
+ ChallengeProgressStatus[ChallengeProgressStatus["Completed"] = 3] = "Completed";
14
+ ChallengeProgressStatus[ChallengeProgressStatus["Expired"] = 4] = "Expired";
15
+ })(ChallengeProgressStatus || (ChallengeProgressStatus = {}));
@@ -0,0 +1,24 @@
1
+ export function getDeviceType() {
2
+ const userAgent = navigator.userAgent.toLowerCase();
3
+ const width = screen.availWidth;
4
+ const height = screen.availHeight;
5
+ if (userAgent.includes('iphone')) {
6
+ return 'Mobile';
7
+ }
8
+ if (userAgent.includes('ipad')) {
9
+ return 'Tablet';
10
+ }
11
+ if (userAgent.includes('android')) {
12
+ if (height > width && width < 800) {
13
+ return 'Mobile';
14
+ }
15
+ if (width > height && height < 800) {
16
+ return 'Tablet';
17
+ }
18
+ }
19
+ return 'Desktop';
20
+ }
21
+ export function getScreenOrientation() {
22
+ const orientation = window.screen.orientation.type;
23
+ return orientation.includes('portrait') ? 'Portrait' : 'Landscape';
24
+ }
@@ -0,0 +1,6 @@
1
+ import { C as CasinoEngagementSuiteBar$1, d as defineCustomElement$1 } from './casino-engagement-suite-bar2.js';
2
+
3
+ const CasinoEngagementSuiteBar = CasinoEngagementSuiteBar$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { CasinoEngagementSuiteBar, defineCustomElement };
@@ -0,0 +1,99 @@
1
+ import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
+
3
+ const casinoEngagementSuiteBarCss = "@import url(\"https://fonts.googleapis.com/css2?family=Montserrat:wght@600;700;900&display=swap\"); :host{display:block}*{box-sizing:border-box}.CasinoEngagementSuiteBar{height:100vh;background-color:var(--emw--color-background, #1E1638);color:var(--emw--color-typography, #FFF)}.CasinoEngagementSuiteBar .EngagementSuiteContainer{display:flex;align-items:center;gap:4px}.CasinoEngagementSuiteBar .EngagementSuiteContainer .Tile{background-color:var(--emw--color-primary, #251D3E);border-radius:var(--emw--border-radius-medium, 4px);display:flex;flex-direction:row;align-items:center;justify-content:center;position:relative;font-weight:var(--emw--font-weight-semibold, 600);font-size:var(--emw--font-size-x-small, 12px);font-family:\"Montserrat\", sans-serif;color:var(--emw--color-typography, #FFF)}.CasinoEngagementSuiteBar .EngagementSuiteContainer .Tile::before{content:\"\";position:absolute;inset:0;border-radius:var(--emw--border-radius-medium, 4px);padding:1px;background:linear-gradient(0deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.1) 100%);-webkit-mask:linear-gradient(#FFF 0 0) content-box, linear-gradient(#FFF 0 0);-webkit-mask-composite:xor;mask-composite:exclude}.CasinoEngagementSuiteBar .EngagementSuiteContainer .Jackpots,.CasinoEngagementSuiteBar .EngagementSuiteContainer .Rewards{display:flex;flex-direction:column;gap:4px}.CasinoEngagementSuiteBar .EngagementSuiteContainer .Jackpot{padding:14px 8px}.CasinoEngagementSuiteBar .EngagementSuiteContainer .Jackpots .Mega{background:linear-gradient(180deg, #FFB801 15.86%, #FEF746 31.36%, #FBFFE0 36.86%, #FFFA60 47.86%, #FF9400 87.36%);-webkit-text-fill-color:transparent;-webkit-background-clip:text;font-weight:var(--emw--font-weight-bold, 800)}.CasinoEngagementSuiteBar .EngagementSuiteContainer .Reward{justify-content:space-between;padding:8px;cursor:pointer;border:none}.CasinoEngagementSuiteBar .EngagementSuiteContainer .Reward.Active::before{background:linear-gradient(143.2deg, #FF9401 -0.41%, #FFD32D 45.61%, #2D2545 82.77%)}.CasinoEngagementSuiteBar .EngagementSuiteContainer .RewardIcon{width:24px;height:24px;background-size:100%;background-position:center}.Tile.Leaderboard .RewardIcon{background-image:url(\"https://static.everymatrix.com/gic/img/engagement-suite/bar/leaderboard.svg\")}.Tile.Leaderboard.Active .RewardIcon{background-image:url(\"https://static.everymatrix.com/gic/img/engagement-suite/bar/leaderboard-pressed.svg\")}.Tile.Challenges .RewardIcon{background:center 100% url(\"https://static.everymatrix.com/gic/img/engagement-suite/bar/challenge.svg\")}.Tile.Challenges.Active .RewardIcon{background-image:url(\"https://static.everymatrix.com/gic/img/engagement-suite/bar/challenge-pressed.svg\")}.Tile.Luckywheel .RewardIcon{background:center 100% url(\"https://static.everymatrix.com/gic/img/engagement-suite/bar/luckywheel.svg\")}.Tile.Luckywheel.Active .RewardIcon{background-image:url(\"https://static.everymatrix.com/gic/img/engagement-suite/bar/luckywheel-pressed.svg\")}.Tile.Freespins .RewardIcon{background:center 100% url(\"https://static.everymatrix.com/gic/img/engagement-suite/bar/freespins.svg\")}.Tile.Freespins.Active .RewardIcon{background-image:url(\"https://static.everymatrix.com/gic/img/engagement-suite/bar/freespins-pressed.svg\")}.Landscape.CasinoEngagementSuiteBar{width:152px;padding-top:16px;box-shadow:0 4px 4px 0 #00000040, 8px 0 10px 0 #0000004D}.Landscape.CasinoEngagementSuiteBar .EngagementSuiteContainer{flex-direction:column}.Landscape.CasinoEngagementSuiteBar .EngagementSuiteContainer .Tile{width:120px;height:40px}.Portrait.CasinoEngagementSuiteBar{border-radius:0 0 var(--emw--border-radius-medium, 4px) var(--emw--border-radius-medium, 4px);height:auto;padding:10px;box-shadow:0 4px 4px 0 #00000040, 8px 0 10px 0 #0000004D}.Portrait.CasinoEngagementSuiteBar .EngagementSuiteContainer{gap:8px;flex-wrap:wrap}.Portrait.CasinoEngagementSuiteBar .EngagementSuiteContainer .Jackpots,.Portrait.CasinoEngagementSuiteBar .EngagementSuiteContainer .Rewards{width:100%;flex-direction:row;gap:8px}.Portrait.CasinoEngagementSuiteBar .EngagementSuiteContainer .Tile{flex:1 1 0px;height:32px}.Portrait.CasinoEngagementSuiteBar .EngagementSuiteContainer .Jackpot{padding:10px 8px}.Portrait.CasinoEngagementSuiteBar .EngagementSuiteContainer .Reward{padding:4px 8px}";
4
+
5
+ const CasinoEngagementSuiteBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
6
+ constructor() {
7
+ super();
8
+ this.__registerHost();
9
+ this.__attachShadow();
10
+ /**
11
+ * Client custom styling via string
12
+ */
13
+ this.clientStyling = '';
14
+ /**
15
+ * Client custom styling via url
16
+ */
17
+ this.clientStylingUrl = '';
18
+ /**
19
+ * Orientation of the widget
20
+ */
21
+ this.orientation = 'Landscape';
22
+ this.limitStylingAppends = false;
23
+ this.handleTileClick = (ev) => {
24
+ const application = ev.target.getAttribute('data-app');
25
+ window.postMessage({ type: `Bar${application}Click` });
26
+ this.activeWidget = application;
27
+ };
28
+ this.setClientStyling = () => {
29
+ let sheet = document.createElement('style');
30
+ sheet.innerHTML = this.clientStyling;
31
+ this.engagementSuiteBar.prepend(sheet);
32
+ };
33
+ this.setClientStylingURL = () => {
34
+ let url = new URL(this.clientStylingUrl);
35
+ let cssFile = document.createElement('style');
36
+ fetch(url.href)
37
+ .then((res) => res.text())
38
+ .then((data) => {
39
+ cssFile.innerHTML = data;
40
+ setTimeout(() => { this.engagementSuiteBar.prepend(cssFile); }, 1);
41
+ })
42
+ .catch((err) => {
43
+ console.log('Error ', err);
44
+ });
45
+ };
46
+ }
47
+ componentDidRender() {
48
+ // start custom styling area
49
+ if (!this.limitStylingAppends && this.engagementSuiteBar) {
50
+ if (this.clientStyling)
51
+ this.setClientStyling();
52
+ if (this.clientStylingUrl)
53
+ this.setClientStylingURL();
54
+ this.limitStylingAppends = true;
55
+ }
56
+ // end custom styling area
57
+ }
58
+ getChallengeTile() {
59
+ return this.challengePercent
60
+ ? (h("button", { class: `Tile Reward Challenges ${this.activeWidget === 'Challenges' ? 'Active' : ''}`, "data-app": "Challenges", onClick: this.handleTileClick }, h("div", { class: "RewardIcon" }), h("span", null, this.challengePercent)))
61
+ : '';
62
+ }
63
+ render() {
64
+ /**
65
+ * These constants are used only to verify the correct rendering of our widget.
66
+ * In future development, all of this data will be fetched from the backend.
67
+ */
68
+ const megaItem = '$ 988,900,000';
69
+ const majorItem = '$ 77,900,000';
70
+ const minorItem = '$ 3,900,000';
71
+ const leaderboardItem = '4 / 120';
72
+ const luckywheelItem = '5';
73
+ const freespinsItem = '17';
74
+ return h("div", { class: `CasinoEngagementSuiteBar ${this.orientation}`, ref: (el) => (this.engagementSuiteBar = el) }, h("div", { class: "EngagementSuiteContainer" }, h("div", { class: "Jackpots" }, h("div", { class: "Tile Jackpot" }, h("span", { class: "Mega" }, megaItem)), h("div", { class: "Tile Jackpot" }, h("span", { class: "Major" }, majorItem)), h("div", { class: "Tile Jackpot" }, h("span", { class: "Minor" }, minorItem))), h("div", { class: "Rewards" }, h("button", { class: `Tile Reward Leaderboard ${this.activeWidget === 'Leaderboard' ? 'Active' : ''}`, "data-app": "Leaderboard", onClick: this.handleTileClick }, h("div", { class: "RewardIcon" }), h("span", null, leaderboardItem)), h("button", { class: `Tile Reward Luckywheel ${this.activeWidget === 'Luckywheel' ? 'Active' : ''}`, "data-app": "Luckywheel", onClick: this.handleTileClick }, h("div", { class: "RewardIcon" }), h("span", null, luckywheelItem)), this.getChallengeTile(), h("button", { class: `Tile Reward Freespins ${this.activeWidget === 'Freespins' ? 'Active' : ''}`, "data-app": "Freespins", onClick: this.handleTileClick }, h("div", { class: "RewardIcon" }), h("span", null, freespinsItem)))));
75
+ }
76
+ static get style() { return casinoEngagementSuiteBarCss; }
77
+ }, [1, "casino-engagement-suite-bar", {
78
+ "activeWidget": [1537, "active-widget"],
79
+ "challengePercent": [1, "challenge-percent"],
80
+ "clientStyling": [513, "client-styling"],
81
+ "clientStylingUrl": [513, "client-styling-url"],
82
+ "orientation": [1],
83
+ "limitStylingAppends": [32]
84
+ }]);
85
+ function defineCustomElement() {
86
+ if (typeof customElements === "undefined") {
87
+ return;
88
+ }
89
+ const components = ["casino-engagement-suite-bar"];
90
+ components.forEach(tagName => { switch (tagName) {
91
+ case "casino-engagement-suite-bar":
92
+ if (!customElements.get(tagName)) {
93
+ customElements.define(tagName, CasinoEngagementSuiteBar);
94
+ }
95
+ break;
96
+ } });
97
+ }
98
+
99
+ export { CasinoEngagementSuiteBar as C, defineCustomElement as d };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface CasinoEngagementSuiteContainer extends Components.CasinoEngagementSuiteContainer, HTMLElement {}
4
+ export const CasinoEngagementSuiteContainer: {
5
+ prototype: CasinoEngagementSuiteContainer;
6
+ new (): CasinoEngagementSuiteContainer;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,202 @@
1
+ import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
+ import '@everymatrix/casino-engagement-suite-challenges-list';
3
+ import { d as defineCustomElement$2 } from './casino-engagement-suite-bar2.js';
4
+
5
+ var ChallengeLevelProgressStatus;
6
+ (function (ChallengeLevelProgressStatus) {
7
+ ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["Closed"] = 0] = "Closed";
8
+ ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["InProgress"] = 1] = "InProgress";
9
+ ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["Fillup"] = 2] = "Fillup";
10
+ ChallengeLevelProgressStatus[ChallengeLevelProgressStatus["Completed"] = 3] = "Completed";
11
+ })(ChallengeLevelProgressStatus || (ChallengeLevelProgressStatus = {}));
12
+ var ChallengeProgressStatus;
13
+ (function (ChallengeProgressStatus) {
14
+ ChallengeProgressStatus[ChallengeProgressStatus["Started"] = 0] = "Started";
15
+ ChallengeProgressStatus[ChallengeProgressStatus["InProgress"] = 1] = "InProgress";
16
+ ChallengeProgressStatus[ChallengeProgressStatus["PendingLevelReward"] = 2] = "PendingLevelReward";
17
+ ChallengeProgressStatus[ChallengeProgressStatus["Completed"] = 3] = "Completed";
18
+ ChallengeProgressStatus[ChallengeProgressStatus["Expired"] = 4] = "Expired";
19
+ })(ChallengeProgressStatus || (ChallengeProgressStatus = {}));
20
+
21
+ function getDeviceType() {
22
+ const userAgent = navigator.userAgent.toLowerCase();
23
+ const width = screen.availWidth;
24
+ const height = screen.availHeight;
25
+ if (userAgent.includes('iphone')) {
26
+ return 'Mobile';
27
+ }
28
+ if (userAgent.includes('ipad')) {
29
+ return 'Tablet';
30
+ }
31
+ if (userAgent.includes('android')) {
32
+ if (height > width && width < 800) {
33
+ return 'Mobile';
34
+ }
35
+ if (width > height && height < 800) {
36
+ return 'Tablet';
37
+ }
38
+ }
39
+ return 'Desktop';
40
+ }
41
+ function getScreenOrientation() {
42
+ const orientation = window.screen.orientation.type;
43
+ return orientation.includes('portrait') ? 'Portrait' : 'Landscape';
44
+ }
45
+
46
+ const casinoEngagementSuiteContainerCss = ":host{display:inline-block;font-family:inherit}.Backdrop{padding:20px 20px 20px 172px;display:none;position:fixed;inset:0;height:100dvh;width:100vw}.Backdrop.Opened{display:block}.Backdrop .CasinoEngagementSuiteDialog{height:calc(100dvh - 40px);max-width:600px}.CasinoEngagementSuiteContainer.Portrait{width:100vw}.CasinoEngagementSuiteContainer.Portrait .Backdrop{padding:104px 0 20px}.CasinoEngagementSuiteContainer.Portrait .Backdrop .CasinoEngagementSuiteDialog{max-width:initial;padding:0 4px;margin:0 auto;height:calc(100dvh - 124px)}.CasinoEngagementSuiteContainer.Landscape.Mobile .CasinoEngagementSuiteDialog{max-width:366px}";
47
+
48
+ const CasinoEngagementSuiteContainer$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
49
+ constructor() {
50
+ super();
51
+ this.__registerHost();
52
+ this.__attachShadow();
53
+ /**
54
+ * Client custom styling via string
55
+ */
56
+ this.clientStyling = '';
57
+ /**
58
+ * Client custom styling via url
59
+ */
60
+ this.clientStylingUrl = '';
61
+ this.orientation = 'Landscape';
62
+ this.device = 'Mobile';
63
+ this.showChallengesList = false;
64
+ this.limitStylingAppends = false;
65
+ this.handleChallengeListClose = () => {
66
+ this.showChallengesList = false;
67
+ this.activeWidget = '';
68
+ };
69
+ this.orientationChangeHandler = () => {
70
+ this.orientation = getScreenOrientation();
71
+ };
72
+ this.setClientStyling = () => {
73
+ let sheet = document.createElement('style');
74
+ sheet.innerHTML = this.clientStyling;
75
+ this.host.prepend(sheet);
76
+ };
77
+ this.setClientStylingURL = () => {
78
+ let url = new URL(this.clientStylingUrl);
79
+ let cssFile = document.createElement('style');
80
+ fetch(url.href)
81
+ .then((res) => res.text())
82
+ .then((data) => {
83
+ cssFile.innerHTML = data;
84
+ setTimeout(() => { this.host.prepend(cssFile); }, 1);
85
+ })
86
+ .catch((err) => {
87
+ console.log('Error ', err);
88
+ });
89
+ };
90
+ }
91
+ handleEvent(e) {
92
+ const type = e.data.type;
93
+ switch (type) {
94
+ case 'ChallengeHasExpired': {
95
+ this.setChallengePercent();
96
+ break;
97
+ }
98
+ case 'BarChallengesClick': {
99
+ this.showChallengesList = true;
100
+ this.activeWidget = 'Challenges';
101
+ break;
102
+ }
103
+ case 'UpdateChallengeProgress': {
104
+ this.updateChallengeProgress(e.data.data);
105
+ }
106
+ }
107
+ }
108
+ componentDidLoad() {
109
+ this.orientation = getScreenOrientation();
110
+ this.device = getDeviceType();
111
+ window.screen.orientation.addEventListener('change', this.orientationChangeHandler);
112
+ }
113
+ componentDidRender() {
114
+ // start custom styling area
115
+ if (!this.limitStylingAppends && this.host) {
116
+ if (this.clientStyling)
117
+ this.setClientStyling();
118
+ if (this.clientStylingUrl)
119
+ this.setClientStylingURL();
120
+ this.limitStylingAppends = true;
121
+ }
122
+ // end custom styling area
123
+ }
124
+ disconnectedCallback() {
125
+ window.screen.orientation.removeEventListener('change', this.orientationChangeHandler);
126
+ }
127
+ /**
128
+ * Called to initialize widget
129
+ * @param config
130
+ */
131
+ async init(config) {
132
+ this.challenges = config.challenges;
133
+ this.setChallengePercent();
134
+ }
135
+ setChallengePercent() {
136
+ if (!this.challenges)
137
+ return;
138
+ const activeChallenge = this.challenges
139
+ .find(challenge => challenge.Status === ChallengeProgressStatus.InProgress);
140
+ if (activeChallenge) {
141
+ const activeLevel = activeChallenge.LevelProgresses
142
+ .find(progress => progress.ProgressStatus === ChallengeLevelProgressStatus.InProgress);
143
+ if (activeLevel) {
144
+ this.challengePercent = `${activeLevel.ProgressPercentage}%`;
145
+ }
146
+ }
147
+ else {
148
+ this.challengePercent = '—';
149
+ }
150
+ }
151
+ updateChallengeProgress(data) {
152
+ var _a;
153
+ const challenge = (_a = this.challenges) === null || _a === void 0 ? void 0 : _a.find(challenge => challenge.Id === data.ChallengeId);
154
+ if (challenge) {
155
+ challenge.LevelProgresses = data.LevelProgresses;
156
+ this.challenges = [...this.challenges];
157
+ }
158
+ this.setChallengePercent();
159
+ }
160
+ getChallengesWidgets() {
161
+ return h("div", { class: this.showChallengesList ? 'Backdrop Opened' : 'Backdrop' }, h("casino-engagement-suite-challenges-list", { device: this.device, class: "CasinoEngagementSuiteDialog", onClose: this.handleChallengeListClose, challenges: this.challenges }));
162
+ }
163
+ render() {
164
+ return h("div", { class: `CasinoEngagementSuiteContainer ${this.device} ${this.orientation}` }, h("casino-engagement-suite-bar", { orientation: this.orientation, "active-widget": this.activeWidget, "challenge-percent": this.challengePercent }), this.challenges && this.getChallengesWidgets());
165
+ }
166
+ get host() { return this; }
167
+ static get style() { return casinoEngagementSuiteContainerCss; }
168
+ }, [1, "casino-engagement-suite-container", {
169
+ "clientStyling": [513, "client-styling"],
170
+ "clientStylingUrl": [513, "client-styling-url"],
171
+ "orientation": [32],
172
+ "device": [32],
173
+ "showChallengesList": [32],
174
+ "challengePercent": [32],
175
+ "limitStylingAppends": [32],
176
+ "activeWidget": [32],
177
+ "challenges": [32],
178
+ "init": [64]
179
+ }, [[8, "message", "handleEvent"]]]);
180
+ function defineCustomElement$1() {
181
+ if (typeof customElements === "undefined") {
182
+ return;
183
+ }
184
+ const components = ["casino-engagement-suite-container", "casino-engagement-suite-bar"];
185
+ components.forEach(tagName => { switch (tagName) {
186
+ case "casino-engagement-suite-container":
187
+ if (!customElements.get(tagName)) {
188
+ customElements.define(tagName, CasinoEngagementSuiteContainer$1);
189
+ }
190
+ break;
191
+ case "casino-engagement-suite-bar":
192
+ if (!customElements.get(tagName)) {
193
+ defineCustomElement$2();
194
+ }
195
+ break;
196
+ } });
197
+ }
198
+
199
+ const CasinoEngagementSuiteContainer = CasinoEngagementSuiteContainer$1;
200
+ const defineCustomElement = defineCustomElement$1;
201
+
202
+ export { CasinoEngagementSuiteContainer, defineCustomElement };