OneSignal / onesignal-ngx

OneSignal Angular
Other
5 stars 5 forks source link

[Bug]: Cannot access OneSignal.User.getTags() from Angular SDK #44

Open akhileshptp opened 6 months ago

akhileshptp commented 6 months ago

What happened?

I am using the Angular SDK from one-signal (v11). It allows me to addTags but when I try to access the method to getTags, it says the method is not available on User object [getTags is undefined]. On checking the declaration file, it seems that the method is not exposed from the package. If I try to access it from the console on the web-page, I am able to get the tags then.

import { OneSignal } from 'onesignal-ngx';
export class OneSignalSDKService {

  constructor(private oneSignal: OneSignalModule) {} 
  getMarketingPushNotificationState(): boolean {
      const tags = this.oneSignal.User.getTags();  // throws error at this line
      return (tags?.someValue == 'true');
  }

I have made sure that OneSignal initialization is already done and there are values in this.oneSignal and this.oneSignal.User. I am also able to call the methods this.oneSignal.User.addTag() and this.oneSignal.User.addTags() with proper params.

What browsers are you seeing the problem on?

Firefox, Chrome (Chromium), Safari, Microsoft Edge

What operating system are you running?

Windows 10

Steps to reproduce?

1. Use `import { OneSignal } from 'onesignal-ngx';` in any angular app and call the init method with a valid app id.
2. Try to get the tags from the OneSignal object (inject as dependency in constructor as shown in the code above) this.oneSignal.User.getTags();

What did you expect to happen?

I should be able to get the list of tags and their values through that method. The method should be exposed from the declaration file of the npm package.

Relevant log output

No response