@streamlayer/sdk-web-core 1.6.4 → 1.6.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/lib/ui/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export type UIData = {
9
9
  };
10
10
  export type OnContentActivateCallback = (renderData: UIData) => void;
11
11
  export type UIState = {
12
+ promotionExternalAd?: boolean;
12
13
  promotionSidebar?: boolean;
13
14
  promotionOverlay?: boolean;
14
15
  promotionBanner?: boolean;
package/lib/ui/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createMapStore, eventBus, } from '@streamlayer/sdk-web-interfaces';
2
- import { QuestionType } from '@streamlayer/sdk-web-types';
2
+ import { PromotionType, QuestionType } from '@streamlayer/sdk-web-types';
3
3
  const questionTypes = {
4
4
  [QuestionType.FACTOID]: 'insight',
5
5
  [QuestionType.POLL]: 'poll',
@@ -61,10 +61,11 @@ export const ui = (instance, opts, done) => {
61
61
  }
62
62
  if (event.slEventBus?.type === 'advertisement' && opts.withAd) {
63
63
  const ctx = event.slEventBus;
64
- const { hasNotification, id, isViewed } = ctx.payload;
64
+ const { hasNotification, id, isViewed, type } = ctx.payload;
65
65
  switch (ctx.action) {
66
66
  case 'notification-opened':
67
67
  instance.sdk.uiState.set({
68
+ promotionExternalAd: type === PromotionType.EXTERNAL_AD,
68
69
  promotionBanner: true,
69
70
  promotionNotification: false,
70
71
  promotionOverlay: true,
@@ -84,6 +85,7 @@ export const ui = (instance, opts, done) => {
84
85
  promotionBanner: true,
85
86
  promotionOverlay: true,
86
87
  promotionSidebar: true,
88
+ promotionExternalAd: type === PromotionType.EXTERNAL_AD,
87
89
  });
88
90
  break;
89
91
  }
@@ -97,15 +99,18 @@ export const ui = (instance, opts, done) => {
97
99
  promotionBanner: true,
98
100
  promotionOverlay: true,
99
101
  promotionSidebar: true,
102
+ promotionExternalAd: type === PromotionType.EXTERNAL_AD,
100
103
  });
101
104
  }
102
105
  break;
103
106
  case 'closed':
107
+ console.log('closed', ctx.payload);
104
108
  instance.sdk.uiState.set({
105
109
  ...instance.sdk.uiState.get(),
106
110
  promotionNotification: false,
107
111
  promotionBanner: false,
108
112
  promotionOverlay: false,
113
+ promotionExternalAd: false,
109
114
  promotionSidebar: false,
110
115
  });
111
116
  onAdvertisementActivate({
package/package.json CHANGED
@@ -7,11 +7,11 @@
7
7
  "@nanostores/query": "^0.2.10",
8
8
  "@streamlayer/sl-eslib": "^5.130.0",
9
9
  "nanostores": "^0.10.3",
10
- "@streamlayer/sdk-web-api": "^1.6.5",
11
- "@streamlayer/sdk-web-interfaces": "^1.2.5",
12
- "@streamlayer/sdk-web-logger": "^1.0.26",
13
- "@streamlayer/sdk-web-storage": "^1.0.26",
14
- "@streamlayer/sdk-web-types": "^1.7.5"
10
+ "@streamlayer/sdk-web-api": "^1.6.6",
11
+ "@streamlayer/sdk-web-interfaces": "^1.2.6",
12
+ "@streamlayer/sdk-web-logger": "^1.0.27",
13
+ "@streamlayer/sdk-web-types": "^1.8.0",
14
+ "@streamlayer/sdk-web-storage": "^1.0.27"
15
15
  },
16
16
  "exports": {
17
17
  ".": {
@@ -40,7 +40,7 @@
40
40
  "default": "./lib/auth/index.js"
41
41
  }
42
42
  },
43
- "version": "1.6.4",
43
+ "version": "1.6.5",
44
44
  "type": "module",
45
45
  "main": "./lib/index.js",
46
46
  "module": "./lib/index.js",