@splash-tech/jackpot-sdk 3.0.3 → 3.0.4
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/clients/registry.d.ts +3 -3
- package/dist/clients/registry.js +5 -11
- package/dist/compat/v2/mapLaunchParams.d.ts +2 -14
- package/dist/compat/v2/splashJackpot.d.ts +1 -1
- package/dist/compat/v2/splashJackpot.js +11 -2
- package/dist/compat/v2/types.d.ts +16 -0
- package/dist/compat/v3/createSplashJackpot.d.ts +1 -1
- package/dist/compat/v3/createSplashJackpot.js +1 -4
- package/dist/{types.d.ts → compat/v3/types.d.ts} +2 -3
- package/dist/compat/v3/types.js +1 -0
- package/dist/core/types.d.ts +0 -1
- package/package.json +1 -1
- /package/dist/{types.js → compat/v2/types.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SDKEnv } from '../
|
|
1
|
+
import { SDKEnv } from '../compat/v2/types';
|
|
2
2
|
import { FooterWidget as FooterWidgetH4 } from './h4n8w3vt/FooterWidget';
|
|
3
3
|
import { FooterWidget as FooterWidgetX7 } from './x7k2m9qp/FooterWidget';
|
|
4
4
|
import { WinWidget as WinWidgetX7 } from './x7k2m9qp/WinWidget';
|
|
@@ -19,8 +19,8 @@ export interface ClientWidgets {
|
|
|
19
19
|
[Clients.h4n8w3vt]: H4Widgets;
|
|
20
20
|
}
|
|
21
21
|
interface ClientDefinition<C extends ClientId> {
|
|
22
|
-
baseUrls
|
|
23
|
-
createWidgets: (
|
|
22
|
+
baseUrls?: Record<SDKEnv, string>;
|
|
23
|
+
createWidgets: (baseUrl: string) => ClientWidgets[C];
|
|
24
24
|
}
|
|
25
25
|
export declare const clientRegistry: {
|
|
26
26
|
[K in ClientId]: ClientDefinition<K>;
|
package/dist/clients/registry.js
CHANGED
|
@@ -13,20 +13,14 @@ export const clientRegistry = {
|
|
|
13
13
|
staging: 'https://jackpot-widget-staging.splash.tech',
|
|
14
14
|
production: 'https://jackpot-widget.splash.tech',
|
|
15
15
|
},
|
|
16
|
-
createWidgets: (
|
|
17
|
-
footerWidget: new FooterWidgetX7(
|
|
18
|
-
winWidget: new WinWidgetX7(
|
|
16
|
+
createWidgets: (baseUrl) => ({
|
|
17
|
+
footerWidget: new FooterWidgetX7(baseUrl),
|
|
18
|
+
winWidget: new WinWidgetX7(baseUrl),
|
|
19
19
|
}),
|
|
20
20
|
},
|
|
21
21
|
[Clients.h4n8w3vt]: {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
dev: 'https://jackpot-widget-b2tech-dev.splash.tech',
|
|
25
|
-
staging: 'https://jackpot-widget-b2tech-staging.splash.tech',
|
|
26
|
-
production: 'https://jackpot-widget-b2tech.splash.tech',
|
|
27
|
-
},
|
|
28
|
-
createWidgets: (origin) => ({
|
|
29
|
-
footerWidget: new FooterWidgetH4(origin),
|
|
22
|
+
createWidgets: (baseUrl) => ({
|
|
23
|
+
footerWidget: new FooterWidgetH4(baseUrl),
|
|
30
24
|
}),
|
|
31
25
|
},
|
|
32
26
|
};
|
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
import { FooterWidgetBaseConfig,
|
|
2
|
-
|
|
3
|
-
data: unknown;
|
|
4
|
-
mode?: SDKEnv;
|
|
5
|
-
position?: FooterWidgetBaseConfig['position'];
|
|
6
|
-
maxWidth?: string;
|
|
7
|
-
container?: string;
|
|
8
|
-
}
|
|
9
|
-
export interface V2WinWidgetLaunchParams {
|
|
10
|
-
data: unknown;
|
|
11
|
-
mode?: SDKEnv;
|
|
12
|
-
animation?: 'wheel' | 'airplane';
|
|
13
|
-
container?: string;
|
|
14
|
-
}
|
|
1
|
+
import { FooterWidgetBaseConfig, WidgetLaunchParams, WinWidgetBaseConfig } from '../../core/types';
|
|
2
|
+
import { V2FooterWidgetLaunchParams, V2WinWidgetLaunchParams } from './types';
|
|
15
3
|
export declare function mapV2FooterWidgetLaunchParams(params: V2FooterWidgetLaunchParams): WidgetLaunchParams<FooterWidgetBaseConfig>;
|
|
16
4
|
export declare function mapV2WinWidgetLaunchParams(params: V2WinWidgetLaunchParams): WidgetLaunchParams<WinWidgetBaseConfig & {
|
|
17
5
|
animation?: 'wheel' | 'airplane';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FooterWidgetEvents, WinWidgetEvents } from '../../clients/x7k2m9qp/types';
|
|
2
2
|
import { WidgetEventHandler } from '../../core/types';
|
|
3
|
-
import { V2FooterWidgetLaunchParams, V2WinWidgetLaunchParams } from './
|
|
3
|
+
import { V2FooterWidgetLaunchParams, V2WinWidgetLaunchParams } from './types';
|
|
4
4
|
export declare const splashJackpot: {
|
|
5
5
|
footerWidget: {
|
|
6
6
|
isLaunched: () => boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Clients } from '../../clients/registry';
|
|
1
|
+
import { Clients, clientRegistry } from '../../clients/registry';
|
|
2
2
|
import { createSplashJackpot } from '../v3/createSplashJackpot';
|
|
3
3
|
import { mapV2FooterWidgetLaunchParams, mapV2WinWidgetLaunchParams, } from './mapLaunchParams';
|
|
4
4
|
// Facade for legacy v2.
|
|
@@ -9,12 +9,21 @@ function createV2SplashJackpot() {
|
|
|
9
9
|
let instance = null;
|
|
10
10
|
const footerWidgetListeners = new Map();
|
|
11
11
|
const winWidgetListeners = new Map();
|
|
12
|
+
function resolveBuiltInBaseUrl(mode) {
|
|
13
|
+
var _a;
|
|
14
|
+
const env = mode !== null && mode !== void 0 ? mode : 'production';
|
|
15
|
+
const baseUrl = (_a = clientRegistry[Clients.x7k2m9qp].baseUrls) === null || _a === void 0 ? void 0 : _a[env];
|
|
16
|
+
if (!baseUrl) {
|
|
17
|
+
throw new Error(`splashJackpot: no widget URL for mode "${env}".`);
|
|
18
|
+
}
|
|
19
|
+
return baseUrl;
|
|
20
|
+
}
|
|
12
21
|
function createInstance(mode) {
|
|
13
22
|
if (instance)
|
|
14
23
|
return instance;
|
|
15
24
|
instance = createSplashJackpot({
|
|
16
25
|
client: Clients.x7k2m9qp,
|
|
17
|
-
|
|
26
|
+
baseUrl: resolveBuiltInBaseUrl(mode),
|
|
18
27
|
});
|
|
19
28
|
for (const [event, handlers] of footerWidgetListeners) {
|
|
20
29
|
for (const handler of handlers) {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FooterWidgetBaseConfig } from '../../core/types';
|
|
2
|
+
export type SDKEnv = 'local' | 'dev' | 'staging' | 'production';
|
|
3
|
+
export type V2Mode = SDKEnv;
|
|
4
|
+
export interface V2FooterWidgetLaunchParams {
|
|
5
|
+
data: unknown;
|
|
6
|
+
mode?: V2Mode;
|
|
7
|
+
position?: FooterWidgetBaseConfig['position'];
|
|
8
|
+
maxWidth?: string;
|
|
9
|
+
container?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface V2WinWidgetLaunchParams {
|
|
12
|
+
data: unknown;
|
|
13
|
+
mode?: V2Mode;
|
|
14
|
+
animation?: 'wheel' | 'airplane';
|
|
15
|
+
container?: string;
|
|
16
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ClientId } from '../../clients/registry';
|
|
2
|
-
import {
|
|
2
|
+
import { SplashJackpotSDK, SplashJackpotInitOptions } from './types';
|
|
3
3
|
export declare function createSplashJackpot<C extends ClientId>(options: SplashJackpotInitOptions<C>): SplashJackpotSDK<C>;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { clientRegistry } from '../../clients/registry';
|
|
2
2
|
export function createSplashJackpot(options) {
|
|
3
|
-
var _a;
|
|
4
3
|
const client = clientRegistry[options.client];
|
|
5
4
|
if (!client) {
|
|
6
5
|
throw new Error(`createSplashJackpot: unknown client "${options.client}".`);
|
|
7
6
|
}
|
|
8
|
-
|
|
9
|
-
const childAppOrigin = client.baseUrls[env];
|
|
10
|
-
return client.createWidgets(childAppOrigin);
|
|
7
|
+
return client.createWidgets(options.baseUrl);
|
|
11
8
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { ClientId, ClientWidgets } from '
|
|
2
|
-
import { SDKEnv } from './core/types';
|
|
1
|
+
import { ClientId, ClientWidgets } from '../../clients/registry';
|
|
3
2
|
export interface SplashJackpotInitOptions<C extends ClientId> {
|
|
4
3
|
client: C;
|
|
5
|
-
|
|
4
|
+
baseUrl: string;
|
|
6
5
|
}
|
|
7
6
|
export type SplashJackpotSDK<C extends ClientId> = ClientWidgets[C];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/core/types.d.ts
CHANGED
package/package.json
CHANGED
|
File without changes
|