@atomic.io/action-cards-web-sdk-cdn-icons 25.2.0 → 25.3.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
@@ -1,12 +1,12 @@
1
1
  [![codecov](https://codecov.io/github/atomic-app/action-cards-web-sdk/branch/master/graph/badge.svg?token=BNXNRL8ASJ)](https://codecov.io/github/atomic-app/action-cards-web-sdk)
2
2
 
3
- # Web SDK - Current (25.2.0)
3
+ # Web SDK - Current (25.3.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 **25.2.0**.
9
+ The current stable release is **25.3.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 `25.2.0`, and is hosted on our CDN at `https://downloads.atomic.io/web-sdk/release/25.2.0/sdk.js`.
21
+ The current version of the Atomic Web SDK is `25.3.0`, and is hosted on our CDN at `https://downloads.atomic.io/web-sdk/release/25.3.0/sdk.js`.
22
22
 
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/25.2.0/sdk-cdn-icons.js`.
23
+ 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/25.3.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/25.2.0/sdk.js"></script>
32
+ <script src="https://downloads.atomic.io/web-sdk/release/25.3.0/sdk.js"></script>
33
33
  </body>
34
34
  </html>
35
35
  ```
@@ -158,7 +158,7 @@ const instance = AtomicSDK.launch({...})
158
158
 
159
159
  ## Displaying a stream container
160
160
 
161
- This section applies to all types of container. Containers can be created using the `launch` method (launcher view) , the `embed` method (standalone vertical and horizontal containers), or the `singleCard` method (single card view).
161
+ This section applies to all types of container. Containers can be created using the `launch` method (launcher view) , the `embed` method (standalone vertical and horizontal containers), the `singleCard` method (single card view), or the `modalStreamContainer` method (modal container).
162
162
  Specifics and code examples for each type of container are explained in more detail in their dedicated sections below.
163
163
 
164
164
  Before displaying a stream container, you must initialize the SDK by calling the `initialise` method:
@@ -181,7 +181,7 @@ Some configuration options are common for all types of container, other options
181
181
 
182
182
  A selection of UI elements can be customized within stream containers (this customization does **not apply to single card views**, with the exception of `toastConfig`). These are configured using the `enabledUiElements` property on a stream container configuration object:
183
183
 
184
- - `cardListToast` - defaults to `true`. Set to `false` to turn off toast messages on the card list.
184
+ - `cardListToast` - defaults to `true`. Set to `false` to turn off toast messages.
185
185
  - `customToastContainer` - defaults to `false`. Set to `true` to use an [alternative toast message presentation](https://documentation.atomic.io/sdks/web#custom-toast-message-positioning) for standalone or launcher stream containers which allows you to reposition the toast message.
186
186
  - `toastConfig` - an optional configuration object to customize the toast messages displayed by the SDK.
187
187
  - `timeout`: optionally supply a number that sets how long the toast message should be displayed for in milliseconds.
@@ -235,6 +235,8 @@ AtomicSDK.launch({
235
235
 
236
236
  #### Functionality
237
237
 
238
+ ##### Runtime variables
239
+
238
240
  - `onRuntimeVariablesRequested`: an optional property that can be used on the configuration object to allow your app to resolve runtime variables. If this callback is not implemented, runtime variables will fall back to their default values, as defined in the Atomic Workbench.
239
241
  - `runtimeVariableResolutionTimeout` defaults to 5 seconds (5000 ms) if not provided.
240
242
 
@@ -318,7 +320,7 @@ AtomicSDK.launch({
318
320
 
319
321
  #### Displaying a custom header
320
322
 
321
- The Web SDK supports displaying a custom header above your card feed for stream containers created using the `launch` or `embed` methods. It has no effect for `singleCard` stream containers.
323
+ The Web SDK supports displaying a custom header above your card feed for stream containers created using the `launch` or `embed` methods. It has no effect for `singleCard` or `modalStreamContainer` containers.
322
324
 
323
325
  The custom header is supplied as an HTML string to the `customContainerHeader` property of the [customized UI elements](https://documentation.atomic.io/sdks/web#style-and-presentation). Styles should be applied inline to the HTML elements. Do not attempt to reference classes or other styling from your host application stylesheets because these will not be applied.
324
326
 
@@ -343,21 +345,23 @@ You can enforce a minimum height for the cards displayed in your stream containe
343
345
 
344
346
  ```js
345
347
  AtomicSDK.launch({
348
+ streamContainerId: "1234",
346
349
  ...
347
- features: {
348
- ...
349
- cardMinimumHeight: 250 // Replace 250 with your desired minimum height
350
- }
350
+ cardMinimumHeight: 250 // Replace 250 with your desired minimum height
351
351
  });
352
352
  ```
353
353
 
354
354
  The minimum height is specified in pixels.
355
355
 
356
+ #### Card maximum width
357
+
358
+ You can enforce a maximum width for cards displayed in the modal stream container variant. See [displaying a modal stream container](https://documentation.atomic.io/sdks/web#modal-stream-container) for more information.
359
+
356
360
  #### Single card container toast messages
357
361
 
358
- Toast messages will now be displayed for the single card stream container. The toast messages are enabled by default, as they are for the other stream container variants. The single card toast message can be configured (or disabled) in the same way as they can for the other stream container variants, see the [style and presentation](https://documentation.atomic.io/sdks/web#style-and-presentation) section of the Web SDK for details on how to do this.
362
+ The single card and modal container toast message can be configured (or disabled) in the same way as they can for the other stream container variants, see the [style and presentation](https://documentation.atomic.io/sdks/web#style-and-presentation) section of the Web SDK for details on how to do this.
359
363
 
360
- The default position of single card toast notifications is in the centre at the bottom of the viewport and with a maximum width of 500px. The SDK exposes a class (`toast-container`) on the iframe containing the toast messages which can be used to apply your own styling should you wish to do so. See the CSS code snippet below for an example of how to reposition single card toasts to the bottom right of the viewport and with a smaller width, if your embed element id was `host-embed-element`.
364
+ The default position of these toast notifications is in the centre at the bottom of the viewport and with a maximum width of 500px. The SDK exposes a class (`toast-container`) on the iframe containing the toast messages which can be used to apply your own styling should you wish to do so. See the CSS code snippet below for an example of how to reposition the toasts to the bottom right of the viewport and with a smaller width, if your embed element id was `host-embed-element`.
361
365
 
362
366
  ```css
363
367
  #host-embed-element iframe.toast-container {
@@ -370,8 +374,6 @@ The default position of single card toast notifications is in the centre at the
370
374
 
371
375
  #### Reposition launcher or standalone (vertical & horizontal) stream container toast messages
372
376
 
373
- _(introduced in 23.4.2)_
374
-
375
377
  You have the ability customize the positioning of toast messages displayed by the standalone or launcher stream container variants if you wish. To do so set the `customToastContainer` option to true [style and presentation](https://documentation.atomic.io/sdks/web#style-and-presentation)
376
378
 
377
379
  Once you have done so the toast position will default to the centre at the bottom of the viewport and with a maximum width of 500px, the same as for [single card toasts](https://documentation.atomic.io/sdks/web#single-card-toasts). In the same manner as for single card toasts you can use the `toast-container` class to reposition the iframe containing the toast messages.
@@ -393,7 +395,7 @@ The code sample below shows how to use the `AtomicSDK.launch(config)` method, to
393
395
  ...
394
396
  <body>
395
397
  <!-- Installation -->
396
- <script src="https://downloads.atomic.io/web-sdk/release/25.2.0/sdk.js"></script>
398
+ <script src="https://downloads.atomic.io/web-sdk/release/25.3.0/sdk.js"></script>
397
399
 
398
400
  <script>
399
401
  AtomicSDK.initialise('<apiHost>', '<apiKey>', '<environmentId>')
@@ -424,7 +426,7 @@ When creating a stream container in the launcher mode you can supply an optional
424
426
  ...
425
427
  onLauncherToggled: isOpen => {
426
428
  if (isOpen) {
427
- console.log('the launcher is has been opened')
429
+ console.log('the launcher has been opened')
428
430
  } else {
429
431
  console.log('the launcher has been closed')
430
432
  }
@@ -468,7 +470,7 @@ The iframe generated by the `singleCard` method can be styled just like any othe
468
470
  ...
469
471
  <body>
470
472
  <!--Installation-->
471
- <script src="https://downloads.atomic.io/web-sdk/release/25.2.0/sdk.js"></script>
473
+ <script src="https://downloads.atomic.io/web-sdk/release/25.3.0/sdk.js"></script>
472
474
 
473
475
  <script>
474
476
  AtomicSDK.initialise('<apiHost>', '<apiKey>', '<environmentId>')
@@ -501,7 +503,7 @@ The iframe generated by the `embed` method can be styled just like any other DOM
501
503
  ...
502
504
  <body>
503
505
  <!--Installation-->
504
- <script src="https://downloads.atomic.io/web-sdk/release/25.2.0/sdk.js"></script>
506
+ <script src="https://downloads.atomic.io/web-sdk/release/25.3.0/sdk.js"></script>
505
507
 
506
508
  <script>
507
509
  AtomicSDK.initialise('<apiHost>', '<apiKey>', '<environmentId>')
@@ -533,15 +535,13 @@ When creating a stream container with the `embed` method, pass a configuration o
533
535
  AtomicSDK.embed({
534
536
  streamContainerId: "1234",
535
537
  ...
536
- features: {
537
- horizontalContainerConfig: {
538
- enabled: true,
539
- cardWidth: 400,
540
- emptyStyle: "standard",
541
- headerAlignment: "center",
542
- scrollMode: "snap",
543
- lastCardAlignment: "left"
544
- }
538
+ horizontalContainerConfig: {
539
+ enabled: true,
540
+ cardWidth: 400,
541
+ emptyStyle: "standard",
542
+ headerAlignment: "center",
543
+ scrollMode: "snap",
544
+ lastCardAlignment: "left"
545
545
  }
546
546
  })
547
547
  ```
@@ -569,9 +569,88 @@ This object allows you to configure the horizontal stream container via the foll
569
569
  - `left`: Default value. The last card is aligned to the left of the container.
570
570
  - `center`: The last card is aligned in the middle of the container.
571
571
 
572
- ## API-driven card containers
572
+ ## Displaying a modal stream container
573
+
574
+ The modal stream container variant presents cards in a fullscreen takeover. It remains hidden until cards are delivered, at which point they are displayed one at a time in a modal over the host app’s content.
575
+
576
+ The modal cannot be manually dismissed. Once all cards in the container have been actioned (e.g. submitted, dismissed, or snoozed), the container is automatically hidden again.
573
577
 
574
- _(introduced in 23.4.0)_
578
+ The following illustrates initializing a modal stream container with example configuration options:
579
+
580
+ ```html
581
+ <html>
582
+ ...
583
+ <body>
584
+ <!--Installation-->
585
+ <script src="https://downloads.atomic.io/web-sdk/release/25.3.0/sdk.js"></script>
586
+
587
+ <script>
588
+ AtomicSDK.initialise('<apiHost>', '<apiKey>', '<environmentId>')
589
+ AtomicSDK.setSessionDelegate(() => {
590
+ return Promise.resolve('<authToken>')
591
+ })
592
+
593
+ AtomicSDK.modalStreamContainer({
594
+ streamContainerId: '1234',
595
+ cardMaximumWidth: 400, // a pixel value
596
+ cardHorizontalAlignment: 'center',
597
+ modalContainerPositioning: 'center',
598
+ modalContainerVerticalPadding: 50, // a pixel value
599
+ onModalStreamToggled: isOpen => {
600
+ if (isOpen) {
601
+ console.log('the modal has been opened')
602
+ } else {
603
+ console.log('the modal has been closed')
604
+ }
605
+ }
606
+ })
607
+ </script>
608
+ </body>
609
+ </html>
610
+ ```
611
+
612
+ ### Modal stream container behavior
613
+
614
+ - Only one modal stream container can be present at a time. Attempts to initialize more than one modal stream container will be ignored.
615
+ - The fullscreen container is displayed automatically when cards are available in the assigned stream container.
616
+ - Only the first card is displayed at any given time, following the same rules as the single card container.
617
+ - The container is automatically hidden when all cards have been actioned or cleared.
618
+ - If log out is called while the container is visible, it closes immediately.
619
+ - The container becomes scrollable when the card content exceeds the viewport height.
620
+ - Clicking the background does nothing - dismissal can only occur through normal card actions.
621
+ - Card subviews are rendered in place of the card content when navigated to.
622
+
623
+ ### Theming and layout
624
+
625
+ Alignment properties of the modal stream container are controlled via the `modalContainerPositioning` & `cardHorizontalAlignment` configuration properties.
626
+
627
+ `modalContainerPositioning` controls vertical alignment and can be either `top`, `center` or `bottom`. When configured for 'top' or 'bottom' the `modalContainerVerticalPadding` configuration property (a number value in pixels)
628
+ will dictate whether any padding should be applied between the card and the top/bottom edge of the viewport. If `modalContainerVerticalPadding` is omitted, vertical spacing is determined by the stream container padding defined in the container theme.
629
+ Horizontal padding is always controlled by the container theme.
630
+
631
+ `cardHorizontalAlignment` controls the horizontal alignment and can be either `leading`, `center` or `trailing`.
632
+
633
+ The background applied behind the card within the modal stream container can be configured via the [stream container theme](https://documentation.atomic.io/guide/configuration/themes#modal-container). If no background color configuration is applied, the modal background defaults to `rgba(0, 0, 0, 0.5)`.
634
+
635
+ ### Responding to the modal opening or closing
636
+
637
+ When creating the modal stream container you can supply an optional callback that will be invoked whenever the stream container is opened or closed. To use this callback set it on the `onModalStreamToggled` property of the configuration object supplied to the `AtomicSDK.modalStreamContainer(config)` method. The function you provide is called with a single boolean argument indicating whether the modal has just been opened (true) or closed (false). The code sample below shows how to set this callback.
638
+
639
+ ```js
640
+ AtomicSDK.modalStreamContainer({
641
+ streamContainerId: '1234',
642
+ ...
643
+ onModalStreamToggled: isOpen => {
644
+ if (isOpen) {
645
+ console.log('the modal has been opened')
646
+ } else {
647
+ console.log('the modal has been closed')
648
+ }
649
+ }
650
+ })
651
+ ```
652
+
653
+ ## API-driven card containers
575
654
 
576
655
  The SDK provides the ability to create an "API-driven" card container that can be used for observing a stream container without rendering any UI. This is done using the SDK method `AtomicSDK.observableStreamContainer` which accepts a configuration object that has a subset of the properties accepted by the other stream container variants:
577
656
 
@@ -681,8 +760,6 @@ const observableContainer = AtomicSDK.observeStreamContainer({
681
760
 
682
761
  ## API-driven card actions
683
762
 
684
- _(introduced in 23.4.0)_
685
-
686
763
  The SDK provides the ability to execute card actions through pure SDK API. The currently supported actions are: dismiss, submit, and snooze. To execute these card actions, call the `AtomicSDK.onCardAction` method with the target stream container and card instance ID then call the appropriate card action method from the object that is returned:
687
764
 
688
765
  ### Dismissing a card
@@ -723,7 +800,7 @@ AtomicSDK.onCardAction('stream-container-id', 'card-id').snooze(
723
800
 
724
801
  ### Submitting a card
725
802
 
726
- Atomic cards now include button names when they are submitted. The name will be added to analytics to enable referencing the triggering button in an Action Flow. Resulting from this change as of version `24.2.0` the `submitButtonName` parameter must be supplied when performing an API-driven card submission.
803
+ Atomic cards include button names when they are submitted. The name will be added to analytics to enable referencing the triggering button in an Action Flow. To facilitate this, the `submitButtonName` parameter must be supplied when performing an API-driven card submission.
727
804
 
728
805
  Call the `submit` method with `onActionSuccess`, `onActionFailed` parameters, these are functions to be invoked on success or failure of the dismiss action. Also supply a `submitButtonName` parameter which is the button "name" attribute obtained from the card data. Optionally a fourth parameter may be supplied for the response object that you wish to submit with the card. This object can only contain values with are strings, numbers or booleans.
729
806
 
@@ -786,15 +863,13 @@ instance.setOpen(true);
786
863
 
787
864
  If you have a single card, horizontal or vertical stream container that is selectively displayed to the user (such as one that is hidden inside of a notification drawer) you need to inform the SDK when this stream container is "open" and viewable by the user. This is important so that analytics events such as `stream-displayed` & `card-displayed` are correctly dispatched. Failing to do so will result in an incorrect count of seen and unread cards, as described in the [retrieving the count of cards section](https://documentation.atomic.io/sdks/web#retrieving-the-count-of-active-and-unseen-cards) of this guide.
788
865
 
789
- Use the `controlledContainerOpenState` feature flag in the configuration object when initialising your stream container. This ensures that your container will be initialised in the "closed" state. After initialisation of the container, it is then the responsibility of the host app to call the `setOpen` method on the stream container instance when the stream container is being displayed to or hidden from the user:
866
+ Enable `controlledContainerOpenState` the configuration object when initializing your stream container. This ensures that your container will be initialized in the "closed" state. After initialization of the container, it is then the responsibility of the host app to call the `setOpen` method on the stream container instance when the stream container is being displayed to or hidden from the user:
790
867
 
791
868
  ```js
792
869
  const instance = AtomicSDK.embed({
793
870
  streamContainerId: "1234",
794
871
  ...
795
- features: {
796
- controlledContainerOpenState: true
797
- }
872
+ controlledContainerOpenState: true
798
873
  });
799
874
 
800
875
  // when the host app has displayed the container to the user call
@@ -939,9 +1014,6 @@ instance.streamFilters.clearFilters()
939
1014
 
940
1015
  ## Image linking
941
1016
 
942
- _(introduced in 24.1.0)_
943
- _This is a beta feature in the Atomic Workbench_
944
-
945
1017
  Image elements can be used to trigger a navigation action. In the Atomic Workbench you can configure the behavior of the link to trigger a subview navigation, open a URL or to send a payload to your app. For information on how to handle the image link payload see [custom action payloads on image links](https://documentation.atomic.io/sdks/web#supporting-custom-action-payloads-on-image-links)
946
1018
 
947
1019
  ## Custom action payloads
@@ -1013,7 +1085,7 @@ Configuration of card voting from within the workbench provides further customiz
1013
1085
 
1014
1086
  Whether enabled in the workbench, or in the SDK configuration, the default wording of card voting options can be configured. See the [custom strings](#custom-strings) section of this guide if you want to change the default wording.
1015
1087
 
1016
- ### Configuring card voting within the SDK
1088
+ ### Configuring card voting within the SDK (deprecated)
1017
1089
 
1018
1090
  The following describes how card voting appears when configured via the SDK feature configuration:
1019
1091
 
@@ -1556,7 +1628,7 @@ There are two options you can customize for the focus ring color:
1556
1628
 
1557
1629
  If you use runtime variables on a card, you can optionally choose to send the resolved values of any runtime variables back to the Atomic Platform as an analytics event. This per-card analytics event - `runtime-vars-updated` - contains the values of runtime variables rendered in the card and seen by the end user. Therefore, you should not enable this feature if your runtime variables contain sensitive data that you do not wish to store on the Atomic Platform.
1558
1630
 
1559
- To enable this feature, set the `features.runtimeVariableAnalytics` flag on your configuration object to `true`:
1631
+ To enable this feature, set the `features.runtimeVariableAnalytics` flag on your stream container configuration object to `true`:
1560
1632
 
1561
1633
  ```javascript
1562
1634
  AtomicSDK.launch({
@@ -1722,7 +1794,7 @@ AtomicSDK.updateUser(userUpdateObject)
1722
1794
 
1723
1795
  ## File Upload
1724
1796
 
1725
- _This is currently a preview feature in the Workbench_
1797
+ _This is currently a beta feature in the Workbench_
1726
1798
 
1727
1799
  ### Card & feed overlay during file upload
1728
1800
 
@@ -1791,10 +1863,6 @@ Currently, no event is generated to indicate when a user cancels an upload. We w
1791
1863
 
1792
1864
  ## Custom icons
1793
1865
 
1794
- _(introduced in 24.2.0)_
1795
-
1796
- _This is currently a beta feature in the Atomic Workbench._
1797
-
1798
1866
  The SDK now supports the use of custom icons in card elements. When you are editing a card in the card template editor of the Workbench you will notice that for card elements that support it the [properties panel](https://documentation.atomic.io/guide/cards/creating#properties-panel-right) will show an "Include icon" option. From this location you can select an icon to use, either from the Media Library or Font Awesome.
1799
1867
 
1800
1868
  Choosing to use an icon from the Media Library you have the ability to provide an SVG format icon and an optional fallback icon to be used in case the SVG fails to load. The "Select icon" dropdown will present any SVG format assets in your media library which can be used as a custom icon. To add an icon for use you can press the "Open Media Library" button at the bottom of the dropdown.
@@ -1822,11 +1890,7 @@ If the provided SVG image fails to load due to a broken URL or network issues th
1822
1890
  1. The fallback FontAwesome icon is used if it is set in Atomic Workbench for this custom icon.
1823
1891
  2. Otherwise, a default placeholder image is displayed.
1824
1892
 
1825
- ## Image things
1826
-
1827
- _(introduced in 24.2.0)_
1828
-
1829
- _This is currently a beta feature in the Atomic Workbench._
1893
+ ## Multiple display heights
1830
1894
 
1831
1895
  In the Atomic Workbench you can now specify the display height for banner and inline media components. The height of inline image and video elements, along with banner image and video elements, may be specified as one of four different display heights. These are;
1832
1896
 
@@ -1837,6 +1901,76 @@ In the Atomic Workbench you can now specify the display height for banner and in
1837
1901
 
1838
1902
  When using these new layouts be mindful that customers using older versions of the SDK will default to the "Tall" layout.
1839
1903
 
1904
+ ## File Upload
1905
+
1906
+ _This is currently a beta feature in the Workbench_
1907
+
1908
+ _Uploaded images are processed and scanned during upload. AVIF, HEIC and HEIF file formats are automatically converted to JPG during this process._
1909
+
1910
+ ### Card & feed overlay during file upload
1911
+
1912
+ The file upload process will commence when a user attempts to submit a card that has files attached. While the file upload is in progress the card (or card subview when submitting from a subview) will be replaced with an overlay to prevent user interaction while this takes place. This overlay displays a loading indicator, a message indicating what is taking place, and a button that may be used to cancel the file upload.
1913
+
1914
+ If the card is within a launcher, vertical or horizontal stream container variant, any other cards within the feed will be covered by a scrim while the upload is in progress, to prevent user interaction with other cards in the feed and visually indicate that the upload has not finished.
1915
+
1916
+ #### Single card & Horizontal stream container overlay
1917
+
1918
+ The modal iframe, used to present subviews in the single card & horizontal stream containers, has an 'uploading-files' class added to the iframe element while there is a file upload in progress. This can be used to trigger any UI you may wish to display in your application while the file upload is in progress.
1919
+
1920
+ The following code snippet is an example of how you could detect this:
1921
+
1922
+ ```js
1923
+ // An observer to observe changes in the modal subview iframe class list
1924
+ const observer = new MutationObserver(mutations => {
1925
+ mutations.forEach(mutation => {
1926
+ if (mutation.target.classList.contains('uploading-files')) {
1927
+ // Uploading has commenced, modify UI as required
1928
+ } else {
1929
+ // Uploading has finished, modify UI as required
1930
+ }
1931
+ })
1932
+ })
1933
+
1934
+ // Observe changes in the relevant modal subview, in this case one that
1935
+ // has been embedded inside of a host element with the ID "embed-container".
1936
+ observer.observe(document.querySelector('#embed-container>.modal-subview'), {
1937
+ attributeFilter: ['class']
1938
+ })
1939
+ ```
1940
+
1941
+ ### Custom strings
1942
+
1943
+ The card overlay message & cancel button label text can be customized using the [custom strings](https://documentation.atomic.io/sdks/web#custom-strings) feature of the SDK. If you wish to change the text used you would supply a value for the `processingStateMessage` and/or the `processingStateCancelButtonTitle` for the stream container(s) that you wanted to customize this for.
1944
+
1945
+ ### Toast message
1946
+
1947
+ If a file upload fails to successfully complete the user will be displayed a toast message indicating this and providing the option to retry. By default the text of this message will be "Couldn't upload file(s)", if you wish to customize this you may do so via the [toast config](https://documentation.atomic.io/sdks/web#style-and-presentation) configuration object for the stream container, setting a value for the `fileUploadFailed` toast message.
1948
+
1949
+ ### SDK events
1950
+
1951
+ There are new events that are emitted during the file upload process. When a user attempts to submit a card that has files attached, the file upload process will commence and these events can be used to track its progression:
1952
+
1953
+ - `user-file-uploads-started`, emitted once the file upload process has started.
1954
+ - `user-file-uploads-completed`, emitted once the file upload process has completed, with all files having been successfully uploaded.
1955
+ - `user-file-uploads-failed`, emitted once the file upload process has completed or been cancelled, with one or more files having failed to upload.
1956
+
1957
+ These events can be observed using the [SDK event observer](https://documentation.atomic.io/sdks/web#sdk-event-observer). The details for the relevant files are found in the `properties` of the event object, keyed by the form field they were submitted, for example:
1958
+
1959
+ ```js
1960
+ {
1961
+ eventName: "user-file-uploads-completed",
1962
+ ...
1963
+ properties: {
1964
+ upload_fieldname: {
1965
+ filename: "filename_in_S3_bucket.png",
1966
+ targetBucketId: "S3_bucket_id"
1967
+ }
1968
+ }
1969
+ }
1970
+ ```
1971
+
1972
+ _Currently, no event is generated to indicate when a user cancels an upload. We will add a corresponding SDK event in upcoming versions._
1973
+
1840
1974
  ## Cordova/Capacitor
1841
1975
 
1842
1976
  The Atomic Web SDK also supports use within Cordova and Capacitor apps.
@@ -1845,10 +1979,10 @@ To use the SDK with your Cordova or Capacitor app:
1845
1979
 
1846
1980
  1. Download the Atomic SDK from our CDN, and bundle it with your application. There are two files you need to download:
1847
1981
 
1848
- - `https://downloads.atomic.io/web-sdk/release/25.2.0/iframe-manager.js`
1849
- - `https://downloads.atomic.io/web-sdk/release/25.2.0/sdk.js`
1982
+ - `https://downloads.atomic.io/web-sdk/release/25.3.0/iframe-manager.js`
1983
+ - `https://downloads.atomic.io/web-sdk/release/25.3.0/sdk.js`
1850
1984
 
1851
- _Where `25.2.0` is the version number of the SDK you wish to use._
1985
+ _Where `25.3.0` is the version number of the SDK you wish to use._
1852
1986
 
1853
1987
  2. **(Cordova only)**: Modify the `Content-Security-Policy` meta tag in your Cordova app to allow the following URLs, after the `default-src` directive:
1854
1988
 
@@ -1933,9 +2067,21 @@ The following example sets the client app version to `Version 2.3.1`.
1933
2067
  AtomicSDK.setClientAppVersion('Version 2.3.1')
1934
2068
  ```
1935
2069
 
2070
+ ### Setting a custom user Id attribute
2071
+
2072
+ 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.
2073
+
2074
+ The attribute name has a maximum length of 128 characters and must be a string.
2075
+
2076
+ The following example sets the attribute to `my_custom_id`.
2077
+
2078
+ ```js
2079
+ AtomicSDK.setTokenUserIdAttribute('my_custom_id')
2080
+ ```
2081
+
1936
2082
  ## Third-party dependencies
1937
2083
 
1938
- The Atomic Web SDK (as at the current release `25.2.0`) uses the following third-party dependencies:
2084
+ The Atomic Web SDK (as at the current release `25.3.0`) uses the following third-party dependencies:
1939
2085
 
1940
2086
  - Font Awesome Free `5.13.1`
1941
2087
  - snarkdown `1.2.1`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomic.io/action-cards-web-sdk-cdn-icons",
3
- "version": "25.2.0",
3
+ "version": "25.3.0",
4
4
  "description": "The Atomic Web SDK",
5
5
  "main": "public/sdk.js",
6
6
  "typings": "public/sdk.d.ts",
@@ -39,7 +39,7 @@
39
39
  "@babel/preset-react": "^7.9.4",
40
40
  "@babel/preset-typescript": "^7.9.0",
41
41
  "@microsoft/api-extractor": "^7.19.5",
42
- "@playwright/test": "^1.38.0",
42
+ "@playwright/test": "^1.55.0",
43
43
  "@popa-marius/pushstate-server": "3.1.2",
44
44
  "@types/css-font-loading-module": "^0.0.13",
45
45
  "@types/jest": "^26.0.4",
@@ -55,7 +55,7 @@
55
55
  "enzyme-adapter-preact-pure": "^4.1.0",
56
56
  "focus-visible": "^5.2.0",
57
57
  "jest": "^26.0.4",
58
- "playwright": "^1.38.0",
58
+ "playwright": "^1.55.0",
59
59
  "preact": "10.4.1",
60
60
  "prettier": "3.2.5",
61
61
  "react": "^18.2.0",
@@ -64,7 +64,7 @@
64
64
  "terser-webpack-plugin": "^5.3.10",
65
65
  "to-string-loader": "^1.2.0",
66
66
  "ts-loader": "^9.5.1",
67
- "typescript": "^3.8.3",
67
+ "typescript": "^5.9.2",
68
68
  "url-loader": "^4.1.1",
69
69
  "webpack": "^5.90.0",
70
70
  "webpack-cli": "^5.1.4",
@@ -1,4 +1,4 @@
1
- The Atomic Web SDK (25.2.0) uses the following open sources libraries:
1
+ The Atomic Web SDK (25.3.0) uses the following open sources libraries:
2
2
 
3
3
  -----------------------
4
4