radar-sdk-js 4.4.9-beta.0 → 4.4.9

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/README.md CHANGED
@@ -56,7 +56,7 @@ Radar.initialize('prj_test_pk_...', { /* options */ });
56
56
 
57
57
  Add the following script in your `html` file
58
58
  ```html
59
- <script src="https://js.radar.com/v4.4.9-beta.0/radar.min.js"></script>
59
+ <script src="https://js.radar.com/v4.4.9/radar.min.js"></script>
60
60
  ```
61
61
 
62
62
  Then initialize the Radar SDK
@@ -73,8 +73,8 @@ To create a map, first initialize the Radar SDK with your publishable key. Then
73
73
  ```html
74
74
  <html>
75
75
  <head>
76
- <link href="https://js.radar.com/v4.4.9-beta.0/radar.css" rel="stylesheet">
77
- <script src="https://js.radar.com/v4.4.9-beta.0/radar.min.js"></script>
76
+ <link href="https://js.radar.com/v4.4.9/radar.css" rel="stylesheet">
77
+ <script src="https://js.radar.com/v4.4.9/radar.min.js"></script>
78
78
  </head>
79
79
 
80
80
  <body>
@@ -98,8 +98,8 @@ To create an autocomplete input, first initialize the Radar SDK with your publis
98
98
  ```html
99
99
  <html>
100
100
  <head>
101
- <link href="https://js.radar.com/v4.4.9-beta.0/radar.css" rel="stylesheet">
102
- <script src="https://js.radar.com/v4.4.9-beta.0/radar.min.js"></script>
101
+ <link href="https://js.radar.com/v4.4.9/radar.css" rel="stylesheet">
102
+ <script src="https://js.radar.com/v4.4.9/radar.min.js"></script>
103
103
  </head>
104
104
 
105
105
  <body>
