@streamlayer/sdk-web-core 1.10.1 → 1.11.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 CHANGED
@@ -11,6 +11,8 @@ declare module '@streamlayer/sdk-web-interfaces' {
11
11
  friendsTab: 'enabled' | 'disabled' | 'activatedGame';
12
12
  theme?: string;
13
13
  themeMode?: 'light' | 'dark';
14
+ skipOnboarding?: boolean;
15
+ hideFriends?: boolean;
14
16
  }
15
17
  interface StreamLayerSDK {
16
18
  initializeApp: (contextConfig?: ContextConfig) => Promise<{
package/lib/ui/index.d.ts CHANGED
@@ -17,12 +17,15 @@ export type UIState = {
17
17
  promotionNotification?: boolean;
18
18
  app?: boolean;
19
19
  appNotification?: boolean;
20
+ onboardingNotification?: boolean;
20
21
  };
21
22
  export interface UIContext {
22
23
  disableApp: () => void;
23
24
  enableApp: () => void;
24
25
  disableAppNotification: () => void;
25
26
  enableAppNotification: () => void;
27
+ disableOnboardingNotification: () => void;
28
+ enableOnboardingNotification: () => void;
26
29
  onContentActivate?: OnContentActivateCallback;
27
30
  }
28
31
  declare module '@streamlayer/sdk-web-interfaces' {
package/lib/ui/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createMapStore, eventBus, } from '@streamlayer/sdk-web-interfaces';
2
- import { PromotionType, QuestionType } from '@streamlayer/sdk-web-types';
2
+ import { NotificationType, PromotionType, QuestionType } from '@streamlayer/sdk-web-types';
3
3
  const questionTypes = {
4
4
  [QuestionType.FACTOID]: 'insight',
5
5
  [QuestionType.POLL]: 'poll',
@@ -18,6 +18,12 @@ export const ui = (instance, opts, done) => {
18
18
  instance.sdk.uiState.setKey('appNotification', false);
19
19
  }
20
20
  },
21
+ enableOnboardingNotification: function () {
22
+ instance.sdk.uiState.setKey('onboardingNotification', true);
23
+ },
24
+ disableOnboardingNotification: function () {
25
+ instance.sdk.uiState.setKey('onboardingNotification', false);
26
+ },
21
27
  enableApp: function () {
22
28
  instance.sdk.uiState.set({
23
29
  app: true,
@@ -27,6 +33,7 @@ export const ui = (instance, opts, done) => {
27
33
  disableApp: function () {
28
34
  instance.sdk.uiState.set({
29
35
  ...instance.sdk.uiState.get(),
36
+ onboardingNotification: false,
30
37
  appNotification: false,
31
38
  app: false,
32
39
  });
@@ -50,13 +57,25 @@ export const ui = (instance, opts, done) => {
50
57
  const listener = (event) => {
51
58
  if (event.slEventBus?.type === 'notification') {
52
59
  const action = event.slEventBus.action;
53
- switch (action) {
54
- case 'received':
55
- instance.ui.enableAppNotification();
56
- break;
57
- case 'closed':
58
- instance.ui.disableAppNotification();
59
- break;
60
+ if (event.slEventBus.payload.type === NotificationType.ONBOARDING) {
61
+ switch (action) {
62
+ case 'received':
63
+ instance.ui.enableOnboardingNotification();
64
+ break;
65
+ case 'closed':
66
+ instance.ui.disableOnboardingNotification();
67
+ break;
68
+ }
69
+ }
70
+ else {
71
+ switch (action) {
72
+ case 'received':
73
+ instance.ui.enableAppNotification();
74
+ break;
75
+ case 'closed':
76
+ instance.ui.disableAppNotification();
77
+ break;
78
+ }
60
79
  }
61
80
  }
62
81
  if (event.slEventBus?.type === 'advertisement' && opts.withAd) {
@@ -84,6 +103,7 @@ export const ui = (instance, opts, done) => {
84
103
  if (!opts.withAdNotification) {
85
104
  instance.sdk.uiState.set({
86
105
  promotionBanner: hasBanner,
106
+ onboardingNotification: instance.sdk.uiState.get().onboardingNotification,
87
107
  promotionOverlay: true,
88
108
  promotionSidebar: true,
89
109
  promotionExternalAd: type === PromotionType.EXTERNAL_AD,
@@ -92,11 +112,13 @@ export const ui = (instance, opts, done) => {
92
112
  }
93
113
  if (hasNotification) {
94
114
  instance.sdk.uiState.set({
115
+ onboardingNotification: instance.sdk.uiState.get().onboardingNotification,
95
116
  promotionNotification: true,
96
117
  });
97
118
  }
98
119
  else {
99
120
  instance.sdk.uiState.set({
121
+ onboardingNotification: instance.sdk.uiState.get().onboardingNotification,
100
122
  promotionBanner: hasBanner,
101
123
  promotionOverlay: true,
102
124
  promotionSidebar: true,
package/package.json CHANGED
@@ -7,11 +7,11 @@
7
7
  "@nanostores/query": "^0.2.10",
8
8
  "@streamlayer/sl-eslib": "^5.149.1",
9
9
  "nanostores": "^0.10.3",
10
- "@streamlayer/sdk-web-api": "^1.7.1",
11
- "@streamlayer/sdk-web-interfaces": "^1.4.10",
12
- "@streamlayer/sdk-web-logger": "^1.0.44",
13
- "@streamlayer/sdk-web-storage": "^1.0.44",
14
- "@streamlayer/sdk-web-types": "^1.10.1"
10
+ "@streamlayer/sdk-web-api": "^1.7.3",
11
+ "@streamlayer/sdk-web-interfaces": "^1.4.12",
12
+ "@streamlayer/sdk-web-logger": "^1.0.46",
13
+ "@streamlayer/sdk-web-storage": "^1.0.46",
14
+ "@streamlayer/sdk-web-types": "^1.10.3"
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.10.1",
48
+ "version": "1.11.1",
49
49
  "type": "module",
50
50
  "main": "./lib/index.js",
51
51
  "module": "./lib/index.js",