function buildSelectionPage(e) {

  const selected = e.drive.activeCursorItem

  // Check if Google Doc type, respond unsupported if not 
  if (selected.mimeType != "application/vnd.google-apps.document") {
    return {
      sections: [
        {
          widgets: [
            {
              textParagraph: {
                text: "<b>Note</b>: currently only <i>Google Docs<i/> file types are supported."
              },
            }
          ]
        }
      ],
      "header": buildHeader()
    };
  }

  // Get document body 
  const docBody = getDocumentBody(selected.id);


  //  Create widgets starting with Title
  const widgets = [
    {
      textParagraph: {
        text: `<b>${selected.title}</b>`
      },
    }
  ];

  // Check if doc is empty before calling AI
  if (docBody.length > 1) {

    // Get AI data
    const aiResponse = getAiSummary(docBody);

    console.log('RESPONSE')

    console.log(aiResponse)


    //  Add the Summary text 
    widgets.push({
      "decoratedText": {
        "topLabel": "Summary",
        "text": aiResponse.summary,
        "wrapText": true
      }
    },
    )

    // Divider
    widgets.push({ "divider": {} },)

    // Create an object of items 
    const items = [];
    aiResponse.names.forEach(name => {
      items.push({
        "text": name,
        "value": name,
        "selected": false
      },)

    });

    // Set first item as selected 
    items[0].selected = true


    // Add the Radio button of 'names' as items
    widgets.push(
      {
        "selectionInput": {
          "name": "names",
          "label": "Select a new name",
          "type": "RADIO_BUTTON",
          "items": items
        }
      },
    )

    // Create the 'Rename' button
    widgets.push(
      {
        "buttonList": {
          "buttons": [
            {
              "text": "Rename",
              "icon": {
                "iconUrl": ICON_RENAME,
                "altText": "Rename"
              },
              "onClick": {
                "action": {
                  "function": "renameFile",
                  "parameters": [
                    {
                      "key": "id",
                      "value": selected.id
                    }
                  ],
                  "loadIndicator": "SPINNER"
                }
              }
            },           {
              "text": "",
              "icon": {
                "iconUrl": ICON_RETRY,
                "altText": "Retry"
              },
              "onClick": {
                "action": {
                  "function": "updateCard",
                  "parameters": [
                    {
                      "key": "id",
                      "value": selected.id
                    }
                  ],
                  "loadIndicator": "SPINNER"
                }
              }
            }
          ]
        },
        "horizontalAlignment": "CENTER",
      }
    )

  } // end if

  // Don't call AI, but offer to delete
  else {

    //  Add the Summary text 
    widgets.push({
      "decoratedText": {
        "topLabel": "Summary",
        "text": "Empty document",
        "wrapText": true
      }
    },
    )

    // Divider
    widgets.push({ "divider": {} },)

    // Create the 'Delete' button
    widgets.push(
      {
        "buttonList": {
          "buttons": [
            {
              "text": "Move to trash",
              "icon": {
                "iconUrl": ICON_DELETE,
                "altText": "Move to trash"
              },
              "onClick": {
                "action": {
                  "function": "moveFileToTrash",
                  "parameters": [
                    {
                      "key": "id",
                      "value": selected.id
                    }
                  ],
                  "loadIndicator": "SPINNER"
                }
              },
              "color": {
                "red": 0.961,
                "green": 0.6,
                "blue": 0.667,
                "alpha": 1
              }
            }
          ]
        },
        "horizontalAlignment": "CENTER",
      }
    )
  } // end else


  return {
    sections: [
      {
        widgets
      },
    ],
    "header": buildHeader()
  };
}
Builds the card for the selected active item.

@param e - Add-on event context