Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cordova Browser: registerSuperProperties method is not supported #95

Open
shnist opened this issue Oct 30, 2018 · 2 comments
Open

Cordova Browser: registerSuperProperties method is not supported #95

shnist opened this issue Oct 30, 2018 · 2 comments

Comments

@shnist
Copy link

shnist commented Oct 30, 2018

Hi,

We've recently integrated this plugin in our Ionic App. We are calling this.mixpanel.registerSuperProperties. When we try to run our app using the browser platform (cordova browser), we're coming across this error:

core.js:1449 ERROR Error: Uncaught (in promise): Cordova-Plugin-Mixpanel :  registerSuperProperties is not supported...
    at c (polyfills.js:3)
    at polyfills.js:3
    at MixpanelLib.mixpanel.registerSuperProperties (MixpanelProxy.js:105)
    at callCordovaPlugin (plugin.js:116)
    at plugin.js:142
    at util.js:22
    at new t (polyfills.js:3)
    at tryNativePromise (util.js:21)
    at getPromise (util.js:29)
    at wrapPromise (plugin.js:125)

I'm trying to figure out if this is the expected behaviour. Looking at the source code for the MixpanelProxy file:

  mixpanel.registerSuperProperties = function(superProperties, onSuccess, onFail) {
    if (!superProperties || typeof superProperties !== 'object') {
      if (onFail && typeof onFail === 'function')
        return onFail(errors.invalid('superProperties', superProperties));
      else return false;
    }

    if (onFail && typeof onFail === 'function')
      return onFail(errors.notsupported("registerSuperProperties"));
  };

For us it always returns at if (onFail && typeof onFail === 'function') return onFail(errors.notsupported("registerSuperProperties"));

Is it because it's trying to delegate the call to the JavaScript SDK and it's failing because the method name doesn't exist? Any help you could give would be gratefully appreciated.

@coldiary
Copy link

coldiary commented Nov 6, 2018

Hi !

I'm coming for the same reason as above.
I wanted to add that more than one method is reported as not supported by the plugin : setPushId, reset, flush, registerSuperProperties. Some are even not proxied : unregisterSuperProperty, getSuperProperties, and maybe some more.

This is despite the fact that code is present in the js lib file for the methods above :

MixpanelLib.prototype.register = function(props, days) {
    this['persistence'].register(props, days);
};

Is there a reason to not proxy these methods ?

As a workaround, method from the library itself are still reachable on the proxy object, so one can call them, and it should work, for example for registerSuperProperies :

mixpanel.register(props);

@samzilverberg
Copy link
Owner

your'e welcome to create a PR to add these for the browser platform.

the browser platform was contributed, i'm not actively supporting it on my own (I personally dont even understand what its good for 😆 ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants