radar-sdk-js 4.1.3 → 4.1.5-beta.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/README.md +7 -7
- package/dist/api/verify.d.ts +2 -2
- package/dist/index.d.ts +2 -1
- package/dist/radar.js +26 -6
- package/dist/radar.js.map +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/api/verify.ts +17 -4
- package/src/index.ts +4 -0
- package/src/types.ts +5 -0
- package/src/ui/map.ts +6 -0
- package/src/version.ts +1 -1
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.1.
|
|
59
|
+
<script src="https://js.radar.com/v4.1.5-beta.0/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.1.
|
|
77
|
-
<script src="https://js.radar.com/v4.1.
|
|
76
|
+
<link href="https://js.radar.com/v4.1.5-beta.0/radar.css" rel="stylesheet">
|
|
77
|
+
<script src="https://js.radar.com/v4.1.5-beta.0/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.1.
|
|
102
|
-
<script src="https://js.radar.com/v4.1.
|
|
101
|
+
<link href="https://js.radar.com/v4.1.5-beta.0/radar.css" rel="stylesheet">
|
|
102
|
+
<script src="https://js.radar.com/v4.1.5-beta.0/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.1.
|
|
134
|
-
<script src="https://js.radar.com/v4.1.
|
|
133
|
+
<link href="https://js.radar.com/v4.1.5-beta.0/radar.css" rel="stylesheet">
|
|
134
|
+
<script src="https://js.radar.com/v4.1.5-beta.0/radar.min.js"></script>
|
|
135
135
|
</head>
|
|
136
136
|
|
|
137
137
|
<body>
|
package/dist/api/verify.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RadarTrackParams, RadarTrackResponse } from '../types';
|
|
1
|
+
import type { RadarTrackParams, RadarTrackResponse, RadarTrackTokenResponse } from '../types';
|
|
2
2
|
declare class VerifyAPI {
|
|
3
|
-
static trackVerified(params: RadarTrackParams): Promise<RadarTrackResponse>;
|
|
3
|
+
static trackVerified(params: RadarTrackParams, encrypted?: Boolean): Promise<RadarTrackTokenResponse | RadarTrackResponse>;
|
|
4
4
|
}
|
|
5
5
|
export default VerifyAPI;
|
package/dist/index.d.ts
CHANGED
|
@@ -62,7 +62,8 @@ declare class Radar {
|
|
|
62
62
|
static setMetadata(metadata?: RadarMetadata): void;
|
|
63
63
|
static getLocation(): Promise<import("./types").NavigatorPosition>;
|
|
64
64
|
static trackOnce(params?: RadarTrackParams): Promise<import("./types").RadarTrackResponse>;
|
|
65
|
-
static trackVerified(params?: RadarTrackParams): Promise<import("./types").RadarTrackResponse>;
|
|
65
|
+
static trackVerified(params?: RadarTrackParams): Promise<import("./types").RadarTrackResponse | import("./types").RadarTrackTokenResponse>;
|
|
66
|
+
static trackVerifiedToken(params?: RadarTrackParams): Promise<import("./types").RadarTrackResponse | import("./types").RadarTrackTokenResponse>;
|
|
66
67
|
static getContext(params: Location): Promise<import("./types").RadarContextResponse>;
|
|
67
68
|
static setTripOptions(tripOptions?: RadarTripOptions): void;
|
|
68
69
|
static clearTripOptions(): void;
|
package/dist/radar.js
CHANGED
|
@@ -565,7 +565,7 @@ var Navigator = /** @class */ (function () {
|
|
|
565
565
|
return Navigator;
|
|
566
566
|
}());
|
|
567
567
|
|
|
568
|
-
var SDK_VERSION = '4.1.
|
|
568
|
+
var SDK_VERSION = '4.1.5-beta.0';
|
|
569
569
|
|
|
570
570
|
var Http = /** @class */ (function () {
|
|
571
571
|
function Http() {
|
|
@@ -1527,9 +1527,10 @@ var TrackAPI = /** @class */ (function () {
|
|
|
1527
1527
|
var VerifyAPI = /** @class */ (function () {
|
|
1528
1528
|
function VerifyAPI() {
|
|
1529
1529
|
}
|
|
1530
|
-
VerifyAPI.trackVerified = function (params) {
|
|
1530
|
+
VerifyAPI.trackVerified = function (params, encrypted) {
|
|
1531
|
+
if (encrypted === void 0) { encrypted = false; }
|
|
1531
1532
|
return __awaiter(this, void 0, void 0, function () {
|
|
1532
|
-
var options, userId, deviceId, installId, sessionId, description, metadata, body, response, user, events, location, trackRes;
|
|
1533
|
+
var options, userId, deviceId, installId, sessionId, description, metadata, body, response, user, events, token, location, trackTokenRes, trackRes;
|
|
1533
1534
|
return __generator(this, function (_a) {
|
|
1534
1535
|
switch (_a.label) {
|
|
1535
1536
|
case 0:
|
|
@@ -1547,7 +1548,7 @@ var VerifyAPI = /** @class */ (function () {
|
|
|
1547
1548
|
Storage.setItem(Storage.USER_ID, userId);
|
|
1548
1549
|
}
|
|
1549
1550
|
metadata = params.metadata || Storage.getJSON(Storage.METADATA);
|
|
1550
|
-
body = __assign(__assign({}, params), { description: description, deviceId: deviceId, foreground: true, installId: installId, sessionId: sessionId, metadata: metadata, sdkVersion: SDK_VERSION, stopped: true, userId: userId });
|
|
1551
|
+
body = __assign(__assign({}, params), { description: description, deviceId: deviceId, foreground: true, installId: installId, sessionId: sessionId, metadata: metadata, sdkVersion: SDK_VERSION, stopped: true, userId: userId, encrypted: encrypted });
|
|
1551
1552
|
return [4 /*yield*/, Http.request({
|
|
1552
1553
|
method: 'GET',
|
|
1553
1554
|
path: 'verify',
|
|
@@ -1556,14 +1557,23 @@ var VerifyAPI = /** @class */ (function () {
|
|
|
1556
1557
|
})];
|
|
1557
1558
|
case 1:
|
|
1558
1559
|
response = _a.sent();
|
|
1559
|
-
user = response.user, events = response.events;
|
|
1560
|
-
if (user.location && user.location.coordinates && user.locationAccuracy) {
|
|
1560
|
+
user = response.user, events = response.events, token = response.token;
|
|
1561
|
+
if (user && user.location && user.location.coordinates && user.locationAccuracy) {
|
|
1561
1562
|
location = {
|
|
1562
1563
|
latitude: user.location.coordinates[1],
|
|
1563
1564
|
longitude: user.location.coordinates[0],
|
|
1564
1565
|
accuracy: user.locationAccuracy,
|
|
1565
1566
|
};
|
|
1566
1567
|
}
|
|
1568
|
+
if (encrypted) {
|
|
1569
|
+
trackTokenRes = {
|
|
1570
|
+
token: token,
|
|
1571
|
+
};
|
|
1572
|
+
if (options.debug) {
|
|
1573
|
+
trackTokenRes.response = response;
|
|
1574
|
+
}
|
|
1575
|
+
return [2 /*return*/, trackTokenRes];
|
|
1576
|
+
}
|
|
1567
1577
|
trackRes = {
|
|
1568
1578
|
user: user,
|
|
1569
1579
|
events: events,
|
|
@@ -1686,6 +1696,12 @@ var MapUI = /** @class */ (function () {
|
|
|
1686
1696
|
if (markerOptions.color) {
|
|
1687
1697
|
maplibreOptions.color = markerOptions.color;
|
|
1688
1698
|
}
|
|
1699
|
+
if (markerOptions.element) {
|
|
1700
|
+
maplibreOptions.element = markerOptions.element;
|
|
1701
|
+
}
|
|
1702
|
+
if (markerOptions.scale) {
|
|
1703
|
+
maplibreOptions.scale = markerOptions.scale;
|
|
1704
|
+
}
|
|
1689
1705
|
var marker = new maplibregl.Marker(maplibreOptions);
|
|
1690
1706
|
// set popup text or HTML
|
|
1691
1707
|
if (markerOptions.text) {
|
|
@@ -2187,6 +2203,10 @@ var Radar = /** @class */ (function () {
|
|
|
2187
2203
|
if (params === void 0) { params = {}; }
|
|
2188
2204
|
return VerifyAPI.trackVerified(params);
|
|
2189
2205
|
};
|
|
2206
|
+
Radar.trackVerifiedToken = function (params) {
|
|
2207
|
+
if (params === void 0) { params = {}; }
|
|
2208
|
+
return VerifyAPI.trackVerified(params, true);
|
|
2209
|
+
};
|
|
2190
2210
|
Radar.getContext = function (params) {
|
|
2191
2211
|
return ContextAPI.getContext(params);
|
|
2192
2212
|
};
|
package/dist/radar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radar.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"radar.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/types.d.ts
CHANGED
|
@@ -141,6 +141,9 @@ export interface RadarTrackResponse extends RadarResponse {
|
|
|
141
141
|
user?: RadarUser;
|
|
142
142
|
events?: RadarEvent[];
|
|
143
143
|
}
|
|
144
|
+
export interface RadarTrackTokenResponse extends RadarResponse {
|
|
145
|
+
token?: String;
|
|
146
|
+
}
|
|
144
147
|
export interface RadarContextResponse extends RadarResponse {
|
|
145
148
|
location?: Location;
|
|
146
149
|
geofences?: RadarGeofence[];
|
|
@@ -338,6 +341,8 @@ export interface RadarMarkerOptions {
|
|
|
338
341
|
color?: string;
|
|
339
342
|
text?: string;
|
|
340
343
|
html?: string;
|
|
344
|
+
element?: HTMLElement;
|
|
345
|
+
scale?: number;
|
|
341
346
|
}
|
|
342
347
|
export interface RadarAutocompleteUIOptions {
|
|
343
348
|
container: string | HTMLElement;
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "4.1.
|
|
1
|
+
declare const _default: "4.1.5-beta.0";
|
|
2
2
|
export default _default;
|
package/package.json
CHANGED
package/src/api/verify.ts
CHANGED
|
@@ -6,10 +6,10 @@ import Logger from '../logger';
|
|
|
6
6
|
import Session from '../session';
|
|
7
7
|
import Storage from '../storage';
|
|
8
8
|
|
|
9
|
-
import type { RadarTrackParams, RadarTrackResponse } from '../types';
|
|
9
|
+
import type { RadarTrackParams, RadarTrackResponse, RadarTrackTokenResponse } from '../types';
|
|
10
10
|
|
|
11
11
|
class VerifyAPI {
|
|
12
|
-
static async trackVerified(params: RadarTrackParams) {
|
|
12
|
+
static async trackVerified(params: RadarTrackParams, encrypted: Boolean = false) {
|
|
13
13
|
const options = Config.get();
|
|
14
14
|
|
|
15
15
|
// user indentification fields
|
|
@@ -40,6 +40,7 @@ class VerifyAPI {
|
|
|
40
40
|
sdkVersion: SDK_VERSION,
|
|
41
41
|
stopped: true,
|
|
42
42
|
userId,
|
|
43
|
+
encrypted,
|
|
43
44
|
};
|
|
44
45
|
|
|
45
46
|
const response: any = await Http.request({
|
|
@@ -49,9 +50,9 @@ class VerifyAPI {
|
|
|
49
50
|
host: 'https://radar-verify.com:52516',
|
|
50
51
|
});
|
|
51
52
|
|
|
52
|
-
const { user, events } = response;
|
|
53
|
+
const { user, events, token } = response;
|
|
53
54
|
let location;
|
|
54
|
-
if (user.location && user.location.coordinates && user.locationAccuracy) {
|
|
55
|
+
if (user && user.location && user.location.coordinates && user.locationAccuracy) {
|
|
55
56
|
location = {
|
|
56
57
|
latitude: user.location.coordinates[1],
|
|
57
58
|
longitude: user.location.coordinates[0],
|
|
@@ -59,6 +60,18 @@ class VerifyAPI {
|
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
62
|
|
|
63
|
+
if (encrypted) {
|
|
64
|
+
const trackTokenRes = {
|
|
65
|
+
token,
|
|
66
|
+
} as RadarTrackTokenResponse;
|
|
67
|
+
|
|
68
|
+
if (options.debug) {
|
|
69
|
+
trackTokenRes.response = response;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return trackTokenRes;
|
|
73
|
+
}
|
|
74
|
+
|
|
62
75
|
const trackRes = {
|
|
63
76
|
user,
|
|
64
77
|
events,
|
package/src/index.ts
CHANGED
|
@@ -148,6 +148,10 @@ class Radar {
|
|
|
148
148
|
return VerifyAPI.trackVerified(params);
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
+
public static trackVerifiedToken(params: RadarTrackParams = {}) {
|
|
152
|
+
return VerifyAPI.trackVerified(params, true);
|
|
153
|
+
}
|
|
154
|
+
|
|
151
155
|
public static getContext(params: Location) {
|
|
152
156
|
return ContextAPI.getContext(params);
|
|
153
157
|
}
|
package/src/types.ts
CHANGED
|
@@ -206,6 +206,9 @@ export interface RadarTrackResponse extends RadarResponse {
|
|
|
206
206
|
events?: RadarEvent[];
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
+
export interface RadarTrackTokenResponse extends RadarResponse {
|
|
210
|
+
token?: String;
|
|
211
|
+
}
|
|
209
212
|
|
|
210
213
|
export interface RadarContextResponse extends RadarResponse {
|
|
211
214
|
location?: Location;
|
|
@@ -452,6 +455,8 @@ export interface RadarMarkerOptions {
|
|
|
452
455
|
color?: string;
|
|
453
456
|
text?: string;
|
|
454
457
|
html?: string;
|
|
458
|
+
element?: HTMLElement;
|
|
459
|
+
scale?: number;
|
|
455
460
|
}
|
|
456
461
|
|
|
457
462
|
export interface RadarAutocompleteUIOptions {
|
package/src/ui/map.ts
CHANGED
|
@@ -133,6 +133,12 @@ class MapUI {
|
|
|
133
133
|
if (markerOptions.color) {
|
|
134
134
|
maplibreOptions.color = markerOptions.color;
|
|
135
135
|
}
|
|
136
|
+
if (markerOptions.element) {
|
|
137
|
+
maplibreOptions.element = markerOptions.element;
|
|
138
|
+
}
|
|
139
|
+
if (markerOptions.scale) {
|
|
140
|
+
maplibreOptions.scale = markerOptions.scale;
|
|
141
|
+
}
|
|
136
142
|
|
|
137
143
|
const marker = new maplibregl.Marker(maplibreOptions);
|
|
138
144
|
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '4.1.
|
|
1
|
+
export default '4.1.5-beta.0';
|