@orangelogic/orange-dam-content-browser-sdk 2.4.12 → 2.4.13

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
@@ -108,6 +108,30 @@ setting is simply ignored. Because no GetAssetLink request is made, only the com
108
108
  `extraFields` (`ScrubUrl` and `AllowATSLink`) are returned in this mode -- request any
109
109
  other field with `simplePick` off.
110
110
 
111
+ ## Errors on Confirm (`onError`)
112
+
113
+ When the asset link request of a confirm fails, the SDK does not call `onAssetSelected`.
114
+ The dialog stays open and shows the error, and its confirm button becomes usable again.
115
+ The SDK also calls `onError(errorMessage, error)`:
116
+
117
+ ```html
118
+ <script>
119
+ OrangeDAMContentBrowser.open({
120
+ containerId: 'asset-picker',
121
+ onAssetSelected: (assets) => console.log(assets),
122
+ onError: (errorMessage, error) => {
123
+ // error.errorCode is the Cortex error code, for example 'OL_ERR_002_NOTALLOWED'.
124
+ console.error(errorMessage, error?.errorCode);
125
+ },
126
+ });
127
+ </script>
128
+ ```
129
+
130
+ `error` is an `AssetLinkError`. When Cortex sends an error body, `errorCode` and
131
+ `serverMessage` hold its `ErrorCode` and `Message`. For a network failure they are empty.
132
+ A successful response with no link is not an error: the asset goes to `onAssetSelected`
133
+ with its preview URL as `imageUrl`.
134
+
111
135
  ## Select Without an Asset Link (`skipLinkGeneration`)
112
136
 
113
137
  Set `skipLinkGeneration: true` when the host needs the selected asset's fields, not a