Cordova Browser: registerSuperProperties method is not supported
shnist opened this issue · 2 comments
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.
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);
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 😆 ).