@streamlayer/react 0.40.2 → 0.41.0
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/cjs/gamification-feature.js +1 -1
- package/lib/cjs/index3.js +1 -0
- package/lib/cjs/masters.js +1 -1
- package/lib/cjs/masters2.js +51 -47
- package/lib/cjs/points.js +1 -1
- package/lib/cjs/useStreamLayerApp.js +1 -1
- package/lib/dist/cjs/index.js +198 -1
- package/lib/dist/es/index.js +44726 -7
- package/lib/dist/index.d.ts +395 -44
- package/lib/dist/style.css +1 -1
- package/lib/es/gamification-feature.js +10 -1365
- package/lib/es/index3.js +246 -0
- package/lib/es/masters.js +8 -6
- package/lib/es/masters2.js +13141 -11606
- package/lib/es/points.js +38 -34
- package/lib/es/useStreamLayerApp.js +1 -1
- package/lib/style.css +1 -1
- package/package.json +29 -29
- package/lib/cjs/useSdkFeature.js +0 -1
- package/lib/dist/cjs/gamification-feature.js +0 -1
- package/lib/dist/cjs/masters.js +0 -200
- package/lib/dist/es/gamification-feature.js +0 -1636
- package/lib/dist/es/masters.js +0 -43278
- package/lib/es/useSdkFeature.js +0 -193
package/lib/dist/index.d.ts
CHANGED
|
@@ -5,11 +5,11 @@ declare module "../../sdk-web-types/src/sl-types" {
|
|
|
5
5
|
import type { GameSettings as IGameSettings } from '@streamlayer/sl-eslib/sdkSettings/game/common/game_common_pb';
|
|
6
6
|
import type { ClientSettings } from '@streamlayer/sl-eslib/sdkSettings/client/client_pb';
|
|
7
7
|
import type { MeResponse } from '@streamlayer/sl-eslib/users/users_pb';
|
|
8
|
-
export { QuestionType, QuestionStatus, QuestionImages, ImagePosition,
|
|
9
|
-
import type { PickHistory as IPickHistory, InsightHistory as IInsightHistory, TweetHistory as ITweetHistory, FeedItemAttributes, InstantView as IInstantView } from '@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb';
|
|
8
|
+
export { QuestionType, QuestionStatus, QuestionImages, ImagePosition, SilenceSetting, QuestionOptions, } from '@streamlayer/sl-eslib/interactive/interactive.common_pb';
|
|
9
|
+
import type { PickHistory as IPickHistory, InsightHistory as IInsightHistory, TweetHistory as ITweetHistory, FeedItem as IFeedItem, FeedItemAttributes as IFeedItemAttributes, InstantView as IInstantView } from '@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb';
|
|
10
10
|
export { PickHistoryStatus } from '@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb';
|
|
11
11
|
import type { LeaderboardItem as ILeaderboardItem } from '@streamlayer/sl-eslib/interactive/leaderboard/interactive.leaderboard_pb';
|
|
12
|
-
import type { ExtendedQuestionAnswer as IExtendedQuestionAnswer } from '@streamlayer/sl-eslib/interactive/interactive.common_pb';
|
|
12
|
+
import type { ExtendedQuestionAnswer as IExtendedQuestionAnswer, Question as IQuestion, ExtendedQuestion as IExtendedQuestion } from '@streamlayer/sl-eslib/interactive/interactive.common_pb';
|
|
13
13
|
export type PickHistory = PlainMessage<IPickHistory>;
|
|
14
14
|
export type ExtendedQuestionAnswer = PlainMessage<IExtendedQuestionAnswer>;
|
|
15
15
|
export type InsightHistory = PlainMessage<IInsightHistory>;
|
|
@@ -21,14 +21,85 @@ declare module "../../sdk-web-types/src/sl-types" {
|
|
|
21
21
|
export type User = MeResponse;
|
|
22
22
|
export type UserSettings = ClientSettings;
|
|
23
23
|
export type LeaderboardItem = ILeaderboardItem;
|
|
24
|
-
export type FeedItem = PlainMessage<
|
|
24
|
+
export type FeedItem = PlainMessage<IFeedItem>;
|
|
25
|
+
export type FeedItemAttributes = PlainMessage<IFeedItemAttributes>;
|
|
25
26
|
export type InstantView = PlainMessage<IInstantView>;
|
|
26
27
|
export type GameSettings = PlainMessage<IGameSettings>;
|
|
28
|
+
export type Question = PlainMessage<IQuestion>;
|
|
29
|
+
export type ExtendedQuestion = PlainMessage<IExtendedQuestion>;
|
|
27
30
|
export { SdkOverlayType as FeatureType, SdkOverlaySettings, GamesOverlaySettings, } from '@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb';
|
|
31
|
+
export { InvitationFrom } from '@streamlayer/sl-eslib/analytics/v1/invitations/invitations_pb';
|
|
28
32
|
}
|
|
29
33
|
declare module "../../sdk-web-types/src/index" {
|
|
30
34
|
export * from "../../sdk-web-types/src/sl-types";
|
|
31
35
|
}
|
|
36
|
+
declare module "../../sdk-web-logger/src/index" {
|
|
37
|
+
import { pino, ChildLoggerOptions } from 'pino';
|
|
38
|
+
export const createLogger: (name: string, options?: ChildLoggerOptions) => pino.Logger<never>;
|
|
39
|
+
export type Logger = ReturnType<typeof createLogger>;
|
|
40
|
+
}
|
|
41
|
+
declare module "../../sdk-web-interfaces/src/event-bus/index" {
|
|
42
|
+
import { InvitationFrom, QuestionType } from '../../sdk-web-types/src/index.ts';
|
|
43
|
+
const EventBusActions: {
|
|
44
|
+
notification: {
|
|
45
|
+
received: string;
|
|
46
|
+
opened: string;
|
|
47
|
+
rendered: string;
|
|
48
|
+
closed: string;
|
|
49
|
+
};
|
|
50
|
+
invitation: {
|
|
51
|
+
accepted: string;
|
|
52
|
+
sent: string;
|
|
53
|
+
};
|
|
54
|
+
interactions: {
|
|
55
|
+
tap: string;
|
|
56
|
+
scroll: string;
|
|
57
|
+
};
|
|
58
|
+
poll: {
|
|
59
|
+
voted: string;
|
|
60
|
+
navigated: string;
|
|
61
|
+
opened: string;
|
|
62
|
+
received: string;
|
|
63
|
+
onboardingPassed: string;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
export type EventBusActionPayload = {
|
|
67
|
+
notification: {
|
|
68
|
+
eventId?: string;
|
|
69
|
+
questionId?: string;
|
|
70
|
+
questionType?: QuestionType;
|
|
71
|
+
};
|
|
72
|
+
invitation: {
|
|
73
|
+
from?: InvitationFrom;
|
|
74
|
+
};
|
|
75
|
+
interactions: unknown;
|
|
76
|
+
poll: {
|
|
77
|
+
questionId?: string;
|
|
78
|
+
questionType?: QuestionType;
|
|
79
|
+
questionOpenedFrom?: 'list' | 'notification';
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
type EventBusActionsKeys = keyof typeof EventBusActions;
|
|
83
|
+
type EventBusActions<T> = T extends EventBusActionsKeys ? keyof (typeof EventBusActions)[T] : never;
|
|
84
|
+
export type EventBusData<T extends EventBusActionsKeys = EventBusActionsKeys> = {
|
|
85
|
+
type: T;
|
|
86
|
+
action: EventBusActions<T>;
|
|
87
|
+
payload: EventBusActionPayload[T];
|
|
88
|
+
};
|
|
89
|
+
export class EventBusEvent<T extends EventBusActionsKeys = EventBusActionsKeys> extends Event {
|
|
90
|
+
slEventBus?: EventBusData<T>;
|
|
91
|
+
constructor(name: string, payload?: EventBusData<T>);
|
|
92
|
+
}
|
|
93
|
+
export class EventBus {
|
|
94
|
+
private name;
|
|
95
|
+
private listeners;
|
|
96
|
+
constructor(name?: string);
|
|
97
|
+
emit: <K extends "notification" | "invitation" | "interactions" | "poll" = "notification" | "invitation" | "interactions" | "poll">(type: K, payload: Omit<EventBusData<K>, "type">) => void;
|
|
98
|
+
listen<T extends EventBusActionsKeys>(listener: (event: EventBusEvent<T>) => void): () => void;
|
|
99
|
+
off<T extends EventBusActionsKeys>(listener: (event: EventBusEvent<T>) => void): void;
|
|
100
|
+
destroy: () => void;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
32
103
|
declare module "../../sdk-web-interfaces/src/auth" {
|
|
33
104
|
export abstract class AbstractAuthenticationProvider {
|
|
34
105
|
abstract login(...args: unknown[]): Promise<unknown>;
|
|
@@ -38,7 +109,7 @@ declare module "../../sdk-web-interfaces/src/auth" {
|
|
|
38
109
|
}
|
|
39
110
|
}
|
|
40
111
|
declare module "../../sdk-web-interfaces/src/store/abstract" {
|
|
41
|
-
import type
|
|
112
|
+
import { type AnyStore } from 'nanostores';
|
|
42
113
|
global {
|
|
43
114
|
interface Window {
|
|
44
115
|
slStore: any;
|
|
@@ -85,7 +156,7 @@ declare module "../../sdk-web-interfaces/src/store/abstract" {
|
|
|
85
156
|
export const mergeStores: <T extends Record<string, AbstractStore<AnyStore>>, K = { [Index in keyof T]: ReturnType<T[Index]["getStore"]>["value"]; }>(stores: T) => import("nanostores").ReadableAtom<K>;
|
|
86
157
|
}
|
|
87
158
|
declare module "../../sdk-web-interfaces/src/store/map" {
|
|
88
|
-
import type
|
|
159
|
+
import { type MapStoreKeys, type MapStore as NMapStore } from 'nanostores';
|
|
89
160
|
import { AbstractStore } from "../../sdk-web-interfaces/src/store/abstract";
|
|
90
161
|
/**
|
|
91
162
|
* Wrapper for nanostores MapStore
|
|
@@ -151,7 +222,7 @@ declare module "../../sdk-web-interfaces/src/feature" {
|
|
|
151
222
|
}
|
|
152
223
|
}
|
|
153
224
|
declare module "../../sdk-web-interfaces/src/store/single" {
|
|
154
|
-
import type
|
|
225
|
+
import { type StoreValue, type WritableAtom } from 'nanostores';
|
|
155
226
|
import { AbstractStore } from "../../sdk-web-interfaces/src/store/abstract";
|
|
156
227
|
/**
|
|
157
228
|
* Wrapper for nanostores WritableAtom
|
|
@@ -196,6 +267,7 @@ declare module "../../sdk-web-interfaces/src/store/api" {
|
|
|
196
267
|
}
|
|
197
268
|
declare module "../../sdk-web-interfaces/src/index" {
|
|
198
269
|
import { FeatureType } from '../../sdk-web-types/src/index.ts';
|
|
270
|
+
import { EventBus, EventBusEvent, EventBusData, EventBusActionPayload } from "../../sdk-web-interfaces/src/event-bus/index";
|
|
199
271
|
export { AbstractAuthenticationProvider } from "../../sdk-web-interfaces/src/auth";
|
|
200
272
|
export { AbstractFeature, FeatureSource, type FeatureProps, FeatureStatus } from "../../sdk-web-interfaces/src/feature";
|
|
201
273
|
export { MapStore, createMapStore } from "../../sdk-web-interfaces/src/store/map";
|
|
@@ -203,7 +275,10 @@ declare module "../../sdk-web-interfaces/src/index" {
|
|
|
203
275
|
export { SingleStore, createSingleStore, createComputedStore } from "../../sdk-web-interfaces/src/store/single";
|
|
204
276
|
export { AbstractStore, mergeStores } from "../../sdk-web-interfaces/src/store/abstract";
|
|
205
277
|
export { ApiStore } from "../../sdk-web-interfaces/src/store/api";
|
|
278
|
+
export type CancelMountCb = () => void;
|
|
279
|
+
export type OnMountCb = () => CancelMountCb;
|
|
206
280
|
export interface StreamLayerSDK {
|
|
281
|
+
onMount: (cb: OnMountCb) => void;
|
|
207
282
|
closeFeature: (destroy?: boolean) => void;
|
|
208
283
|
openFeature: (featureType: FeatureType) => void;
|
|
209
284
|
}
|
|
@@ -212,22 +287,76 @@ declare module "../../sdk-web-interfaces/src/index" {
|
|
|
212
287
|
}
|
|
213
288
|
type DoneFn = Function;
|
|
214
289
|
export type StreamLayerPlugin = (instance: StreamLayerContext, opts: unknown, done: DoneFn) => void;
|
|
290
|
+
export const eventBus: EventBus;
|
|
291
|
+
export type { EventBusEvent, EventBusData, EventBusActionPayload };
|
|
215
292
|
}
|
|
216
293
|
declare module "../../sdk-web-api/src/utils/devtools" {
|
|
217
294
|
export const __GRPC_DEVTOOLS_EXTENSION__: any;
|
|
218
295
|
}
|
|
296
|
+
declare module "../../sdk-web-api/src/grpc/retry" {
|
|
297
|
+
import { type Interceptor } from '@connectrpc/connect';
|
|
298
|
+
/**
|
|
299
|
+
* Retry interceptor
|
|
300
|
+
*
|
|
301
|
+
* This interceptor is used to retry requests in case of network errors.
|
|
302
|
+
* Retries are performed according to the exponential backoff algorithm.
|
|
303
|
+
* Allowing retries for the following error codes:
|
|
304
|
+
* [
|
|
305
|
+
* Code.Unknown,
|
|
306
|
+
* Code.Internal,
|
|
307
|
+
* Code.DeadlineExceeded,
|
|
308
|
+
* Code.ResourceExhausted,
|
|
309
|
+
* Code.FailedPrecondition,
|
|
310
|
+
* Code.Unavailable,
|
|
311
|
+
* Code.DataLoss,
|
|
312
|
+
* ]
|
|
313
|
+
*
|
|
314
|
+
* Retry params:
|
|
315
|
+
* - retryAttempts: number of attempts to retry the request, 0 means no retries
|
|
316
|
+
* - retryDelay: max delay between retries in milliseconds
|
|
317
|
+
*
|
|
318
|
+
* Example:
|
|
319
|
+
* ```ts
|
|
320
|
+
const { client, createRequestOptions, queryKey } = transport.createPromiseClient(Leaderboard, {
|
|
321
|
+
method: 'summary',
|
|
322
|
+
params: [$eventId, $userId],
|
|
323
|
+
})
|
|
324
|
+
|
|
325
|
+
return transport.nanoquery.createFetcherStore(queryKey, {
|
|
326
|
+
fetcher: async (_, __, eventId, userId) => {
|
|
327
|
+
const contextValues = createRequestOptions({
|
|
328
|
+
retryAttempts: 5,
|
|
329
|
+
retryDelay: 10000,
|
|
330
|
+
})
|
|
331
|
+
|
|
332
|
+
const res = await client.summary(
|
|
333
|
+
{
|
|
334
|
+
eventId: eventId as unknown as bigint,
|
|
335
|
+
userId: userId as string,
|
|
336
|
+
},
|
|
337
|
+
{ contextValues }
|
|
338
|
+
)
|
|
339
|
+
|
|
340
|
+
return res.data?.attributes
|
|
341
|
+
},
|
|
342
|
+
})
|
|
343
|
+
* ```
|
|
344
|
+
*/
|
|
345
|
+
export const retry: Interceptor;
|
|
346
|
+
}
|
|
219
347
|
declare module "../../sdk-web-api/src/grpc/transport" {
|
|
348
|
+
import { MapStore } from '../../sdk-web-interfaces/src/index.ts';
|
|
220
349
|
import { createRouterTransport, ConnectRouter, Interceptor, PromiseClient, UnaryRequest, StreamRequest } from '@connectrpc/connect';
|
|
221
350
|
import type { ServiceType, Message, PlainMessage } from '@bufbuild/protobuf';
|
|
222
351
|
import { createGrpcWebTransport } from '@connectrpc/connect-web';
|
|
223
|
-
import type
|
|
224
|
-
import { nanoquery } from '@nanostores/query';
|
|
352
|
+
import { type KeyInput, nanoquery } from '@nanostores/query';
|
|
225
353
|
import { Atom } from 'nanostores';
|
|
226
354
|
import { ServerStreamSubscription, type ServerStreamSubscriptionOptions } from "../../sdk-web-api/src/grpc/subscription";
|
|
227
355
|
type KnownHeaders = {
|
|
228
356
|
authorization?: string;
|
|
229
357
|
sdk?: string;
|
|
230
358
|
'sl-device-id': string;
|
|
359
|
+
'sl-device-os': string;
|
|
231
360
|
'sl-user-id'?: string;
|
|
232
361
|
} & Record<string, string>;
|
|
233
362
|
export type GrpcTransport = Transport['transport'];
|
|
@@ -244,6 +373,12 @@ declare module "../../sdk-web-api/src/grpc/transport" {
|
|
|
244
373
|
createMutatorStore: NanoqueryReturnType[1];
|
|
245
374
|
utils: NanoqueryReturnType[2];
|
|
246
375
|
};
|
|
376
|
+
export const RequestOptionsKeys: {
|
|
377
|
+
retryAttempts: import("@connectrpc/connect").ContextKey<number>;
|
|
378
|
+
retryDelay: import("@connectrpc/connect").ContextKey<number>;
|
|
379
|
+
};
|
|
380
|
+
type RequestOptionsKey = keyof typeof RequestOptionsKeys;
|
|
381
|
+
type RequestOptions = Partial<Record<RequestOptionsKey, (typeof RequestOptionsKeys)[RequestOptionsKey]['defaultValue']>>;
|
|
247
382
|
/**
|
|
248
383
|
* transport wrapper, initialize grpc transport, store headers and connect interceptors
|
|
249
384
|
*/
|
|
@@ -257,10 +392,10 @@ declare module "../../sdk-web-api/src/grpc/transport" {
|
|
|
257
392
|
readonly streamTransport: ReturnType<typeof createGrpcWebTransport>;
|
|
258
393
|
readonly nanoquery: NanoqueryObjectType;
|
|
259
394
|
readonly host: string;
|
|
395
|
+
readonly $headers: MapStore<KnownHeaders>;
|
|
260
396
|
protected interceptors: Interceptor[];
|
|
261
|
-
private readonly $headers;
|
|
262
397
|
private clients;
|
|
263
|
-
private
|
|
398
|
+
private streamClients;
|
|
264
399
|
private subscriptions;
|
|
265
400
|
constructor(host: string);
|
|
266
401
|
addSubscription: <T extends ServiceType, Req extends Message<Req>, Res extends Message<Res>>(method: { [P in keyof PromiseClient<T> as T["methods"][P] extends import("@bufbuild/protobuf").MethodInfoServerStreaming<any, any> ? P : never]: T["methods"][P] extends import("@bufbuild/protobuf").MethodInfoServerStreaming<any, any> ? PromiseClient<T>[P] : never; }[keyof { [P in keyof PromiseClient<T> as T["methods"][P] extends import("@bufbuild/protobuf").MethodInfoServerStreaming<any, any> ? P : never]: T["methods"][P] extends import("@bufbuild/protobuf").MethodInfoServerStreaming<any, any> ? PromiseClient<T>[P] : never; }], params: PlainMessage<Req> | Atom<PlainMessage<Req>>, options: ServerStreamSubscriptionOptions) => ServerStreamSubscription<ServiceType, Message<import("@bufbuild/protobuf").AnyMessage>, Message<import("@bufbuild/protobuf").AnyMessage>, never, never> | ServerStreamSubscription<T, Req, Res, keyof { [P in keyof PromiseClient<T> as T["methods"][P] extends import("@bufbuild/protobuf").MethodInfoServerStreaming<any, any> ? P : never]: T["methods"][P] extends import("@bufbuild/protobuf").MethodInfoServerStreaming<any, any> ? PromiseClient<T>[P] : never; }, { [P in keyof PromiseClient<T> as T["methods"][P] extends import("@bufbuild/protobuf").MethodInfoServerStreaming<any, any> ? P : never]: T["methods"][P] extends import("@bufbuild/protobuf").MethodInfoServerStreaming<any, any> ? PromiseClient<T>[P] : never; }[keyof { [P in keyof PromiseClient<T> as T["methods"][P] extends import("@bufbuild/protobuf").MethodInfoServerStreaming<any, any> ? P : never]: T["methods"][P] extends import("@bufbuild/protobuf").MethodInfoServerStreaming<any, any> ? PromiseClient<T>[P] : never; }]>;
|
|
@@ -275,6 +410,7 @@ declare module "../../sdk-web-api/src/grpc/transport" {
|
|
|
275
410
|
method: keyof T["methods"];
|
|
276
411
|
}) => {
|
|
277
412
|
client: PromiseClient<T>;
|
|
413
|
+
createRequestOptions: (options: RequestOptions) => import("@connectrpc/connect").ContextValues;
|
|
278
414
|
queryKey: ((string | number | true) | import("nanostores").ReadableAtom<(string | number | true) | (false | void | null | undefined)> | import("@nanostores/query").FetcherStore<any, any>)[];
|
|
279
415
|
queryKeyStr: string;
|
|
280
416
|
};
|
|
@@ -398,6 +534,8 @@ declare module "../../sdk-web-api/src/grpc/queries/organization" {
|
|
|
398
534
|
brandDefaults?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").BrandDefaults | undefined;
|
|
399
535
|
pub?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").JWK | undefined;
|
|
400
536
|
getstream?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").GetStreamSettingsClient | undefined;
|
|
537
|
+
publicName?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").PublicName | undefined;
|
|
538
|
+
analyticsVersion?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").AnalyticsVersion | undefined;
|
|
401
539
|
} | undefined, any>;
|
|
402
540
|
export const $organizationAdvertising: ($enabled: ReadableAtom<string | undefined>, transport: Transport) => import("@nanostores/query").FetcherStore<import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").Advertising | undefined, any>;
|
|
403
541
|
}
|
|
@@ -421,11 +559,13 @@ declare module "../../sdk-web-api/src/index" {
|
|
|
421
559
|
}
|
|
422
560
|
interface StreamLayerContext {
|
|
423
561
|
transport: Transport;
|
|
562
|
+
analyticsTransport: Transport;
|
|
424
563
|
}
|
|
425
564
|
}
|
|
426
565
|
export const transport: (instance: StreamLayerContext, opts: {
|
|
427
566
|
sdkKey: string;
|
|
428
567
|
host: string;
|
|
568
|
+
analyticsHost: string;
|
|
429
569
|
version?: string;
|
|
430
570
|
}, done: () => void) => void;
|
|
431
571
|
}
|
|
@@ -492,6 +632,8 @@ declare module "../../sdk-web-core/src/store/init" {
|
|
|
492
632
|
brandDefaults?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").BrandDefaults | undefined;
|
|
493
633
|
pub?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").JWK | undefined;
|
|
494
634
|
getstream?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").GetStreamSettingsClient | undefined;
|
|
635
|
+
publicName?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").PublicName | undefined;
|
|
636
|
+
analyticsVersion?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").AnalyticsVersion | undefined;
|
|
495
637
|
} | undefined, import("@nanostores/query").FetcherStore<{
|
|
496
638
|
id: string;
|
|
497
639
|
overlays?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").SdkOverlay[] | undefined;
|
|
@@ -508,6 +650,8 @@ declare module "../../sdk-web-core/src/store/init" {
|
|
|
508
650
|
brandDefaults?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").BrandDefaults | undefined;
|
|
509
651
|
pub?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").JWK | undefined;
|
|
510
652
|
getstream?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").GetStreamSettingsClient | undefined;
|
|
653
|
+
publicName?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").PublicName | undefined;
|
|
654
|
+
analyticsVersion?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").AnalyticsVersion | undefined;
|
|
511
655
|
} | undefined, any>>;
|
|
512
656
|
readonly organizationAdvertising: ApiStore<import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").Advertising | undefined, import("@nanostores/query").FetcherStore<import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").Advertising | undefined, any>>;
|
|
513
657
|
};
|
|
@@ -588,6 +732,8 @@ declare module "../../sdk-web-core/src/store/store" {
|
|
|
588
732
|
brandDefaults?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").BrandDefaults | undefined;
|
|
589
733
|
pub?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").JWK | undefined;
|
|
590
734
|
getstream?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").GetStreamSettingsClient | undefined;
|
|
735
|
+
publicName?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").PublicName | undefined;
|
|
736
|
+
analyticsVersion?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").AnalyticsVersion | undefined;
|
|
591
737
|
} | undefined, import("@nanostores/query").FetcherStore<{
|
|
592
738
|
id: string;
|
|
593
739
|
overlays?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").SdkOverlay[] | undefined;
|
|
@@ -604,6 +750,8 @@ declare module "../../sdk-web-core/src/store/store" {
|
|
|
604
750
|
brandDefaults?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").BrandDefaults | undefined;
|
|
605
751
|
pub?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").JWK | undefined;
|
|
606
752
|
getstream?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").GetStreamSettingsClient | undefined;
|
|
753
|
+
publicName?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").PublicName | undefined;
|
|
754
|
+
analyticsVersion?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").AnalyticsVersion | undefined;
|
|
607
755
|
} | undefined, any>>;
|
|
608
756
|
readonly organizationAdvertising: import('../../sdk-web-interfaces/src/index.ts').ApiStore<import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").Advertising | undefined, import("@nanostores/query").FetcherStore<import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").Advertising | undefined, any>>;
|
|
609
757
|
};
|
|
@@ -615,14 +763,8 @@ declare module "../../sdk-web-core/src/store/store" {
|
|
|
615
763
|
[Index in keyof StoreObj]: (params: FetcherValue<CoreStoreInterface[Index]>) => void;
|
|
616
764
|
};
|
|
617
765
|
}
|
|
618
|
-
declare module "../../sdk-web-logger/src/index" {
|
|
619
|
-
import { pino, ChildLoggerOptions } from 'pino';
|
|
620
|
-
export const createLogger: (name: string, options?: ChildLoggerOptions) => pino.Logger<never>;
|
|
621
|
-
export type Logger = ReturnType<typeof createLogger>;
|
|
622
|
-
}
|
|
623
766
|
declare module "../../sdk-web-core/src/deepLink/index" {
|
|
624
|
-
import { StreamLayerContext } from '../../sdk-web-interfaces/src/index.ts';
|
|
625
|
-
import { MapStore } from '../../sdk-web-interfaces/src/index.ts';
|
|
767
|
+
import { MapStore, StreamLayerContext } from '../../sdk-web-interfaces/src/index.ts';
|
|
626
768
|
type DeepLinkContextData = {
|
|
627
769
|
handled?: boolean;
|
|
628
770
|
parsed?: boolean;
|
|
@@ -799,7 +941,7 @@ declare module "../../sdk-web-core/src/index" {
|
|
|
799
941
|
import { StreamLayerContext } from '../../sdk-web-interfaces/src/index.ts';
|
|
800
942
|
export { bypass, storage } from "../../sdk-web-core/src/auth/index";
|
|
801
943
|
export { store } from "../../sdk-web-core/src/store/index";
|
|
802
|
-
export { deepLink, type DeepLinkUrlParams, type DeepLinkCallback, DEEP_LINK_PREFIX, DEEP_LINK_USER_ID, DEEP_LINK_EVENT_ID, DEEP_LINK_EXTERNAL_EVENT_ID, } from "../../sdk-web-core/src/deepLink/index";
|
|
944
|
+
export { deepLink, type DeepLinkUrlParams, type DeepLinkCallback, type DeepLinkContext, DEEP_LINK_PREFIX, DEEP_LINK_USER_ID, DEEP_LINK_EVENT_ID, DEEP_LINK_EXTERNAL_EVENT_ID, } from "../../sdk-web-core/src/deepLink/index";
|
|
803
945
|
export { videoPlayer, type VideoPlayerCallback } from "../../sdk-web-core/src/videoPlayer/index";
|
|
804
946
|
import "../../sdk-web-core/src/store/index";
|
|
805
947
|
import "../../sdk-web-core/src/auth/index";
|
|
@@ -812,6 +954,9 @@ declare module "../../sdk-web-core/src/index" {
|
|
|
812
954
|
disableApp: () => void;
|
|
813
955
|
createEventSession: (providerStreamId: string) => void;
|
|
814
956
|
}
|
|
957
|
+
interface StreamLayerContext {
|
|
958
|
+
ready: () => void;
|
|
959
|
+
}
|
|
815
960
|
}
|
|
816
961
|
/**
|
|
817
962
|
* The main application instance is the core of a application. It includes:
|
|
@@ -852,7 +997,7 @@ declare module "../../sdk-web-notifications/src/queue/index" {
|
|
|
852
997
|
addToQueue: (notification: Notification) => void;
|
|
853
998
|
tickWaitingQueue: () => void;
|
|
854
999
|
tickActiveQueue: (notificationId: string) => void;
|
|
855
|
-
closeNotification: (notificationId: string) =>
|
|
1000
|
+
closeNotification: (notificationId: string) => Notification | undefined;
|
|
856
1001
|
}
|
|
857
1002
|
}
|
|
858
1003
|
declare module "../../sdk-web-notifications/src/storage" {
|
|
@@ -865,9 +1010,10 @@ declare module "../../sdk-web-notifications/src/storage" {
|
|
|
865
1010
|
}
|
|
866
1011
|
}
|
|
867
1012
|
declare module "../../sdk-web-notifications/src/notifications" {
|
|
868
|
-
import { InstantView, QuestionType, GameSettings, TweetHistory
|
|
1013
|
+
import { InstantView, QuestionType, GameSettings, TweetHistory } from '../../sdk-web-types/src/index.ts';
|
|
869
1014
|
import { NotificationsQueue, NotificationsQueueOptions } from "../../sdk-web-notifications/src/queue/index";
|
|
870
1015
|
export type NotificationData = {
|
|
1016
|
+
questionId: string;
|
|
871
1017
|
questionType: QuestionType;
|
|
872
1018
|
question?: {
|
|
873
1019
|
title: string;
|
|
@@ -880,9 +1026,7 @@ declare module "../../sdk-web-notifications/src/notifications" {
|
|
|
880
1026
|
correctAnswerTitle?: string;
|
|
881
1027
|
questionTitle?: string;
|
|
882
1028
|
};
|
|
883
|
-
insight?: InstantView
|
|
884
|
-
imageMode?: QuestionImages;
|
|
885
|
-
};
|
|
1029
|
+
insight?: InstantView;
|
|
886
1030
|
onboarding?: GameSettings & {
|
|
887
1031
|
instantOpen?: boolean;
|
|
888
1032
|
};
|
|
@@ -893,6 +1037,7 @@ declare module "../../sdk-web-notifications/src/notifications" {
|
|
|
893
1037
|
account: string;
|
|
894
1038
|
accountVerified: boolean;
|
|
895
1039
|
tweet: TweetHistory['tweet'] | undefined;
|
|
1040
|
+
tweetId: string;
|
|
896
1041
|
};
|
|
897
1042
|
};
|
|
898
1043
|
export enum NotificationType {
|
|
@@ -908,6 +1053,7 @@ declare module "../../sdk-web-notifications/src/notifications" {
|
|
|
908
1053
|
action?: (...args: unknown[]) => void;
|
|
909
1054
|
close?: (...args: unknown[]) => void;
|
|
910
1055
|
methods?: M;
|
|
1056
|
+
emitEvent?: boolean;
|
|
911
1057
|
data: NotificationData;
|
|
912
1058
|
id: string;
|
|
913
1059
|
persistent?: boolean;
|
|
@@ -921,6 +1067,7 @@ declare module "../../sdk-web-notifications/src/notifications" {
|
|
|
921
1067
|
constructor(options?: Partial<NotificationsQueueOptions>);
|
|
922
1068
|
add: (notification: Notification) => void;
|
|
923
1069
|
close: (notificationId: string, markAsViewed?: boolean) => void;
|
|
1070
|
+
getActiveNotification: () => Notification | null;
|
|
924
1071
|
getQueueStore: () => import("nanostores").WritableAtom<Map<string, Notification> | undefined>;
|
|
925
1072
|
markAsViewed: (notificationId: string) => void;
|
|
926
1073
|
}
|
|
@@ -938,6 +1085,7 @@ declare module "../../sdk-web-notifications/src/index" {
|
|
|
938
1085
|
}
|
|
939
1086
|
interface StreamLayerSDK {
|
|
940
1087
|
getNotificationsStore: Notifications['getQueueStore'];
|
|
1088
|
+
getActiveNotification: Notifications['getActiveNotification'];
|
|
941
1089
|
}
|
|
942
1090
|
}
|
|
943
1091
|
/**
|
|
@@ -1295,9 +1443,9 @@ declare module "../../feature-gamification/src/queries/index" {
|
|
|
1295
1443
|
};
|
|
1296
1444
|
};
|
|
1297
1445
|
}, QuestionSubscriptionRequest, QuestionSubscriptionResponse, "subscription" | "votingSubscription" | "questionSubscription" | "feedSubscription", ((request: import("@bufbuild/protobuf").PartialMessage<SubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions | undefined) => AsyncIterable<SubscriptionResponse>) | ((request: import("@bufbuild/protobuf").PartialMessage<VotingSubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions | undefined) => AsyncIterable<VotingSubscriptionResponse>) | ((request: import("@bufbuild/protobuf").PartialMessage<QuestionSubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions | undefined) => AsyncIterable<QuestionSubscriptionResponse>) | ((request: import("@bufbuild/protobuf").PartialMessage<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedSubscriptionRequest>, options?: import("@connectrpc/connect").CallOptions | undefined) => AsyncIterable<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedSubscriptionResponse>)>;
|
|
1298
|
-
export const getQuestionByUser: (questionId: string, transport: Transport) => Promise<import(
|
|
1446
|
+
export const getQuestionByUser: (questionId: string, transport: Transport) => Promise<import("@streamlayer/sl-eslib/interactive/interactive.common_pb").ExtendedQuestion | undefined>;
|
|
1299
1447
|
export const getQuestionDetail: (questionId: string, transport: Transport) => Promise<import("@streamlayer/sl-eslib/interactive/interactive.common_pb").Question | undefined>;
|
|
1300
|
-
export const $questionByUser: ($questionId: ReadableAtom<string | undefined
|
|
1448
|
+
export const $questionByUser: ($questionId: ReadableAtom<string | undefined> | string, transport: Transport) => import("@nanostores/query").FetcherStore<import("@bufbuild/protobuf").PlainMessage<import("@streamlayer/sl-eslib/interactive/interactive.common_pb").ExtendedQuestion>, any>;
|
|
1301
1449
|
export const $pickHistory: (slStreamId: ReadableAtom<string | undefined>, transport: Transport) => import("@nanostores/query").FetcherStore<(import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").PickHistory | undefined)[], any>;
|
|
1302
1450
|
export const $feedList: ($slStreamId: ReadableAtom<string | undefined>, $interactiveAllowed: ReadableAtom<InteractiveAllowed>, transport: Transport) => import("@nanostores/query").FetcherStore<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedItem[], any>;
|
|
1303
1451
|
export { $userSummary, $leaderboardList } from "../../feature-gamification/src/queries/leaderboard";
|
|
@@ -1306,24 +1454,26 @@ declare module "../../feature-gamification/src/queries/index" {
|
|
|
1306
1454
|
}
|
|
1307
1455
|
declare module "../../feature-gamification/src/detail" {
|
|
1308
1456
|
import type { Transport } from '../../sdk-web-api/src/index.ts';
|
|
1457
|
+
import { FeedItem, ExtendedQuestion } from '../../sdk-web-types/src/index.ts';
|
|
1309
1458
|
import { ReadableAtom } from 'nanostores';
|
|
1310
|
-
import { getQuestionByUser } from "../../feature-gamification/src/queries/index";
|
|
1311
1459
|
import { type GamificationBackground } from "../../feature-gamification/src/background";
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
}
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1460
|
+
export const detail: (transport: Transport, $openedQuestionId: ReadableAtom<{
|
|
1461
|
+
questionId: string;
|
|
1462
|
+
question?: FeedItem & {
|
|
1463
|
+
openedFrom?: 'list' | 'notification';
|
|
1464
|
+
};
|
|
1465
|
+
} | undefined>, $feedList: ReturnType<GamificationBackground['feedList']['getStore']>) => {
|
|
1466
|
+
$store: ReadableAtom<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedItem | (import("@bufbuild/protobuf").PlainMessage<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedItem> & {
|
|
1467
|
+
openedFrom?: "list" | "notification" | undefined;
|
|
1468
|
+
}) | undefined>;
|
|
1469
|
+
$extendedStore: import("@nanostores/query").FetcherStore<import("@bufbuild/protobuf").PlainMessage<import("@streamlayer/sl-eslib/interactive/interactive.common_pb").ExtendedQuestion>, any>;
|
|
1470
|
+
updateExtendedQuestion: (question: ExtendedQuestion | undefined) => void;
|
|
1322
1471
|
};
|
|
1323
1472
|
}
|
|
1324
1473
|
declare module "../../feature-gamification/src/background" {
|
|
1325
1474
|
import { ApiStore, type StreamLayerContext } from '../../sdk-web-interfaces/src/index.ts';
|
|
1326
1475
|
import type { GetApiResponseType } from '../../sdk-web-api/src/index.ts';
|
|
1476
|
+
import { FeedItem } from '../../sdk-web-types/src/index.ts';
|
|
1327
1477
|
import '@streamlayer/sdk-web-core/store';
|
|
1328
1478
|
import { ReadableAtom, WritableAtom } from 'nanostores';
|
|
1329
1479
|
import * as queries from "../../feature-gamification/src/queries/index";
|
|
@@ -1348,7 +1498,12 @@ declare module "../../feature-gamification/src/background" {
|
|
|
1348
1498
|
*/
|
|
1349
1499
|
interactiveAllowed: WritableAtom<InteractiveAllowed>;
|
|
1350
1500
|
/** opened question, using to download statistics */
|
|
1351
|
-
openedQuestionId: WritableAtom<
|
|
1501
|
+
openedQuestionId: WritableAtom<{
|
|
1502
|
+
questionId: string;
|
|
1503
|
+
question?: FeedItem & {
|
|
1504
|
+
openedFrom?: 'list' | 'notification';
|
|
1505
|
+
};
|
|
1506
|
+
} | undefined>;
|
|
1352
1507
|
/** opened question statistics */
|
|
1353
1508
|
openedQuestion: ReturnType<typeof detail>;
|
|
1354
1509
|
/** last active question in feed */
|
|
@@ -1364,6 +1519,7 @@ declare module "../../feature-gamification/src/background" {
|
|
|
1364
1519
|
questionSubscription?: ReturnType<typeof queries.questionSubscription>;
|
|
1365
1520
|
private notifications;
|
|
1366
1521
|
private log;
|
|
1522
|
+
private transport;
|
|
1367
1523
|
constructor(instance: StreamLayerContext);
|
|
1368
1524
|
/**
|
|
1369
1525
|
* Get id for notifications and link with current session
|
|
@@ -1384,13 +1540,21 @@ declare module "../../feature-gamification/src/background" {
|
|
|
1384
1540
|
/**
|
|
1385
1541
|
* Open question and mark notification for this question as viewed
|
|
1386
1542
|
*/
|
|
1387
|
-
openQuestion: (questionId: string
|
|
1543
|
+
openQuestion: (questionId: string, question?: FeedItem & {
|
|
1544
|
+
openedFrom?: 'list' | 'notification';
|
|
1545
|
+
}) => void;
|
|
1388
1546
|
/**
|
|
1389
1547
|
* Close question and mark notification for this question as viewed
|
|
1390
1548
|
*/
|
|
1391
1549
|
closeQuestion: (questionId?: string) => void;
|
|
1392
1550
|
}
|
|
1393
1551
|
}
|
|
1552
|
+
declare module "../../feature-gamification/src/constants" {
|
|
1553
|
+
export enum ERROR {
|
|
1554
|
+
UNKNOWN = "unknown",
|
|
1555
|
+
ALREADY_VOTED = "already_voted"
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1394
1558
|
declare module "../../feature-gamification/src/queries/actions" {
|
|
1395
1559
|
import type { Transport } from '../../sdk-web-api/src/index.ts';
|
|
1396
1560
|
export const submitAnswer: (transport: Transport, data: {
|
|
@@ -1489,7 +1653,7 @@ declare module "../../feature-gamification/src/deepLink" {
|
|
|
1489
1653
|
}
|
|
1490
1654
|
declare module "../../feature-gamification/src/gamification" {
|
|
1491
1655
|
import { AbstractFeature, ApiStore, FeatureSource, type FeatureProps, type StreamLayerContext } from '../../sdk-web-interfaces/src/index.ts';
|
|
1492
|
-
import { type GamesOverlaySettings } from '../../sdk-web-types/src/index.ts';
|
|
1656
|
+
import { type GamesOverlaySettings, FeedItem } from '../../sdk-web-types/src/index.ts';
|
|
1493
1657
|
import type { GetApiResponseType } from '../../sdk-web-api/src/index.ts';
|
|
1494
1658
|
import '@streamlayer/sdk-web-core/store';
|
|
1495
1659
|
import type { PlainMessage } from '@bufbuild/protobuf';
|
|
@@ -1534,20 +1698,25 @@ declare module "../../feature-gamification/src/gamification" {
|
|
|
1534
1698
|
openedUser: WritableAtom<LeaderboardItem | undefined>;
|
|
1535
1699
|
closeFeature: () => void;
|
|
1536
1700
|
openFeature: () => void;
|
|
1701
|
+
feedSubscription: GamificationBackground['feedSubscription'];
|
|
1702
|
+
activeQuestionId: GamificationBackground['activeQuestionId'];
|
|
1703
|
+
openedQuestionId: GamificationBackground['openedQuestionId'];
|
|
1537
1704
|
private notifications;
|
|
1538
1705
|
private transport;
|
|
1539
1706
|
/** gamification background class, handle subscriptions and notifications for closed overlay */
|
|
1540
1707
|
private background;
|
|
1541
1708
|
/** Browser cache */
|
|
1542
1709
|
private storage;
|
|
1710
|
+
private submitAnswerTimeout;
|
|
1543
1711
|
constructor(config: FeatureProps, source: FeatureSource, instance: StreamLayerContext);
|
|
1544
1712
|
get isInteractiveAllowed(): boolean;
|
|
1545
1713
|
checkInteractiveFlag: () => void;
|
|
1546
|
-
connect: (
|
|
1714
|
+
connect: () => void;
|
|
1547
1715
|
disconnect: () => void;
|
|
1548
1716
|
submitAnswer: (questionId: string, answerId: string) => Promise<void>;
|
|
1549
|
-
|
|
1550
|
-
|
|
1717
|
+
openQuestion: (questionId: string, question?: FeedItem & {
|
|
1718
|
+
openedFrom?: 'list' | 'notification';
|
|
1719
|
+
}) => void;
|
|
1551
1720
|
closeQuestion: (questionId?: string) => void;
|
|
1552
1721
|
openUser: (userId: string) => void;
|
|
1553
1722
|
closeUser: () => void;
|
|
@@ -1596,13 +1765,195 @@ declare module "../../sdk-web-features/src/index" {
|
|
|
1596
1765
|
getFeature: <T extends FeatureType = FeatureType>(featureType: T) => (T extends FeatureType.GAMES ? Gamification : Feature) | undefined;
|
|
1597
1766
|
getActiveFeature: SingleStore<FeatureType>['getStore'];
|
|
1598
1767
|
closeFeature: (destroy?: boolean) => void;
|
|
1768
|
+
featuresList: SingleStore<Set<FeatureType>>;
|
|
1599
1769
|
}
|
|
1600
1770
|
}
|
|
1601
1771
|
export const features: (instance: StreamLayerContext, opts: unknown, done: () => void) => void;
|
|
1602
1772
|
}
|
|
1773
|
+
declare module "../../sdk-web-analytics/src/invitation" {
|
|
1774
|
+
import { InvitationFrom } from '@streamlayer/sl-eslib/analytics/v1/invitations/invitations_pb';
|
|
1775
|
+
import { Analytics } from "../../sdk-web-analytics/src/analytics";
|
|
1776
|
+
export class InvitationAnalytics {
|
|
1777
|
+
private analytics;
|
|
1778
|
+
constructor(analytics: Analytics);
|
|
1779
|
+
accepted: () => void;
|
|
1780
|
+
sent: ({ from }: {
|
|
1781
|
+
from?: InvitationFrom | undefined;
|
|
1782
|
+
}) => void;
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
declare module "../../sdk-web-analytics/src/interactions" {
|
|
1786
|
+
import { Analytics } from "../../sdk-web-analytics/src/analytics";
|
|
1787
|
+
export class InteractionsAnalytics {
|
|
1788
|
+
private analytics;
|
|
1789
|
+
constructor(analytics: Analytics);
|
|
1790
|
+
tap: () => void;
|
|
1791
|
+
scroll: () => void;
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
declare module "../../sdk-web-analytics/src/constants" {
|
|
1795
|
+
import { TopicType, Category } from '@streamlayer/sl-eslib/analytics/v1/common/analytics.common_pb';
|
|
1796
|
+
import { NotificationKind } from '@streamlayer/sl-eslib/analytics/v1/notifications/notifications_pb';
|
|
1797
|
+
export const AllowedCases: {
|
|
1798
|
+
games: string;
|
|
1799
|
+
notification: string;
|
|
1800
|
+
invitation: string;
|
|
1801
|
+
eventOpened: string;
|
|
1802
|
+
interactions: string;
|
|
1803
|
+
};
|
|
1804
|
+
export const TOPIC_TYPE_MAP: {
|
|
1805
|
+
0: TopicType;
|
|
1806
|
+
4: TopicType;
|
|
1807
|
+
1: TopicType;
|
|
1808
|
+
3: TopicType;
|
|
1809
|
+
6: TopicType;
|
|
1810
|
+
2: TopicType;
|
|
1811
|
+
5: TopicType;
|
|
1812
|
+
};
|
|
1813
|
+
export const QUESTION_NOTIFICATION_KIND_MAP: {
|
|
1814
|
+
0: NotificationKind;
|
|
1815
|
+
4: NotificationKind;
|
|
1816
|
+
1: NotificationKind;
|
|
1817
|
+
3: NotificationKind;
|
|
1818
|
+
6: NotificationKind;
|
|
1819
|
+
2: NotificationKind;
|
|
1820
|
+
5: NotificationKind;
|
|
1821
|
+
};
|
|
1822
|
+
export const CATEGORY_TYPE_MAP: {
|
|
1823
|
+
0: Category;
|
|
1824
|
+
1: Category;
|
|
1825
|
+
2: Category;
|
|
1826
|
+
3: Category;
|
|
1827
|
+
4: Category;
|
|
1828
|
+
5: Category;
|
|
1829
|
+
6: Category;
|
|
1830
|
+
7: Category;
|
|
1831
|
+
8: Category;
|
|
1832
|
+
9: Category;
|
|
1833
|
+
10: Category;
|
|
1834
|
+
11: Category;
|
|
1835
|
+
12: Category;
|
|
1836
|
+
13: Category;
|
|
1837
|
+
14: Category;
|
|
1838
|
+
15: Category;
|
|
1839
|
+
};
|
|
1840
|
+
}
|
|
1841
|
+
declare module "../../sdk-web-analytics/src/notifications" {
|
|
1842
|
+
import { Analytics } from "../../sdk-web-analytics/src/analytics";
|
|
1843
|
+
export class NotificationsAnalytics {
|
|
1844
|
+
private analytics;
|
|
1845
|
+
constructor(analytics: Analytics);
|
|
1846
|
+
private received;
|
|
1847
|
+
private opened;
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
declare module "../../sdk-web-analytics/src/polls" {
|
|
1851
|
+
import { QuestionType } from '../../sdk-web-types/src/index.ts';
|
|
1852
|
+
import { Analytics } from "../../sdk-web-analytics/src/analytics";
|
|
1853
|
+
/**
|
|
1854
|
+
* PollsAnalytics is a class that is used to send analytics events related to polls.
|
|
1855
|
+
* It is used to send events when a poll is received, opened, voted, onboarding passed, or navigated.
|
|
1856
|
+
*/
|
|
1857
|
+
export class PollsAnalytics {
|
|
1858
|
+
private analytics;
|
|
1859
|
+
constructor(analytics: Analytics);
|
|
1860
|
+
received: ({ questionId, questionType }: {
|
|
1861
|
+
questionId?: string | undefined;
|
|
1862
|
+
questionType?: QuestionType | undefined;
|
|
1863
|
+
}) => void;
|
|
1864
|
+
opened: ({ questionId, questionType, questionOpenedFrom, }: {
|
|
1865
|
+
questionId?: string | undefined;
|
|
1866
|
+
questionType?: QuestionType | undefined;
|
|
1867
|
+
questionOpenedFrom?: "list" | "notification" | undefined;
|
|
1868
|
+
}) => void;
|
|
1869
|
+
voted: ({ questionId, questionType }: {
|
|
1870
|
+
questionId?: string | undefined;
|
|
1871
|
+
questionType?: QuestionType | undefined;
|
|
1872
|
+
}) => void;
|
|
1873
|
+
onboardingPassed: () => void;
|
|
1874
|
+
navigated: () => void;
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
declare module "../../sdk-web-analytics/src/heartbeat" {
|
|
1878
|
+
import { Transport } from '../../sdk-web-api/src/index.ts';
|
|
1879
|
+
import { Analytics } from "../../sdk-web-analytics/src/analytics";
|
|
1880
|
+
type IHeartbeat = {
|
|
1881
|
+
transport: Transport;
|
|
1882
|
+
$commonStore: Analytics['commonStore'];
|
|
1883
|
+
};
|
|
1884
|
+
export const heartbeat: ({ transport, $commonStore }: IHeartbeat) => {
|
|
1885
|
+
enable: () => void;
|
|
1886
|
+
disable: () => void;
|
|
1887
|
+
mount: () => void;
|
|
1888
|
+
unmount: () => void;
|
|
1889
|
+
};
|
|
1890
|
+
}
|
|
1891
|
+
declare module "../../sdk-web-analytics/src/analytics" {
|
|
1892
|
+
import { MapStore, StreamLayerContext, OnMountCb } from '../../sdk-web-interfaces/src/index.ts';
|
|
1893
|
+
import { Logger } from '../../sdk-web-logger/src/index.ts';
|
|
1894
|
+
import { GamesMessage, NotificationMessage, SendInvitationsMessage, EventOpenedMessage, SendInteractionsMessage, CommonData } from '@streamlayer/sl-eslib/analytics/v2/streaming/streaming_pb';
|
|
1895
|
+
import { PlainMessage } from '@bufbuild/protobuf';
|
|
1896
|
+
import { InvitationAnalytics } from "../../sdk-web-analytics/src/invitation";
|
|
1897
|
+
import { InteractionsAnalytics } from "../../sdk-web-analytics/src/interactions";
|
|
1898
|
+
import { NotificationsAnalytics } from "../../sdk-web-analytics/src/notifications";
|
|
1899
|
+
import { PollsAnalytics } from "../../sdk-web-analytics/src/polls";
|
|
1900
|
+
import '@streamlayer/sdk-web-features';
|
|
1901
|
+
type AnalyticsMessages = {
|
|
1902
|
+
games?: PlainMessage<GamesMessage>;
|
|
1903
|
+
notification?: PlainMessage<NotificationMessage>;
|
|
1904
|
+
invitation?: PlainMessage<SendInvitationsMessage>;
|
|
1905
|
+
eventOpened?: PlainMessage<EventOpenedMessage>;
|
|
1906
|
+
interactions?: PlainMessage<SendInteractionsMessage>;
|
|
1907
|
+
common: PlainMessage<CommonData>;
|
|
1908
|
+
};
|
|
1909
|
+
export const logger: Logger;
|
|
1910
|
+
/**
|
|
1911
|
+
* analytics events
|
|
1912
|
+
* 1. start (on start we should send heartbeats, generate session id)
|
|
1913
|
+
* 2. overlay open (on open we should update store, create overlay session id)
|
|
1914
|
+
* 3. overlay close (on close we should update store, remove overlay session id)
|
|
1915
|
+
* 4. switch event
|
|
1916
|
+
* 5. on update screen orientation
|
|
1917
|
+
* 6. on open question we should update topicId, topicType (???parentTopicId, ???topicSubType)
|
|
1918
|
+
* 7. on close question we should clear topicId, topicType
|
|
1919
|
+
*/
|
|
1920
|
+
export class Analytics {
|
|
1921
|
+
readonly commonStore: MapStore<AnalyticsMessages['common']>;
|
|
1922
|
+
readonly notifications: NotificationsAnalytics;
|
|
1923
|
+
readonly polls: PollsAnalytics;
|
|
1924
|
+
readonly invitation: InvitationAnalytics;
|
|
1925
|
+
readonly interactions: InteractionsAnalytics;
|
|
1926
|
+
private heartbeat;
|
|
1927
|
+
private analyticsClient;
|
|
1928
|
+
private listeners;
|
|
1929
|
+
private listenersCancels;
|
|
1930
|
+
private connected;
|
|
1931
|
+
constructor(instance: StreamLayerContext);
|
|
1932
|
+
connect: () => void;
|
|
1933
|
+
disconnect: () => void;
|
|
1934
|
+
write: <T extends "notification" | "invitation" | "interactions" | "games" | "eventOpened" = "notification" | "invitation" | "interactions" | "games" | "eventOpened">(key: T, value: AnalyticsMessages[T]) => void;
|
|
1935
|
+
writeCommon: <T extends "eventId" | "category" | "kind" | "screenOrientation" | "sessionId" | "overlaySessionId" | "topicId" | "topicType" | "parentTopicId" | "parentTopicType" | "participantsCount" | "routeMap" | "trackTimestamp" | "topicSubType" | "country" = "eventId" | "category" | "kind" | "screenOrientation" | "sessionId" | "overlaySessionId" | "topicId" | "topicType" | "parentTopicId" | "parentTopicType" | "participantsCount" | "routeMap" | "trackTimestamp" | "topicSubType" | "country">(key: T, value: PlainMessage<CommonData>[T]) => void;
|
|
1936
|
+
onConnect: (cb: OnMountCb) => void;
|
|
1937
|
+
private connectToSDK;
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
declare module "../../sdk-web-analytics/src/index" {
|
|
1941
|
+
import { type StreamLayerContext } from '../../sdk-web-interfaces/src/index.ts';
|
|
1942
|
+
import type { DeepLinkContext } from '../../sdk-web-core/src/index.ts';
|
|
1943
|
+
import { Transport } from '../../sdk-web-api/src/index.ts';
|
|
1944
|
+
import { Analytics } from "../../sdk-web-analytics/src/analytics";
|
|
1945
|
+
module '@streamlayer/sdk-web-interfaces' {
|
|
1946
|
+
interface StreamLayerContext {
|
|
1947
|
+
analytics: Analytics;
|
|
1948
|
+
deepLink: DeepLinkContext;
|
|
1949
|
+
analyticsTransport: Transport;
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
export const analytics: (instance: StreamLayerContext, opts: unknown, done: Function) => void;
|
|
1953
|
+
}
|
|
1603
1954
|
declare module "../../sdk-web/src/index" {
|
|
1604
1955
|
import { StreamLayerContext } from '../../sdk-web-interfaces/src/index.ts';
|
|
1605
|
-
import type
|
|
1956
|
+
import { type DeepLinkCallback, type VideoPlayerCallback } from '../../sdk-web-core/src/index.ts';
|
|
1606
1957
|
import avvio from 'avvio';
|
|
1607
1958
|
import './polyfills/raf';
|
|
1608
1959
|
export type StreamLayerInstance = avvio.mixedInstance<StreamLayerContext>;
|