@streamlayer/feature-gamification 1.6.0 → 1.6.2

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.
@@ -59,7 +59,7 @@ export const advertisement = ($slStreamId, $feedSubscription, instance) => {
59
59
  action: 'received',
60
60
  payload: {
61
61
  advertisementId: active.data.question.id,
62
- advertisementType: active.data?.promotion.type,
62
+ advertisementType: active.data?.promotion?.type,
63
63
  },
64
64
  });
65
65
  if (!prevActive?.data || active.data.id !== prevActive.data.id) {
@@ -79,7 +79,7 @@ export const advertisement = ($slStreamId, $feedSubscription, instance) => {
79
79
  action: 'opened',
80
80
  payload: {
81
81
  advertisementId: active.data.question.id,
82
- advertisementType: active.data?.promotion.type,
82
+ advertisementType: active.data?.promotion?.type,
83
83
  },
84
84
  });
85
85
  }
@@ -27,5 +27,5 @@ export declare const parsePromotion: (response: SubscriptionResponse) => {
27
27
  hasTriggers?: boolean;
28
28
  };
29
29
  notification: import("@streamlayer/sl-eslib/interactive/interactive.common_pb").QuestionNotification | undefined;
30
- promotion: import("@streamlayer/sl-eslib/interactive/interactive.common_pb").QuestionOptions_PromotionOptions;
30
+ promotion: import("@streamlayer/sl-eslib/interactive/interactive.common_pb").QuestionOptions_PromotionOptions | undefined;
31
31
  } | undefined;
@@ -1,16 +1,11 @@
1
1
  export const parsePromotion = (response) => {
2
2
  const questionItem = response.data?.attributes?.question;
3
- const feedItem = response.data?.attributes?.feedItem?.attributes?.attributes?.case === 'promotion'
4
- ? response.data.attributes.feedItem.attributes
5
- : undefined;
3
+ const feedItem = response.data?.attributes?.feedItem?.type === 'promotion' ? response.data.attributes.feedItem : undefined;
6
4
  if (feedItem === undefined || !questionItem) {
7
5
  return;
8
6
  }
9
7
  const { options, notification, ...question } = questionItem;
10
8
  const promotionItem = options?.options.case === 'promotion' ? options.options.value : undefined;
11
- if (!promotionItem) {
12
- return;
13
- }
14
9
  // eslint-disable-next-line consistent-return
15
10
  return {
16
11
  id: question.id,
@@ -377,7 +377,7 @@ export declare const getPromotionDetail: (promoId: string, transport: Transport)
377
377
  ai?: import("@streamlayer/sl-eslib/interactive/interactive.common_pb").QuestionAi;
378
378
  hasTriggers?: boolean;
379
379
  };
380
- promotion: import("@streamlayer/sl-eslib/interactive/interactive.common_pb").QuestionOptions_PromotionOptions;
380
+ promotion: import("@streamlayer/sl-eslib/interactive/interactive.common_pb").QuestionOptions_PromotionOptions | undefined;
381
381
  notification: import("@streamlayer/sl-eslib/interactive/interactive.common_pb").QuestionNotification | undefined;
382
382
  } | undefined>;
383
383
  export declare const $pickHistory: (slStreamId: ReadableAtom<string | undefined>, transport: Transport) => import("@nanostores/query").FetcherStore<(import("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb").PickHistory | undefined)[], any>;
@@ -409,7 +409,7 @@ export declare const $activePromotionId: ($slStreamId: ReadableAtom<string | und
409
409
  ai?: import("@streamlayer/sl-eslib/interactive/interactive.common_pb").QuestionAi;
410
410
  hasTriggers?: boolean;
411
411
  };
412
- promotion: import("@streamlayer/sl-eslib/interactive/interactive.common_pb").QuestionOptions_PromotionOptions;
412
+ promotion: import("@streamlayer/sl-eslib/interactive/interactive.common_pb").QuestionOptions_PromotionOptions | undefined;
413
413
  notification: import("@streamlayer/sl-eslib/interactive/interactive.common_pb").QuestionNotification | undefined;
414
414
  } | undefined, any>;
415
415
  export { $userSummary, $leaderboardList } from './leaderboard';
@@ -85,7 +85,7 @@ export const getPromotionDetail = async (promoId, transport) => {
85
85
  }
86
86
  const { options, notification, ...question } = res.data.attributes;
87
87
  const promotion = options?.options.case === 'promotion' ? options?.options.value : undefined;
88
- return promotion ? { id: question.id, question, promotion, notification } : undefined;
88
+ return { id: question.id, question, promotion, notification };
89
89
  };
90
90
  export const $pickHistory = (slStreamId, transport) => {
91
91
  const { client, queryKey } = transport.createPromiseClient(Feed, { method: 'pickHistory', params: [slStreamId] });
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@streamlayer/feature-gamification",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "peerDependencies": {
5
5
  "@bufbuild/protobuf": "^1.10.0",
6
6
  "@fastify/deepmerge": "^2.0.0",
7
7
  "@streamlayer/sl-eslib": "^5.123.1",
8
8
  "nanostores": "^0.10.3",
9
- "@streamlayer/sdk-web-api": "^1.5.0",
10
- "@streamlayer/sdk-web-core": "^1.4.0",
11
- "@streamlayer/sdk-web-interfaces": "^1.1.12",
12
- "@streamlayer/sdk-web-logger": "^1.0.17",
13
- "@streamlayer/sdk-web-notifications": "^1.1.12",
14
- "@streamlayer/sdk-web-storage": "^1.0.17",
15
- "@streamlayer/sdk-web-types": "^1.6.0"
9
+ "@streamlayer/sdk-web-api": "^1.5.2",
10
+ "@streamlayer/sdk-web-core": "^1.4.2",
11
+ "@streamlayer/sdk-web-interfaces": "^1.1.14",
12
+ "@streamlayer/sdk-web-logger": "^1.0.19",
13
+ "@streamlayer/sdk-web-notifications": "^1.1.14",
14
+ "@streamlayer/sdk-web-storage": "^1.0.19",
15
+ "@streamlayer/sdk-web-types": "^1.6.2"
16
16
  },
17
17
  "devDependencies": {
18
18
  "tslib": "^2.7.0"