@streamlayer/sdk-web-core 1.14.1 → 1.15.1
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/lib/index.d.ts +2 -0
- package/lib/ui/index.d.ts +5 -0
- package/lib/ui/index.js +54 -9
- package/lib/videoPlayer/index.d.ts +2 -1
- package/package.json +7 -7
package/lib/index.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ declare module '@streamlayer/sdk-web-interfaces' {
|
|
|
14
14
|
skipOnboarding?: boolean;
|
|
15
15
|
hideFriends?: boolean;
|
|
16
16
|
betPack?: boolean;
|
|
17
|
+
containerId?: string;
|
|
18
|
+
parentClassName?: string;
|
|
17
19
|
}
|
|
18
20
|
interface StreamLayerSDK {
|
|
19
21
|
initializeApp: (contextConfig?: ContextConfig) => Promise<{
|
package/lib/ui/index.d.ts
CHANGED
|
@@ -16,8 +16,11 @@ export type UIState = {
|
|
|
16
16
|
promotionBanner?: boolean;
|
|
17
17
|
promotionNotification?: boolean;
|
|
18
18
|
app?: boolean;
|
|
19
|
+
appSidebar?: boolean;
|
|
19
20
|
appNotification?: boolean;
|
|
21
|
+
appBanner?: boolean;
|
|
20
22
|
onboardingNotification?: boolean;
|
|
23
|
+
exposedPauseAd?: boolean;
|
|
21
24
|
};
|
|
22
25
|
export interface UIContext {
|
|
23
26
|
disableApp: () => void;
|
|
@@ -27,6 +30,8 @@ export interface UIContext {
|
|
|
27
30
|
disableOnboardingNotification: () => void;
|
|
28
31
|
enableOnboardingNotification: () => void;
|
|
29
32
|
onContentActivate?: OnContentActivateCallback;
|
|
33
|
+
enableExposedPauseAd: () => void;
|
|
34
|
+
disableExposedPauseAd: () => void;
|
|
30
35
|
}
|
|
31
36
|
declare module '@streamlayer/sdk-web-interfaces' {
|
|
32
37
|
interface StreamLayerContext {
|
package/lib/ui/index.js
CHANGED
|
@@ -7,6 +7,12 @@ const questionTypes = {
|
|
|
7
7
|
[QuestionType.PREDICTION]: 'prediction',
|
|
8
8
|
[QuestionType.TWEET]: 'tweet',
|
|
9
9
|
};
|
|
10
|
+
const isOverlayPromotion = (type) => {
|
|
11
|
+
return (type === PromotionType.INGAME_IAB11 ||
|
|
12
|
+
type === PromotionType.INGAME_IAB21 ||
|
|
13
|
+
type === PromotionType.NFL_SHOP_OVERLAY ||
|
|
14
|
+
type === PromotionType.SHOP_OVERLAY);
|
|
15
|
+
};
|
|
10
16
|
export const ui = (instance, opts, done) => {
|
|
11
17
|
instance.sdk.uiState = createMapStore({});
|
|
12
18
|
instance.ui = {
|
|
@@ -34,10 +40,24 @@ export const ui = (instance, opts, done) => {
|
|
|
34
40
|
instance.sdk.uiState.set({
|
|
35
41
|
...instance.sdk.uiState.get(),
|
|
36
42
|
onboardingNotification: false,
|
|
43
|
+
appBanner: false,
|
|
44
|
+
appSidebar: false,
|
|
37
45
|
appNotification: false,
|
|
38
46
|
app: false,
|
|
39
47
|
});
|
|
40
48
|
},
|
|
49
|
+
enableExposedPauseAd: function () {
|
|
50
|
+
instance.sdk.uiState.set({
|
|
51
|
+
...instance.sdk.uiState.get(),
|
|
52
|
+
exposedPauseAd: true,
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
disableExposedPauseAd: function () {
|
|
56
|
+
instance.sdk.uiState.set({
|
|
57
|
+
...instance.sdk.uiState.get(),
|
|
58
|
+
exposedPauseAd: false,
|
|
59
|
+
});
|
|
60
|
+
},
|
|
41
61
|
};
|
|
42
62
|
if (opts.onContentActivate) {
|
|
43
63
|
instance.ui.onContentActivate = opts.onContentActivate;
|
|
@@ -48,9 +68,9 @@ export const ui = (instance, opts, done) => {
|
|
|
48
68
|
}
|
|
49
69
|
};
|
|
50
70
|
instance.onQuestionActivate = ({ questionType, ...params }) => {
|
|
71
|
+
instance.ui.enableAppNotification();
|
|
51
72
|
if (instance.ui.onContentActivate) {
|
|
52
73
|
const type = params.type || (questionType && questionTypes[questionType]) || 'question';
|
|
53
|
-
instance.ui.enableAppNotification();
|
|
54
74
|
instance.ui.onContentActivate({ ...params, type });
|
|
55
75
|
}
|
|
56
76
|
};
|
|
@@ -67,6 +87,31 @@ export const ui = (instance, opts, done) => {
|
|
|
67
87
|
break;
|
|
68
88
|
}
|
|
69
89
|
}
|
|
90
|
+
if (event.slEventBus?.type === 'poll') {
|
|
91
|
+
const action = event.slEventBus.action;
|
|
92
|
+
const { hasBanner } = event.slEventBus.payload;
|
|
93
|
+
switch (action) {
|
|
94
|
+
case 'onboardingOpen':
|
|
95
|
+
instance.sdk.uiState.set({
|
|
96
|
+
app: true,
|
|
97
|
+
});
|
|
98
|
+
break;
|
|
99
|
+
case 'opened':
|
|
100
|
+
instance.sdk.uiState.set({
|
|
101
|
+
...instance.sdk.uiState.get(),
|
|
102
|
+
appBanner: hasBanner,
|
|
103
|
+
appSidebar: true,
|
|
104
|
+
});
|
|
105
|
+
break;
|
|
106
|
+
case 'closed':
|
|
107
|
+
instance.sdk.uiState.set({
|
|
108
|
+
...instance.sdk.uiState.get(),
|
|
109
|
+
appBanner: false,
|
|
110
|
+
appSidebar: false,
|
|
111
|
+
});
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
70
115
|
if (event.slEventBus?.type === 'notification') {
|
|
71
116
|
const action = event.slEventBus.action;
|
|
72
117
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -101,8 +146,8 @@ export const ui = (instance, opts, done) => {
|
|
|
101
146
|
promotionExternalAd: type === PromotionType.EXTERNAL_AD,
|
|
102
147
|
promotionBanner: hasBanner,
|
|
103
148
|
promotionNotification: false,
|
|
104
|
-
promotionOverlay:
|
|
105
|
-
promotionSidebar:
|
|
149
|
+
promotionOverlay: isOverlayPromotion(type),
|
|
150
|
+
promotionSidebar: !isOverlayPromotion(type),
|
|
106
151
|
});
|
|
107
152
|
break;
|
|
108
153
|
case 'received':
|
|
@@ -118,8 +163,8 @@ export const ui = (instance, opts, done) => {
|
|
|
118
163
|
instance.sdk.uiState.set({
|
|
119
164
|
promotionBanner: hasBanner,
|
|
120
165
|
onboardingNotification: instance.sdk.uiState.get().onboardingNotification,
|
|
121
|
-
promotionOverlay:
|
|
122
|
-
promotionSidebar:
|
|
166
|
+
promotionOverlay: isOverlayPromotion(type),
|
|
167
|
+
promotionSidebar: !isOverlayPromotion(type),
|
|
123
168
|
promotionExternalAd: type === PromotionType.EXTERNAL_AD,
|
|
124
169
|
});
|
|
125
170
|
break;
|
|
@@ -134,8 +179,8 @@ export const ui = (instance, opts, done) => {
|
|
|
134
179
|
instance.sdk.uiState.set({
|
|
135
180
|
onboardingNotification: instance.sdk.uiState.get().onboardingNotification,
|
|
136
181
|
promotionBanner: hasBanner,
|
|
137
|
-
promotionOverlay:
|
|
138
|
-
promotionSidebar:
|
|
182
|
+
promotionOverlay: isOverlayPromotion(type),
|
|
183
|
+
promotionSidebar: !isOverlayPromotion(type),
|
|
139
184
|
promotionExternalAd: type === PromotionType.EXTERNAL_AD,
|
|
140
185
|
});
|
|
141
186
|
}
|
|
@@ -165,8 +210,8 @@ export const ui = (instance, opts, done) => {
|
|
|
165
210
|
// @ts-ignore
|
|
166
211
|
const cancel2 = instance.activeFeature.subscribe((feature) => {
|
|
167
212
|
if (feature) {
|
|
168
|
-
instance.ui.enableApp()
|
|
169
|
-
instance.sdk.uiState.set({ app: true })
|
|
213
|
+
// instance.ui.enableApp()
|
|
214
|
+
// instance.sdk.uiState.set({ app: true })
|
|
170
215
|
}
|
|
171
216
|
else {
|
|
172
217
|
instance.ui.disableApp();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StreamLayerContext } from '@streamlayer/sdk-web-interfaces';
|
|
2
2
|
export type VideoPlayerData = {
|
|
3
|
-
muted
|
|
3
|
+
muted?: boolean;
|
|
4
|
+
play?: boolean;
|
|
4
5
|
};
|
|
5
6
|
export type VideoPlayerCallback = (videoPlayerData: VideoPlayerData) => void;
|
|
6
7
|
export interface VideoPlayerContext {
|
package/package.json
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
},
|
|
6
6
|
"peerDependencies": {
|
|
7
7
|
"@nanostores/query": "^0.2.10",
|
|
8
|
-
"@streamlayer/sl-eslib": "^5.
|
|
8
|
+
"@streamlayer/sl-eslib": "^5.216.1",
|
|
9
9
|
"nanostores": "^0.11.4",
|
|
10
|
-
"@streamlayer/sdk-web-api": "^1.
|
|
11
|
-
"@streamlayer/sdk-web-interfaces": "^1.
|
|
12
|
-
"@streamlayer/sdk-web-logger": "^1.0.
|
|
13
|
-
"@streamlayer/sdk-web-storage": "^1.0.
|
|
14
|
-
"@streamlayer/sdk-web-types": "^1.
|
|
10
|
+
"@streamlayer/sdk-web-api": "^1.12.1",
|
|
11
|
+
"@streamlayer/sdk-web-interfaces": "^1.7.1",
|
|
12
|
+
"@streamlayer/sdk-web-logger": "^1.0.68",
|
|
13
|
+
"@streamlayer/sdk-web-storage": "^1.0.68",
|
|
14
|
+
"@streamlayer/sdk-web-types": "^1.14.1"
|
|
15
15
|
},
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"default": "./lib/auth/index.js"
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
|
-
"version": "1.
|
|
48
|
+
"version": "1.15.1",
|
|
49
49
|
"type": "module",
|
|
50
50
|
"main": "./lib/index.js",
|
|
51
51
|
"module": "./lib/index.js",
|