@splash-tech/jackpot-sdk 3.0.7 → 3.0.9
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/README.md
CHANGED
|
@@ -48,14 +48,13 @@ splashJackpot.winWidget.launch({
|
|
|
48
48
|
|
|
49
49
|
# Widget Launch Parameters
|
|
50
50
|
|
|
51
|
-
| Parameter
|
|
52
|
-
|
|
|
53
|
-
| data
|
|
54
|
-
| container
|
|
55
|
-
| mode
|
|
56
|
-
| maxWidth
|
|
57
|
-
| height
|
|
58
|
-
| showLevelIcons | boolean | true | Whether to show jackpot level icons in the footer widget |
|
|
51
|
+
| Parameter | Type | Default | Description |
|
|
52
|
+
| --------- | ------ | ------------- | --------------------------------------------------------- |
|
|
53
|
+
| data | object | null | Widget data from Splash backend |
|
|
54
|
+
| container | string | document.body | CSS selector where widget will be injected |
|
|
55
|
+
| mode | string | production | SDK environment (`local`, `dev`, `staging`, `production`) |
|
|
56
|
+
| maxWidth | string | '1300px' | Maximum width of the footer widget |
|
|
57
|
+
| height | string | '50px' | Height of the footer widget |
|
|
59
58
|
|
|
60
59
|
Example:
|
|
61
60
|
|
|
@@ -66,7 +65,6 @@ splashJackpot.footerWidget.launch({
|
|
|
66
65
|
mode: 'production',
|
|
67
66
|
maxWidth: '100%',
|
|
68
67
|
height: '80px',
|
|
69
|
-
showLevelIcons: true,
|
|
70
68
|
});
|
|
71
69
|
```
|
|
72
70
|
|
|
@@ -34,6 +34,7 @@ export class FooterWidget extends FooterWidgetBase {
|
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
handleChildMessage(type) {
|
|
37
|
+
var _a;
|
|
37
38
|
switch (type) {
|
|
38
39
|
case IncomingEvent.footerWidgetLoaded:
|
|
39
40
|
this.sendInitialData();
|
|
@@ -44,10 +45,12 @@ export class FooterWidget extends FooterWidgetBase {
|
|
|
44
45
|
case IncomingEvent.participateChange:
|
|
45
46
|
this.emit('participateChange');
|
|
46
47
|
return true;
|
|
47
|
-
case IncomingEvent.showPopup:
|
|
48
|
+
case IncomingEvent.showPopup: {
|
|
49
|
+
const iframeRect = (_a = this.iframe) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
48
50
|
this.emit('showPopup');
|
|
49
|
-
this.expandIframe();
|
|
51
|
+
this.expandIframe(iframeRect);
|
|
50
52
|
return true;
|
|
53
|
+
}
|
|
51
54
|
case IncomingEvent.hidePopup:
|
|
52
55
|
this.emit('hidePopup');
|
|
53
56
|
this.collapseIframe();
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { FooterWidgetBaseConfig } from '../../core/types';
|
|
2
2
|
export interface FooterWidgetConfig extends FooterWidgetBaseConfig {
|
|
3
|
+
winNotification?: WinNotificationConfig;
|
|
4
|
+
}
|
|
5
|
+
export interface WinNotificationConfig {
|
|
6
|
+
show?: boolean;
|
|
7
|
+
frequency?: string;
|
|
8
|
+
duration?: string;
|
|
3
9
|
}
|
|
4
10
|
export interface FooterWidgetEvents {
|
|
5
11
|
participateChange: void;
|
|
@@ -31,6 +31,7 @@ export class FooterWidget extends FooterWidgetBase {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
handleChildMessage(type) {
|
|
34
|
+
var _a;
|
|
34
35
|
switch (type) {
|
|
35
36
|
case IncomingEvent.footerWidgetLoaded:
|
|
36
37
|
this.sendInitialData();
|
|
@@ -38,10 +39,12 @@ export class FooterWidget extends FooterWidgetBase {
|
|
|
38
39
|
case IncomingEvent.ready:
|
|
39
40
|
this.onChildAppLoaded();
|
|
40
41
|
return true;
|
|
41
|
-
case IncomingEvent.showPopup:
|
|
42
|
+
case IncomingEvent.showPopup: {
|
|
43
|
+
const iframeRect = (_a = this.iframe) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
42
44
|
this.emit('showPopup');
|
|
43
|
-
this.expandIframe();
|
|
45
|
+
this.expandIframe(iframeRect);
|
|
44
46
|
return true;
|
|
47
|
+
}
|
|
45
48
|
case IncomingEvent.hidePopup:
|
|
46
49
|
this.emit('hidePopup');
|
|
47
50
|
this.collapseIframe();
|
|
@@ -15,7 +15,7 @@ export declare abstract class FooterWidgetBase<TConfig extends FooterWidgetBaseC
|
|
|
15
15
|
updateData(partialData: object): void;
|
|
16
16
|
destroy(): void;
|
|
17
17
|
protected styleIframe(iframe: HTMLIFrameElement): HTMLIFrameElement;
|
|
18
|
-
protected expandIframe(): void;
|
|
18
|
+
protected expandIframe(iframeRect?: DOMRect): void;
|
|
19
19
|
protected collapseIframe(): void;
|
|
20
20
|
private setIframeHeight;
|
|
21
21
|
protected onChildAppLoaded(): void;
|
|
@@ -57,6 +57,7 @@ export class FooterWidgetBase extends BaseWidget {
|
|
|
57
57
|
}
|
|
58
58
|
styleIframe(iframe) {
|
|
59
59
|
iframe.style.left = '0';
|
|
60
|
+
iframe.style.right = '';
|
|
60
61
|
iframe.style.width = '100%';
|
|
61
62
|
iframe.style.height = this.height;
|
|
62
63
|
iframe.style.zIndex = '999999'; // 6
|
|
@@ -70,10 +71,36 @@ export class FooterWidgetBase extends BaseWidget {
|
|
|
70
71
|
}
|
|
71
72
|
return iframe;
|
|
72
73
|
}
|
|
73
|
-
expandIframe() {
|
|
74
|
-
this.
|
|
74
|
+
expandIframe(iframeRect) {
|
|
75
|
+
if (!this.iframe)
|
|
76
|
+
return;
|
|
77
|
+
if (!this.container) {
|
|
78
|
+
this.setIframeHeight('100%');
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const rect = iframeRect !== null && iframeRect !== void 0 ? iframeRect : this.iframe.getBoundingClientRect();
|
|
82
|
+
this.iframe.style.position = 'fixed';
|
|
83
|
+
this.iframe.style.left = `${rect.left}px`;
|
|
84
|
+
this.iframe.style.right = 'auto';
|
|
85
|
+
this.iframe.style.width = `${rect.width}px`;
|
|
86
|
+
if (this.position === 'top') {
|
|
87
|
+
this.iframe.style.top = `${rect.top}px`;
|
|
88
|
+
this.iframe.style.bottom = 'auto';
|
|
89
|
+
this.setIframeHeight(`${Math.max(rect.height, window.innerHeight - rect.top)}px`);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
this.iframe.style.top = '0';
|
|
93
|
+
this.iframe.style.bottom = 'auto';
|
|
94
|
+
this.setIframeHeight(`${Math.max(rect.height, rect.bottom)}px`);
|
|
75
95
|
}
|
|
76
96
|
collapseIframe() {
|
|
97
|
+
if (!this.iframe)
|
|
98
|
+
return;
|
|
99
|
+
if (this.container) {
|
|
100
|
+
this.iframe.style.position = 'absolute';
|
|
101
|
+
this.styleIframe(this.iframe);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
77
104
|
this.setIframeHeight(this.height);
|
|
78
105
|
}
|
|
79
106
|
setIframeHeight(height) {
|