@@ -130,8 +130,8 @@ To power [geofencing](https://radar.com/documentation/geofencing/overview) exper
130
130
  ```html
131
131
  <html>
132
132
  <head>
133
- <link href="https://js.radar.com/v4.4.9-beta.0/radar.css" rel="stylesheet">
134
- <script src="https://js.radar.com/v4.4.9-beta.0/radar.min.js"></script>
133
+ <link href="https://js.radar.com/v4.4.9/radar.css" rel="stylesheet">
134
+ <script src="https://js.radar.com/v4.4.9/radar.min.js"></script>
135
135
  </head>
136
136
 
137
137
  <body>
@@ -1,6 +1,5 @@
1
1
  import type { RadarStartTrackingVerifiedParams, RadarTrackVerifiedParams, RadarTrackVerifiedResponse } from '../types';
2
2
  declare class VerifyAPI {
3
- static ipChanged(): Promise<boolean>;
4
3
  static trackVerified(params: RadarTrackVerifiedParams, encrypted?: Boolean): Promise<RadarTrackVerifiedResponse>;
5
4
  static startTrackingVerified(params: RadarStartTrackingVerifiedParams): Promise<void>;
6
5
  static stopTrackingVerified(): void;
package/dist/radar.js CHANGED
@@ -405,7 +405,7 @@ class Navigator {
405
405
  }
406
406
  }
407
407
 
408
- var SDK_VERSION = '4.4.9-beta.0';
408
+ var SDK_VERSION = '4.4.9';
409
409
 
410
410
  const inFlightRequests = new Map();
411
411
  class Http {
@@ -1247,8 +1247,27 @@ class TrackAPI {
1247
1247
  'X-Radar-Desktop-Device-Type': 'Web',
1248
1248
  },
1249
1249
  });
1250
+ let sclVal = -1;
1251
+ let cslVal = -1;
1252
+ /*
1253
+ try {
1254
+ const [sclRes, csl] = await Promise.all([
1255
+ Http.request({
1256
+ host: `https://${pingHost}`,
1257
+ method: 'GET',
1258
+ path: 'ping',
1259
+ }),
1260
+ ping(`wss://${pingHost}`),
1261
+ ]);
1262
+ const { scl }: any = sclRes;
1263
+ sclVal = scl;
1264
+ cslVal = csl;
1265
+ } catch (err) {
1266
+ // do nothing, send scl = -1 and csl = -1
1267
+ }
1268
+ */
1250
1269
  const payload = {
1251
- payload: JSON.stringify(Object.assign(Object.assign({}, body), { lang,
1270
+ payload: JSON.stringify(Object.assign(Object.assign({}, body), { scl: sclVal, csl: cslVal, lang,
1252
1271
  langs })),
1253
1272
  };
1254
1273
  const reqToken = yield signJWT(payload, dk);
@@ -1263,6 +1282,15 @@ class TrackAPI {
1263
1282
  'X-Radar-Body-Is-Token': 'true',
1264
1283
  },
1265
1284
  });
1285
+ if (options.debug && response && response.user) {
1286
+ if (!response.user.metadata) {
1287
+ response.user.metadata = {};
1288
+ }
1289
+ response.user.metadata['radar:debug'] = {
1290
+ sclVal,
1291
+ cslVal,
1292
+ };
1293
+ }
1266
1294
  let { user, events, token, expiresAt, expiresIn, passed, failureReasons, _id } = response;
1267
1295
  const location = { latitude, longitude, accuracy };
1268
1296
  if (expiresAt) {
@@ -1310,24 +1338,8 @@ let lastToken = null;
1310
1338
  let lastTokenNow = 0;
1311
1339
  let expectedCountryCode = null;
1312
1340
  let expectedStateCode = null;
1313
- let lastIp = null;
1314
1341
  class VerifyAPI {
1315
- static ipChanged() {
1316
- return __awaiter(this, void 0, void 0, function* () {
1317
- const { ip } = yield Http.request({
1318
- method: 'GET',
1319
- path: 'ping',
1320
- });
1321
- const ipChanged = ip !== lastIp;
1322
- if (ipChanged) {
1323
- Logger.info(`IP changed from ${lastIp} to ${ip}`);
1324
- }
1325
- lastIp = ip;
1326
- return ipChanged;
1327
- });
1328
- }
1329
1342
  static trackVerified(params, encrypted = false) {
1330
- var _a, _b;
1331
1343
  return __awaiter(this, void 0, void 0, function* () {
1332
1344
  const options = Config.get();
1333
1345
  const { skipVerifyApp } = params;
@@ -1398,10 +1410,6 @@ class VerifyAPI {
1398
1410
  trackRes.response = response;
1399
1411
  }
1400
1412
  }
1401
- if (params.ipChanges && ((_a = trackRes === null || trackRes === void 0 ? void 0 : trackRes.user) === null || _a === void 0 ? void 0 : _a.ip)) {
1402
- lastIp = (_b = trackRes === null || trackRes === void 0 ? void 0 : trackRes.user) === null || _b === void 0 ? void 0 : _b.ip;
1403
- Logger.info(`Setting ip to ${lastIp}`);
1404
- }
1405
1413
  lastToken = trackRes;
1406
1414
  lastTokenNow = performance.now();
1407
1415
  if (tokenCallback) {
@@ -1412,11 +1420,6 @@ class VerifyAPI {
1412
1420
  }
1413
1421
  static startTrackingVerified(params) {
1414
1422
  return __awaiter(this, void 0, void 0, function* () {
1415
- let { interval } = params;
1416
- if (!interval) {
1417
- interval = 60;
1418
- Logger.info(`interval not provided, using 60 seconds`);
1419
- }
1420
1423
  const doTrackVerified = () => __awaiter(this, void 0, void 0, function* () {
1421
1424
  let trackRes;
1422
1425
  try {
@@ -1425,6 +1428,7 @@ class VerifyAPI {
1425
1428
  catch (err) {
1426
1429
  Logger.error(`trackVerified error: ${err.message}`);
1427
1430
  }
1431
+ const { interval } = params;
1428
1432
  let expiresIn = 0;
1429
1433
  let minInterval = interval;
1430
1434
  if (trackRes) {
@@ -1456,11 +1460,7 @@ class VerifyAPI {
1456
1460
  static getVerifiedLocationToken(params) {
1457
1461
  return __awaiter(this, void 0, void 0, function* () {
1458
1462
  const lastTokenElapsed = (performance.now() - lastTokenNow) / 1000;
1459
- let ipChanged = false;
1460
- if (params.ipChanges) {
1461
- ipChanged = yield this.ipChanged();
1462
- }
1463
- if (lastToken && lastToken.passed && !ipChanged) {
1463
+ if (lastToken && lastToken.passed) {
1464
1464
  if (lastTokenElapsed < (lastToken.expiresIn || 0)) {
1465
1465
  return lastToken;
1466
1466
  }
@@ -1924,6 +1924,7 @@ class RadarLogoControl {
1924
1924
  this.link.id = 'radar-map-logo';
1925
1925
  this.link.href = 'https://radar.com?ref=powered_by_radar';
1926
1926
  this.link.target = '_blank';
1927
+ this.link.style.pointerEvents = "auto";
1927
1928
  this.link.appendChild(img);
1928
1929
  return this.link;
1929
1930
  }
@@ -2032,7 +2033,7 @@ class RadarMap extends maplibregl.Map {
2032
2033
  // configure map options
2033
2034
  const style = getStyle(config, radarMapOptions);
2034
2035
  const mapOptions = Object.assign({}, defaultRadarMapOptions, defaultMaplibreOptions, radarMapOptions, { style });
2035
- Logger.debug('map initialized with options', mapOptions);
2036
+ Logger.debug('map initailized with options', mapOptions);
2036
2037
  mapOptions.transformRequest = (url, resourceType) => {
2037
2038
  // this handles when a style is switched
2038
2039
  if (resourceType === 'Style' && isRadarStyle(url)) {
package/dist/radar.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"radar.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/types.d.ts CHANGED
@@ -59,12 +59,10 @@ export interface RadarTrackVerifiedParams {
59
59
  description?: string;
60
60
  metadata?: RadarMetadata;
61
61
  skipVerifyApp?: boolean;
62
- ipChanges?: boolean;
63
62
  }
64
63
  export interface RadarStartTrackingVerifiedParams {
65
64
  interval: number;
66
65
  skipVerifyApp?: boolean;
67
- ipChanges?: boolean;
68
66
  }
69
67
  export declare enum RadarEventConfidence {
70
68
  none = 0,
@@ -149,7 +147,6 @@ export interface RadarUser {
149
147
  dma?: RadarRegion;
150
148
  postalCode?: RadarRegion;
151
149
  fraud?: RadarFraud;
152
- ip?: string;
153
150
  }
154
151
  export interface RadarTrackResponse extends RadarResponse {
155
152
  location?: Location;
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "4.4.9-beta.0";
1
+ declare const _default: "4.4.9";
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "radar-sdk-js",
3
- "version": "4.4.9-beta.0",
3
+ "version": "4.4.9",
4
4
  "description": "Web Javascript SDK for Radar, location infrastructure for mobile and web apps.",
5
5
  "homepage": "https://radar.com",
6
6
  "type": "module",
package/src/api/track.ts CHANGED
@@ -89,6 +89,7 @@ class TrackAPI {
89
89
  let response: any;
90
90
  if (fraud) {
91
91
  const host = 'https://api-verified.radar.io';
92
+ const pingHost = 'ping.radar-verify.com';
92
93
 
93
94
  const lang = navigator.language;
94
95
  const langs = navigator.languages;
@@ -108,9 +109,31 @@ class TrackAPI {
108
109
  },
109
110
  });
110
111
 
112
+ let sclVal = -1;
113
+ let cslVal = -1;
114
+ /*
115
+ try {
116
+ const [sclRes, csl] = await Promise.all([
117
+ Http.request({
118
+ host: `https://${pingHost}`,
119
+ method: 'GET',
120
+ path: 'ping',
121
+ }),
122
+ ping(`wss://${pingHost}`),
123
+ ]);
124
+ const { scl }: any = sclRes;
125
+ sclVal = scl;
126
+ cslVal = csl;
127
+ } catch (err) {
128
+ // do nothing, send scl = -1 and csl = -1
129
+ }
130
+ */
131
+
111
132
  const payload = {
112
133
  payload: JSON.stringify({
113
134
  ...body,
135
+ scl: sclVal,
136
+ csl: cslVal,
114
137
  lang,
115
138
  langs,
116
139
  }),
@@ -130,6 +153,17 @@ class TrackAPI {
130
153
  },
131
154
  });
132
155
 
156
+ if (options.debug && response && response.user) {
157
+ if (!response.user.metadata) {
158
+ response.user.metadata = {};
159
+ }
160
+
161
+ response.user.metadata['radar:debug'] = {
162
+ sclVal,
163
+ cslVal,
164
+ };
165
+ }
166
+
133
167
  let { user, events, token, expiresAt, expiresIn, passed, failureReasons, _id } = response;
134
168
  const location = { latitude, longitude, accuracy };
135
169
  if (expiresAt) {
package/src/api/verify.ts CHANGED
@@ -15,25 +15,8 @@ let lastToken: RadarTrackVerifiedResponse | null = null;
15
15
  let lastTokenNow: number = 0;
16
16
  let expectedCountryCode: string | null = null;
17
17
  let expectedStateCode: string | null = null;
18
- let lastIp: string | null = null;
19
18
 
20
19
  class VerifyAPI {
21
- static async ipChanged() {
22
- const { ip }: any = await Http.request({
23
- method: 'GET',
24
- path: 'ping',
25
- });
26
-
27
- const ipChanged = ip !== lastIp;
28
- if (ipChanged) {
29
- Logger.info(`IP changed from ${lastIp} to ${ip}`);
30
- }
31
-
32
- lastIp = ip;
33
-
34
- return ipChanged;
35
- }
36
-
37
20
  static async trackVerified(params: RadarTrackVerifiedParams, encrypted: Boolean = false) {
38
21
  const options = Config.get();
39
22
 
@@ -121,11 +104,6 @@ class VerifyAPI {
121
104
  }
122
105
  }
123
106
 
124
- if (params.ipChanges && trackRes?.user?.ip) {
125
- lastIp = trackRes?.user?.ip;
126
- Logger.info(`Setting ip to ${lastIp}`);
127
- }
128
-
129
107
  lastToken = trackRes;
130
108
  lastTokenNow = performance.now();
131
109
 
@@ -137,12 +115,6 @@ class VerifyAPI {
137
115
  }
138
116
 
139
117
  static async startTrackingVerified(params: RadarStartTrackingVerifiedParams) {
140
- let { interval } = params;
141
- if (!interval) {
142
- interval = 60;
143
- Logger.info(`interval not provided, using 60 seconds`);
144
- }
145
-
146
118
  const doTrackVerified = async () => {
147
119
  let trackRes;
148
120
  try {
@@ -150,6 +122,8 @@ class VerifyAPI {
150
122
  } catch (err: any) {
151
123
  Logger.error(`trackVerified error: ${err.message}`);
152
124
  }
125
+
126
+ const { interval } = params;
153
127
 
154
128
  let expiresIn = 0;
155
129
  let minInterval = interval;
@@ -190,12 +164,7 @@ class VerifyAPI {
190
164
  static async getVerifiedLocationToken(params: RadarTrackVerifiedParams) {
191
165
  const lastTokenElapsed = (performance.now() - lastTokenNow) / 1000;
192
166
 
193
- let ipChanged = false;
194
- if (params.ipChanges) {
195
- ipChanged = await this.ipChanged();
196
- }
197
-
198
- if (lastToken && lastToken.passed && !ipChanged) {
167
+ if (lastToken && lastToken.passed) {
199
168
  if (lastTokenElapsed < (lastToken.expiresIn || 0)) {
200
169
  return lastToken;
201
170
  }
package/src/types.ts CHANGED
@@ -81,13 +81,11 @@ export interface RadarTrackVerifiedParams {
81
81
  description?: string;
82
82
  metadata?: RadarMetadata;
83
83
  skipVerifyApp?: boolean;
84
- ipChanges?: boolean;
85
84
  }
86
85
 
87
86
  export interface RadarStartTrackingVerifiedParams {
88
87
  interval: number;
89
88
  skipVerifyApp?: boolean;
90
- ipChanges?: boolean;
91
89
  }
92
90
 
93
91
  export enum RadarEventConfidence {
@@ -219,7 +217,6 @@ export interface RadarUser {
219
217
  dma?: RadarRegion;
220
218
  postalCode?: RadarRegion;
221
219
  fraud?: RadarFraud;
222
- ip?: string;
223
220
  }
224
221
 
225
222
  export interface RadarTrackResponse extends RadarResponse {
@@ -12,6 +12,7 @@ class RadarLogoControl {
12
12
  this.link.id = 'radar-map-logo';
13
13
  this.link.href = 'https://radar.com?ref=powered_by_radar';
14
14
  this.link.target = '_blank';
15
+ this.link.style.pointerEvents = "auto";
15
16
  this.link.appendChild(img);
16
17
 
17
18
  return this.link;
@@ -96,7 +96,7 @@ class RadarMap extends maplibregl.Map {
96
96
  radarMapOptions,
97
97
  { style },
98
98
  );
99
- Logger.debug('map initialized with options', mapOptions);
99
+ Logger.debug('map initailized with options', mapOptions);
100
100
 
101
101
  (mapOptions as maplibregl.MapOptions).transformRequest = (url, resourceType) => {
102
102
  // this handles when a style is switched
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export default '4.4.9-beta.0';
1
+ export default '4.4.9';