radar-sdk-js 4.4.0 → 4.4.1-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 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.0/radar.min.js"></script>
59
+ <script src="https://js.radar.com/v4.4.1-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.4.0/radar.css" rel="stylesheet">
77
- <script src="https://js.radar.com/v4.4.0/radar.min.js"></script>
76
+ <link href="https://js.radar.com/v4.4.1-beta.0/radar.css" rel="stylesheet">
77
+ <script src="https://js.radar.com/v4.4.1-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.4.0/radar.css" rel="stylesheet">
102
- <script src="https://js.radar.com/v4.4.0/radar.min.js"></script>
101
+ <link href="https://js.radar.com/v4.4.1-beta.0/radar.css" rel="stylesheet">
102
+ <script src="https://js.radar.com/v4.4.1-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.4.0/radar.css" rel="stylesheet">
134
- <script src="https://js.radar.com/v4.4.0/radar.min.js"></script>
133
+ <link href="https://js.radar.com/v4.4.1-beta.0/radar.css" rel="stylesheet">
134
+ <script src="https://js.radar.com/v4.4.1-beta.0/radar.min.js"></script>
135
135
  </head>
136
136
 
137
137
  <body>
package/dist/api.d.ts ADDED
@@ -0,0 +1,36 @@
1
+ import type { Location, RadarAutocompleteParams, RadarConversionParams, RadarDistanceParams, RadarForwardGeocodeParams, RadarMatrixParams, RadarMetadata, RadarOptions, RadarReverseGeocodeParams, RadarSearchGeofencesParams, RadarSearchPlacesParams, RadarStartTrackingVerifiedParams, RadarTrackParams, RadarTrackVerifiedResponse, RadarTripOptions, RadarValidateAddressParams } from './types';
2
+ declare class Radar {
3
+ static get VERSION(): string;
4
+ static initialize(publishableKey: string, options?: RadarOptions): void;
5
+ static clear(): void;
6
+ static setUserId(userId?: string): void;
7
+ static setDescription(description?: string): void;
8
+ static setMetadata(metadata?: RadarMetadata): void;
9
+ static getLocation(): Promise<import("./types").NavigatorPosition>;
10
+ static trackOnce(params?: RadarTrackParams): Promise<import("./types").RadarTrackResponse>;
11
+ static trackVerified(params?: RadarTrackParams): Promise<RadarTrackVerifiedResponse>;
12
+ static startTrackingVerified(params: RadarStartTrackingVerifiedParams): Promise<void>;
13
+ static stopTrackingVerified(): void;
14
+ static getVerifiedLocationToken(): Promise<RadarTrackVerifiedResponse>;
15
+ static setExpectedJurisdiction(countryCode?: string, stateCode?: string): void;
16
+ static getContext(params: Location): Promise<import("./types").RadarContextResponse>;
17
+ static setTripOptions(tripOptions?: RadarTripOptions): void;
18
+ static clearTripOptions(): void;
19
+ static getTripOptions(): RadarTripOptions;
20
+ static startTrip(tripOptions: RadarTripOptions): Promise<import("./types").RadarTripResponse>;
21
+ static updateTrip(tripOptions: RadarTripOptions): Promise<import("./types").RadarTripResponse>;
22
+ static completeTrip(): Promise<import("./types").RadarTripResponse>;
23
+ static cancelTrip(): Promise<import("./types").RadarTripResponse>;
24
+ static logConversion(params: RadarConversionParams): Promise<import("./types").RadarConversionResponse>;
25
+ static onTokenUpdated(callback: (token: RadarTrackVerifiedResponse) => void): void;
26
+ static forwardGeocode(params: RadarForwardGeocodeParams): Promise<import("./types").RadarGeocodeResponse>;
27
+ static reverseGeocode(params: RadarReverseGeocodeParams): Promise<import("./types").RadarGeocodeResponse>;
28
+ static ipGeocode(): Promise<import("./types").RadarIPGeocodeResponse>;
29
+ static autocomplete(params: RadarAutocompleteParams): Promise<import("./types").RadarAutocompleteResponse>;
30
+ static searchGeofences(params: RadarSearchGeofencesParams): Promise<import("./types").RadarSearchGeofencesResponse>;
31
+ static searchPlaces(params: RadarSearchPlacesParams): Promise<import("./types").RadarSearchPlacesResponse>;
32
+ static validateAddress(params: RadarValidateAddressParams): Promise<import("./types").RadarValidateAddressResponse>;
33
+ static distance(params: RadarDistanceParams): Promise<import("./types").RadarRouteResponse>;
34
+ static matrix(params: RadarMatrixParams): Promise<import("./types").RadarMatrixResponse>;
35
+ }
36
+ export default Radar;
package/dist/index.d.ts CHANGED
@@ -1,10 +1,9 @@
1
+ import RadarAPI from './api';
1
2
  import MapUI from './ui/map';
2
3
  import AutocompleteUI from './ui/autocomplete';
