File tree Expand file tree Collapse file tree 3 files changed +9
-6
lines changed
packages/optimizely-cms-sdk/src
samples/nextjs-template/src/app Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -343,13 +343,17 @@ export function getPreviewUtils(opti: OptimizelyComponentProps['opti']) {
343343 src ( input : InferredContentReference | string | null | undefined ) : string {
344344 const previewToken = opti . __context ?. preview_token ;
345345
346- // if input is a ContentReference
347- if ( typeof input === 'object' && previewToken && input ?. item ?. Url ) {
348- return appendToken ( input ?. item ?. Url , previewToken ) ;
346+ // if input is an object with a URL
347+ if ( typeof input === 'object' && input ) {
348+ // if dam asset is selected the default URL is in input.url.default will be null
349+ const url = input . url ?. default ?? input . item ?. Url ;
350+ if ( url ) {
351+ return appendToken ( url , previewToken ) ;
352+ }
349353 }
350354
351355 // if input is a string URL
352- if ( typeof input === 'string' && previewToken ) {
356+ if ( typeof input === 'string' ) {
353357 return appendToken ( input , previewToken ) ;
354358 }
355359
Original file line number Diff line number Diff line change 77 * @returns The URL with the preview token appended as a query parameter.
88 */
99export const appendToken = ( url : string , previewToken ?: string ) : string => {
10- if ( ! previewToken ) return url ;
10+ if ( ! previewToken || previewToken . trim ( ) === '' ) return url ;
1111 const separator = url . includes ( '?' ) ? '&' : '?' ;
1212 return `${ url } ${ separator } preview_token=${ previewToken } ` ;
1313} ;
Original file line number Diff line number Diff line change @@ -414,7 +414,6 @@ a:hover span.animate {
414414.about-us .about-us-image {
415415 position : relative;
416416 width : 100% ;
417- padding-top : 56.25% ;
418417}
419418
420419.about-us .about-us-image img {
You can’t perform that action at this time.
0 commit comments