@smartcar/auth 2.9.0 → 2.11.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 +2 -2
- package/dist/npm/sdk.js +14 -2
- package/doc/README.md +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ npm install @smartcar/auth
|
|
|
24
24
|
### Smartcar CDN
|
|
25
25
|
|
|
26
26
|
```html
|
|
27
|
-
<script src="https://javascript-sdk.smartcar.com/2.
|
|
27
|
+
<script src="https://javascript-sdk.smartcar.com/2.11.0/sdk.js"></script>
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
## SDK reference
|
|
@@ -178,4 +178,4 @@ https://application-backend.com/page?error=access_denied&error_description=User+
|
|
|
178
178
|
[tag-image]: https://img.shields.io/github/tag/smartcar/javascript-sdk.svg
|
|
179
179
|
|
|
180
180
|
<!-- Please do not modify or remove this, it is used by the build process -->
|
|
181
|
-
[version]: 2.
|
|
181
|
+
[version]: 2.11.0
|
package/dist/npm/sdk.js
CHANGED
|
@@ -73,6 +73,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
73
73
|
* backend sever for an access token
|
|
74
74
|
* @param {Object} [state] - contains state if it was set on the initial
|
|
75
75
|
* authorization request
|
|
76
|
+
* @param {String} [virtualKeyUrl] - virtual key URL used by Tesla to register
|
|
77
|
+
* Smartcar's virtual key on a vehicle. This registration will be required in order to use
|
|
78
|
+
* any commands on a Tesla vehicle. It is an optional argument as it is only included in
|
|
79
|
+
* specific cases.
|
|
76
80
|
*/
|
|
77
81
|
|
|
78
82
|
/**
|
|
@@ -204,6 +208,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
204
208
|
};
|
|
205
209
|
|
|
206
210
|
var err = generateError(message.error, message.errorDescription);
|
|
211
|
+
var virtualKeyUrl = message.virtualKeyUrl;
|
|
207
212
|
/**
|
|
208
213
|
* Call `onComplete` with parameters even if developer is not using
|
|
209
214
|
* a Smartcar-hosted redirect. Regardless of if they are using a
|
|
@@ -217,7 +222,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
217
222
|
* parameters in their redirect uri.
|
|
218
223
|
*/
|
|
219
224
|
|
|
220
|
-
_this.onComplete(err, message.code, originalState);
|
|
225
|
+
_this.onComplete(err, message.code, originalState, virtualKeyUrl);
|
|
221
226
|
}
|
|
222
227
|
}; // add handler for postMessage event on completion of Smartcar Connect
|
|
223
228
|
|
|
@@ -259,6 +264,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
259
264
|
* for more information.
|
|
260
265
|
* @param {String[]} [options.flags] - An optional space-separated list of feature
|
|
261
266
|
* flags that your application has early access to.
|
|
267
|
+
* @param {String} [options.user] - An optional unique identifier for a vehicle owner.
|
|
268
|
+
* This identifier is used to aggregate analytics across Connect sessions for each vehicle owner.
|
|
262
269
|
*
|
|
263
270
|
* @return {String} Connect URL to redirect user to.
|
|
264
271
|
*
|
|
@@ -273,6 +280,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
273
280
|
* &single_select=true
|
|
274
281
|
* &single_select_vin=5YJSA1E14FF101307
|
|
275
282
|
* &flags=country:DE color:00819D
|
|
283
|
+
* &user=2dad4eaf-9094-4bff-bb0f-ffbbdde8b562
|
|
276
284
|
*/
|
|
277
285
|
function getAuthUrl(options) {
|
|
278
286
|
options = options || {};
|
|
@@ -345,6 +353,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
345
353
|
link += "&flags=".concat(encodeURIComponent(options.flags.join(' ')));
|
|
346
354
|
}
|
|
347
355
|
|
|
356
|
+
if (options.user) {
|
|
357
|
+
link += "&user=".concat(encodeURIComponent(options.user));
|
|
358
|
+
}
|
|
359
|
+
|
|
348
360
|
return link;
|
|
349
361
|
}
|
|
350
362
|
/**
|
|
@@ -525,7 +537,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
525
537
|
|
|
526
538
|
if (usesOldUriScheme) {
|
|
527
539
|
// eslint-disable-next-line no-console
|
|
528
|
-
console.warn("\nThe Smartcar redirect URI you're using is outdated! To update it, please see:\nhttps://
|
|
540
|
+
console.warn("\nThe Smartcar redirect URI you're using is outdated! To update it, please see:\nhttps://github.com/smartcar/javascript-sdk#1-register-a-javascript-sdk-redirect-uri\n");
|
|
529
541
|
}
|
|
530
542
|
}
|
|
531
543
|
}
|
package/doc/README.md
CHANGED
|
@@ -72,6 +72,7 @@ Generates Smartcar OAuth URL.
|
|
|
72
72
|
| [options.vehicleInfo.make] | <code>String</code> | | `vehicleInfo` is an object with an optional property `make`, which allows users to bypass the car brand selection screen. For a complete list of supported brands, please see our [API Reference](https://smartcar.com/docs/api#authorization) documentation. |
|
|
73
73
|
| [options.singleSelect] | <code>Boolean</code> \| <code>Object</code> | | An optional value that sets the behavior of the grant dialog displayed to the user. If set to `true`, `single_select` limits the user to selecting only one vehicle. If `single_select` is passed in as an object with the property `vin`, Smartcar will only authorize the vehicle with the specified VIN. See the [API reference](https://smartcar.com/docs/api/#connect-match) for more information. |
|
|
74
74
|
| [options.flags] | <code>Array.<String></code> | | An optional space-separated list of feature flags that your application has early access to. |
|
|
75
|
+
| [options.user] | <code>String</code> | | An optional unique identifier for a vehicle owner. This identifier is used to aggregate analytics across Connect sessions for each vehicle owner. |
|
|
75
76
|
|
|
76
77
|
**Example**
|
|
77
78
|
```js
|
|
@@ -85,6 +86,7 @@ response_type=code
|
|
|
85
86
|
&single_select=true
|
|
86
87
|
&single_select_vin=5YJSA1E14FF101307
|
|
87
88
|
&flags=country:DE color:00819D
|
|
89
|
+
&user=2dad4eaf-9094-4bff-bb0f-ffbbdde8b562
|
|
88
90
|
```
|
|
89
91
|
<a name="Smartcar+openDialog"></a>
|
|
90
92
|
|
|
@@ -203,6 +205,7 @@ Invalid subscription error returned by Connect.
|
|
|
203
205
|
| error | <code>Error</code> | something went wrong in Connect; this normally indicates that the user denied access to your application or does not have a connected vehicle |
|
|
204
206
|
| code | <code>String</code> | the authorization code to be exchanged from a backend sever for an access token |
|
|
205
207
|
| [state] | <code>Object</code> | contains state if it was set on the initial authorization request |
|
|
208
|
+
| [virtualKeyUrl] | <code>String</code> | virtual key URL used by Tesla to register Smartcar's virtual key on a vehicle. This registration will be required in order to use any commands on a Tesla vehicle. It is an optional argument as it is only included in specific cases. |
|
|
206
209
|
|
|
207
210
|
<a name="WindowOptions"></a>
|
|
208
211
|
|