@splash-tech/jackpot-sdk 1.0.7 → 1.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 +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +14 -14
- package/dist/types.d.ts +7 -9
- package/dist/widgets/BaseWidget.d.ts +6 -0
- package/dist/widgets/BaseWidget.js +7 -1
- package/dist/widgets/footerWidget/FooterWidget.d.ts +4 -4
- package/dist/widgets/footerWidget/FooterWidget.js +6 -3
- package/dist/widgets/footerWidget/types/data.d.ts +3 -148
- package/dist/widgets/shared/types.d.ts +4 -4
- package/dist/widgets/winWidget/WinWidget.d.ts +10 -0
- package/dist/widgets/{wonJackpotWidget/WonJackpotWidget.js → winWidget/WinWidget.js} +10 -7
- package/dist/widgets/{wonJackpotWidget → winWidget}/types/data.d.ts +4 -1
- package/package.json +1 -1
- package/dist/widgets/wonJackpotWidget/WonJackpotWidget.d.ts +0 -10
- /package/dist/widgets/footerWidget/types/{event.d.ts → events.d.ts} +0 -0
- /package/dist/widgets/footerWidget/types/{event.js → events.js} +0 -0
- /package/dist/widgets/{wonJackpotWidget → winWidget}/types/data.js +0 -0
- /package/dist/widgets/{wonJackpotWidget/types/event.d.ts → winWidget/types/events.d.ts} +0 -0
- /package/dist/widgets/{wonJackpotWidget/types/event.js → winWidget/types/events.js} +0 -0
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SplashJackpotSDK } from './types';
|
|
2
|
-
|
|
3
|
-
export
|
|
2
|
+
declare const splashJackpot: SplashJackpotSDK;
|
|
3
|
+
export { splashJackpot };
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { FooterWidget } from './widgets/footerWidget/FooterWidget';
|
|
2
|
-
import {
|
|
2
|
+
import { WinWidget } from './widgets/winWidget/WinWidget';
|
|
3
3
|
const footerWidget = FooterWidget.getInstance();
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const winWidget = WinWidget.getInstance();
|
|
5
|
+
const splashJackpot = {
|
|
6
|
+
footerWidget: {
|
|
7
7
|
isLaunched: () => footerWidget.isWidgetLaunched(),
|
|
8
|
-
launch: (params) => footerWidget.
|
|
8
|
+
launch: (params) => footerWidget.launch(params),
|
|
9
9
|
updateData: (partialData) => footerWidget.updateData(partialData),
|
|
10
|
-
|
|
11
|
-
hidePopup: () => footerWidget.hidePopup(),
|
|
12
|
-
destroy: () => footerWidget.destroyFooter(),
|
|
10
|
+
destroy: () => footerWidget.destroy(),
|
|
13
11
|
addEventListener: (event, handler) => footerWidget.addEventListener(event, handler),
|
|
14
12
|
removeEventListener: (event, handler) => footerWidget.removeEventListener(event, handler),
|
|
15
13
|
},
|
|
16
|
-
|
|
17
|
-
isLaunched: () =>
|
|
18
|
-
launch: (params) =>
|
|
19
|
-
destroy: () =>
|
|
20
|
-
addEventListener: (event, handler) =>
|
|
21
|
-
removeEventListener: (event, handler) =>
|
|
14
|
+
winWidget: {
|
|
15
|
+
isLaunched: () => winWidget.isWidgetLaunched(),
|
|
16
|
+
launch: (params) => winWidget.launch(params),
|
|
17
|
+
destroy: () => winWidget.destroy(),
|
|
18
|
+
addEventListener: (event, handler) => winWidget.addEventListener(event, handler),
|
|
19
|
+
removeEventListener: (event, handler) => winWidget.removeEventListener(event, handler),
|
|
22
20
|
},
|
|
23
21
|
};
|
|
22
|
+
// export
|
|
23
|
+
export { splashJackpot };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import { FooterWidgetParams } from './widgets/footerWidget/types/data';
|
|
2
|
-
import { FooterWidgetEvents } from './widgets/footerWidget/types/
|
|
2
|
+
import { FooterWidgetEvents } from './widgets/footerWidget/types/events';
|
|
3
3
|
import { WidgetEventHandler } from './widgets/shared/types';
|
|
4
|
-
import {
|
|
5
|
-
import { WinWidgetWidgetEvents } from './widgets/
|
|
4
|
+
import { WinWidgetParams } from './widgets/winWidget/types/data';
|
|
5
|
+
import { WinWidgetWidgetEvents } from './widgets/winWidget/types/events';
|
|
6
6
|
export interface SplashJackpotSDK {
|
|
7
|
-
|
|
7
|
+
footerWidget: {
|
|
8
8
|
isLaunched: () => boolean;
|
|
9
9
|
launch: (params: FooterWidgetParams) => void;
|
|
10
|
-
updateData: (partialData: unknown) => void;
|
|
11
|
-
showPopup: () => void;
|
|
12
|
-
hidePopup: () => void;
|
|
10
|
+
updateData: (partialData: Partial<unknown>) => void;
|
|
13
11
|
destroy: () => void;
|
|
14
12
|
addEventListener(event: keyof FooterWidgetEvents, handler: WidgetEventHandler): void;
|
|
15
13
|
removeEventListener(event: keyof FooterWidgetEvents, handler: WidgetEventHandler): void;
|
|
16
14
|
};
|
|
17
|
-
|
|
15
|
+
winWidget: {
|
|
18
16
|
isLaunched: () => boolean;
|
|
19
|
-
launch: (params:
|
|
17
|
+
launch: (params: WinWidgetParams) => void;
|
|
20
18
|
destroy: () => void;
|
|
21
19
|
addEventListener(event: keyof WinWidgetWidgetEvents, handler: WidgetEventHandler): void;
|
|
22
20
|
removeEventListener(event: keyof WinWidgetWidgetEvents, handler: WidgetEventHandler): void;
|
|
@@ -2,12 +2,18 @@ import { IframeOutgoingEvent, SDKMode, WidgetEventHandler, WidgetParams } from '
|
|
|
2
2
|
interface ChildMessage {
|
|
3
3
|
type: IframeOutgoingEvent;
|
|
4
4
|
data: unknown;
|
|
5
|
+
jackpotId?: string | null;
|
|
6
|
+
tag?: string | null;
|
|
7
|
+
brand?: string | null;
|
|
5
8
|
}
|
|
6
9
|
export declare abstract class BaseWidget {
|
|
7
10
|
protected iframe: HTMLIFrameElement | null;
|
|
8
11
|
protected childAppOrigin: string | null;
|
|
9
12
|
protected isLaunched: boolean;
|
|
10
13
|
protected data: unknown;
|
|
14
|
+
protected jackpotId: string | null;
|
|
15
|
+
protected tag: string | null;
|
|
16
|
+
protected brand: string | null;
|
|
11
17
|
private listeners;
|
|
12
18
|
protected getBaseUrl(mode: SDKMode): string;
|
|
13
19
|
protected createIframe(): HTMLIFrameElement;
|
|
@@ -3,6 +3,9 @@ export class BaseWidget {
|
|
|
3
3
|
this.iframe = null;
|
|
4
4
|
this.childAppOrigin = null;
|
|
5
5
|
this.isLaunched = false;
|
|
6
|
+
this.jackpotId = null;
|
|
7
|
+
this.tag = null;
|
|
8
|
+
this.brand = null;
|
|
6
9
|
this.listeners = new Map();
|
|
7
10
|
}
|
|
8
11
|
getBaseUrl(mode) {
|
|
@@ -48,9 +51,12 @@ export class BaseWidget {
|
|
|
48
51
|
this.isLaunched = false;
|
|
49
52
|
}
|
|
50
53
|
setParamsData(params) {
|
|
51
|
-
const { mode, data } = params;
|
|
54
|
+
const { mode, data, jackpotId, tag, brand } = params;
|
|
52
55
|
this.childAppOrigin = this.getBaseUrl(mode !== null && mode !== void 0 ? mode : 'production');
|
|
53
56
|
this.data = data;
|
|
57
|
+
this.jackpotId = jackpotId !== null && jackpotId !== void 0 ? jackpotId : null;
|
|
58
|
+
this.tag = tag !== null && tag !== void 0 ? tag : null;
|
|
59
|
+
this.brand = brand !== null && brand !== void 0 ? brand : null;
|
|
54
60
|
}
|
|
55
61
|
setLaunched(launched) {
|
|
56
62
|
this.isLaunched = launched;
|
|
@@ -5,10 +5,10 @@ export declare class FooterWidget extends BaseWidget {
|
|
|
5
5
|
private constructor();
|
|
6
6
|
static getInstance(): FooterWidget;
|
|
7
7
|
private childMessageHandler;
|
|
8
|
-
|
|
8
|
+
launch(params: FooterWidgetParams): void;
|
|
9
9
|
updateData(partialData: unknown): void;
|
|
10
10
|
private validateNonEmptyObject;
|
|
11
|
-
showPopup
|
|
12
|
-
hidePopup
|
|
13
|
-
|
|
11
|
+
private showPopup;
|
|
12
|
+
private hidePopup;
|
|
13
|
+
destroy(): void;
|
|
14
14
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseWidget } from '../BaseWidget';
|
|
2
|
-
import { FooterIframeIncomingEvent, FooterIframeOutgoingEvent, } from './types/
|
|
2
|
+
import { FooterIframeIncomingEvent, FooterIframeOutgoingEvent, } from './types/events';
|
|
3
3
|
export class FooterWidget extends BaseWidget {
|
|
4
4
|
constructor() {
|
|
5
5
|
super();
|
|
@@ -15,6 +15,9 @@ export class FooterWidget extends BaseWidget {
|
|
|
15
15
|
this.sendDataToChild({
|
|
16
16
|
type: FooterIframeOutgoingEvent.footerWidgetDataInitial,
|
|
17
17
|
data: this.data,
|
|
18
|
+
jackpotId: this.jackpotId,
|
|
19
|
+
tag: this.tag,
|
|
20
|
+
brand: this.brand,
|
|
18
21
|
});
|
|
19
22
|
break;
|
|
20
23
|
case FooterIframeIncomingEvent.showPopup: {
|
|
@@ -40,7 +43,7 @@ export class FooterWidget extends BaseWidget {
|
|
|
40
43
|
}
|
|
41
44
|
return FooterWidget.instance;
|
|
42
45
|
}
|
|
43
|
-
|
|
46
|
+
launch(params) {
|
|
44
47
|
if (this.isWidgetLaunched()) {
|
|
45
48
|
console.warn('Footer widget is already launched');
|
|
46
49
|
return;
|
|
@@ -86,7 +89,7 @@ export class FooterWidget extends BaseWidget {
|
|
|
86
89
|
this.iframe.style.height = '50px';
|
|
87
90
|
}
|
|
88
91
|
}
|
|
89
|
-
|
|
92
|
+
destroy() {
|
|
90
93
|
window.removeEventListener('message', this.childMessageHandler);
|
|
91
94
|
this.removeAllEventListeners();
|
|
92
95
|
this.removeIframe();
|
|
@@ -3,152 +3,7 @@ export interface FooterWidgetParams {
|
|
|
3
3
|
data: unknown;
|
|
4
4
|
mode?: SDKMode;
|
|
5
5
|
container?: string;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
newGroup: JackpotGroupResponseNew;
|
|
10
|
-
theme: JackpotThemeResponse;
|
|
11
|
-
participate: JackpotParticipation;
|
|
12
|
-
}
|
|
13
|
-
export interface JackpotGroup {
|
|
14
|
-
uuid: string;
|
|
15
|
-
name: string;
|
|
16
|
-
brands: string[];
|
|
17
|
-
tags: {
|
|
18
|
-
tag: string;
|
|
19
|
-
}[];
|
|
20
|
-
deleted: boolean;
|
|
21
|
-
}
|
|
22
|
-
export interface JackpotGroupResponse {
|
|
23
|
-
jackpotGroup: JackpotGroup | null;
|
|
24
|
-
theme: Theme | null;
|
|
25
|
-
jackpotLevels: JackpotLevel[];
|
|
26
|
-
}
|
|
27
|
-
export interface JackpotLevel {
|
|
28
|
-
uuid: string;
|
|
29
|
-
name: string;
|
|
30
|
-
currency: string;
|
|
31
|
-
values: {
|
|
32
|
-
[key: string]: number;
|
|
33
|
-
};
|
|
34
|
-
won: boolean;
|
|
35
|
-
paused: boolean;
|
|
36
|
-
prizeLabel: string | null;
|
|
37
|
-
iconAsset: Asset | null;
|
|
38
|
-
}
|
|
39
|
-
export interface JackpotLevelWithColor extends JackpotLevel {
|
|
40
|
-
filter: string;
|
|
41
|
-
background: string;
|
|
42
|
-
}
|
|
43
|
-
export interface WonJackpotLevel extends JackpotLevelWithColor {
|
|
44
|
-
winAmount: number;
|
|
45
|
-
}
|
|
46
|
-
export interface JackpotSegment {
|
|
47
|
-
icon: string;
|
|
48
|
-
backgroundColor: string;
|
|
49
|
-
label: string;
|
|
50
|
-
index: number;
|
|
51
|
-
isWon: boolean;
|
|
52
|
-
filter: string;
|
|
53
|
-
}
|
|
54
|
-
export interface Theme extends BaseTheme {
|
|
55
|
-
clientLogoAsset: Asset | null;
|
|
56
|
-
jackpotLogoAsset: Asset | null;
|
|
57
|
-
jackpotPopupImageAsset: Asset | null;
|
|
58
|
-
lockingSymbolSoundAsset: Asset | null;
|
|
59
|
-
resultNoPrizeSoundAsset: Asset | null;
|
|
60
|
-
resultPrizeRevealSoundAsset: Asset | null;
|
|
61
|
-
spinSoundAsset: Asset | null;
|
|
62
|
-
}
|
|
63
|
-
export interface JackpotGroupResponseNew {
|
|
64
|
-
uuid: string;
|
|
65
|
-
noOfWins: number;
|
|
66
|
-
totalWinAmount: number;
|
|
67
|
-
currentCounters: JackpotCounter[];
|
|
68
|
-
}
|
|
69
|
-
export interface JackpotCounter {
|
|
70
|
-
uuid: string;
|
|
71
|
-
name: string;
|
|
72
|
-
currency: string;
|
|
73
|
-
currentValue: number;
|
|
74
|
-
totalUserLevelContributionPerSpin: number;
|
|
75
|
-
}
|
|
76
|
-
export interface JackpotThemeResponse {
|
|
77
|
-
theme: Theme;
|
|
78
|
-
}
|
|
79
|
-
export interface JackpotParticipation {
|
|
80
|
-
jackpotId: string;
|
|
81
|
-
participate: boolean;
|
|
82
|
-
tag: string | null;
|
|
83
|
-
}
|
|
84
|
-
export interface Asset {
|
|
85
|
-
uuid: string;
|
|
86
|
-
createdTs: string;
|
|
87
|
-
name: string;
|
|
88
|
-
label: string;
|
|
89
|
-
comment: string;
|
|
90
|
-
url: string;
|
|
91
|
-
tags: string[];
|
|
92
|
-
type: AssetType;
|
|
93
|
-
sportType: SportType;
|
|
94
|
-
}
|
|
95
|
-
export declare enum AssetType {
|
|
96
|
-
GAME = "GAME",
|
|
97
|
-
REPORT = "REPORT",
|
|
98
|
-
FONT = "FONT",
|
|
99
|
-
CLIENT = "CLIENT",
|
|
100
|
-
AUDIO = "AUDIO"
|
|
101
|
-
}
|
|
102
|
-
export declare enum SportType {
|
|
103
|
-
SOCCER = "SOCCER",
|
|
104
|
-
CRICKET = "CRICKET",
|
|
105
|
-
BASKETBALL = "BASKETBALL",
|
|
106
|
-
ICE_HOCKEY = "ICE HOCKEY",
|
|
107
|
-
RUGBY = "RUGBY",
|
|
108
|
-
MMA = "MMA",
|
|
109
|
-
BOXING = "BOXING",
|
|
110
|
-
BASEBALL = "BASEBALL",
|
|
111
|
-
GOLF = "GOLF",
|
|
112
|
-
TENNIS = "TENNIS",
|
|
113
|
-
E_SPORTS = "E-SPORTS",
|
|
114
|
-
FORMULA_1 = "FORMULA 1",
|
|
115
|
-
OTHER = "OTHER",
|
|
116
|
-
DARTS = "DARTS",
|
|
117
|
-
OLYMPICS = "OLYMPICS",
|
|
118
|
-
VOLLEYBALL = "VOLLEYBALL",
|
|
119
|
-
AMERICAN_FOOTBALL = "AMERICAN FOOTBALL"
|
|
120
|
-
}
|
|
121
|
-
export interface BaseTheme {
|
|
122
|
-
uuid: string;
|
|
123
|
-
createdTs: string;
|
|
124
|
-
updatedTs: string;
|
|
125
|
-
name: string;
|
|
126
|
-
cssVariables: ConfigValue[];
|
|
127
|
-
primaryFontRegularAsset: Asset;
|
|
128
|
-
primaryFontMediumAsset: Asset;
|
|
129
|
-
primaryFontBoldAsset: Asset;
|
|
130
|
-
jackpotFontAsset: Asset;
|
|
131
|
-
darkMode: boolean;
|
|
132
|
-
backgroundAnimation: BackgroundAnimationType | null;
|
|
133
|
-
labels: ConfigValue[];
|
|
134
|
-
cornerRadiusCta: number;
|
|
135
|
-
termsAndConditions: string | null;
|
|
136
|
-
rules: string | null;
|
|
137
|
-
faq: string | null;
|
|
138
|
-
secondaryCtaStyle: CTAStyles | null;
|
|
139
|
-
}
|
|
140
|
-
export declare enum CTAStyles {
|
|
141
|
-
Outline = "OUTLINE",
|
|
142
|
-
Solid = "SOLID"
|
|
143
|
-
}
|
|
144
|
-
export interface ConfigValue {
|
|
145
|
-
uuid: string;
|
|
146
|
-
key: string;
|
|
147
|
-
description: string;
|
|
148
|
-
value: string;
|
|
149
|
-
hint: string;
|
|
150
|
-
}
|
|
151
|
-
export declare enum BackgroundAnimationType {
|
|
152
|
-
SNOW = "SNOW",
|
|
153
|
-
SPARKLE = "SPARKLE"
|
|
6
|
+
jackpotId?: string;
|
|
7
|
+
tag?: string;
|
|
8
|
+
brand?: string;
|
|
154
9
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FooterWidgetParams } from '../footerWidget/types/data';
|
|
2
|
-
import { FooterIframeOutgoingEvent } from '../footerWidget/types/
|
|
3
|
-
import {
|
|
4
|
-
import { WinWidgetIframeOutgoingEvent } from '../
|
|
2
|
+
import { FooterIframeOutgoingEvent } from '../footerWidget/types/events';
|
|
3
|
+
import { WinWidgetParams } from '../winWidget/types/data';
|
|
4
|
+
import { WinWidgetIframeOutgoingEvent } from '../winWidget/types/events';
|
|
5
5
|
export type SDKMode = 'local' | 'dev' | 'staging' | 'production';
|
|
6
|
-
export type WidgetParams = FooterWidgetParams |
|
|
6
|
+
export type WidgetParams = FooterWidgetParams | WinWidgetParams;
|
|
7
7
|
export type IframeOutgoingEvent = FooterIframeOutgoingEvent | WinWidgetIframeOutgoingEvent;
|
|
8
8
|
export type WidgetEventHandler = () => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseWidget } from '../BaseWidget';
|
|
2
|
+
import { WinWidgetParams } from './types/data';
|
|
3
|
+
export declare class WinWidget extends BaseWidget {
|
|
4
|
+
private static instance;
|
|
5
|
+
private constructor();
|
|
6
|
+
static getInstance(): WinWidget;
|
|
7
|
+
private childMessageHandler;
|
|
8
|
+
launch(params: WinWidgetParams): void;
|
|
9
|
+
destroy(): void;
|
|
10
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseWidget } from '../BaseWidget';
|
|
2
|
-
import { WinWidgetIframeIncomingEvent, WinWidgetIframeOutgoingEvent, } from './types/
|
|
3
|
-
export class
|
|
2
|
+
import { WinWidgetIframeIncomingEvent, WinWidgetIframeOutgoingEvent, } from './types/events';
|
|
3
|
+
export class WinWidget extends BaseWidget {
|
|
4
4
|
constructor() {
|
|
5
5
|
super();
|
|
6
6
|
this.childMessageHandler = (event) => {
|
|
@@ -14,6 +14,9 @@ export class WonJackpotWidget extends BaseWidget {
|
|
|
14
14
|
this.sendDataToChild({
|
|
15
15
|
type: WinWidgetIframeOutgoingEvent.winWidgetDataInitial,
|
|
16
16
|
data: this.data,
|
|
17
|
+
jackpotId: this.jackpotId,
|
|
18
|
+
tag: this.tag,
|
|
19
|
+
brand: this.brand,
|
|
17
20
|
});
|
|
18
21
|
break;
|
|
19
22
|
case WinWidgetIframeIncomingEvent.winWidgetClose:
|
|
@@ -23,12 +26,12 @@ export class WonJackpotWidget extends BaseWidget {
|
|
|
23
26
|
};
|
|
24
27
|
}
|
|
25
28
|
static getInstance() {
|
|
26
|
-
if (!
|
|
27
|
-
|
|
29
|
+
if (!WinWidget.instance) {
|
|
30
|
+
WinWidget.instance = new WinWidget();
|
|
28
31
|
}
|
|
29
|
-
return
|
|
32
|
+
return WinWidget.instance;
|
|
30
33
|
}
|
|
31
|
-
|
|
34
|
+
launch(params) {
|
|
32
35
|
if (this.isWidgetLaunched()) {
|
|
33
36
|
console.warn('Won Jackpot widget is already launched');
|
|
34
37
|
return;
|
|
@@ -46,7 +49,7 @@ export class WonJackpotWidget extends BaseWidget {
|
|
|
46
49
|
this.setLaunched(true);
|
|
47
50
|
window.addEventListener('message', this.childMessageHandler);
|
|
48
51
|
}
|
|
49
|
-
|
|
52
|
+
destroy() {
|
|
50
53
|
window.removeEventListener('message', this.childMessageHandler);
|
|
51
54
|
this.removeAllEventListeners();
|
|
52
55
|
this.removeIframe();
|
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BaseWidget } from '../BaseWidget';
|
|
2
|
-
import { WonJackpotWidgetParams } from './types/data';
|
|
3
|
-
export declare class WonJackpotWidget extends BaseWidget {
|
|
4
|
-
private static instance;
|
|
5
|
-
private constructor();
|
|
6
|
-
static getInstance(): WonJackpotWidget;
|
|
7
|
-
private childMessageHandler;
|
|
8
|
-
launchWonJackpot(params: WonJackpotWidgetParams): void;
|
|
9
|
-
destroyWonJackpot(): void;
|
|
10
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|