@suprsend/web-sdk 1.2.5 → 1.3.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suprsend/web-sdk",
3
- "version": "1.2.5",
3
+ "version": "1.3.0",
4
4
  "description": "This is sdk used to integrate suprsend functionality in javascript applications",
5
5
  "main": "dist/cjs_bundle.js",
6
6
  "scripts": {
@@ -31,7 +31,6 @@
31
31
  "webpack-cli": "^4.8.0"
32
32
  },
33
33
  "dependencies": {
34
- "libphonenumber-js": "^1.10.7",
35
34
  "mitt": "^3.0.0"
36
35
  }
37
36
  }
@@ -12,7 +12,7 @@ class Preferences {
12
12
  constructor(instance, emitter) {
13
13
  this.ss_instance = instance;
14
14
  this._preference_data;
15
- this._preference_args;
15
+ this._preference_args; // used internally after over_all_channel_preferences update
16
16
  this._emitter = emitter;
17
17
 
18
18
  this._debounced_update_category_preferences = utils.debounce_by_type(
@@ -181,6 +181,7 @@ class Preferences {
181
181
 
182
182
  async get_preferences(args = {}) {
183
183
  let url_path = "full_preference";
184
+ this._preference_args = args;
184
185
  let query_params = { tenant_id: args?.tenant_id };
185
186
 
186
187
  const response = await this._get_request(url_path, query_params);
package/src/user.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import utils from "./utils";
2
2
  import config from "./config";
3
3
  import { regex, constants } from "./constants";
4
- import { parsePhoneNumber } from "libphonenumber-js";
5
4
  import Preferences from "./preferences";
6
5
 
7
6
  class User {
@@ -70,19 +69,6 @@ class User {
70
69
  }
71
70
  }
72
71
 
73
- _validate_mobile_and_send(key, mobile) {
74
- try {
75
- const mobile_number = parsePhoneNumber(mobile);
76
- if (mobile_number.isValid()) {
77
- this.append(key, mobile);
78
- } else {
79
- console.log("SuprSend: Provide valid Mobile number");
80
- }
81
- } catch (err) {
82
- console.log("SuprSend: Provide valid Mobile number");
83
- }
84
- }
85
-
86
72
  set(key, value) {
87
73
  const data = utils.format_props({ key, value });
88
74
  if (!utils.is_empty(data)) {
@@ -155,7 +141,7 @@ class User {
155
141
  }
156
142
 
157
143
  add_sms(mobile = "") {
158
- this._validate_mobile_and_send("$sms", mobile);
144
+ this.append("$sms", mobile);
159
145
  }
160
146
 
161
147
  remove_sms(mobile = "") {
@@ -163,7 +149,7 @@ class User {
163
149
  }
164
150
 
165
151
  add_whatsapp(mobile = "") {
166
- this._validate_mobile_and_send("$whatsapp", mobile);
152
+ this.append("$whatsapp", mobile);
167
153
  }
168
154
 
169
155
  remove_whatsapp(mobile = "") {