diff --git a/src/handlers/ExecuteBlockActionHandler.ts b/src/handlers/ExecuteBlockActionHandler.ts index 01bfec3..e0ffd87 100644 --- a/src/handlers/ExecuteBlockActionHandler.ts +++ b/src/handlers/ExecuteBlockActionHandler.ts @@ -260,11 +260,8 @@ export class ExecuteBlockActionHandler { oAuth2Storage: OAuth2Storage, roomInteractionStorage: RoomInteractionStorage ) { - const { user } = this.context.getInteractionData(); const PropertyName = `${DatabaseModal.PROPERTY_NAME_ACTION}-${uuid()}`; - const PropertyType = `${ - DatabaseModal.PROPERTY_TYPE_SELECT_ACTION - }-${uuid()}`; + const PropertyType = `${DatabaseModal.PROPERTY_TYPE_SELECT_ACTION}-${uuid()}`; await modalInteraction.storeInteractionActionId({ PropertyType, @@ -911,7 +908,7 @@ export class ExecuteBlockActionHandler { .getInteractionResponder() .updateModalViewResponse(modal); } - + // update the modal if database is selected const database = Object as IDatabase; diff --git a/src/lib/NotionSDK.ts b/src/lib/NotionSDK.ts index 5b76ce0..993f9a0 100644 --- a/src/lib/NotionSDK.ts +++ b/src/lib/NotionSDK.ts @@ -97,13 +97,18 @@ export class NotionSDK implements INotionSDK { cursor?: string ): Promise | Error> { try { - const data = { - filter: { - value: NotionObjectTypes.PAGE, + const data: { + filter?: any; + start_cursor?: string | undefined; + } = {}; + + if (cursor !== undefined) { + data.start_cursor = cursor; + data.filter = { + value: NotionObjectTypes.DATABASE, property: NotionObjectTypes.PROPERTY, - }, - start_cursor: cursor, - }; + } + } const response = await this.http.post(NotionApi.SEARCH, { data, @@ -507,9 +512,13 @@ export class NotionSDK implements INotionSDK { cursor?: string ): Promise | Error> { try { - const data = { - start_cursor: cursor, - }; + const data: { + start_cursor?: string; + } = {}; + + if (cursor !== undefined) { + data.start_cursor = cursor; + } const response = await this.http.post(NotionApi.SEARCH, { data, diff --git a/src/modals/common/DropDownComponent.ts b/src/modals/common/DropDownComponent.ts index f34e39e..d1ec096 100644 --- a/src/modals/common/DropDownComponent.ts +++ b/src/modals/common/DropDownComponent.ts @@ -37,18 +37,20 @@ export function DropDownComponent( dispatchActionConfig.push(Modals.dispatchActionConfigOnInput); } - const dropDown = elementBuilder.addDropDown( - { - placeholder, + const inputBlock = blockBuilder.createInputBlock({ + text: text, + element: { + type: 'static_select', + blockId: blockId, options: dropDownOption, - dispatchActionConfig, - initialValue + appId: app.getID(), + actionId: actionId, + placeholder: { + type: 'plain_text', + text: placeholder, + }, + dispatchActionConfig: [Modals.dispatchActionConfigOnSelect] }, - { blockId, actionId } - ); - const inputBlock = blockBuilder.createInputBlock({ - text, - element: dropDown, optional: false, }); diff --git a/src/modals/common/searchPageComponent.ts b/src/modals/common/searchPageComponent.ts index 6f5b5a7..9d425e3 100644 --- a/src/modals/common/searchPageComponent.ts +++ b/src/modals/common/searchPageComponent.ts @@ -39,19 +39,23 @@ export async function searchPageComponent( }; }); const dropDownOption = elementBuilder.createDropDownOptions(options); - const dropDown = elementBuilder.addDropDown( - { - placeholder: SearchPage.PLACEHOLDER, - options: dropDownOption, - dispatchActionConfig: [Modals.dispatchActionConfigOnSelect], - }, - { blockId: SearchPage.BLOCK_ID, actionId } - ); const inputBlock = blockBuilder.createInputBlock({ text: SearchPage.LABEL, - element: dropDown, + element: { + type: 'static_select', + blockId: SearchPage.BLOCK_ID, + options: dropDownOption, + appId: app.getID(), + actionId: actionId, + placeholder: { + type: 'plain_text', + text: SearchPage.PLACEHOLDER, + }, + dispatchActionConfig: [Modals.dispatchActionConfigOnSelect] + }, optional: false, }); + return inputBlock; } diff --git a/src/modals/common/searchPageOrDatabaseComponent.ts b/src/modals/common/searchPageOrDatabaseComponent.ts index 64daa30..1d180d6 100644 --- a/src/modals/common/searchPageOrDatabaseComponent.ts +++ b/src/modals/common/searchPageOrDatabaseComponent.ts @@ -36,7 +36,7 @@ export async function searchPageOrDatabaseComponent( const options: StaticSelectOptionsParam = accesiblePagesAndDatabase.map( (item) => { - + const info = NotionObjectTypes.INFO.toString(); const name = NotionObjectTypes.NAME.toString(); @@ -51,17 +51,20 @@ export async function searchPageOrDatabaseComponent( ); const dropDownOption = elementBuilder.createDropDownOptions(options); - const dropDown = elementBuilder.addDropDown( - { - placeholder: SearchPageAndDatabase.PLACEHOLDER, - options: dropDownOption, - dispatchActionConfig: [Modals.dispatchActionConfigOnSelect], - }, - { blockId: SearchPageAndDatabase.BLOCK_ID, actionId } - ); const inputBlock = blockBuilder.createInputBlock({ text: SearchPageAndDatabase.LABEL, - element: dropDown, + element: { + type: 'static_select', + blockId: SearchPageAndDatabase.BLOCK_ID, + options: dropDownOption, + appId: app.getID(), + actionId: actionId, + placeholder: { + type: 'plain_text', + text: SearchPageAndDatabase.PLACEHOLDER, + }, + dispatchActionConfig: [Modals.dispatchActionConfigOnSelect] + }, optional: false, });