@suprsend/web-sdk 1.2.6 → 1.3.1

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.6",
3
+ "version": "1.3.1",
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
  }
package/src/constants.js CHANGED
@@ -47,4 +47,4 @@ export const os_useragent_map = {
47
47
  Linux: "Linux",
48
48
  };
49
49
 
50
- export const regex = { email: /\S+@\S+\.\S+/ };
50
+ export const regex = { email: /\S+@\S+\.\S+/, mobile: /^\+[1-9]\d{1,14}$/ };
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 {
@@ -72,14 +71,17 @@ class User {
72
71
 
73
72
  _validate_mobile_and_send(key, mobile) {
74
73
  try {
75
- const mobile_number = parsePhoneNumber(mobile);
76
- if (mobile_number.isValid()) {
74
+ if (regex.mobile.test(mobile)) {
77
75
  this.append(key, mobile);
78
76
  } else {
79
- console.log("SuprSend: Provide valid Mobile number");
77
+ console.log(
78
+ "SuprSend: Provide valid Mobile number as per E.164 standard"
79
+ );
80
80
  }
81
81
  } catch (err) {
82
- console.log("SuprSend: Provide valid Mobile number");
82
+ console.log(
83
+ "SuprSend: Provide valid Mobile number as per E.164 standard"
84
+ );
83
85
  }
84
86
  }
85
87