3
- import type { Location, RadarAutocompleteParams, RadarConversionParams, RadarDistanceParams, RadarForwardGeocodeParams, RadarMatrixParams, RadarMetadata, RadarOptions, RadarReverseGeocodeParams, RadarSearchGeofencesParams, RadarSearchPlacesParams, RadarStartTrackingVerifiedParams, RadarTrackParams, RadarTrackVerifiedResponse, RadarTripOptions, RadarValidateAddressParams } from './types';
4
4
  import 'maplibre-gl/dist/maplibre-gl.css';
5
5
  import '../styles/radar.css';
6
- declare class Radar {
7
- static get VERSION(): string;
6
+ declare class Radar extends RadarAPI {
8
7
  static get ui(): {
9
8
  maplibregl: typeof import("maplibre-gl");
10
9
  map: typeof MapUI.createMap;
@@ -12,36 +11,5 @@ declare class Radar {
12
11
  popup: typeof MapUI.createPopup;
13
12
  autocomplete: typeof AutocompleteUI.createAutocomplete;
14
13
  };
15
- static initialize(publishableKey: string, options?: RadarOptions): void;
16
- static clear(): void;
17
- static setUserId(userId?: string): void;
18
- static setDescription(description?: string): void;
19
- static setMetadata(metadata?: RadarMetadata): void;
20
- static getLocation(): Promise<import("./types").NavigatorPosition>;
21
- static trackOnce(params?: RadarTrackParams): Promise<import("./types").RadarTrackResponse>;
22
- static trackVerified(params?: RadarTrackParams): Promise<RadarTrackVerifiedResponse>;
23
- static startTrackingVerified(params: RadarStartTrackingVerifiedParams): Promise<void>;
24
- static stopTrackingVerified(): void;
25
- static getVerifiedLocationToken(): Promise<RadarTrackVerifiedResponse>;
26
- static setExpectedJurisdiction(countryCode?: string, stateCode?: string): void;
27
- static getContext(params: Location): Promise<import("./types").RadarContextResponse>;
28
- static setTripOptions(tripOptions?: RadarTripOptions): void;
29
- static clearTripOptions(): void;
30
- static getTripOptions(): RadarTripOptions;
31
- static startTrip(tripOptions: RadarTripOptions): Promise<import("./types").RadarTripResponse>;
32
- static updateTrip(tripOptions: RadarTripOptions): Promise<import("./types").RadarTripResponse>;
33
- static completeTrip(): Promise<import("./types").RadarTripResponse>;
34
- static cancelTrip(): Promise<import("./types").RadarTripResponse>;
35
- static logConversion(params: RadarConversionParams): Promise<import("./types").RadarConversionResponse>;
36
- static onTokenUpdated(callback: (token: RadarTrackVerifiedResponse) => void): void;
37
- static forwardGeocode(params: RadarForwardGeocodeParams): Promise<import("./types").RadarGeocodeResponse>;
38
- static reverseGeocode(params: RadarReverseGeocodeParams): Promise<import("./types").RadarGeocodeResponse>;
39
- static ipGeocode(): Promise<import("./types").RadarIPGeocodeResponse>;
40
- static autocomplete(params: RadarAutocompleteParams): Promise<import("./types").RadarAutocompleteResponse>;
41
- static searchGeofences(params: RadarSearchGeofencesParams): Promise<import("./types").RadarSearchGeofencesResponse>;
42
- static searchPlaces(params: RadarSearchPlacesParams): Promise<import("./types").RadarSearchPlacesResponse>;
43
- static validateAddress(params: RadarValidateAddressParams): Promise<import("./types").RadarValidateAddressResponse>;
44
- static distance(params: RadarDistanceParams): Promise<import("./types").RadarRouteResponse>;
45
- static matrix(params: RadarMatrixParams): Promise<import("./types").RadarMatrixResponse>;
46
14
  }
47
15
  export default Radar;
package/dist/radar.js CHANGED
@@ -405,7 +405,7 @@ class Navigator {
405
405
  }
406
406
  }
407
407
 
408
- var SDK_VERSION = '4.4.0';
408
+ var SDK_VERSION = '4.4.1-beta.0';
409
409
 
410
410
  const inFlightRequests = new Map();
411
411
  class Http {
@@ -1501,6 +1501,158 @@ class VerifyAPI {
1501
1501
  }
1502
1502
  }
1503
1503
 
1504
+ const isSecretKey = (key) => (key.includes('_sk_'));
1505
+ const isLiveKey = (key) => (key.includes('_live_'));
1506
+ let Radar$1 = class Radar {
1507
+ static get VERSION() {
1508
+ return SDK_VERSION;
1509
+ }
1510
+ static initialize(publishableKey, options = {}) {
1511
+ if (!publishableKey) {
1512
+ throw new RadarPublishableKeyError('Publishable key required in initialization.');
1513
+ }
1514
+ if (isSecretKey(publishableKey)) {
1515
+ throw new RadarPublishableKeyError('Secret keys are not allowed. Please use your Radar publishable key.');
1516
+ }
1517
+ // store settings in global config
1518
+ const live = isLiveKey(publishableKey);
1519
+ const logLevel = live ? 'error' : 'info';
1520
+ const debug = !live;
1521
+ const radarOptions = Object.assign(Config.defaultOptions, {
1522
+ publishableKey,
1523
+ live,
1524
+ logLevel,
1525
+ debug,
1526
+ }, options);
1527
+ Config.setup(radarOptions);
1528
+ Logger.info(`initialized with ${live ? 'live' : 'test'} publishableKey.`);
1529
+ if (options.debug) {
1530
+ Logger.info(`using options: ${JSON.stringify(options)}`);
1531
+ }
1532
+ // NOTE(jasonl): this allows us to run jest tests
1533
+ // without having to mock the ConfigAPI.getConfig call
1534
+ if (!(window === null || window === void 0 ? void 0 : window.RADAR_TEST_ENV)) {
1535
+ ConfigAPI.getConfig();
1536
+ }
1537
+ }
1538
+ static clear() {
1539
+ Config.clear();
1540
+ }
1541
+ ///////////////////////
1542
+ // Geofencing Platform
1543
+ ///////////////////////
1544
+ static setUserId(userId) {
1545
+ if (!userId) {
1546
+ Storage.removeItem(Storage.USER_ID);
1547
+ return;
1548
+ }
1549
+ Storage.setItem(Storage.USER_ID, String(userId).trim());
1550
+ }
1551
+ static setDescription(description) {
1552
+ if (!description) {
1553
+ Storage.removeItem(Storage.DESCRIPTION);
1554
+ return;
1555
+ }
1556
+ Storage.setItem(Storage.DESCRIPTION, String(description).trim());
1557
+ }
1558
+ static setMetadata(metadata) {
1559
+ if (!metadata) {
1560
+ Storage.removeItem(Storage.METADATA);
1561
+ return;
1562
+ }
1563
+ Storage.setItem(Storage.METADATA, JSON.stringify(metadata));
1564
+ }
1565
+ static getLocation() {
1566
+ return Navigator.getCurrentPosition();
1567
+ }
1568
+ static trackOnce(params = {}) {
1569
+ try {
1570
+ return TrackAPI.trackOnce(params);
1571
+ }
1572
+ finally {
1573
+ ConfigAPI.getConfig(params); // call with updated permissions
1574
+ }
1575
+ }
1576
+ static trackVerified(params = {}) {
1577
+ return VerifyAPI.trackVerified(params);
1578
+ }
1579
+ static startTrackingVerified(params) {
1580
+ return VerifyAPI.startTrackingVerified(params);
1581
+ }
1582
+ static stopTrackingVerified() {
1583
+ return VerifyAPI.stopTrackingVerified();
1584
+ }
1585
+ static getVerifiedLocationToken() {
1586
+ return VerifyAPI.getVerifiedLocationToken();
1587
+ }
1588
+ static setExpectedJurisdiction(countryCode, stateCode) {
1589
+ VerifyAPI.setExpectedJurisdiction(countryCode, stateCode);
1590
+ }
1591
+ static getContext(params) {
1592
+ return ContextAPI.getContext(params);
1593
+ }
1594
+ static setTripOptions(tripOptions) {
1595
+ TripsAPI.setTripOptions(tripOptions);
1596
+ }
1597
+ static clearTripOptions() {
1598
+ TripsAPI.clearTripOptions();
1599
+ }
1600
+ static getTripOptions() {
1601
+ return TripsAPI.getTripOptions();
1602
+ }
1603
+ static startTrip(tripOptions) {
1604
+ return TripsAPI.startTrip(tripOptions);
1605
+ }
1606
+ static updateTrip(tripOptions) {
1607
+ return TripsAPI.updateTrip(tripOptions);
1608
+ }
1609
+ static completeTrip() {
1610
+ return TripsAPI.completeTrip();
1611
+ }
1612
+ static cancelTrip() {
1613
+ return TripsAPI.cancelTrip();
1614
+ }
1615
+ static logConversion(params) {
1616
+ return ConversionsAPI.logConversion(params);
1617
+ }
1618
+ ///////////////////////
1619
+ // Listeners
1620
+ ///////////////////////
1621
+ static onTokenUpdated(callback) {
1622
+ VerifyAPI.onTokenUpdated(callback);
1623
+ }
1624
+ /////////////////
1625
+ // Maps Platform
1626
+ /////////////////
1627
+ static forwardGeocode(params) {
1628
+ return Geocoding.forwardGeocode(params);
1629
+ }
1630
+ static reverseGeocode(params) {
1631
+ return Geocoding.reverseGeocode(params);
1632
+ }
1633
+ static ipGeocode() {
1634
+ return Geocoding.ipGeocode();
1635
+ }
1636
+ static autocomplete(params) {
1637
+ return SearchAPI.autocomplete(params);
1638
+ }
1639
+ static searchGeofences(params) {
1640
+ return SearchAPI.searchGeofences(params);
1641
+ }
1642
+ static searchPlaces(params) {
1643
+ return SearchAPI.searchPlaces(params);
1644
+ }
1645
+ static validateAddress(params) {
1646
+ return AddressesAPI.validateAddress(params);
1647
+ }
1648
+ static distance(params) {
1649
+ return RoutingAPI.distance(params);
1650
+ }
1651
+ static matrix(params) {
1652
+ return RoutingAPI.matrix(params);
1653
+ }
1654
+ };
1655
+
1504
1656
  class RadarFeatureMouseEvent {
1505
1657
  constructor(type, feature, originalEvent) {
1506
1658
  this.type = type;
@@ -2745,13 +2897,8 @@ class AutocompleteUI {
2745
2897
  }
2746
2898
  }
2747
2899
 
2748
- const isSecretKey = (key) => (key.includes('_sk_'));
2749
- const isLiveKey = (key) => (key.includes('_live_'));
2750
- class Radar {
2751
- static get VERSION() {
2752
- return SDK_VERSION;
2753
- }
2754
- // "ui" namespace
2900
+ class Radar extends Radar$1 {
2901
+ // "ui" namespace for Maps and Autocomplete
2755
2902
  static get ui() {
2756
2903
  return {
2757
2904
  maplibregl: MapUI.getMapLibre(),
@@ -2761,150 +2908,6 @@ class Radar {
2761
2908
  autocomplete: AutocompleteUI.createAutocomplete,
2762
2909
  };
2763
2910
  }
2764
- static initialize(publishableKey, options = {}) {
2765
- if (!publishableKey) {
2766
- throw new RadarPublishableKeyError('Publishable key required in initialization.');
2767
- }
2768
- if (isSecretKey(publishableKey)) {
2769
- throw new RadarPublishableKeyError('Secret keys are not allowed. Please use your Radar publishable key.');
2770
- }
2771
- // store settings in global config
2772
- const live = isLiveKey(publishableKey);
2773
- const logLevel = live ? 'error' : 'info';
2774
- const debug = !live;
2775
- const radarOptions = Object.assign(Config.defaultOptions, {
2776
- publishableKey,
2777
- live,
2778
- logLevel,
2779
- debug,
2780
- }, options);
2781
- Config.setup(radarOptions);
2782
- Logger.info(`initialized with ${live ? 'live' : 'test'} publishableKey.`);
2783
- if (options.debug) {
2784
- Logger.info(`using options: ${JSON.stringify(options)}`);
2785
- }
2786
- // NOTE(jasonl): this allows us to run jest tests
2787
- // without having to mock the ConfigAPI.getConfig call
2788
- if (!(window === null || window === void 0 ? void 0 : window.RADAR_TEST_ENV)) {
2789
- ConfigAPI.getConfig();
2790
- }
2791
- }
2792
- static clear() {
2793
- Config.clear();
2794
- }
2795
- ///////////////////////
2796
- // Geofencing Platform
2797
- ///////////////////////
2798
- static setUserId(userId) {
2799
- if (!userId) {
2800
- Storage.removeItem(Storage.USER_ID);
2801
- return;
2802
- }
2803
- Storage.setItem(Storage.USER_ID, String(userId).trim());
2804
- }
2805
- static setDescription(description) {
2806
- if (!description) {
2807
- Storage.removeItem(Storage.DESCRIPTION);
2808
- return;
2809
- }
2810
- Storage.setItem(Storage.DESCRIPTION, String(description).trim());
2811
- }
2812
- static setMetadata(metadata) {
2813
- if (!metadata) {
2814
- Storage.removeItem(Storage.METADATA);
2815
- return;
2816
- }
2817
- Storage.setItem(Storage.METADATA, JSON.stringify(metadata));
2818
- }
2819
- static getLocation() {
2820
- return Navigator.getCurrentPosition();
2821
- }
2822
- static trackOnce(params = {}) {
2823
- try {
2824
- return TrackAPI.trackOnce(params);
2825
- }
2826
- finally {
2827
- ConfigAPI.getConfig(params); // call with updated permissions
2828
- }
2829
- }
2830
- static trackVerified(params = {}) {
2831
- return VerifyAPI.trackVerified(params);
2832
- }
2833
- static startTrackingVerified(params) {
2834
- return VerifyAPI.startTrackingVerified(params);
2835
- }
2836
- static stopTrackingVerified() {
2837
- return VerifyAPI.stopTrackingVerified();
2838
- }
2839
- static getVerifiedLocationToken() {
2840
- return VerifyAPI.getVerifiedLocationToken();
2841
- }
2842
- static setExpectedJurisdiction(countryCode, stateCode) {
2843
- VerifyAPI.setExpectedJurisdiction(countryCode, stateCode);
2844
- }
2845
- static getContext(params) {
2846
- return ContextAPI.getContext(params);
2847
- }
2848
- static setTripOptions(tripOptions) {
2849
- TripsAPI.setTripOptions(tripOptions);
2850
- }
2851
- static clearTripOptions() {
2852
- TripsAPI.clearTripOptions();
2853
- }
2854
- static getTripOptions() {
2855
- return TripsAPI.getTripOptions();
2856
- }
2857
- static startTrip(tripOptions) {
2858
- return TripsAPI.startTrip(tripOptions);
2859
- }
2860
- static updateTrip(tripOptions) {
2861
- return TripsAPI.updateTrip(tripOptions);
2862
- }
2863
- static completeTrip() {
2864
- return TripsAPI.completeTrip();
2865
- }
2866
- static cancelTrip() {
2867
- return TripsAPI.cancelTrip();
2868
- }
2869
- static logConversion(params) {
2870
- return ConversionsAPI.logConversion(params);
2871
- }
2872
- ///////////////////////
2873
- // listeners
2874
- ///////////////////////
2875
- static onTokenUpdated(callback) {
2876
- VerifyAPI.onTokenUpdated(callback);
2877
- }
2878
- ///////////////////////
2879
- // Maps Platform
2880
- ///////////////////////
2881
- static forwardGeocode(params) {
2882
- return Geocoding.forwardGeocode(params);
2883
- }
2884
- static reverseGeocode(params) {
2885
- return Geocoding.reverseGeocode(params);
2886
- }
2887
- static ipGeocode() {
2888
- return Geocoding.ipGeocode();
2889
- }
2890
- static autocomplete(params) {
2891
- return SearchAPI.autocomplete(params);
2892
- }
2893
- static searchGeofences(params) {
2894
- return SearchAPI.searchGeofences(params);
2895
- }
2896
- static searchPlaces(params) {
2897
- return SearchAPI.searchPlaces(params);
2898
- }
2899
- static validateAddress(params) {
2900
- return AddressesAPI.validateAddress(params);
2901
- }
2902
- static distance(params) {
2903
- return RoutingAPI.distance(params);
2904
- }
2905
- static matrix(params) {
2906
- return RoutingAPI.matrix(params);
2907
- }
2908
2911
  }
2909
2912
 
2910
2913
  export { Radar as default };
package/dist/radar.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"radar.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "radar-sdk-js",
3
- "version": "4.4.0",
3
+ "version": "4.4.1-beta.0",
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.ts ADDED
@@ -0,0 +1,237 @@
1
+ import Config from './config';
2
+ import Logger from './logger';
3
+ import Storage from './storage';
4
+ import Navigator from './navigator';
5
+ import { RadarPublishableKeyError } from './errors';
6
+
7
+ import AddressesAPI from './api/addresses';
8
+ import ConfigAPI from './api/config';
9
+ import ContextAPI from './api/context';
10
+ import ConversionsAPI from './api/conversions';
11
+ import GeocodingAPI from './api/geocoding';
12
+ import RoutingAPI from './api/routing';
13
+ import SearchAPI from './api/search';
14
+ import TrackAPI from './api/track';
15
+ import TripsAPI from './api/trips';
16
+ import VerifyAPI from './api/verify';
17
+
18
+ import SDK_VERSION from './version';
19
+
20
+ import type {
21
+ Location,
22
+ RadarAutocompleteParams,
23
+ RadarConversionParams,
24
+ RadarDistanceParams,
25
+ RadarForwardGeocodeParams,
26
+ RadarMatrixParams,
27
+ RadarMetadata,
28
+ RadarOptions,
29
+ RadarReverseGeocodeParams,
30
+ RadarSearchGeofencesParams,
31
+ RadarSearchPlacesParams,
32
+ RadarStartTrackingVerifiedParams,
33
+ RadarTrackParams,
34
+ RadarTrackVerifiedResponse,
35
+ RadarTripOptions,
36
+ RadarValidateAddressParams,
37
+ } from './types';
38
+
39
+ const isSecretKey = (key: string): boolean => (
40
+ key.includes('_sk_')
41
+ );
42
+ const isLiveKey = (key: string): boolean => (
43
+ key.includes('_live_')
44
+ );
45
+
46
+ class Radar {
47
+ public static get VERSION() {
48
+ return SDK_VERSION;
49
+ }
50
+
51
+ public static initialize(publishableKey: string, options: RadarOptions = {}) {
52
+ if (!publishableKey) {
53
+ throw new RadarPublishableKeyError('Publishable key required in initialization.');
54
+ }
55
+
56
+ if (isSecretKey(publishableKey)) {
57
+ throw new RadarPublishableKeyError('Secret keys are not allowed. Please use your Radar publishable key.');
58
+ }
59
+
60
+ // store settings in global config
61
+ const live = isLiveKey(publishableKey);
62
+ const logLevel = live ? 'error' : 'info';
63
+ const debug = !live;
64
+ const radarOptions = Object.assign(
65
+ Config.defaultOptions,
66
+ {
67
+ publishableKey,
68
+ live,
69
+ logLevel,
70
+ debug,
71
+ },
72
+ options,
73
+ );
74
+ Config.setup(radarOptions);
75
+
76
+ Logger.info(`initialized with ${live ? 'live' : 'test'} publishableKey.`);
77
+ if (options.debug) {
78
+ Logger.info(`using options: ${JSON.stringify(options)}`);
79
+ }
80
+
81
+ // NOTE(jasonl): this allows us to run jest tests
82
+ // without having to mock the ConfigAPI.getConfig call
83
+ if (!(window as any)?.RADAR_TEST_ENV) {
84
+ ConfigAPI.getConfig();
85
+ }
86
+ }
87
+
88
+ public static clear() {
89
+ Config.clear();
90
+ }
91
+
92
+ ///////////////////////
93
+ // Geofencing Platform
94
+ ///////////////////////
95
+
96
+ public static setUserId(userId?: string) {
97
+ if (!userId) {
98
+ Storage.removeItem(Storage.USER_ID);
99
+ return;
100
+ }
101
+ Storage.setItem(Storage.USER_ID, String(userId).trim());
102
+ }
103
+
104
+ public static setDescription(description?: string) {
105
+ if (!description) {
106
+ Storage.removeItem(Storage.DESCRIPTION);
107
+ return;
108
+ }
109
+ Storage.setItem(Storage.DESCRIPTION, String(description).trim());
110
+ }
111
+
112
+ public static setMetadata(metadata?: RadarMetadata) {
113
+ if (!metadata) {
114
+ Storage.removeItem(Storage.METADATA);
115
+ return;
116
+ }
117
+ Storage.setItem(Storage.METADATA, JSON.stringify(metadata));
118
+ }
119
+
120
+ public static getLocation() {
121
+ return Navigator.getCurrentPosition();
122
+ }
123
+
124
+ public static trackOnce(params: RadarTrackParams = {}) {
125
+ try {
126
+ return TrackAPI.trackOnce(params);
127
+ } finally {
128
+ ConfigAPI.getConfig(params); // call with updated permissions
129
+ }
130
+ }
131
+
132
+ public static trackVerified(params: RadarTrackParams = {}) {
133
+ return VerifyAPI.trackVerified(params);
134
+ }
135
+
136
+ public static startTrackingVerified(params: RadarStartTrackingVerifiedParams) {
137
+ return VerifyAPI.startTrackingVerified(params);
138
+ }
139
+
140
+ public static stopTrackingVerified() {
141
+ return VerifyAPI.stopTrackingVerified();
142
+ }
143
+
144
+ public static getVerifiedLocationToken() {
145
+ return VerifyAPI.getVerifiedLocationToken();
146
+ }
147
+
148
+ public static setExpectedJurisdiction(countryCode?: string, stateCode?: string) {
149
+ VerifyAPI.setExpectedJurisdiction(countryCode, stateCode);
150
+ }
151
+
152
+ public static getContext(params: Location) {
153
+ return ContextAPI.getContext(params);
154
+ }
155
+
156
+ public static setTripOptions(tripOptions?: RadarTripOptions) {
157
+ TripsAPI.setTripOptions(tripOptions);
158
+ }
159
+
160
+ public static clearTripOptions() {
161
+ TripsAPI.clearTripOptions();
162
+ }
163
+
164
+ public static getTripOptions() {
165
+ return TripsAPI.getTripOptions();
166
+ }
167
+
168
+ public static startTrip(tripOptions: RadarTripOptions) {
169
+ return TripsAPI.startTrip(tripOptions);
170
+ }
171
+
172
+ public static updateTrip(tripOptions: RadarTripOptions) {
173
+ return TripsAPI.updateTrip(tripOptions);
174
+ }
175
+
176
+ public static completeTrip() {
177
+ return TripsAPI.completeTrip();
178
+ }
179
+
180
+ public static cancelTrip() {
181
+ return TripsAPI.cancelTrip();
182
+ }
183
+
184
+ public static logConversion(params: RadarConversionParams) {
185
+ return ConversionsAPI.logConversion(params);
186
+ }
187
+
188
+ ///////////////////////
189
+ // Listeners
190
+ ///////////////////////
191
+ public static onTokenUpdated(callback: (token: RadarTrackVerifiedResponse) => void) {
192
+ VerifyAPI.onTokenUpdated(callback);
193
+ }
194
+
195
+
196
+ /////////////////
197
+ // Maps Platform
198
+ /////////////////
199
+
200
+ public static forwardGeocode(params: RadarForwardGeocodeParams) {
201
+ return GeocodingAPI.forwardGeocode(params);
202
+ }
203
+
204
+ public static reverseGeocode(params: RadarReverseGeocodeParams) {
205
+ return GeocodingAPI.reverseGeocode(params);
206
+ }
207
+
208
+ public static ipGeocode() {
209
+ return GeocodingAPI.ipGeocode();
210
+ }
211
+
212
+ public static autocomplete(params: RadarAutocompleteParams) {
213
+ return SearchAPI.autocomplete(params);
214
+ }
215
+
216
+ public static searchGeofences(params: RadarSearchGeofencesParams) {
217
+ return SearchAPI.searchGeofences(params);
218
+ }
219
+
220
+ public static searchPlaces(params: RadarSearchPlacesParams) {
221
+ return SearchAPI.searchPlaces(params);
222
+ }
223
+
224
+ public static validateAddress(params: RadarValidateAddressParams) {
225
+ return AddressesAPI.validateAddress(params);
226
+ }
227
+
228
+ public static distance(params: RadarDistanceParams) {
229
+ return RoutingAPI.distance(params);
230
+ }
231
+
232
+ public static matrix(params: RadarMatrixParams) {
233
+ return RoutingAPI.matrix(params);
234
+ }
235
+ }
236
+
237
+ export default Radar;
package/src/index.ts CHANGED
@@ -1,61 +1,13 @@
1
- import Config from './config';
2
- import Logger from './logger';
3
- import Storage from './storage';
4
- import Navigator from './navigator';
5
- import { RadarPublishableKeyError } from './errors';
6
-
7
- import AddressesAPI from './api/addresses';
8
- import ConfigAPI from './api/config';
9
- import ContextAPI from './api/context';
10
- import ConversionsAPI from './api/conversions';
11
- import GeocodingAPI from './api/geocoding';
12
- import RoutingAPI from './api/routing';
13
- import SearchAPI from './api/search';
14
- import TrackAPI from './api/track';
15
- import TripsAPI from './api/trips';
16
- import VerifyAPI from './api/verify';
1
+ import RadarAPI from './api';
17
2
 
18
3
  import MapUI from './ui/map';
19
4
  import AutocompleteUI from './ui/autocomplete';
20
5
 
21
- import SDK_VERSION from './version';
22
-
23
- import type {
24
- Location,
25
- RadarAutocompleteParams,
26
- RadarConversionParams,
27
- RadarDistanceParams,
28
- RadarForwardGeocodeParams,
29
- RadarMatrixParams,
30
- RadarMetadata,
31
- RadarOptions,
32
- RadarReverseGeocodeParams,
33
- RadarSearchGeofencesParams,
34
- RadarSearchPlacesParams,
35
- RadarStartTrackingVerifiedParams,
36
- RadarTrackParams,
37
- RadarTrackVerifiedResponse,
38
- RadarTripOptions,
39
- RadarValidateAddressParams,
40
- } from './types';
41
-
42
6
  import 'maplibre-gl/dist/maplibre-gl.css';
43
7
  import '../styles/radar.css';
44
8
 
45
-
46
- const isSecretKey = (key: string): boolean => (
47
- key.includes('_sk_')
48
- );
49
- const isLiveKey = (key: string): boolean => (
50
- key.includes('_live_')
51
- );
52
-
53
- class Radar {
54
- public static get VERSION() {
55
- return SDK_VERSION;
56
- }
57
-
58
- // "ui" namespace
9
+ class Radar extends RadarAPI {
10
+ // "ui" namespace for Maps and Autocomplete
59
11
  public static get ui() {
60
12
  return {
61
13
  maplibregl: MapUI.getMapLibre(),
@@ -65,190 +17,6 @@ class Radar {
65
17
  autocomplete: AutocompleteUI.createAutocomplete,
66
18
  };
67
19
  }
68
-
69
- public static initialize(publishableKey: string, options: RadarOptions = {}) {
70
- if (!publishableKey) {
71
- throw new RadarPublishableKeyError('Publishable key required in initialization.');
72
- }
73
-
74
- if (isSecretKey(publishableKey)) {
75
- throw new RadarPublishableKeyError('Secret keys are not allowed. Please use your Radar publishable key.');
76
- }
77
-
78
- // store settings in global config
79
- const live = isLiveKey(publishableKey);
80
- const logLevel = live ? 'error' : 'info';
81
- const debug = !live;
82
- const radarOptions = Object.assign(
83
- Config.defaultOptions,
84
- {
85
- publishableKey,
86
- live,
87
- logLevel,
88
- debug,
89
- },
90
- options,
91
- );
92
- Config.setup(radarOptions);
93
-
94
- Logger.info(`initialized with ${live ? 'live' : 'test'} publishableKey.`);
95
- if (options.debug) {
96
- Logger.info(`using options: ${JSON.stringify(options)}`);
97
- }
98
-
99
- // NOTE(jasonl): this allows us to run jest tests
100
- // without having to mock the ConfigAPI.getConfig call
101
- if (!(window as any)?.RADAR_TEST_ENV) {
102
- ConfigAPI.getConfig();
103
- }
104
- }
105
-
106
- public static clear() {
107
- Config.clear();
108
- }
109
-
110
- ///////////////////////
111
- // Geofencing Platform
112
- ///////////////////////
113
-
114
- public static setUserId(userId?: string) {
115
- if (!userId) {
116
- Storage.removeItem(Storage.USER_ID);
117
- return;
118
- }
119
- Storage.setItem(Storage.USER_ID, String(userId).trim());
120
- }
121
-
122
- public static setDescription(description?: string) {
123
- if (!description) {
124
- Storage.removeItem(Storage.DESCRIPTION);
125
- return;
126
- }
127
- Storage.setItem(Storage.DESCRIPTION, String(description).trim());
128
- }
129
-
130
- public static setMetadata(metadata?: RadarMetadata) {
131
- if (!metadata) {
132
- Storage.removeItem(Storage.METADATA);
133
- return;
134
- }
135
- Storage.setItem(Storage.METADATA, JSON.stringify(metadata));
136
- }
137
-
138
- public static getLocation() {
139
- return Navigator.getCurrentPosition();
140
- }
141
-
142
- public static trackOnce(params: RadarTrackParams = {}) {
143
- try {
144
- return TrackAPI.trackOnce(params);
145
- } finally {
146
- ConfigAPI.getConfig(params); // call with updated permissions
147
- }
148
- }
149
-
150
- public static trackVerified(params: RadarTrackParams = {}) {
151
- return VerifyAPI.trackVerified(params);
152
- }
153
-
154
- public static startTrackingVerified(params: RadarStartTrackingVerifiedParams) {
155
- return VerifyAPI.startTrackingVerified(params);
156
- }
157
-
158
- public static stopTrackingVerified() {
159
- return VerifyAPI.stopTrackingVerified();
160
- }
161
-
162
- public static getVerifiedLocationToken() {
163
- return VerifyAPI.getVerifiedLocationToken();
164
- }
165
-
166
- public static setExpectedJurisdiction(countryCode?: string, stateCode?: string) {
167
- VerifyAPI.setExpectedJurisdiction(countryCode, stateCode);
168
- }
169
-
170
- public static getContext(params: Location) {
171
- return ContextAPI.getContext(params);
172
- }
173
-
174
- public static setTripOptions(tripOptions?: RadarTripOptions) {
175
- TripsAPI.setTripOptions(tripOptions);
176
- }
177
-
178
- public static clearTripOptions() {
179
- TripsAPI.clearTripOptions();
180
- }
181
-
182
- public static getTripOptions() {
183
- return TripsAPI.getTripOptions();
184
- }
185
-
186
- public static startTrip(tripOptions: RadarTripOptions) {
187
- return TripsAPI.startTrip(tripOptions);
188
- }
189
-
190
- public static updateTrip(tripOptions: RadarTripOptions) {
191
- return TripsAPI.updateTrip(tripOptions);
192
- }
193
-
194
- public static completeTrip() {
195
- return TripsAPI.completeTrip();
196
- }
197
-
198
- public static cancelTrip() {
199
- return TripsAPI.cancelTrip();
200
- }
201
-
202
- public static logConversion(params: RadarConversionParams) {
203
- return ConversionsAPI.logConversion(params);
204
- }
205
-
206
- ///////////////////////
207
- // listeners
208
- ///////////////////////
209
- public static onTokenUpdated(callback: (token: RadarTrackVerifiedResponse) => void) {
210
- VerifyAPI.onTokenUpdated(callback);
211
- }
212
-
213
- ///////////////////////
214
- // Maps Platform
215
- ///////////////////////
216
-
217
- public static forwardGeocode(params: RadarForwardGeocodeParams) {
218
- return GeocodingAPI.forwardGeocode(params);
219
- }
220
-
221
- public static reverseGeocode(params: RadarReverseGeocodeParams) {
222
- return GeocodingAPI.reverseGeocode(params);
223
- }
224
-
225
- public static ipGeocode() {
226
- return GeocodingAPI.ipGeocode();
227
- }
228
-
229
- public static autocomplete(params: RadarAutocompleteParams) {
230
- return SearchAPI.autocomplete(params);
231
- }
232
-
233
- public static searchGeofences(params: RadarSearchGeofencesParams) {
234
- return SearchAPI.searchGeofences(params);
235
- }
236
-
237
- public static searchPlaces(params: RadarSearchPlacesParams) {
238
- return SearchAPI.searchPlaces(params);
239
- }
240
-
241
- public static validateAddress(params: RadarValidateAddressParams) {
242
- return AddressesAPI.validateAddress(params);
243
- }
244
-
245
- public static distance(params: RadarDistanceParams) {
246
- return RoutingAPI.distance(params);
247
- }
248
-
249
- public static matrix(params: RadarMatrixParams) {
250
- return RoutingAPI.matrix(params);
251
- }
252
20
  }
253
21
 
254
22
  export default Radar;
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export default '4.4.0';
1
+ export default '4.4.1-beta.0';