카탈로그 찾아보기 구성요소에 대한 샘플 코드

  • 릴리스 버전: Australia
  • 업데이트 날짜 2026년 03월 12일
  • 소요 시간: 3분
  • 이벤트가 트리거될 때 작업을 정의하기 위해 샘플 코드가 제공됩니다. 웹 페이지에 구성요소를 포함하기 전에 사용 사례에 대한 샘플 코드를 업데이트합니다.

    샘플 코드

    { 
    
    'CATALOG_BROWSE#COMPONENT_READY' : (e) => { 
    
    // This event is dispatched when a component is ready and usable. 
    
    }, 
    
    'CATALOG_BROWSE#CATALOG_ITEM_SELECTED' : (e) => { 
    
    // This event is dispatched when a catalog item is selected. 
    
    var {catalog_item_details} = e.detail.payload; 
    
    // Logic to construct the URL based on the catalog item details 
    
    let redirectURL; 
    
    const type = catalog_item_details.type; 
    
     
    
    if (type === 'catalog_item' || type === 'record_producer') { 
    
    redirectURL = '/catalog_form?emb_recordid=' + catalog_item_details.sys_id; 
    
    } else if (type === 'content_item') { 
    
    const content_type = catalog_item_details.content_type; 
    
    if (content_type === 'kb') { 
    
    redirectURL = '/article_view?emb_recordid=' + catalog_item_details.kb_article; 
    
    } else if (content_type === 'external') { 
    
    redirectURL = catalog_item_details.url; 
    
    } else if (content_type === 'dynamic') { 
    
    const dynamicContentItemDetails = catalog_item_details.dynamicContentItemDetails; 
    
    // Check for 'Playbook' dynamic content type 
    
    if(dynamicContentItemDetails.dynamicContentType === 'c0e6a71443923110f6669c7385b8f20a') 
    
    redirectURL = '/playbook_intake?emb_playbook_title=' + dynamicContentItemDetails.content.title + '&emb_table=' + dynamicContentItemDetails.content.table + '&emb_record_generator=' + dynamicContentItemDetails.content.query + '&emb_playbook_experience=' + dynamicContentItemDetails.content.playbook_experience; 
    
    } 
    
    } 
    
    // Redirect to the respective component page 
    
    open(redirectURL, '_self'); 
    
    }, 
    
    'CATALOG_BROWSE#COMPONENT_EMPTY' : (e) => { 
    
    // This event is dispatched when a component has nothing to display. 
    
    }, 
    
    'CATALOG_BROWSE#COMPONENT_ERROR' : (e) => { 
    
    // This event is dispatched when a component encounters an error. 
    
    var {errorMessage, errorType} = e.detail.payload; 
    
    console.log(errorMessage, errorType); 
    
    }