@streamlayer/feature-gamification 0.33.2 → 0.33.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.
@@ -75,7 +75,7 @@ export class Gamification extends AbstractFeature {
75
75
  */
76
76
  this.background.activeQuestionId.listen((question) => {
77
77
  const onboardingStatus = this.onboardingStatus.$store.get();
78
- if (question && question.data && onboardingStatus) {
78
+ if (question && question.data && onboardingStatus && onboardingStatus !== OnboardingStatus.Unset) {
79
79
  if (question.data.question?.id !== undefined &&
80
80
  question.data.question.notification !== undefined &&
81
81
  question.data.question?.bypassNotifications?.inAppSilence !== SilenceSetting.ON &&
package/lib/onboarding.js CHANGED
@@ -25,7 +25,7 @@ export const onboarding = (service, background, transport, notifications) => {
25
25
  const showOnboardingInApp = () => {
26
26
  const { inplayGame } = service.featureSettings.get();
27
27
  const notificationId = background.getCurrentSessionId({ prefix: 'onboarding' });
28
- if (inplayGame && inplayGame.enable) {
28
+ if (inplayGame) {
29
29
  notifications.add({
30
30
  type: NotificationType.ONBOARDING,
31
31
  id: notificationId,
@@ -90,8 +90,11 @@ export const onboarding = (service, background, transport, notifications) => {
90
90
  if ($store.get() === OnboardingStatus.Completed) {
91
91
  return;
92
92
  }
93
- const onboardingEnabled = !!(moderation?.options?.onboardingEnabled && service.featureSettings.get().inplayGame?.onboarding?.completed);
93
+ const onboardingEnabled = !!moderation?.options?.onboardingEnabled;
94
94
  const optIn = !!service.featureSettings.get().inplayGame?.titleCard?.optIn;
95
+ if (moderation === undefined || service.featureSettings.get() === undefined) {
96
+ return;
97
+ }
95
98
  if (onboardingEnabled) {
96
99
  if (optIn) {
97
100
  $store.set(OnboardingStatus.Required);
@@ -124,6 +127,11 @@ export const onboarding = (service, background, transport, notifications) => {
124
127
  void onboardingProcess();
125
128
  }
126
129
  });
130
+ service.featureSettings.listen((value) => {
131
+ if (value) {
132
+ void onboardingProcess();
133
+ }
134
+ });
127
135
  });
128
136
  const submitInplay = async () => {
129
137
  const eventId = background.slStreamId.get();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamlayer/feature-gamification",
3
- "version": "0.33.2",
3
+ "version": "0.33.3",
4
4
  "peerDependencies": {
5
5
  "@bufbuild/protobuf": "^1.4.2",
6
6
  "@streamlayer/sl-eslib": "^5.61.1",