@splash-tech/jackpot-sdk 3.0.4 → 3.0.5
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 +2 -0
- package/dist/clients/h4n8w3vt/FooterWidget.d.ts +0 -1
- package/dist/clients/h4n8w3vt/FooterWidget.js +0 -1
- package/dist/clients/h4n8w3vt/LobbyWidget.d.ts +0 -0
- package/dist/clients/h4n8w3vt/LobbyWidget.js +70 -0
- package/dist/clients/x7k2m9qp/FooterWidget.d.ts +0 -1
- package/dist/clients/x7k2m9qp/FooterWidget.js +0 -1
- package/dist/compat/v2/mapLaunchParams.js +2 -2
- package/dist/compat/v2/types.d.ts +1 -0
- package/dist/core/FooterWidgetBase.d.ts +1 -1
- package/dist/core/FooterWidgetBase.js +5 -1
- package/dist/core/LobbyWidgetBase.d.ts +0 -0
- package/dist/core/LobbyWidgetBase.js +71 -0
- package/dist/core/types.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,6 +54,7 @@ splashJackpot.winWidget.launch({
|
|
|
54
54
|
| container | string | document.body | CSS selector where widget will be injected |
|
|
55
55
|
| mode | string | production | SDK environment (`local`, `dev`, `staging`, `production`) |
|
|
56
56
|
| maxWidth | string | '1300px' | Maximum width of the footer widget |
|
|
57
|
+
| height | string | '50px' | Height of the footer widget |
|
|
57
58
|
|
|
58
59
|
Example:
|
|
59
60
|
|
|
@@ -63,6 +64,7 @@ splashJackpot.footerWidget.launch({
|
|
|
63
64
|
container: '#game-container',
|
|
64
65
|
mode: 'production',
|
|
65
66
|
maxWidth: '100%',
|
|
67
|
+
height: '80px',
|
|
66
68
|
});
|
|
67
69
|
```
|
|
68
70
|
|
|
@@ -2,7 +2,6 @@ import { FooterWidgetBase } from '../../core/FooterWidgetBase';
|
|
|
2
2
|
import { FooterWidgetConfig, FooterWidgetEvents } from './types';
|
|
3
3
|
export declare class FooterWidget extends FooterWidgetBase<FooterWidgetConfig, FooterWidgetEvents> {
|
|
4
4
|
protected readonly route = "/footer-widget";
|
|
5
|
-
protected readonly height = "64px";
|
|
6
5
|
protected sendInitialData(): void;
|
|
7
6
|
protected sendDataUpdate(partialData: object): void;
|
|
8
7
|
protected handleChildMessage(type: string | undefined): boolean;
|
|
File without changes
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { LobbyWidgetBase } from '../../core/LobbyWidgetBase';
|
|
3
|
+
// import { InitialChildMessage } from '../../core/types';
|
|
4
|
+
// import { LobbyWidgetConfig, LobbyWidgetEvents } from './types';
|
|
5
|
+
// enum IncomingEvent {
|
|
6
|
+
// lobbyWidgetLoaded = 'jackpot-lobby-widget-loaded',
|
|
7
|
+
// optInToggle = 'jackpot-lobby-widget-opt-in-toggle',
|
|
8
|
+
// showAll = 'jackpot-lobby-widget-show-all',
|
|
9
|
+
// toggleFavorite = 'jackpot-lobby-widget-toggle-favorite',
|
|
10
|
+
// infoClick = 'jackpot-lobby-widget-info-click',
|
|
11
|
+
// gameClick = 'jackpot-lobby-widget-game-click',
|
|
12
|
+
// resize = 'jackpot-lobby-widget-resize',
|
|
13
|
+
// }
|
|
14
|
+
// enum OutgoingEvent {
|
|
15
|
+
// lobbyWidgetDataInitial = 'jackpot-lobby-widget-data-initial',
|
|
16
|
+
// lobbyWidgetDataUpdated = 'jackpot-lobby-widget-data-updated',
|
|
17
|
+
// }
|
|
18
|
+
// export class LobbyWidget extends LobbyWidgetBase<
|
|
19
|
+
// LobbyWidgetConfig,
|
|
20
|
+
// LobbyWidgetEvents
|
|
21
|
+
// > {
|
|
22
|
+
// protected readonly route = '/lobby-widget';
|
|
23
|
+
// protected sendInitialData(): void {
|
|
24
|
+
// this.sendToChild({
|
|
25
|
+
// type: OutgoingEvent.lobbyWidgetDataInitial,
|
|
26
|
+
// data: this.data,
|
|
27
|
+
// config: this.config,
|
|
28
|
+
// } satisfies InitialChildMessage<LobbyWidgetConfig>);
|
|
29
|
+
// }
|
|
30
|
+
// protected sendDataUpdate(partialData: object): void {
|
|
31
|
+
// this.sendToChild({
|
|
32
|
+
// type: OutgoingEvent.lobbyWidgetDataUpdated,
|
|
33
|
+
// data: partialData,
|
|
34
|
+
// });
|
|
35
|
+
// }
|
|
36
|
+
// protected handleChildMessage(
|
|
37
|
+
// type: string | undefined,
|
|
38
|
+
// payload?: unknown,
|
|
39
|
+
// ): boolean {
|
|
40
|
+
// switch (type) {
|
|
41
|
+
// case IncomingEvent.lobbyWidgetLoaded:
|
|
42
|
+
// this.sendInitialData();
|
|
43
|
+
// return true;
|
|
44
|
+
// case IncomingEvent.optInToggle:
|
|
45
|
+
// this.emit('optInToggle');
|
|
46
|
+
// return true;
|
|
47
|
+
// case IncomingEvent.showAll:
|
|
48
|
+
// this.emit('showAll');
|
|
49
|
+
// return true;
|
|
50
|
+
// case IncomingEvent.toggleFavorite:
|
|
51
|
+
// this.emit('toggleFavorite', payload);
|
|
52
|
+
// return true;
|
|
53
|
+
// case IncomingEvent.infoClick:
|
|
54
|
+
// this.emit('infoClick');
|
|
55
|
+
// return true;
|
|
56
|
+
// case IncomingEvent.gameClick:
|
|
57
|
+
// this.emit('gameClick', payload);
|
|
58
|
+
// return true;
|
|
59
|
+
// case IncomingEvent.resize: {
|
|
60
|
+
// const height = (payload as { height?: number } | undefined)?.height;
|
|
61
|
+
// if (this.iframe && typeof height === 'number' && height > 0) {
|
|
62
|
+
// this.iframe.style.height = `${height}px`;
|
|
63
|
+
// }
|
|
64
|
+
// return true;
|
|
65
|
+
// }
|
|
66
|
+
// default:
|
|
67
|
+
// return false;
|
|
68
|
+
// }
|
|
69
|
+
// }
|
|
70
|
+
// }
|
|
@@ -2,7 +2,6 @@ import { FooterWidgetBase } from '../../core/FooterWidgetBase';
|
|
|
2
2
|
import { FooterWidgetConfig, FooterWidgetEvents } from './types';
|
|
3
3
|
export declare class FooterWidget extends FooterWidgetBase<FooterWidgetConfig, FooterWidgetEvents> {
|
|
4
4
|
protected readonly route = "/footer-widget";
|
|
5
|
-
protected readonly height = "50px";
|
|
6
5
|
protected sendInitialData(): void;
|
|
7
6
|
protected sendDataUpdate(partialData: object): void;
|
|
8
7
|
protected handleChildMessage(type: string | undefined): boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export function mapV2FooterWidgetLaunchParams(params) {
|
|
2
2
|
return {
|
|
3
3
|
data: params.data,
|
|
4
|
-
config: Object.assign(Object.assign(Object.assign({}, (params.container !== undefined
|
|
4
|
+
config: Object.assign(Object.assign(Object.assign(Object.assign({}, (params.container !== undefined
|
|
5
5
|
? { container: params.container }
|
|
6
|
-
: {})), (params.position !== undefined ? { position: params.position } : {})), (params.maxWidth !== undefined ? { maxWidth: params.maxWidth } : {})),
|
|
6
|
+
: {})), (params.position !== undefined ? { position: params.position } : {})), (params.maxWidth !== undefined ? { maxWidth: params.maxWidth } : {})), (params.height !== undefined ? { height: params.height } : {})),
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
9
|
export function mapV2WinWidgetLaunchParams(params) {
|
|
@@ -2,10 +2,10 @@ import { BaseWidget } from './BaseWidget';
|
|
|
2
2
|
import { FooterWidgetBaseConfig, WidgetLaunchParams } from './types';
|
|
3
3
|
export declare abstract class FooterWidgetBase<TConfig extends FooterWidgetBaseConfig, TEvents> extends BaseWidget<TConfig, TEvents> {
|
|
4
4
|
protected abstract readonly route: string;
|
|
5
|
-
protected abstract readonly height: string;
|
|
6
5
|
protected container: string;
|
|
7
6
|
protected position: "top" | "bottom";
|
|
8
7
|
protected maxWidth: string;
|
|
8
|
+
protected height: string;
|
|
9
9
|
protected abstract sendInitialData(): void;
|
|
10
10
|
protected abstract sendDataUpdate(partialData: object): void;
|
|
11
11
|
launch(params: WidgetLaunchParams<TConfig>): void;
|
|
@@ -4,6 +4,7 @@ const defaults = {
|
|
|
4
4
|
container: '',
|
|
5
5
|
position: 'bottom',
|
|
6
6
|
maxWidth: '1300px',
|
|
7
|
+
height: '50px',
|
|
7
8
|
};
|
|
8
9
|
export class FooterWidgetBase extends BaseWidget {
|
|
9
10
|
constructor() {
|
|
@@ -11,9 +12,10 @@ export class FooterWidgetBase extends BaseWidget {
|
|
|
11
12
|
this.container = defaults.container;
|
|
12
13
|
this.position = defaults.position;
|
|
13
14
|
this.maxWidth = defaults.maxWidth;
|
|
15
|
+
this.height = defaults.height;
|
|
14
16
|
}
|
|
15
17
|
launch(params) {
|
|
16
|
-
var _a, _b, _c, _d;
|
|
18
|
+
var _a, _b, _c, _d, _e;
|
|
17
19
|
if (this.isLaunched()) {
|
|
18
20
|
console.warn('Footer widget is already launched');
|
|
19
21
|
return;
|
|
@@ -23,6 +25,7 @@ export class FooterWidgetBase extends BaseWidget {
|
|
|
23
25
|
this.container = (_b = this.config.container) !== null && _b !== void 0 ? _b : defaults.container;
|
|
24
26
|
this.position = (_c = this.config.position) !== null && _c !== void 0 ? _c : defaults.position;
|
|
25
27
|
this.maxWidth = (_d = this.config.maxWidth) !== null && _d !== void 0 ? _d : defaults.maxWidth;
|
|
28
|
+
this.height = (_e = this.config.height) !== null && _e !== void 0 ? _e : defaults.height;
|
|
26
29
|
this.iframe = this.createIframe();
|
|
27
30
|
this.iframe = this.styleIframe(this.iframe);
|
|
28
31
|
this.iframe.src = `${this.childAppOrigin}${this.route}`;
|
|
@@ -39,6 +42,7 @@ export class FooterWidgetBase extends BaseWidget {
|
|
|
39
42
|
this.container = defaults.container;
|
|
40
43
|
this.position = defaults.position;
|
|
41
44
|
this.maxWidth = defaults.maxWidth;
|
|
45
|
+
this.height = defaults.height;
|
|
42
46
|
this.stopListening();
|
|
43
47
|
this.removeIframe();
|
|
44
48
|
}
|
|
File without changes
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { validateNonEmptyObject } from '../shared/validation';
|
|
3
|
+
// import { BaseWidget } from './BaseWidget';
|
|
4
|
+
// import { LobbyWidgetBaseConfig, LobbyWidgetLaunchParams } from './types';
|
|
5
|
+
// const LOBBY_IFRAME_ATTR = 'data-splash-lobby-widget';
|
|
6
|
+
// const defaults = {
|
|
7
|
+
// container: '',
|
|
8
|
+
// showHero: false,
|
|
9
|
+
// };
|
|
10
|
+
// export abstract class LobbyWidgetBase<
|
|
11
|
+
// TConfig extends LobbyWidgetBaseConfig,
|
|
12
|
+
// TEvents,
|
|
13
|
+
// > extends BaseWidget<TConfig, TEvents> {
|
|
14
|
+
// protected abstract readonly route: string;
|
|
15
|
+
// protected container = defaults.container;
|
|
16
|
+
// protected showHero = defaults.showHero;
|
|
17
|
+
// protected abstract sendInitialData(): void;
|
|
18
|
+
// protected abstract sendDataUpdate(partialData: object): void;
|
|
19
|
+
// public launch(params: LobbyWidgetLaunchParams<TConfig>): this {
|
|
20
|
+
// if (this.isLaunched()) {
|
|
21
|
+
// console.warn('Lobby widget is already launched');
|
|
22
|
+
// return this;
|
|
23
|
+
// }
|
|
24
|
+
// this.config = params.config ?? ({} as TConfig);
|
|
25
|
+
// this.data = params.data;
|
|
26
|
+
// this.container = this.config.container ?? defaults.container;
|
|
27
|
+
// this.showHero = this.config.showHero ?? defaults.showHero;
|
|
28
|
+
// if (!this.container) {
|
|
29
|
+
// console.error('Lobby widget: config.container is required.');
|
|
30
|
+
// return this;
|
|
31
|
+
// }
|
|
32
|
+
// const targetContainer = document.querySelector(this.container);
|
|
33
|
+
// if (!targetContainer) {
|
|
34
|
+
// console.error(`Lobby widget: container "${this.container}" not found`);
|
|
35
|
+
// return this;
|
|
36
|
+
// }
|
|
37
|
+
// if (targetContainer.querySelector(`iframe[${LOBBY_IFRAME_ATTR}]`)) {
|
|
38
|
+
// console.error(
|
|
39
|
+
// `Lobby widget: container "${this.container}" already has a lobby widget. Use a separate container per widget.`,
|
|
40
|
+
// );
|
|
41
|
+
// return this;
|
|
42
|
+
// }
|
|
43
|
+
// this.iframe = this.createIframe();
|
|
44
|
+
// this.iframe = this.styleIframe(this.iframe);
|
|
45
|
+
// this.iframe.setAttribute(LOBBY_IFRAME_ATTR, '');
|
|
46
|
+
// this.iframe.src = `${this.childAppOrigin}${this.route}`;
|
|
47
|
+
// this.iframe.style.position = 'relative';
|
|
48
|
+
// targetContainer.appendChild(this.iframe);
|
|
49
|
+
// this.setLaunched(true);
|
|
50
|
+
// this.startListening();
|
|
51
|
+
// return this;
|
|
52
|
+
// }
|
|
53
|
+
// public updateData(partialData: object): void {
|
|
54
|
+
// if (!validateNonEmptyObject(partialData, 'lobbyWidget.updateData')) return;
|
|
55
|
+
// this.sendDataUpdate(partialData);
|
|
56
|
+
// }
|
|
57
|
+
// public destroy(): void {
|
|
58
|
+
// this.container = defaults.container;
|
|
59
|
+
// this.showHero = defaults.showHero;
|
|
60
|
+
// this.stopListening();
|
|
61
|
+
// this.removeIframe();
|
|
62
|
+
// }
|
|
63
|
+
// protected styleIframe(iframe: HTMLIFrameElement): HTMLIFrameElement {
|
|
64
|
+
// iframe.style.display = 'block';
|
|
65
|
+
// iframe.style.width = '100%';
|
|
66
|
+
// iframe.style.border = 'none';
|
|
67
|
+
// iframe.style.backgroundColor = 'transparent';
|
|
68
|
+
// iframe.style.zIndex = '1';
|
|
69
|
+
// return iframe;
|
|
70
|
+
// }
|
|
71
|
+
// }
|
package/dist/core/types.d.ts
CHANGED