rdjpalmer / no-persistence-mixpanel

Minimal wrapper of the Mixpanel HTTP api. Avoid cookie banners and add analytics to figma plugins
MIT License
1 stars 0 forks source link

`distinct_id` property in certain methods should be `$distinct_id` #10

Open rdjpalmer opened 2 months ago

rdjpalmer commented 2 months ago
diff --git a/node_modules/no-persistence-mixpanel/index.js b/node_modules/no-persistence-mixpanel/index.js
index 3e07354..d9e7240 100644
--- a/node_modules/no-persistence-mixpanel/index.js
+++ b/node_modules/no-persistence-mixpanel/index.js
@@ -70,11 +70,11 @@ var Mixpanel = /** @class */ (function () {
         var options = __assign(__assign({}, this.options), { body: JSON.stringify([
                 {
                     $set: properties,
-                    distinct_id: this.distinctId,
+                    $distinct_id: this.distinctId,
                     token: this.token,
                 },
             ]) });
-        return fetch("https://api.mixpanel.com/engage#profile-set", options);
+        return fetch("https://api.mixpanel.com/engage?verbose=1#profile-set", options);
     };
     Mixpanel.prototype.setUserPropertyOnce = function (properties) {
         if (typeof this.distinctId === "undefined") {
@@ -83,7 +83,7 @@ var Mixpanel = /** @class */ (function () {
         var options = __assign(__assign({}, this.options), { body: JSON.stringify([
                 {
                     $set_once: properties,
-                    distinct_id: this.distinctId,
+                    $distinct_id: this.distinctId,
                     token: this.token,
                 },
             ]) });
@@ -96,7 +96,7 @@ var Mixpanel = /** @class */ (function () {
         var options = __assign(__assign({}, this.options), { body: JSON.stringify([
                 {
                     $add: properties,
-                    distinct_id: this.distinctId,
+                    $distinct_id: this.distinctId,
                     token: this.token,
                 },
             ]) });
@@ -109,7 +109,7 @@ var Mixpanel = /** @class */ (function () {
         var options = __assign(__assign({}, this.options), { body: JSON.stringify([
                 {
                     $union: properties,
-                    distinct_id: this.distinctId,
+                    $distinct_id: this.distinctId,
                     token: this.token,
                 },
             ]) });
@@ -122,7 +122,7 @@ var Mixpanel = /** @class */ (function () {
         var options = __assign(__assign({}, this.options), { body: JSON.stringify([
                 {
                     $append: properties,
-                    distinct_id: this.distinctId,
+                    $distinct_id: this.distinctId,
                     token: this.token,
                 },
             ]) });
@@ -135,7 +135,7 @@ var Mixpanel = /** @class */ (function () {
         var options = __assign(__assign({}, this.options), { body: JSON.stringify([
                 {
                     $remove: properties,
-                    distinct_id: this.distinctId,
+                    $distinct_id: this.distinctId,
                     token: this.token,
                 },
             ]) });
@@ -148,7 +148,7 @@ var Mixpanel = /** @class */ (function () {
         var options = __assign(__assign({}, this.options), { body: JSON.stringify([
                 {
                     $unset: properties,
-                    distinct_id: this.distinctId,
+                    $distinct_id: this.distinctId,
                     token: this.token,
                 },
             ]) });

This issue body was partially generated by patch-package.