@streamlayer/react 0.40.2 → 0.40.3

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.
@@ -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, ExtendedQuestion, SilenceSetting, QuestionOptions, } from '@streamlayer/sl-eslib/interactive/interactive.common_pb';
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,9 +21,12 @@ 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<FeedItemAttributes>;
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';
28
31
  }
29
32
  declare module "../../sdk-web-types/src/index" {
@@ -216,6 +219,62 @@ declare module "../../sdk-web-interfaces/src/index" {
216
219
  declare module "../../sdk-web-api/src/utils/devtools" {
217
220
  export const __GRPC_DEVTOOLS_EXTENSION__: any;
218
221
  }
222
+ declare module "../../sdk-web-logger/src/index" {
223
+ import { pino, ChildLoggerOptions } from 'pino';
224
+ export const createLogger: (name: string, options?: ChildLoggerOptions) => pino.Logger<never>;
225
+ export type Logger = ReturnType<typeof createLogger>;
226
+ }
227
+ declare module "../../sdk-web-api/src/grpc/retry" {
228
+ import { type Interceptor } from '@connectrpc/connect';
229
+ /**
230
+ * Retry interceptor
231
+ *
232
+ * This interceptor is used to retry requests in case of network errors.
233
+ * Retries are performed according to the exponential backoff algorithm.
234
+ * Allowing retries for the following error codes:
235
+ * [
236
+ * Code.Unknown,
237
+ * Code.Internal,
238
+ * Code.DeadlineExceeded,
239
+ * Code.ResourceExhausted,
240
+ * Code.FailedPrecondition,
241
+ * Code.Unavailable,
242
+ * Code.DataLoss,
243
+ * ]
244
+ *
245
+ * Retry params:
246
+ * - retryAttempts: number of attempts to retry the request, 0 means no retries
247
+ * - retryDelay: max delay between retries in milliseconds
248
+ *
249
+ * Example:
250
+ * ```ts
251
+ const { client, createRequestOptions, queryKey } = transport.createPromiseClient(Leaderboard, {
252
+ method: 'summary',
253
+ params: [$eventId, $userId],
254
+ })
255
+
256
+ return transport.nanoquery.createFetcherStore(queryKey, {
257
+ fetcher: async (_, __, eventId, userId) => {
258
+ const contextValues = createRequestOptions({
259
+ retryAttempts: 5,
260
+ retryDelay: 10000,
261
+ })
262
+
263
+ const res = await client.summary(
264
+ {
265
+ eventId: eventId as unknown as bigint,
266
+ userId: userId as string,
267
+ },
268
+ { contextValues }
269
+ )
270
+
271
+ return res.data?.attributes
272
+ },
273
+ })
274
+ * ```
275
+ */
276
+ export const retry: Interceptor;
277
+ }
219
278
  declare module "../../sdk-web-api/src/grpc/transport" {
220
279
  import { createRouterTransport, ConnectRouter, Interceptor, PromiseClient, UnaryRequest, StreamRequest } from '@connectrpc/connect';
221
280
  import type { ServiceType, Message, PlainMessage } from '@bufbuild/protobuf';
@@ -244,6 +303,12 @@ declare module "../../sdk-web-api/src/grpc/transport" {
244
303
  createMutatorStore: NanoqueryReturnType[1];
245
304
  utils: NanoqueryReturnType[2];
246
305
  };
306
+ export const RequestOptionsKeys: {
307
+ retryAttempts: import("@connectrpc/connect").ContextKey<number>;
308
+ retryDelay: import("@connectrpc/connect").ContextKey<number>;
309
+ };
310
+ type RequestOptionsKey = keyof typeof RequestOptionsKeys;
311
+ type RequestOptions = Partial<Record<RequestOptionsKey, (typeof RequestOptionsKeys)[RequestOptionsKey]['defaultValue']>>;
247
312
  /**
248
313
  * transport wrapper, initialize grpc transport, store headers and connect interceptors
249
314
  */
@@ -275,6 +340,7 @@ declare module "../../sdk-web-api/src/grpc/transport" {
275
340
  method: keyof T["methods"];
276
341
  }) => {
277
342
  client: PromiseClient<T>;
343
+ createRequestOptions: (options: RequestOptions) => import("@connectrpc/connect").ContextValues;
278
344
  queryKey: ((string | number | true) | import("nanostores").ReadableAtom<(string | number | true) | (false | void | null | undefined)> | import("@nanostores/query").FetcherStore<any, any>)[];
279
345
  queryKeyStr: string;
280
346
  };
@@ -398,6 +464,8 @@ declare module "../../sdk-web-api/src/grpc/queries/organization" {
398
464
  brandDefaults?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").BrandDefaults | undefined;
399
465
  pub?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").JWK | undefined;
400
466
  getstream?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").GetStreamSettingsClient | undefined;
467
+ publicName?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").PublicName | undefined;
468
+ analyticsVersion?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").AnalyticsVersion | undefined;
401
469
  } | undefined, any>;
402
470
  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
471
  }
@@ -492,6 +560,8 @@ declare module "../../sdk-web-core/src/store/init" {
492
560
  brandDefaults?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").BrandDefaults | undefined;
493
561
  pub?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").JWK | undefined;
494
562
  getstream?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").GetStreamSettingsClient | undefined;
563
+ publicName?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").PublicName | undefined;
564
+ analyticsVersion?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").AnalyticsVersion | undefined;
495
565
  } | undefined, import("@nanostores/query").FetcherStore<{
496
566
  id: string;
497
567
  overlays?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").SdkOverlay[] | undefined;
@@ -508,6 +578,8 @@ declare module "../../sdk-web-core/src/store/init" {
508
578
  brandDefaults?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").BrandDefaults | undefined;
509
579
  pub?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").JWK | undefined;
510
580
  getstream?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").GetStreamSettingsClient | undefined;
581
+ publicName?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").PublicName | undefined;
582
+ analyticsVersion?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").AnalyticsVersion | undefined;
511
583
  } | undefined, any>>;
512
584
  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
585
  };
@@ -588,6 +660,8 @@ declare module "../../sdk-web-core/src/store/store" {
588
660
  brandDefaults?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").BrandDefaults | undefined;
589
661
  pub?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").JWK | undefined;
590
662
  getstream?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").GetStreamSettingsClient | undefined;
663
+ publicName?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").PublicName | undefined;
664
+ analyticsVersion?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").AnalyticsVersion | undefined;
591
665
  } | undefined, import("@nanostores/query").FetcherStore<{
592
666
  id: string;
593
667
  overlays?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").SdkOverlay[] | undefined;
@@ -604,6 +678,8 @@ declare module "../../sdk-web-core/src/store/store" {
604
678
  brandDefaults?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").BrandDefaults | undefined;
605
679
  pub?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").JWK | undefined;
606
680
  getstream?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").GetStreamSettingsClient | undefined;
681
+ publicName?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").PublicName | undefined;
682
+ analyticsVersion?: import("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb").AnalyticsVersion | undefined;
607
683
  } | undefined, any>>;
608
684
  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
685
  };
@@ -615,11 +691,6 @@ declare module "../../sdk-web-core/src/store/store" {
615
691
  [Index in keyof StoreObj]: (params: FetcherValue<CoreStoreInterface[Index]>) => void;
616
692
  };
617
693
  }
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
694
  declare module "../../sdk-web-core/src/deepLink/index" {
624
695
  import { StreamLayerContext } from '../../sdk-web-interfaces/src/index.ts';
625
696
  import { MapStore } from '../../sdk-web-interfaces/src/index.ts';
@@ -865,7 +936,7 @@ declare module "../../sdk-web-notifications/src/storage" {
865
936
  }
866
937
  }
