radar-sdk-js 3.7.1 → 4.0.0-beta.5
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/.babelrc +11 -0
- package/.circleci/config.yml +25 -0
- package/.eslintrc +30 -0
- package/.github/workflows/codeql-analysis.yml +52 -0
- package/.github/workflows/radar-pre-release-actions.yml +29 -0
- package/.github/workflows/radar-release-actions.yml +38 -0
- package/LICENSE +190 -0
- package/README.md +68 -14
- package/assets/logo.svg +8 -0
- package/demo/index.html +292 -0
- package/demo/server.cjs +24 -0
- package/jest.config.js +9 -0
- package/package.json +30 -51
- package/rollup.config.js +47 -0
- package/scripts/bump-version.cjs +32 -0
- package/scripts/check-beta-tag.cjs +37 -0
- package/scripts/check-latest-tag.cjs +37 -0
- package/src/api/addresses.ts +30 -0
- package/src/api/config.ts +41 -0
- package/src/api/context.ts +54 -0
- package/src/api/conversions.ts +57 -0
- package/src/api/geocoding.ts +92 -0
- package/src/api/routing.ts +119 -0
- package/src/api/search.ts +164 -0
- package/src/api/track.ts +94 -0
- package/src/api/trips.ts +170 -0
- package/src/config.ts +27 -0
- package/src/{device.js → device.ts} +15 -2
- package/src/errors.ts +144 -0
- package/src/http.ts +137 -0
- package/src/index.ts +199 -0
- package/src/logger.ts +49 -0
- package/src/navigator.ts +123 -0
- package/src/session.ts +28 -0
- package/src/storage.ts +93 -0
- package/src/types.ts +443 -0
- package/src/version.ts +1 -0
- package/test/api/addresses.test.js +91 -0
- package/test/api/context.test.js +60 -0
- package/test/api/events.test.js +51 -0
- package/test/api/geocoding.test.js +81 -0
- package/test/api/routing.test.js +135 -0
- package/test/api/search.test.js +163 -0
- package/test/api/track.test.js +112 -0
- package/test/api/trips.test.js +315 -0
- package/test/common.js +2 -0
- package/test/device.test.js +51 -0
- package/test/http.test.js +297 -0
- package/test/index.test.js +532 -0
- package/test/mock-data/globals.js +30 -0
- package/test/navigator.test.js +90 -0
- package/test/navigator.test.ts +63 -0
- package/test/radar.test.ts +80 -0
- package/test/session.test.ts +43 -0
- package/test/storage.test.js +66 -0
- package/test/track.test.ts +87 -0
- package/test/userIdentify.test.ts +55 -0
- package/test/utils.ts +55 -0
- package/test/version.test.js +46 -0
- package/tsconfig.json +11 -0
- package/dist/index.js +0 -5580
- package/dist/radar.js +0 -5583
- package/dist/radar.min.js +0 -1
- package/src/api/addresses.js +0 -31
- package/src/api/context.js +0 -20
- package/src/api/events.js +0 -21
- package/src/api/geocoding.js +0 -33
- package/src/api/routing.js +0 -76
- package/src/api/search.js +0 -114
- package/src/api/track.js +0 -61
- package/src/api/trips.js +0 -74
- package/src/api_host.js +0 -12
- package/src/error_codes.js +0 -16
- package/src/http.js +0 -113
- package/src/index.js +0 -340
- package/src/navigator.js +0 -60
- package/src/status.js +0 -15
- package/src/storage.js +0 -89
- package/src/tripStatus.js +0 -10
- package/src/version.js +0 -1
package/.babelrc
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
jobs:
|
|
3
|
+
build:
|
|
4
|
+
docker:
|
|
5
|
+
- image: cimg/node:16.15
|
|
6
|
+
steps:
|
|
7
|
+
- checkout
|
|
8
|
+
- restore_cache:
|
|
9
|
+
key: dependency-cache-{{ checksum "package.json" }}
|
|
10
|
+
- run:
|
|
11
|
+
name: Install Dependencies
|
|
12
|
+
command: npm ci
|
|
13
|
+
- save_cache:
|
|
14
|
+
key: dependency-cache-{{ checksum "package.json" }}
|
|
15
|
+
paths:
|
|
16
|
+
- node_modules
|
|
17
|
+
- run:
|
|
18
|
+
name: Run Tests
|
|
19
|
+
command: npm run test
|
|
20
|
+
- store_artifacts:
|
|
21
|
+
path: coverage
|
|
22
|
+
prefix: coverage
|
|
23
|
+
- run:
|
|
24
|
+
name: Report Test Coverage
|
|
25
|
+
command: npm run report-coverage
|
package/.eslintrc
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"ecmaFeatures": {
|
|
3
|
+
"modules": true,
|
|
4
|
+
},
|
|
5
|
+
"env": {
|
|
6
|
+
"browser": true,
|
|
7
|
+
"mocha": true,
|
|
8
|
+
"node": true,
|
|
9
|
+
},
|
|
10
|
+
"extends": "eslint:recommended",
|
|
11
|
+
"parser": "babel-eslint",
|
|
12
|
+
"rules": {
|
|
13
|
+
"consistent-return": 0,
|
|
14
|
+
"func-names": 0,
|
|
15
|
+
"global-require": 0,
|
|
16
|
+
"max-len": 0,
|
|
17
|
+
"no-alert": 0,
|
|
18
|
+
"no-console": 0,
|
|
19
|
+
"no-param-reassign": 0,
|
|
20
|
+
"no-plusplus": 0,
|
|
21
|
+
"no-shadow": 0,
|
|
22
|
+
"no-underscore-dangle": 0,
|
|
23
|
+
"no-restricted-properties": [0, {
|
|
24
|
+
"object": "Math",
|
|
25
|
+
"property": "pow",
|
|
26
|
+
}],
|
|
27
|
+
"no-bitwise": 0,
|
|
28
|
+
"padded-blocks": 0,
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
name: "CodeQL"
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: master
|
|
6
|
+
pull_request:
|
|
7
|
+
# The branches below must be a subset of the branches above
|
|
8
|
+
branches: '*'
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
analyse:
|
|
12
|
+
name: Analyse
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout repository
|
|
17
|
+
uses: actions/checkout@v2
|
|
18
|
+
with:
|
|
19
|
+
# We must fetch at least the immediate parents so that if this is
|
|
20
|
+
# a pull request then we can checkout the head.
|
|
21
|
+
fetch-depth: 2
|
|
22
|
+
|
|
23
|
+
# If this run was triggered by a pull request event, then checkout
|
|
24
|
+
# the head of the pull request instead of the merge commit.
|
|
25
|
+
- run: git checkout HEAD^2
|
|
26
|
+
if: ${{ github.event_name == 'pull_request' }}
|
|
27
|
+
|
|
28
|
+
# Initializes the CodeQL tools for scanning.
|
|
29
|
+
- name: Initialize CodeQL
|
|
30
|
+
uses: github/codeql-action/init@v1
|
|
31
|
+
# Override language selection by uncommenting this and choosing your languages
|
|
32
|
+
# with:
|
|
33
|
+
# languages: go, javascript, csharp, python, cpp, java
|
|
34
|
+
|
|
35
|
+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
|
36
|
+
# If this step fails, then you should remove it and run the build manually (see below)
|
|
37
|
+
- name: Autobuild
|
|
38
|
+
uses: github/codeql-action/autobuild@v1
|
|
39
|
+
|
|
40
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
|
41
|
+
# 📚 https://git.io/JvXDl
|
|
42
|
+
|
|
43
|
+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
|
44
|
+
# and modify them (or add more) to build your code if your project
|
|
45
|
+
# uses a compiled language
|
|
46
|
+
|
|
47
|
+
#- run: |
|
|
48
|
+
# make bootstrap
|
|
49
|
+
# make release
|
|
50
|
+
|
|
51
|
+
- name: Perform CodeQL Analysis
|
|
52
|
+
uses: github/codeql-action/analyze@v1
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Publish beta package to npmjs
|
|
2
|
+
on:
|
|
3
|
+
release:
|
|
4
|
+
types: [ prereleased ]
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
steps:
|
|
9
|
+
- uses: actions/checkout@v2
|
|
10
|
+
# Setup .npmrc file to publish to npm
|
|
11
|
+
- uses: actions/setup-node@v2
|
|
12
|
+
with:
|
|
13
|
+
node-version: '16.x'
|
|
14
|
+
registry-url: 'https://registry.npmjs.org'
|
|
15
|
+
- run: npm ci --force
|
|
16
|
+
- run: npm run build
|
|
17
|
+
- run: npm run test
|
|
18
|
+
- run: npm run check-beta-tag
|
|
19
|
+
- run: npm publish --tag beta
|
|
20
|
+
env:
|
|
21
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
22
|
+
- uses: jakejarvis/s3-sync-action@master
|
|
23
|
+
env:
|
|
24
|
+
AWS_S3_BUCKET: js.radar.com
|
|
25
|
+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
26
|
+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
27
|
+
AWS_REGION: 'us-east-1'
|
|
28
|
+
SOURCE_DIR: 'cdn/'
|
|
29
|
+
DEST_DIR: ${{ github.ref_name }} # the release tag
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: Publish package to npmjs
|
|
2
|
+
on:
|
|
3
|
+
release:
|
|
4
|
+
types: [ released ]
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
steps:
|
|
9
|
+
- uses: actions/checkout@v2
|
|
10
|
+
# Setup .npmrc file to publish to npm
|
|
11
|
+
- uses: actions/setup-node@v2
|
|
12
|
+
with:
|
|
13
|
+
node-version: '16.x'
|
|
14
|
+
registry-url: 'https://registry.npmjs.org'
|
|
15
|
+
env:
|
|
16
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
17
|
+
- run: echo "MAJOR_VERSION=$(echo ${{ github.ref_name }} | cut -d '.' -f 1)" >> $GITHUB_ENV
|
|
18
|
+
- run: npm ci --force
|
|
19
|
+
- run: npm run build
|
|
20
|
+
- run: npm run test
|
|
21
|
+
- run: npm run check-latest-tag
|
|
22
|
+
- run: npm publish
|
|
23
|
+
- uses: jakejarvis/s3-sync-action@master
|
|
24
|
+
env:
|
|
25
|
+
AWS_S3_BUCKET: js.radar.com
|
|
26
|
+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
27
|
+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
28
|
+
AWS_REGION: 'us-east-1'
|
|
29
|
+
SOURCE_DIR: 'cdn/'
|
|
30
|
+
DEST_DIR: ${{ github.ref_name }} # release tag
|
|
31
|
+
- uses: jakejarvis/s3-sync-action@master
|
|
32
|
+
env:
|
|
33
|
+
AWS_S3_BUCKET: js.radar.com
|
|
34
|
+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
35
|
+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
36
|
+
AWS_REGION: 'us-east-1'
|
|
37
|
+
SOURCE_DIR: 'cdn/'
|
|
38
|
+
DEST_DIR: ${{ env.MAJOR_VERSION }} # release latest major version
|
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2023 Radar Labs, Inc.
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,24 +1,78 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/logo.svg">
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
<h4 align="center">
|
|
6
|
+
<a href="https://radar.com">Website</a> |
|
|
7
|
+
<a href="https://radar.com/blog">Blog</a> |
|
|
8
|
+
<a href="https://radar.com/documentation">Documentation</a> |
|
|
9
|
+
<a href="https://radar.com/documentation/faq">FAQ</a> |
|
|
10
|
+
<a href="mailto:support@radar.com">Support</a>
|
|
11
|
+
</h4>
|
|
6
12
|
|
|
7
|
-
|
|
13
|
+
<p align="center">
|
|
14
|
+
<a href="https://www.npmjs.com/package/radar-sdk-js"><img src="https://img.shields.io/npm/v/radar-sdk-js.svg" alt="npm"></a>
|
|
15
|
+
<a href="https://app.circleci.com/pipelines/github/radarlabs/radar-sdk-js"><img src="https://img.shields.io/circleci/project/github/radarlabs/radar-sdk-js/master.svg" alt="CircleCI branch"></a>
|
|
16
|
+
<a href="http://npm-stat.com/charts.html?package=radar-sdk-js"><img src="https://img.shields.io/npm/dm/radar-sdk-js.svg?style=flat-square" alt="NPM downloads"></a>
|
|
17
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache%202-blue" alt="License"></a>
|
|
18
|
+
</p>
|
|
8
19
|
|
|
9
|
-
|
|
20
|
+
<p align="center">
|
|
21
|
+
⚡ Use Radar SDKs and APIs to add location context to your apps with just a view lines of code. ⚡
|
|
22
|
+
</p>
|
|
10
23
|
|
|
11
|
-
|
|
24
|
+
🔥 Try it! 🔥
|
|
25
|
+
* <a href="https://radar.com/demo/js">Geofencing</a>
|
|
26
|
+
* <a href="Https://radar.com/demo/api">Maps APIs</a>
|
|
12
27
|
|
|
13
|
-
|
|
28
|
+
## ✨ Features (TODO)
|
|
29
|
+
* Feature 1
|
|
30
|
+
* Feature 2
|
|
31
|
+
* Typescript!
|
|
32
|
+
* etc...
|
|
14
33
|
|
|
15
|
-
##
|
|
34
|
+
## 🚀 Installation and Usage
|
|
16
35
|
|
|
17
|
-
|
|
18
|
-
2. `npm install`
|
|
19
|
-
3. To run the SDK in a browser, run `npm run build && node demo/server.js`, which should open a tab in your browser of choice. Modify the `/src/index.html` file as needed
|
|
20
|
-
4. To run tests, run `npm run test`
|
|
36
|
+
**With npm:** <br />
|
|
21
37
|
|
|
22
|
-
|
|
38
|
+
Add the `radar-sdk-js` package
|
|
39
|
+
```bash
|
|
40
|
+
# with npm
|
|
41
|
+
npm install --save radar-sdk-js
|
|
42
|
+
|
|
43
|
+
# with yarn
|
|
44
|
+
yarn add radar-sdk-js
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Then import as an ES Module in your project
|
|
48
|
+
```js
|
|
49
|
+
import Radar from 'radar-sdk-js';
|
|
50
|
+
|
|
51
|
+
// initialize with your test or live publishable key
|
|
52
|
+
Radar.initialize('prj_test_pk_...', { /* options */ });
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**In your html:** <br />
|
|
56
|
+
|
|
57
|
+
Add the following script in your `html` file
|
|
58
|
+
```html
|
|
59
|
+
<script src="https://js.radar.com/v4.0.0-beta.1/radar.min.js"></script>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Then initialize the Radar SDK
|
|
63
|
+
```html
|
|
64
|
+
<script type="text/javascript">
|
|
65
|
+
Radar.initialize('prj_test_pk_...', { /* options */ });
|
|
66
|
+
</script>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
See more examples and usage in the Radar web SDK documentation [here](https://radar.com/documentation/sdk/web).
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
## 🔗 Other links
|
|
73
|
+
* [Contributing](#)
|
|
74
|
+
* [Migrating from 3.x to 4.x](#)
|
|
75
|
+
|
|
76
|
+
## 📫 Support
|
|
23
77
|
|
|
24
78
|
Have questions? We're here to help! Email us at [support@radar.com](mailto:support@radar.com).
|
package/assets/logo.svg
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg width="235" height="55" viewBox="0 0 235 55" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M67.3513 48.4815H79.4201V33.4628H82.2599L90.8382 48.4815H103.617L93.5004 31.1161C97.9375 29.4148 101.132 26.0708 101.132 20.0868V19.8521C101.132 10.9935 94.9794 6.53481 83.9164 6.53481H67.3513V48.4815ZM79.4201 25.6601V15.5695H83.3839C87.2885 15.5695 89.4183 16.9188 89.4183 20.3215V20.5561C89.4183 23.9588 87.4068 25.6601 83.3247 25.6601H79.4201Z" fill="#000257"/>
|
|
3
|
+
<path d="M116.063 49.1855C121.033 49.1855 123.754 47.1321 125.233 44.9028V48.4815H135.527V28.5935C135.527 20.4388 130.084 16.9775 121.565 16.9775C113.105 16.9775 107.248 20.6148 106.775 28.0068H116.714C116.951 26.0708 118.016 24.3695 120.915 24.3695C124.287 24.3695 124.997 26.3055 124.997 29.2388V29.9428H122.039C111.745 29.9428 105.592 32.7588 105.592 39.9748C105.592 46.4868 110.502 49.1855 116.063 49.1855ZM119.731 42.0868C117.247 42.0868 116.063 40.9722 116.063 39.2122C116.063 36.6895 117.956 35.8681 122.216 35.8681H124.997V37.7455C124.997 40.3855 122.749 42.0868 119.731 42.0868Z" fill="#000257"/>
|
|
4
|
+
<path d="M153.046 49.1855C157.72 49.1855 161.151 46.6628 162.689 43.4948V48.4815H173.279V4.30548H162.689V22.1401C160.915 19.0308 158.016 16.9775 153.165 16.9775C145.829 16.9775 140.031 22.5508 140.031 32.9935V33.4628C140.031 44.0815 145.888 49.1855 153.046 49.1855ZM156.773 41.1482C153.105 41.1482 150.798 38.5082 150.798 33.3455V32.8762C150.798 27.5375 152.928 24.8975 156.892 24.8975C160.796 24.8975 162.985 27.6548 162.985 32.8175V33.2868C162.985 38.5082 160.619 41.1482 156.773 41.1482Z" fill="#000257"/>
|
|
5
|
+
<path d="M188.223 49.1855C193.193 49.1855 195.914 47.1321 197.393 44.9028V48.4815H207.687V28.5935C207.687 20.4388 202.245 16.9775 193.725 16.9775C185.265 16.9775 179.408 20.6148 178.935 28.0068H188.874C189.111 26.0708 190.176 24.3695 193.075 24.3695C196.447 24.3695 197.157 26.3055 197.157 29.2388V29.9428H194.199C183.905 29.9428 177.752 32.7588 177.752 39.9748C177.752 46.4868 182.662 49.1855 188.223 49.1855ZM191.891 42.0868C189.407 42.0868 188.223 40.9722 188.223 39.2122C188.223 36.6895 190.117 35.8681 194.376 35.8681H197.157V37.7455C197.157 40.3855 194.909 42.0868 191.891 42.0868Z" fill="#000257"/>
|
|
6
|
+
<path d="M213.729 48.4815H224.319V33.9321C224.319 29.0041 227.869 27.0095 234.317 27.1855V17.3881C229.525 17.3295 226.271 19.3241 224.319 23.9001V17.7988H213.729V48.4815Z" fill="#000257"/>
|
|
7
|
+
<path d="M45.1923 55L22.5962 0L0 55L22.5962 45.6296L45.1923 55Z" fill="#000257"/>
|
|
8
|
+
</svg>
|