@suprsend/web-sdk 0.1.27 → 0.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn_bundle.js +1 -1
- package/dist/cjs_bundle.js +1 -1
- package/package.json +1 -1
- package/src/index.js +8 -1
- package/src/user.js +8 -0
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -149,7 +149,14 @@ class SuprSend {
|
|
|
149
149
|
this.track(internal_events.purchase_made, props);
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
reset() {
|
|
152
|
+
async reset(options = { unsubscribe_push: true }) {
|
|
153
|
+
// unsubscribe push
|
|
154
|
+
if (options?.unsubscribe_push) {
|
|
155
|
+
const subscription = await this.web_push._get_subscription();
|
|
156
|
+
if (subscription) {
|
|
157
|
+
this.user.remove_webpush(subscription);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
153
160
|
this.track(internal_events.user_logout);
|
|
154
161
|
var distinct_id = utils.uuid();
|
|
155
162
|
utils.set_cookie(constants.distinct_id, distinct_id);
|
package/src/user.js
CHANGED
|
@@ -152,6 +152,14 @@ class User {
|
|
|
152
152
|
$pushvendor: "vapid",
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
|
+
|
|
156
|
+
remove_webpush(push = "") {
|
|
157
|
+
this.remove({
|
|
158
|
+
$webpush: push,
|
|
159
|
+
$device_id: this.instance?.env_properties?.$device_id,
|
|
160
|
+
$pushvendor: "vapid",
|
|
161
|
+
});
|
|
162
|
+
}
|
|
155
163
|
}
|
|
156
164
|
|
|
157
165
|
export default User;
|