867
938
  declare module "../../sdk-web-notifications/src/notifications" {
868
- import { InstantView, QuestionType, GameSettings, TweetHistory, QuestionImages } from '../../sdk-web-types/src/index.ts';
939
+ import { InstantView, QuestionType, GameSettings, TweetHistory } from '../../sdk-web-types/src/index.ts';
869
940
  import { NotificationsQueue, NotificationsQueueOptions } from "../../sdk-web-notifications/src/queue/index";
870
941
  export type NotificationData = {
871
942
  questionType: QuestionType;
@@ -880,9 +951,7 @@ declare module "../../sdk-web-notifications/src/notifications" {
880
951
  correctAnswerTitle?: string;
881
952
  questionTitle?: string;
882
953
  };
883
- insight?: InstantView & {
884
- imageMode?: QuestionImages;
885
- };
954
+ insight?: InstantView;
886
955
  onboarding?: GameSettings & {
887
956
  instantOpen?: boolean;
888
957
  };
@@ -893,6 +962,7 @@ declare module "../../sdk-web-notifications/src/notifications" {
893
962
  account: string;
894
963
  accountVerified: boolean;
895
964
  tweet: TweetHistory['tweet'] | undefined;
965
+ tweetId: string;
896
966
  };
897
967
  };
898
968
  export enum NotificationType {
@@ -1295,9 +1365,9 @@ declare module "../../feature-gamification/src/queries/index" {
1295
1365
  };
1296
1366
  };
1297
1367
  }, 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('../../sdk-web-types/src/index.ts').ExtendedQuestion | undefined>;
