Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions apps/google-docs/contentful-app-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
]
},
{
"id": "initiateOauth",
"name": "Initiate OAuth",
"id": "initiateGdocOauth",
"name": "Initiate Gdoc OAuth Flow",
"description": "Initiates the OAuth flow for Google Docs",
"path": "functions/initiateOauth.js",
"entryFile": "functions/initiateOauth.ts",
Expand All @@ -46,8 +46,8 @@
]
},
{
"id": "completeOauth",
"name": "Complete OAuth",
"id": "completeGdocOauth",
"name": "Complete Gdoc OAuth Flow",
"description": "Completes the OAuth flow for Google Docs",
"path": "functions/completeOauth.js",
"entryFile": "functions/completeOauth.ts",
Expand All @@ -59,9 +59,9 @@
]
},
{
"id": "disconnect",
"name": "Disconnect",
"description": "Disconnects the Google Docs app",
"id": "revokeGdocOauthToken",
"name": "Revoke Gdoc OAuth Token",
"description": "Revoke token for the Google Docs app to disconnect from the app",
"path": "functions/disconnect.js",
"entryFile": "functions/disconnect.ts",
"allowNetworks": [
Expand All @@ -72,9 +72,9 @@
]
},
{
"id": "checkStatus",
"name": "Check Status",
"description": "Checks the status of the Google Docs app",
"id": "checkGdocOauthTokenStatus",
"name": "Check Gdoc OAuth Token Status",
"description": "Checks the status of the Google Docs OAuth token to see if it is valid",
"path": "functions/checkStatus.js",
"entryFile": "functions/checkStatus.ts",
"allowNetworks": [
Expand Down
4 changes: 2 additions & 2 deletions apps/google-docs/functions/createEntriesFromDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { createDocument } from './agents/documentParser.agent';
// import { createEntries, createAssets } from './service/entryService';

export type AppActionParameters = {
contentType: string;
contentTypeId: string;
prompt: string;
};
interface AppInstallationParameters {
Expand All @@ -30,7 +30,7 @@ export const handler: FunctionEventHandler<
event: AppActionRequest<'Custom', AppActionParameters>,
context: FunctionEventContext
) => {
const { contentType, prompt } = event.body;
const { contentTypeId, prompt } = event.body;
const { openAiApiKey } = context.appInstallationParameters as AppInstallationParameters;

// INTEG-3262 and INTEG-3263: Take in Content Type, Prompt, and Upload File from user
Expand Down
4 changes: 3 additions & 1 deletion apps/google-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
"upload": "contentful-app-scripts upload --bundle-dir ./build",
"upload-ci": "contentful-app-scripts upload --ci --bundle-dir ./build --organization-id $CONTENTFUL_ORG_ID --definition-id $CONTENTFUL_APP_DEF_ID --token $CONTENTFUL_ACCESS_TOKEN",
"deploy": "contentful-app-scripts upload --ci --bundle-dir ./build --organization-id ${DEFINITIONS_ORG_ID} --definition-id 3EaGZUMKRKVZUyrcoNJ4o4 --token ${CONTENTFUL_CMA_TOKEN}",
"deploy:dev": "npm run build && source .env && contentful-app-scripts upload --ci --bundle-dir ./build --organization-id \"$DEFINITIONS_ORG_ID\" --definition-id 653vTnuQw3j5onU1tUoH6t --token \"$CONTENTFUL_CMA_TOKEN\""
"deploy:dev": "npm run build && source .env && contentful-app-scripts upload --ci --bundle-dir ./build --organization-id $CONTENTFUL_ORG_ID --definition-id 653vTnuQw3j5onU1tUoH6t --token \"$CONTENTFUL_CMA_TOKEN\"",
"deploy:staging": "npm run build && source .env && contentful-app-scripts upload --ci --bundle-dir ./build --organization-id $CONTENTFUL_ORG_ID --definition-id 4i0mp5lQtgNsHYVrD5jIkj --token \"$CONTENTFUL_CMA_TOKEN\""

},
"eslintConfig": {
"extends": "react-app"
Expand Down
23 changes: 23 additions & 0 deletions apps/google-docs/src/locations/ConfigScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,29 @@ const ConfigScreen = () => {
style={{ flex: 1 }}
/>
</Box>
<Button
onClick={async () => {
const appActions = await sdk.cma.appAction.getManyForEnvironment({
environmentId: sdk.ids.environment,
spaceId: sdk.ids.space,
});
const initiateOauthAppAction = appActions.items.find(
(action) => action.name === 'createEntriesFromDocumentAction'
);
const response = await sdk.cma.appActionCall.createWithResponse(
{
appActionId: initiateOauthAppAction?.sys.id || '',
appDefinitionId: sdk.ids.app,
},
{
parameters: {},
}
);

console.log(JSON.parse(response.response.body));
}}>
Create entries from document
</Button>
<Paragraph marginTop="spacingS">
Find your OpenAPI key{' '}
<a
Expand Down