@atomic.io/action-cards-web-sdk-cdn-icons 24.3.2 → 25.1.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 +41 -15
- package/package.json +1 -1
- package/public/LICENSES.txt +1 -1
- package/public/iframe-manager.js +3 -3
- package/public/sdk.d.ts +7 -5
- package/public/sdk.js +3 -3
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
[](https://codecov.io/github/atomic-app/action-cards-web-sdk)
|
|
2
2
|
|
|
3
|
-
# Web SDK - Current (
|
|
3
|
+
# Web SDK - Current (25.1.0)
|
|
4
4
|
|
|
5
5
|
## Introduction
|
|
6
6
|
|
|
7
7
|
The Atomic Web SDK allows you to integrate an Atomic stream container into your web app or site, presenting cards from a stream to your customers.
|
|
8
8
|
|
|
9
|
-
The current stable release is **
|
|
9
|
+
The current stable release is **25.1.0**.
|
|
10
10
|
|
|
11
11
|
### Browser support
|
|
12
12
|
|
|
@@ -18,10 +18,10 @@ We currently do not have a boilerplate app for the Web SDK. [Contact us](mailto:
|
|
|
18
18
|
|
|
19
19
|
## Installation
|
|
20
20
|
|
|
21
|
-
The current version of the Atomic Web SDK is `
|
|
21
|
+
The current version of the Atomic Web SDK is `25.1.0`, and is hosted on our CDN at `https://downloads.atomic.io/web-sdk/release/25.1.0/sdk.js`.
|
|
22
22
|
|
|
23
23
|
As of version `24.2.1` the Web SDK also offers a bundle variant which does not include the font used for icons in action cards. Instead this font is fetched via CDN as required, allowing the size of your initial bundle loaded by the browser to be smaller. Both variations function identically in all other respects.
|
|
24
|
-
This variant is hosted on our CDN at `https://downloads.atomic.io/web-sdk/release/
|
|
24
|
+
This variant is hosted on our CDN at `https://downloads.atomic.io/web-sdk/release/25.1.0/sdk-cdn-icons.js`.
|
|
25
25
|
|
|
26
26
|
To integrate it, add the script for your chosen variant as a source to your web page:
|
|
27
27
|
|
|
@@ -29,7 +29,7 @@ To integrate it, add the script for your chosen variant as a source to your web
|
|
|
29
29
|
<html>
|
|
30
30
|
...
|
|
31
31
|
<body>
|
|
32
|
-
<script src="https://downloads.atomic.io/web-sdk/release/
|
|
32
|
+
<script src="https://downloads.atomic.io/web-sdk/release/25.1.0/sdk.js"></script>
|
|
33
33
|
</body>
|
|
34
34
|
</html>
|
|
35
35
|
```
|
|
@@ -93,6 +93,21 @@ AtomicSDK.setSessionDelegate(() => {
|
|
|
93
93
|
}, retryInterval)
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
+
#### JWT custom user ID field {#jwt-custom-user-id-field}
|
|
97
|
+
|
|
98
|
+
_(introduced in 25.1.0)_
|
|
99
|
+
|
|
100
|
+
To use a custom field in your JWT for the user ID used by the Atomic Platform you must first configure this field in the [Atomic Workbench](/sdks/auth-SDK#custom-user-id-field) for the relevant SDK API Key.
|
|
101
|
+
|
|
102
|
+
Once you have the API Key configuration in place, you need to call the `setTokenUserIdAttribute` method, supplying the field name:
|
|
103
|
+
|
|
104
|
+
```javascript
|
|
105
|
+
AtomicSDK.setTokenUserIdAttribute('custom_id_property')
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**info:**
|
|
109
|
+
This method must be called **before** initialization of the SDK
|
|
110
|
+
|
|
96
111
|
### Login convenience method
|
|
97
112
|
|
|
98
113
|
To be ready to display a stream container you need to have [initialised](https://documentation.atomic.io/sdks/web#displaying-a-stream-container) the SDK & set the [Session Delegate](https://documentation.atomic.io/sdks/web#authenticating-requests-with-a-jwt). You can use the convenience method `login` to accomplish this in one call. This method has the following parameters:
|
|
@@ -390,7 +405,7 @@ The code sample below shows how to use the `AtomicSDK.launch(config)` method, to
|
|
|
390
405
|
...
|
|
391
406
|
<body>
|
|
392
407
|
<!-- Installation -->
|
|
393
|
-
<script src="https://downloads.atomic.io/web-sdk/release/
|
|
408
|
+
<script src="https://downloads.atomic.io/web-sdk/release/25.1.0/sdk.js"></script>
|
|
394
409
|
|
|
395
410
|
<script>
|
|
396
411
|
AtomicSDK.initialise('<apiHost>', '<apiKey>', '<environmentId>')
|
|
@@ -465,7 +480,7 @@ The iframe generated by the `singleCard` method can be styled just like any othe
|
|
|
465
480
|
...
|
|
466
481
|
<body>
|
|
467
482
|
<!--Installation-->
|
|
468
|
-
<script src="https://downloads.atomic.io/web-sdk/release/
|
|
483
|
+
<script src="https://downloads.atomic.io/web-sdk/release/25.1.0/sdk.js"></script>
|
|
469
484
|
|
|
470
485
|
<script>
|
|
471
486
|
AtomicSDK.initialise('<apiHost>', '<apiKey>', '<environmentId>')
|
|
@@ -498,7 +513,7 @@ The iframe generated by the `embed` method can be styled just like any other DOM
|
|
|
498
513
|
...
|
|
499
514
|
<body>
|
|
500
515
|
<!--Installation-->
|
|
501
|
-
<script src="https://downloads.atomic.io/web-sdk/release/
|
|
516
|
+
<script src="https://downloads.atomic.io/web-sdk/release/25.1.0/sdk.js"></script>
|
|
502
517
|
|
|
503
518
|
<script>
|
|
504
519
|
AtomicSDK.initialise('<apiHost>', '<apiKey>', '<environmentId>')
|
|
@@ -1331,9 +1346,8 @@ You will also need to update this token every time the logged-in user changes in
|
|
|
1331
1346
|
|
|
1332
1347
|
To deregister the device for Atomic notifications for your app, such as when a user completely logs out of your app, call `deregisterDeviceForNotifications` on `AtomicSDK`.
|
|
1333
1348
|
|
|
1334
|
-
|
|
1349
|
+
**caution:**
|
|
1335
1350
|
Calling `AtomicSDK.logout()` will automatically invoke this method.
|
|
1336
|
-
:::
|
|
1337
1351
|
|
|
1338
1352
|
If the deregistration fails, the promise will be rejected, returning a description of the failure that occurred.
|
|
1339
1353
|
|
|
@@ -1834,10 +1848,10 @@ To use the SDK with your Cordova or Capacitor app:
|
|
|
1834
1848
|
|
|
1835
1849
|
1. Download the Atomic SDK from our CDN, and bundle it with your application. There are two files you need to download:
|
|
1836
1850
|
|
|
1837
|
-
- `https://downloads.atomic.io/web-sdk/release/
|
|
1838
|
-
- `https://downloads.atomic.io/web-sdk/release/
|
|
1851
|
+
- `https://downloads.atomic.io/web-sdk/release/25.1.0/iframe-manager.js`
|
|
1852
|
+
- `https://downloads.atomic.io/web-sdk/release/25.1.0/sdk.js`
|
|
1839
1853
|
|
|
1840
|
-
_Where `
|
|
1854
|
+
_Where `25.1.0` is the version number of the SDK you wish to use._
|
|
1841
1855
|
|
|
1842
1856
|
2. **(Cordova only)**: Modify the `Content-Security-Policy` meta tag in your Cordova app to allow the following URLs, after the `default-src` directive:
|
|
1843
1857
|
|
|
@@ -1900,7 +1914,7 @@ The level parameter is a number that indicates the verbosity of the logs exposed
|
|
|
1900
1914
|
The SDK allows you to set a callback via the `AtomicSDK.onError` property. This passes javascript errors that may occur in the SDK.
|
|
1901
1915
|
|
|
1902
1916
|
```js
|
|
1903
|
-
AtomicSDK.onError = function(error) {
|
|
1917
|
+
AtomicSDK.onError = function (error) {
|
|
1904
1918
|
// handle the reported error as required
|
|
1905
1919
|
console.error('An error occured in the Atomic SDK: ', error)
|
|
1906
1920
|
}
|
|
@@ -1922,9 +1936,21 @@ The following example sets the client app version to `Version 2.3.1`.
|
|
|
1922
1936
|
AtomicSDK.setClientAppVersion('Version 2.3.1')
|
|
1923
1937
|
```
|
|
1924
1938
|
|
|
1939
|
+
### Setting a custom user Id attribute
|
|
1940
|
+
|
|
1941
|
+
The SDK provides a method `AtomicSDK.setTokenUserIdAttribute` for determining a custom user Id attribute in your JWT if you are not using the standard `sub` attribute. This attribute must also be configured in the Atomic Workbench against the relevant SDK API key.
|
|
1942
|
+
|
|
1943
|
+
The attribute name has a maximum length of 128 characters and must be a string.
|
|
1944
|
+
|
|
1945
|
+
The following example sets the attribute to `my_custom_id`.
|
|
1946
|
+
|
|
1947
|
+
```js
|
|
1948
|
+
AtomicSDK.setTokenUserIdAttribute('my_custom_id')
|
|
1949
|
+
```
|
|
1950
|
+
|
|
1925
1951
|
## Third-party dependencies
|
|
1926
1952
|
|
|
1927
|
-
The Atomic Web SDK (as at the current release `
|
|
1953
|
+
The Atomic Web SDK (as at the current release `25.1.0`) uses the following third-party dependencies:
|
|
1928
1954
|
|
|
1929
1955
|
- Font Awesome Free `5.13.1`
|
|
1930
1956
|
- snarkdown `1.2.1`
|
package/package.json
CHANGED
package/public/LICENSES.txt
CHANGED