@everymatrix/casino-engagement-suite-luckywheel 0.2.0 → 0.2.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.
- package/dist/casino-engagement-suite-luckywheel/casino-engagement-suite-luckywheel.esm.js +1 -1
- package/dist/casino-engagement-suite-luckywheel/index.esm.js +1 -1
- package/dist/casino-engagement-suite-luckywheel/p-7d1170ae.js +2 -0
- package/dist/casino-engagement-suite-luckywheel/p-927567e0.js +15 -0
- package/dist/casino-engagement-suite-luckywheel/p-d8bd2f95.entry.js +1 -0
- package/dist/cjs/{casino-engagement-suite-luckywheel-cc8d37c2.js → casino-engagement-suite-luckywheel-9aaa09f9.js} +49 -80
- package/dist/cjs/casino-engagement-suite-luckywheel.cjs.entry.js +2 -2
- package/dist/cjs/casino-engagement-suite-luckywheel.cjs.js +2 -2
- package/dist/cjs/{index-b46604f4.js → index-6096cc4b.js} +70 -207
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/casino-engagement-suite-luckywheel/casino-engagement-suite-luckywheel.js +37 -77
- package/dist/collection/utils/utils.js +11 -11
- package/dist/esm/{casino-engagement-suite-luckywheel-cf7e798a.js → casino-engagement-suite-luckywheel-88d531c4.js} +49 -80
- package/dist/esm/casino-engagement-suite-luckywheel.entry.js +2 -2
- package/dist/esm/casino-engagement-suite-luckywheel.js +3 -3
- package/dist/esm/{index-8ce51859.js → index-48c42d04.js} +70 -207
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +2 -2
- package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/packages/stencil/casino-engagement-suite-luckywheel/stencil.config.d.ts +2 -0
- package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/packages/stencil/casino-engagement-suite-luckywheel/stencil.config.dev.d.ts +2 -0
- package/dist/types/components/casino-engagement-suite-luckywheel/casino-engagement-suite-luckywheel.d.ts +0 -1
- package/dist/types/models/luckywheel.d.ts +24 -24
- package/dist/types/stencil-public-runtime.d.ts +0 -6
- package/dist/types/utils/types.d.ts +4 -4
- package/package.json +1 -1
- package/dist/casino-engagement-suite-luckywheel/p-2a6e103b.entry.js +0 -1
- package/dist/casino-engagement-suite-luckywheel/p-781c5f2a.js +0 -1
- package/dist/casino-engagement-suite-luckywheel/p-eaad80fd.js +0 -2
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/packages/stencil/casino-engagement-suite-luckywheel/stencil.config.d.ts +0 -2
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/packages/stencil/casino-engagement-suite-luckywheel/stencil.config.dev.d.ts +0 -2
- /package/dist/types/Users/{adrian.pripon/Documents/Work → maria.bumbar/Desktop}/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/packages/stencil/casino-engagement-suite-luckywheel/storybook/main.d.ts +0 -0
- /package/dist/types/Users/{adrian.pripon/Documents/Work → maria.bumbar/Desktop}/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/packages/stencil/casino-engagement-suite-luckywheel/storybook/preview.d.ts +0 -0
- /package/dist/types/Users/{adrian.pripon/Documents/Work → maria.bumbar/Desktop}/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/tools/plugins/index.d.ts +0 -0
- /package/dist/types/Users/{adrian.pripon/Documents/Work → maria.bumbar/Desktop}/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +0 -0
- /package/dist/types/Users/{adrian.pripon/Documents/Work → maria.bumbar/Desktop}/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/tools/plugins/vite-chunk-plugin.d.ts +0 -0
- /package/dist/types/Users/{adrian.pripon/Documents/Work → maria.bumbar/Desktop}/widgets-monorepo/packages/stencil/casino-engagement-suite-luckywheel/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +0 -0
|
@@ -2,39 +2,10 @@ import { __rest } from "tslib";
|
|
|
2
2
|
import { h } from "@stencil/core";
|
|
3
3
|
import { SvgCalc } from "../../utils/class.svgcalc";
|
|
4
4
|
import { Lang } from "../../utils/types";
|
|
5
|
-
import { getOptions,
|
|
5
|
+
import { getOptions, setProps } from "../../utils/utils";
|
|
6
6
|
import { Spinner } from "../../utils/class.spinner";
|
|
7
7
|
export class CasinoEngagementSuiteLuckywheel {
|
|
8
8
|
constructor() {
|
|
9
|
-
/**
|
|
10
|
-
* Client custom styling via string
|
|
11
|
-
*/
|
|
12
|
-
this.clientStyling = '';
|
|
13
|
-
/**
|
|
14
|
-
* Client custom styling via url
|
|
15
|
-
*/
|
|
16
|
-
this.clientStylingUrl = '';
|
|
17
|
-
/**
|
|
18
|
-
* Language of the widget
|
|
19
|
-
*/
|
|
20
|
-
this.language = 'en';
|
|
21
|
-
/**
|
|
22
|
-
* User's device type
|
|
23
|
-
*/
|
|
24
|
-
this.device = 'Mobile';
|
|
25
|
-
/**
|
|
26
|
-
* Wheel size
|
|
27
|
-
*/
|
|
28
|
-
this.size = '440';
|
|
29
|
-
/**
|
|
30
|
-
* Content Direction
|
|
31
|
-
*/
|
|
32
|
-
this.contentdirection = 'anticlockwise';
|
|
33
|
-
this.limitStylingAppends = false;
|
|
34
|
-
this.isPartitionsCustomableReady = false;
|
|
35
|
-
this.isSpinning = false;
|
|
36
|
-
this.radius = 0.85 * Number(this.size) / 2;
|
|
37
|
-
this.speed = 0;
|
|
38
9
|
this.setClientStyling = () => {
|
|
39
10
|
let sheet = document.createElement('style');
|
|
40
11
|
sheet.innerHTML = this.clientStyling;
|
|
@@ -54,14 +25,14 @@ export class CasinoEngagementSuiteLuckywheel {
|
|
|
54
25
|
});
|
|
55
26
|
};
|
|
56
27
|
this.renderImage = (node, index) => {
|
|
57
|
-
const image = this.options[index].
|
|
28
|
+
const image = this.options[index].Image;
|
|
58
29
|
setProps(image, this.settings.getSvgImageProps(index));
|
|
59
30
|
node.innerHTML = null;
|
|
60
31
|
node.appendChild(image);
|
|
61
32
|
};
|
|
62
33
|
this.updateSpinable = () => {
|
|
63
|
-
if (!!this.luckywheel.
|
|
64
|
-
if (Number(this.luckywheel.
|
|
34
|
+
if (!!this.luckywheel.Current) {
|
|
35
|
+
if (Number(this.luckywheel.Current.RemainingTimes) > 0) {
|
|
65
36
|
this.spinable = true;
|
|
66
37
|
return;
|
|
67
38
|
}
|
|
@@ -81,40 +52,43 @@ export class CasinoEngagementSuiteLuckywheel {
|
|
|
81
52
|
this.spinner.launch();
|
|
82
53
|
window.postMessage({
|
|
83
54
|
type: 'SpinLuckyWheel',
|
|
84
|
-
|
|
55
|
+
data: {
|
|
56
|
+
lotteryProgramID: this.luckywheel.Program.Id,
|
|
57
|
+
}
|
|
85
58
|
});
|
|
86
|
-
// todo: this code below simulates the server response,
|
|
87
|
-
// delete after implementation with GLС
|
|
88
|
-
setTimeout(() => {
|
|
89
|
-
window.postMessage({
|
|
90
|
-
type: 'SpinLuckyWheelRes',
|
|
91
|
-
data: {
|
|
92
|
-
item: { result: { wheelOfFortunePartitionIndex: 1 } },
|
|
93
|
-
success: false
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
}, 2500);
|
|
97
|
-
};
|
|
98
|
-
this.handleSpinClick = () => {
|
|
99
|
-
if (isSafari()) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
this.eventSpin();
|
|
103
59
|
};
|
|
60
|
+
this.clientStyling = '';
|
|
61
|
+
this.clientStylingUrl = '';
|
|
62
|
+
this.language = 'en';
|
|
63
|
+
this.device = 'Mobile';
|
|
64
|
+
this.luckywheel = undefined;
|
|
65
|
+
this.size = '440';
|
|
66
|
+
this.contentdirection = 'anticlockwise';
|
|
67
|
+
this.limitStylingAppends = false;
|
|
68
|
+
this.isPartitionsCustomableReady = false;
|
|
69
|
+
this.isSpinning = false;
|
|
70
|
+
this.options = undefined;
|
|
71
|
+
this.radius = 0.85 * Number(this.size) / 2;
|
|
72
|
+
this.speed = 0;
|
|
73
|
+
this.settings = undefined;
|
|
74
|
+
this.svg = undefined;
|
|
75
|
+
this.spinContainer = undefined;
|
|
76
|
+
this.spinable = undefined;
|
|
77
|
+
this.spinner = undefined;
|
|
104
78
|
}
|
|
105
79
|
handleEvent(e) {
|
|
106
80
|
const _a = e === null || e === void 0 ? void 0 : e.data, { type } = _a, rest = __rest(_a, ["type"]);
|
|
107
81
|
switch (type) {
|
|
108
82
|
case 'SpinLuckyWheelRes':
|
|
109
|
-
this.spinner.halt(this.settings.getDeg(rest.data.
|
|
83
|
+
this.spinner.halt(this.settings.getDeg(rest.data.Result.WheelOfFortunePartitionIndex), () => {
|
|
110
84
|
this.isSpinning = false;
|
|
111
85
|
this.updateSpinable();
|
|
112
|
-
const prizeText = this.luckywheel.
|
|
86
|
+
const prizeText = this.luckywheel.Program.WheelOfFortune.Partitions[rest.data.Result.WheelOfFortunePartitionIndex].PrizeText;
|
|
113
87
|
window.postMessage({
|
|
114
88
|
type: 'ShowLuckywheelRewardModal',
|
|
115
89
|
data: {
|
|
116
90
|
PrizeMessage: prizeText['en'] || prizeText['*'],
|
|
117
|
-
HasError: rest.
|
|
91
|
+
HasError: rest.success,
|
|
118
92
|
}
|
|
119
93
|
});
|
|
120
94
|
});
|
|
@@ -163,20 +137,20 @@ export class CasinoEngagementSuiteLuckywheel {
|
|
|
163
137
|
render() {
|
|
164
138
|
const sizeProps = { height: this.size, width: this.size };
|
|
165
139
|
const foreignObjectAgentProps = { 'height': `${this.size}px`, 'width': `${this.size}px` };
|
|
166
|
-
return (h("div", { key: '
|
|
140
|
+
return (h("div", { key: '014cf34ad67ed718b064797ec5497f93cd8e8fc8', class: `WheelContainer ${this.device}`, style: this.defineGeneralVariables() }, h("svg", { key: 'b7eedc15f6290740b3cfa85b784dcb3ed6c59b9b', width: this.size, height: this.size, ref: (el) => { this.svg = el; } }, h("foreignObject", Object.assign({ key: 'ae62d34ee98360bd6da52cad54819813fb714555' }, sizeProps, { class: "Bottom Customable" }), h("div", { key: 'ec3ae09161a1a20956ebf9bb91340c3f77647770', style: foreignObjectAgentProps })), h("g", Object.assign({ key: 'ca9edc54e36206aaf04d8645efa9aeb8b2a7aa9a', class: "PartitionsContainer" }, this.settings.getSpinnerProps()), h("g", { key: '99ca797756be5a290f0951127904489ad6b21c9e', class: "PartitionsBackgrounds" }, this.options.map((_el, index) => {
|
|
167
141
|
return (h("foreignObject", { "clip-path": `url(#clip${index})`, class: "PartitionBackground Customable", style: { '--index': index.toString() }, width: this.size, height: this.size }, h("div", { style: foreignObjectAgentProps })));
|
|
168
|
-
})), h("g", { key: '
|
|
142
|
+
})), h("g", { key: 'b197f9f51c2a8a1b2337ae180b987ad0896d42ae', class: "PartitionsBackgroundStrokes" }, this.options.map((_el, index) => {
|
|
169
143
|
return (h("path", Object.assign({ class: "PartitionBackgroundStroke" }, this.settings.getPartitionDraw(index), { width: this.size, height: this.size })));
|
|
170
|
-
})), h("g", { key: '
|
|
144
|
+
})), h("g", { key: '00435c08f614ae78ab63d2f9fee0c81ff29730ac', class: "Partitions", style: { filter: this.speed > 0.3 ? `blur(${this.speed}px)` : '' } }, this.options.map((el, index) => {
|
|
171
145
|
return ([
|
|
172
|
-
el.
|
|
173
|
-
el.
|
|
146
|
+
el.Image && (h("g", { class: `PartitionImage PartitionImage${index}`, ref: (el) => this.renderImage(el, index) })),
|
|
147
|
+
el.Name && (h("foreignObject", Object.assign({ class: "PartitionText" }, this.settings.getSvgTextPropsAdjustedByImage(index)), h("div", { class: "PartitionTextEntityContainer" }, h("p", { class: `PartitionTextEntity${this.settings.contentdirection === 'clockwise' ? '' : ' Anticlockwise'}`, innerHTML: el.Name }))))
|
|
174
148
|
]);
|
|
175
|
-
}))), h("g", { key: '
|
|
149
|
+
}))), h("g", { key: 'a89ea859fd16d72ec6a38c780548a4aade0b26db', class: { 'active': this.isPartitionsCustomableReady, 'PartitionsCustomable1': true } }, this.options.map((_el, index) => {
|
|
176
150
|
return (h("foreignObject", Object.assign({ class: "Partition1 Customable", style: { '--index': index.toString() } }, sizeProps), h("div", { style: foreignObjectAgentProps })));
|
|
177
|
-
})), h("g", { key: '
|
|
151
|
+
})), h("g", { key: 'b77eaeb0043f72ab39c5bcec7b76543871057c28', class: { 'active': this.isPartitionsCustomableReady, 'PartitionsCustomable2': true } }, this.options.map((_el, index) => {
|
|
178
152
|
return (h("foreignObject", Object.assign({ class: "Partition2 Customable", style: { '--index': index.toString() } }, sizeProps), h("div", { style: foreignObjectAgentProps })));
|
|
179
|
-
})), h("foreignObject", Object.assign({ key: '
|
|
153
|
+
})), h("foreignObject", Object.assign({ key: 'f5fbab79d3c2867c20d9aa05a026be3838fcd39b', class: "Middle Customable" }, sizeProps), h("div", { key: 'b6ad416c3ebfd53e2cbbec6de17b085424a15b0e', style: foreignObjectAgentProps })), h("foreignObject", Object.assign({ key: 'fafc4d94ce9fd81eb57cef4670d0a2bee763128a', class: "Top Customable" }, sizeProps), h("div", { key: 'e1fd86da7c3657863271643354bdf6bd8a325791', style: foreignObjectAgentProps })), h("g", { key: '383cf401f171986ec7799e98ca048b8aca8dea83', class: { 'spinning': this.isSpinning, 'Center': true }, onClick: this.eventSpin }, h("foreignObject", { key: '13f1eecbb754f80c6a649f4a57339ae84f4fb09e', x: Number(this.size) / 2 - 100 / 2, y: Number(this.size) / 2 - 100 / 2, width: 100, height: 100 })), h("g", { key: 'b739f94ed6f4d63eeb30ee2c905ad638fa79694a' }, this.options.map((_el, index) => {
|
|
180
154
|
return (h("clipPath", { id: `clip${index}` }, h("path", Object.assign({}, this.settings.getPartitionDraw(index)))));
|
|
181
155
|
})))));
|
|
182
156
|
}
|
|
@@ -208,8 +182,6 @@ export class CasinoEngagementSuiteLuckywheel {
|
|
|
208
182
|
"tags": [],
|
|
209
183
|
"text": "Client custom styling via string"
|
|
210
184
|
},
|
|
211
|
-
"getter": false,
|
|
212
|
-
"setter": false,
|
|
213
185
|
"attribute": "client-styling",
|
|
214
186
|
"reflect": true,
|
|
215
187
|
"defaultValue": "''"
|
|
@@ -228,8 +200,6 @@ export class CasinoEngagementSuiteLuckywheel {
|
|
|
228
200
|
"tags": [],
|
|
229
201
|
"text": "Client custom styling via url"
|
|
230
202
|
},
|
|
231
|
-
"getter": false,
|
|
232
|
-
"setter": false,
|
|
233
203
|
"attribute": "client-styling-url",
|
|
234
204
|
"reflect": true,
|
|
235
205
|
"defaultValue": "''"
|
|
@@ -248,8 +218,6 @@ export class CasinoEngagementSuiteLuckywheel {
|
|
|
248
218
|
"tags": [],
|
|
249
219
|
"text": "Language of the widget"
|
|
250
220
|
},
|
|
251
|
-
"getter": false,
|
|
252
|
-
"setter": false,
|
|
253
221
|
"attribute": "language",
|
|
254
222
|
"reflect": false,
|
|
255
223
|
"defaultValue": "'en'"
|
|
@@ -268,8 +236,6 @@ export class CasinoEngagementSuiteLuckywheel {
|
|
|
268
236
|
"tags": [],
|
|
269
237
|
"text": "User's device type"
|
|
270
238
|
},
|
|
271
|
-
"getter": false,
|
|
272
|
-
"setter": false,
|
|
273
239
|
"attribute": "device",
|
|
274
240
|
"reflect": false,
|
|
275
241
|
"defaultValue": "'Mobile' as 'Mobile' | 'Tablet' | 'Desktop'"
|
|
@@ -293,9 +259,7 @@ export class CasinoEngagementSuiteLuckywheel {
|
|
|
293
259
|
"docs": {
|
|
294
260
|
"tags": [],
|
|
295
261
|
"text": "Active Luckywheel"
|
|
296
|
-
}
|
|
297
|
-
"getter": false,
|
|
298
|
-
"setter": false
|
|
262
|
+
}
|
|
299
263
|
},
|
|
300
264
|
"size": {
|
|
301
265
|
"type": "string",
|
|
@@ -311,8 +275,6 @@ export class CasinoEngagementSuiteLuckywheel {
|
|
|
311
275
|
"tags": [],
|
|
312
276
|
"text": "Wheel size"
|
|
313
277
|
},
|
|
314
|
-
"getter": false,
|
|
315
|
-
"setter": false,
|
|
316
278
|
"attribute": "size",
|
|
317
279
|
"reflect": false,
|
|
318
280
|
"defaultValue": "'440'"
|
|
@@ -331,8 +293,6 @@ export class CasinoEngagementSuiteLuckywheel {
|
|
|
331
293
|
"tags": [],
|
|
332
294
|
"text": "Content Direction"
|
|
333
295
|
},
|
|
334
|
-
"getter": false,
|
|
335
|
-
"setter": false,
|
|
336
296
|
"attribute": "contentdirection",
|
|
337
297
|
"reflect": false,
|
|
338
298
|
"defaultValue": "'anticlockwise'"
|
|
@@ -68,10 +68,10 @@ export const pointPlus = (point1, point2) => ({
|
|
|
68
68
|
y: point1.y + point2.y
|
|
69
69
|
});
|
|
70
70
|
const optionCompliment = {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
Image: '',
|
|
72
|
+
Name: 'Thank you',
|
|
73
|
+
PrizeText: '',
|
|
74
|
+
PrizeImage: ''
|
|
75
75
|
};
|
|
76
76
|
const getSumProbability = (partitions) => {
|
|
77
77
|
let probabilityAll = 0;
|
|
@@ -85,8 +85,8 @@ const getOptionsFromPartitions = (partitions, lang) => {
|
|
|
85
85
|
const option = {};
|
|
86
86
|
Object.keys(_partition).map((_key) => {
|
|
87
87
|
if (typeof _partition[_key] === 'object' &&
|
|
88
|
-
_partition[_key]
|
|
89
|
-
const targetKey = _key === '
|
|
88
|
+
!!_partition[_key]) {
|
|
89
|
+
const targetKey = _key === 'Image1' ? 'Image' : _key;
|
|
90
90
|
option[targetKey] = _partition[_key][lang] || _partition[_key]['*'];
|
|
91
91
|
}
|
|
92
92
|
});
|
|
@@ -105,14 +105,14 @@ const preloadImage = async (src) => {
|
|
|
105
105
|
};
|
|
106
106
|
};
|
|
107
107
|
export const getOptions = async (bonus, lang) => {
|
|
108
|
-
const
|
|
108
|
+
const partitions = bonus.Program.WheelOfFortune.Partitions;
|
|
109
109
|
let options = getOptionsFromPartitions(partitions, lang);
|
|
110
110
|
if (isSafari()) {
|
|
111
111
|
options = options.map(option => {
|
|
112
|
-
if (option.
|
|
112
|
+
if (option.Image) {
|
|
113
113
|
const img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
|
114
|
-
img.href.baseVal = option.
|
|
115
|
-
return Object.assign(Object.assign({}, option), {
|
|
114
|
+
img.href.baseVal = option.Image;
|
|
115
|
+
return Object.assign(Object.assign({}, option), { Image: img });
|
|
116
116
|
}
|
|
117
117
|
else {
|
|
118
118
|
return option;
|
|
@@ -120,7 +120,7 @@ export const getOptions = async (bonus, lang) => {
|
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
else {
|
|
123
|
-
options = await Promise.all(options.map(async (o) => (Object.assign(Object.assign({}, o), (await preloadImage(o.
|
|
123
|
+
options = await Promise.all(options.map(async (o) => (Object.assign(Object.assign({}, o), (await preloadImage(o.Image))))));
|
|
124
124
|
}
|
|
125
125
|
return options;
|
|
126
126
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as registerInstance, h, g as getElement } from './index-
|
|
1
|
+
import { r as registerInstance, h, g as getElement } from './index-48c42d04.js';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/*! *****************************************************************************
|
|
4
4
|
Copyright (c) Microsoft Corporation.
|
|
5
5
|
|
|
6
6
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -25,12 +25,7 @@ function __rest(s, e) {
|
|
|
25
25
|
t[p[i]] = s[p[i]];
|
|
26
26
|
}
|
|
27
27
|
return t;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
31
|
-
var e = new Error(message);
|
|
32
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
33
|
-
};
|
|
28
|
+
}
|
|
34
29
|
|
|
35
30
|
var PointerMode;
|
|
36
31
|
(function (PointerMode) {
|
|
@@ -129,10 +124,10 @@ const pointPlus = (point1, point2) => ({
|
|
|
129
124
|
y: point1.y + point2.y
|
|
130
125
|
});
|
|
131
126
|
const optionCompliment = {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
127
|
+
Image: '',
|
|
128
|
+
Name: 'Thank you',
|
|
129
|
+
PrizeText: '',
|
|
130
|
+
PrizeImage: ''
|
|
136
131
|
};
|
|
137
132
|
const getSumProbability = (partitions) => {
|
|
138
133
|
let probabilityAll = 0;
|
|
@@ -146,8 +141,8 @@ const getOptionsFromPartitions = (partitions, lang) => {
|
|
|
146
141
|
const option = {};
|
|
147
142
|
Object.keys(_partition).map((_key) => {
|
|
148
143
|
if (typeof _partition[_key] === 'object' &&
|
|
149
|
-
_partition[_key]
|
|
150
|
-
const targetKey = _key === '
|
|
144
|
+
!!_partition[_key]) {
|
|
145
|
+
const targetKey = _key === 'Image1' ? 'Image' : _key;
|
|
151
146
|
option[targetKey] = _partition[_key][lang] || _partition[_key]['*'];
|
|
152
147
|
}
|
|
153
148
|
});
|
|
@@ -166,14 +161,14 @@ const preloadImage = async (src) => {
|
|
|
166
161
|
};
|
|
167
162
|
};
|
|
168
163
|
const getOptions = async (bonus, lang) => {
|
|
169
|
-
const
|
|
164
|
+
const partitions = bonus.Program.WheelOfFortune.Partitions;
|
|
170
165
|
let options = getOptionsFromPartitions(partitions, lang);
|
|
171
166
|
if (isSafari()) {
|
|
172
167
|
options = options.map(option => {
|
|
173
|
-
if (option.
|
|
168
|
+
if (option.Image) {
|
|
174
169
|
const img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
|
175
|
-
img.href.baseVal = option.
|
|
176
|
-
return Object.assign(Object.assign({}, option), {
|
|
170
|
+
img.href.baseVal = option.Image;
|
|
171
|
+
return Object.assign(Object.assign({}, option), { Image: img });
|
|
177
172
|
}
|
|
178
173
|
else {
|
|
179
174
|
return option;
|
|
@@ -181,7 +176,7 @@ const getOptions = async (bonus, lang) => {
|
|
|
181
176
|
});
|
|
182
177
|
}
|
|
183
178
|
else {
|
|
184
|
-
options = await Promise.all(options.map(async (o) => (Object.assign(Object.assign({}, o), (await preloadImage(o.
|
|
179
|
+
options = await Promise.all(options.map(async (o) => (Object.assign(Object.assign({}, o), (await preloadImage(o.Image))))));
|
|
185
180
|
}
|
|
186
181
|
return options;
|
|
187
182
|
};
|
|
@@ -556,35 +551,6 @@ const CasinoEngagementSuiteLuckywheelStyle0 = casinoEngagementSuiteLuckywheelCss
|
|
|
556
551
|
const CasinoEngagementSuiteLuckywheel = class {
|
|
557
552
|
constructor(hostRef) {
|
|
558
553
|
registerInstance(this, hostRef);
|
|
559
|
-
/**
|
|
560
|
-
* Client custom styling via string
|
|
561
|
-
*/
|
|
562
|
-
this.clientStyling = '';
|
|
563
|
-
/**
|
|
564
|
-
* Client custom styling via url
|
|
565
|
-
*/
|
|
566
|
-
this.clientStylingUrl = '';
|
|
567
|
-
/**
|
|
568
|
-
* Language of the widget
|
|
569
|
-
*/
|
|
570
|
-
this.language = 'en';
|
|
571
|
-
/**
|
|
572
|
-
* User's device type
|
|
573
|
-
*/
|
|
574
|
-
this.device = 'Mobile';
|
|
575
|
-
/**
|
|
576
|
-
* Wheel size
|
|
577
|
-
*/
|
|
578
|
-
this.size = '440';
|
|
579
|
-
/**
|
|
580
|
-
* Content Direction
|
|
581
|
-
*/
|
|
582
|
-
this.contentdirection = 'anticlockwise';
|
|
583
|
-
this.limitStylingAppends = false;
|
|
584
|
-
this.isPartitionsCustomableReady = false;
|
|
585
|
-
this.isSpinning = false;
|
|
586
|
-
this.radius = 0.85 * Number(this.size) / 2;
|
|
587
|
-
this.speed = 0;
|
|
588
554
|
this.setClientStyling = () => {
|
|
589
555
|
let sheet = document.createElement('style');
|
|
590
556
|
sheet.innerHTML = this.clientStyling;
|
|
@@ -604,14 +570,14 @@ const CasinoEngagementSuiteLuckywheel = class {
|
|
|
604
570
|
});
|
|
605
571
|
};
|
|
606
572
|
this.renderImage = (node, index) => {
|
|
607
|
-
const image = this.options[index].
|
|
573
|
+
const image = this.options[index].Image;
|
|
608
574
|
setProps(image, this.settings.getSvgImageProps(index));
|
|
609
575
|
node.innerHTML = null;
|
|
610
576
|
node.appendChild(image);
|
|
611
577
|
};
|
|
612
578
|
this.updateSpinable = () => {
|
|
613
|
-
if (!!this.luckywheel.
|
|
614
|
-
if (Number(this.luckywheel.
|
|
579
|
+
if (!!this.luckywheel.Current) {
|
|
580
|
+
if (Number(this.luckywheel.Current.RemainingTimes) > 0) {
|
|
615
581
|
this.spinable = true;
|
|
616
582
|
return;
|
|
617
583
|
}
|
|
@@ -631,40 +597,43 @@ const CasinoEngagementSuiteLuckywheel = class {
|
|
|
631
597
|
this.spinner.launch();
|
|
632
598
|
window.postMessage({
|
|
633
599
|
type: 'SpinLuckyWheel',
|
|
634
|
-
|
|
600
|
+
data: {
|
|
601
|
+
lotteryProgramID: this.luckywheel.Program.Id,
|
|
602
|
+
}
|
|
635
603
|
});
|
|
636
|
-
// todo: this code below simulates the server response,
|
|
637
|
-
// delete after implementation with GLС
|
|
638
|
-
setTimeout(() => {
|
|
639
|
-
window.postMessage({
|
|
640
|
-
type: 'SpinLuckyWheelRes',
|
|
641
|
-
data: {
|
|
642
|
-
item: { result: { wheelOfFortunePartitionIndex: 1 } },
|
|
643
|
-
success: false
|
|
644
|
-
}
|
|
645
|
-
});
|
|
646
|
-
}, 2500);
|
|
647
|
-
};
|
|
648
|
-
this.handleSpinClick = () => {
|
|
649
|
-
if (isSafari()) {
|
|
650
|
-
return;
|
|
651
|
-
}
|
|
652
|
-
this.eventSpin();
|
|
653
604
|
};
|
|
605
|
+
this.clientStyling = '';
|
|
606
|
+
this.clientStylingUrl = '';
|
|
607
|
+
this.language = 'en';
|
|
608
|
+
this.device = 'Mobile';
|
|
609
|
+
this.luckywheel = undefined;
|
|
610
|
+
this.size = '440';
|
|
611
|
+
this.contentdirection = 'anticlockwise';
|
|
612
|
+
this.limitStylingAppends = false;
|
|
613
|
+
this.isPartitionsCustomableReady = false;
|
|
614
|
+
this.isSpinning = false;
|
|
615
|
+
this.options = undefined;
|
|
616
|
+
this.radius = 0.85 * Number(this.size) / 2;
|
|
617
|
+
this.speed = 0;
|
|
618
|
+
this.settings = undefined;
|
|
619
|
+
this.svg = undefined;
|
|
620
|
+
this.spinContainer = undefined;
|
|
621
|
+
this.spinable = undefined;
|
|
622
|
+
this.spinner = undefined;
|
|
654
623
|
}
|
|
655
624
|
handleEvent(e) {
|
|
656
625
|
const _a = e === null || e === void 0 ? void 0 : e.data, { type } = _a, rest = __rest(_a, ["type"]);
|
|
657
626
|
switch (type) {
|
|
658
627
|
case 'SpinLuckyWheelRes':
|
|
659
|
-
this.spinner.halt(this.settings.getDeg(rest.data.
|
|
628
|
+
this.spinner.halt(this.settings.getDeg(rest.data.Result.WheelOfFortunePartitionIndex), () => {
|
|
660
629
|
this.isSpinning = false;
|
|
661
630
|
this.updateSpinable();
|
|
662
|
-
const prizeText = this.luckywheel.
|
|
631
|
+
const prizeText = this.luckywheel.Program.WheelOfFortune.Partitions[rest.data.Result.WheelOfFortunePartitionIndex].PrizeText;
|
|
663
632
|
window.postMessage({
|
|
664
633
|
type: 'ShowLuckywheelRewardModal',
|
|
665
634
|
data: {
|
|
666
635
|
PrizeMessage: prizeText['en'] || prizeText['*'],
|
|
667
|
-
HasError: rest.
|
|
636
|
+
HasError: rest.success,
|
|
668
637
|
}
|
|
669
638
|
});
|
|
670
639
|
});
|
|
@@ -713,20 +682,20 @@ const CasinoEngagementSuiteLuckywheel = class {
|
|
|
713
682
|
render() {
|
|
714
683
|
const sizeProps = { height: this.size, width: this.size };
|
|
715
684
|
const foreignObjectAgentProps = { 'height': `${this.size}px`, 'width': `${this.size}px` };
|
|
716
|
-
return (h("div", { key: '
|
|
685
|
+
return (h("div", { key: '014cf34ad67ed718b064797ec5497f93cd8e8fc8', class: `WheelContainer ${this.device}`, style: this.defineGeneralVariables() }, h("svg", { key: 'b7eedc15f6290740b3cfa85b784dcb3ed6c59b9b', width: this.size, height: this.size, ref: (el) => { this.svg = el; } }, h("foreignObject", Object.assign({ key: 'ae62d34ee98360bd6da52cad54819813fb714555' }, sizeProps, { class: "Bottom Customable" }), h("div", { key: 'ec3ae09161a1a20956ebf9bb91340c3f77647770', style: foreignObjectAgentProps })), h("g", Object.assign({ key: 'ca9edc54e36206aaf04d8645efa9aeb8b2a7aa9a', class: "PartitionsContainer" }, this.settings.getSpinnerProps()), h("g", { key: '99ca797756be5a290f0951127904489ad6b21c9e', class: "PartitionsBackgrounds" }, this.options.map((_el, index) => {
|
|
717
686
|
return (h("foreignObject", { "clip-path": `url(#clip${index})`, class: "PartitionBackground Customable", style: { '--index': index.toString() }, width: this.size, height: this.size }, h("div", { style: foreignObjectAgentProps })));
|
|
718
|
-
})), h("g", { key: '
|
|
687
|
+
})), h("g", { key: 'b197f9f51c2a8a1b2337ae180b987ad0896d42ae', class: "PartitionsBackgroundStrokes" }, this.options.map((_el, index) => {
|
|
719
688
|
return (h("path", Object.assign({ class: "PartitionBackgroundStroke" }, this.settings.getPartitionDraw(index), { width: this.size, height: this.size })));
|
|
720
|
-
})), h("g", { key: '
|
|
689
|
+
})), h("g", { key: '00435c08f614ae78ab63d2f9fee0c81ff29730ac', class: "Partitions", style: { filter: this.speed > 0.3 ? `blur(${this.speed}px)` : '' } }, this.options.map((el, index) => {
|
|
721
690
|
return ([
|
|
722
|
-
el.
|
|
723
|
-
el.
|
|
691
|
+
el.Image && (h("g", { class: `PartitionImage PartitionImage${index}`, ref: (el) => this.renderImage(el, index) })),
|
|
692
|
+
el.Name && (h("foreignObject", Object.assign({ class: "PartitionText" }, this.settings.getSvgTextPropsAdjustedByImage(index)), h("div", { class: "PartitionTextEntityContainer" }, h("p", { class: `PartitionTextEntity${this.settings.contentdirection === 'clockwise' ? '' : ' Anticlockwise'}`, innerHTML: el.Name }))))
|
|
724
693
|
]);
|
|
725
|
-
}))), h("g", { key: '
|
|
694
|
+
}))), h("g", { key: 'a89ea859fd16d72ec6a38c780548a4aade0b26db', class: { 'active': this.isPartitionsCustomableReady, 'PartitionsCustomable1': true } }, this.options.map((_el, index) => {
|
|
726
695
|
return (h("foreignObject", Object.assign({ class: "Partition1 Customable", style: { '--index': index.toString() } }, sizeProps), h("div", { style: foreignObjectAgentProps })));
|
|
727
|
-
})), h("g", { key: '
|
|
696
|
+
})), h("g", { key: 'b77eaeb0043f72ab39c5bcec7b76543871057c28', class: { 'active': this.isPartitionsCustomableReady, 'PartitionsCustomable2': true } }, this.options.map((_el, index) => {
|
|
728
697
|
return (h("foreignObject", Object.assign({ class: "Partition2 Customable", style: { '--index': index.toString() } }, sizeProps), h("div", { style: foreignObjectAgentProps })));
|
|
729
|
-
})), h("foreignObject", Object.assign({ key: '
|
|
698
|
+
})), h("foreignObject", Object.assign({ key: 'f5fbab79d3c2867c20d9aa05a026be3838fcd39b', class: "Middle Customable" }, sizeProps), h("div", { key: 'b6ad416c3ebfd53e2cbbec6de17b085424a15b0e', style: foreignObjectAgentProps })), h("foreignObject", Object.assign({ key: 'fafc4d94ce9fd81eb57cef4670d0a2bee763128a', class: "Top Customable" }, sizeProps), h("div", { key: 'e1fd86da7c3657863271643354bdf6bd8a325791', style: foreignObjectAgentProps })), h("g", { key: '383cf401f171986ec7799e98ca048b8aca8dea83', class: { 'spinning': this.isSpinning, 'Center': true }, onClick: this.eventSpin }, h("foreignObject", { key: '13f1eecbb754f80c6a649f4a57339ae84f4fb09e', x: Number(this.size) / 2 - 100 / 2, y: Number(this.size) / 2 - 100 / 2, width: 100, height: 100 })), h("g", { key: 'b739f94ed6f4d63eeb30ee2c905ad638fa79694a' }, this.options.map((_el, index) => {
|
|
730
699
|
return (h("clipPath", { id: `clip${index}` }, h("path", Object.assign({}, this.settings.getPartitionDraw(index)))));
|
|
731
700
|
})))));
|
|
732
701
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { C as casino_engagement_suite_luckywheel } from './casino-engagement-suite-luckywheel-
|
|
2
|
-
import './index-
|
|
1
|
+
export { C as casino_engagement_suite_luckywheel } from './casino-engagement-suite-luckywheel-88d531c4.js';
|
|
2
|
+
import './index-48c42d04.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-
|
|
2
|
-
export { s as setNonce } from './index-
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-48c42d04.js';
|
|
2
|
+
export { s as setNonce } from './index-48c42d04.js';
|
|
3
3
|
import { g as globalScripts } from './app-globals-0f993ce5.js';
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
|
-
Stencil Client Patch Browser v4.
|
|
6
|
+
Stencil Client Patch Browser v4.19.2 | MIT Licensed | https://stenciljs.com
|
|
7
7
|
*/
|
|
8
8
|
var patchBrowser = () => {
|
|
9
9
|
const importMeta = import.meta.url;
|