faisalman / ua-parser-js

"Unmask Your Traffic" - UAParser.js: The Essential Web Development Tool for User-Agent Detection
https://uaparser.dev/
GNU Affero General Public License v3.0
9.28k stars 1.2k forks source link

withFeatureCheck is not a function (v2.0.0-alpha.2) #656

Closed lnhrdt closed 1 year ago

lnhrdt commented 1 year ago

I learned about the new withClientHints and withFeatureCheck helpers in your alpha releases notes & docs:

The withClientHints seems to work:

UAParser(window.navigator.userAgent)
  // @ts-ignore
  .withClientHints()
  .then((result: UAParser.IResult) => {
    console.log('UAParser result:', result)
  })

But the withFeatureCheck method is not found:

UAParser(window.navigator.userAgent)
  // @ts-ignore
  .withFeatureCheck()
  .then((result: UAParser.IResult) => {
    console.log('UAParser result:', result)
  })

error message:

Uncaught (in promise) TypeError: UAParser(...).withFeatureCheck is not a function

My environment (browser):

rajeakshay commented 1 year ago

I was also interested in trying out withFeatureCheck but 2.0.0-alpha.2 does not have it - https://github.com/faisalman/ua-parser-js/blob/2.0.0-alpha.2/src/ua-parser.mjs . It is in a later commit - https://github.com/faisalman/ua-parser-js/commit/801c2409b3e0fb83f67e95ebeca2723adb4976c9 .

@faisalman Any plans to create another alpha release so early adopters like us can try it out?

lnhrdt commented 1 year ago

@rajeakshay thank you for sharing your discovery! I was spinning my wheels trying to figure out what I was doing wrong.

@faisalman I agree another alpha release would be great. Something else to consider, it might be worth aligning your public docs with the released versions. Or at least changing to the docs to indicate they don't represent a released version. At the moment, the docs I linked above say they're for 2.0.0-alpha and that's where I got misled today.

rdumouchelle commented 1 year ago

Seconding above ^^ another release to address this would be appreciated.

aPaladinesEC commented 1 year ago

Hi, the same here, unavailable to test withFeatureCheck using the pre-release 2.0.0-alpha.2

faisalman commented 1 year ago

withFeatureCheck method has now been included in the recently published v2.0.0-alpha.3

th0rgall commented 1 year ago

FYI: I'm still getting the same error with the recently released 2.0.0-beta.1, and with the previously released -alpha.3.

Update: my bad, I had somehow specified a wrong version (prepending with a v), and didn't notice until now. I retried 2.0.0-beta.1 now in CodeSandbox, and it works exactly as documented (https://docs.uaparser.js.org/v2/api/ua-parser-js/idata/with-feature-check.html).

Demo: https://codesandbox.io/s/nifty-wind-cpmx2h