1368
+ export const getQuestionByUser: (questionId: string, transport: Transport) => Promise<import("@streamlayer/sl-eslib/interactive/interactive.common_pb").ExtendedQuestion | undefined>;
1299
1369
  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>, transport: Transport) => import("@nanostores/query").FetcherStore<import('../../sdk-web-types/src/index.ts').ExtendedQuestion | undefined, any>;
1370
+ export const $questionByUser: ($questionId: ReadableAtom<string | undefined>, transport: Transport) => import("@nanostores/query").FetcherStore<import("@streamlayer/sl-eslib/interactive/interactive.common_pb").ExtendedQuestion | undefined, any>;
1301
1371
  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
1372
  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
1373
  export { $userSummary, $leaderboardList } from "../../feature-gamification/src/queries/leaderboard";
@@ -1306,24 +1376,27 @@ declare module "../../feature-gamification/src/queries/index" {
1306
1376
  }
1307
1377
  declare module "../../feature-gamification/src/detail" {
1308
1378
  import type { Transport } from '../../sdk-web-api/src/index.ts';
1379
+ import { FeedItem, ExtendedQuestion } from '../../sdk-web-types/src/index.ts';
1309
1380
  import { ReadableAtom } from 'nanostores';
1310
- import { getQuestionByUser } from "../../feature-gamification/src/queries/index";
1311
1381
  import { type GamificationBackground } from "../../feature-gamification/src/background";
1312
- type ExtendedQuestion = Awaited<ReturnType<typeof getQuestionByUser>>;
1313
1382
  type ExtendedQuestionStore = {
1314
1383
  data?: ExtendedQuestion;
1315
1384
  loading?: boolean;
1316
1385
  error?: string;
1317
1386
  };
1318
- export const detail: (transport: Transport, $openedQuestionId: ReadableAtom<string | undefined>, $feedList: ReturnType<GamificationBackground['feedList']['getStore']>) => {
1319
- $store: ReadableAtom<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedItem | undefined>;
1387
+ export const detail: (transport: Transport, $openedQuestionId: ReadableAtom<{
1388
+ questionId: string;
1389
+ question?: FeedItem;
1390
+ } | undefined>, $feedList: ReturnType<GamificationBackground['feedList']['getStore']>) => {
1391
+ $store: import("nanostores").WritableAtom<import("@bufbuild/protobuf").PlainMessage<import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").FeedItem> | undefined>;
1320
1392
  $extendedStore: import("nanostores").MapStore<ExtendedQuestionStore>;
1321
- updateExtendedQuestion: (question: ExtendedQuestion) => void;
1393
+ updateExtendedQuestion: (question: ExtendedQuestion | undefined) => void;
1322
1394
  };
1323
1395
  }
1324
1396
  declare module "../../feature-gamification/src/background" {
1325
1397
  import { ApiStore, type StreamLayerContext } from '../../sdk-web-interfaces/src/index.ts';
1326
1398
  import type { GetApiResponseType } from '../../sdk-web-api/src/index.ts';
1399
+ import { FeedItem } from '../../sdk-web-types/src/index.ts';
1327
1400
  import '@streamlayer/sdk-web-core/store';
1328
1401
  import { ReadableAtom, WritableAtom } from 'nanostores';
1329
1402
  import * as queries from "../../feature-gamification/src/queries/index";
@@ -1348,7 +1421,10 @@ declare module "../../feature-gamification/src/background" {
1348
1421
  */
1349
1422
  interactiveAllowed: WritableAtom<InteractiveAllowed>;
1350
1423
  /** opened question, using to download statistics */
1351
- openedQuestionId: WritableAtom<string | undefined>;
1424
+ openedQuestionId: WritableAtom<{
1425
+ questionId: string;
1426
+ question?: FeedItem;
1427
+ } | undefined>;
1352
1428
  /** opened question statistics */
1353
1429
  openedQuestion: ReturnType<typeof detail>;
1354
1430
  /** last active question in feed */
@@ -1384,7 +1460,7 @@ declare module "../../feature-gamification/src/background" {
1384
1460
  /**
1385
1461
  * Open question and mark notification for this question as viewed
1386
1462
  */
1387
- openQuestion: (questionId: string) => void;
1463
+ openQuestion: (questionId: string, question?: FeedItem) => void;
1388
1464
  /**
1389
1465
  * Close question and mark notification for this question as viewed
1390
1466
  */
@@ -1489,7 +1565,7 @@ declare module "../../feature-gamification/src/deepLink" {
1489
1565
  }
1490
1566
  declare module "../../feature-gamification/src/gamification" {
1491
1567
  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';
1568
+ import { type GamesOverlaySettings, FeedItem } from '../../sdk-web-types/src/index.ts';
1493
1569
  import type { GetApiResponseType } from '../../sdk-web-api/src/index.ts';
1494
1570
  import '@streamlayer/sdk-web-core/store';
1495
1571
  import type { PlainMessage } from '@bufbuild/protobuf';
@@ -1547,7 +1623,7 @@ declare module "../../feature-gamification/src/gamification" {
1547
1623
  disconnect: () => void;
1548
1624
  submitAnswer: (questionId: string, answerId: string) => Promise<void>;
1549
1625
  skipQuestion: (questionId: string) => Promise<void>;
1550
- openQuestion: (questionId: string) => void;
1626
+ openQuestion: (questionId: string, question?: FeedItem) => void;
1551
1627
  closeQuestion: (questionId?: string) => void;
1552
1628
  openUser: (userId: string) => void;
1553
1629
  closeUser: () => void;
@@ -1596,6 +1672,7 @@ declare module "../../sdk-web-features/src/index" {
1596
1672
  getFeature: <T extends FeatureType = FeatureType>(featureType: T) => (T extends FeatureType.GAMES ? Gamification : Feature) | undefined;
1597
1673
  getActiveFeature: SingleStore<FeatureType>['getStore'];
1598
1674
  closeFeature: (destroy?: boolean) => void;
1675
+ featuresList: SingleStore<Set<FeatureType>>;
1599
1676
  }
1600
1677
  }
1601
1678
  export const features: (instance: StreamLayerContext, opts: unknown, done: () => void) => void;