Skip to content

Feat/google docs plan step v0 [INTEG-3341]#10360

Open
david-shibley-contentful wants to merge 14 commits intomasterfrom
feat/google-docs-plan-step-v0
Open

Feat/google docs plan step v0 [INTEG-3341]#10360
david-shibley-contentful wants to merge 14 commits intomasterfrom
feat/google-docs-plan-step-v0

Conversation

@david-shibley-contentful
Copy link
Copy Markdown
Contributor

@david-shibley-contentful david-shibley-contentful commented Dec 19, 2025

Purpose

The preview step was the final missing piece of the flow

Things introduced in this PR:

  • Preview step
  • Fetching of the google docs moved to front end

Approach

Screenshot 2025-12-19 at 2 06 17 PM

Testing steps

Breaking Changes

Dependencies and/or References

Deployment

ryunsong-contentful and others added 4 commits December 18, 2025 15:11
* wip

* simplify agent

* organize oauth functions

* reorganizing function handlers

* reorganizing function handlers (prev `createEntriesfromDocument`) calling each agent in a separate function, + removing plan agent for now

* fix: function manifest

* minor edit to manifest

* replacing single function with 2: one for analyzing ct + one for document processing

* fix: add oauth token to analyze content type function

* fix: adding entries to document processor o/p

* feat: new app action to create entries, preview modal

* cleanup + rename preview function

* cleanup

* chore: delete test docs

* cleanup

* rename handler for consistency
* feat: got google doc picker working

* feat: explicitly add api key for google docs oauth connection
@david-shibley-contentful david-shibley-contentful requested a review from a team as a code owner December 19, 2025 21:08
@david-shibley-contentful david-shibley-contentful changed the title Feat/google docs plan step v0 Feat/google docs plan step v0 [INTEG-3341] Dec 19, 2025
Comment on lines +62 to +81
const analyzeContentTypesResponse = await analyzeContentTypesAction(
sdk,
contentTypeIds,
oauthToken
);
console.log('analyzeContentTypesResponse', analyzeContentTypesResponse);
// If entries provided, use them directly. Otherwise fetch document JSON as fallback
let documentJson: unknown | undefined;
if (!entries || entries.length === 0) {
documentJson = await fetchGoogleDocAsJson(documentId, oauthToken);
}

const processDocumentResponse = await createPreviewAction(
const response = await createEntriesFromDocumentAction(
sdk,
contentTypeIds,
documentId,
oauthToken
);
console.log('processDocumentResponse', processDocumentResponse);
entries,
documentJson
) as any;
const result: FinalEntriesResult = response.sys.result;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we revert to using two functions instead of one?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not sure I understand, aren't we using two functions?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into it and the createPreview function only calls the document parser agent and not the content type parser agent (this agent was called by the analyzeContentTypes function that was deleted in the manifest) Was that intentional? If so we would need to delete the content type parser agent.

Comment thread apps/google-docs/functions/agents/documentParserAgent/documentParser.agent.ts Outdated
Comment thread apps/google-docs/functions/createEntriesFromDocument.ts Outdated
Comment thread apps/google-docs/functions/handlers/createPreview/createPreviewHandler.ts Outdated
Comment thread apps/google-docs/functions/handlers/createPreview/createPreviewHandler.ts Outdated
Comment thread apps/google-docs/functions/handlers/createPreview/createPreviewHandler.ts Outdated
Comment thread apps/google-docs/src/components/page/PreviewModal.tsx Outdated
Comment thread apps/google-docs/src/components/page/PreviewModal.tsx Outdated
Comment thread apps/google-docs/src/components/page/PreviewModal.tsx Outdated
Comment thread apps/google-docs/src/components/page/PreviewModal.tsx

const submit = useCallback(
async (contentTypeIds: string[]) => {
async (contentTypeIds: string[], entries?: any[]) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have a diff here? Isn't this part for the content type analysis, but now we are fetching the docs and calling create entries? I think this is not what this hook is intended for

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no?

Comment thread apps/google-docs/src/hooks/usePlanGeneration.ts Outdated
Comment thread apps/google-docs/src/hooks/usePlanGeneration.ts Outdated
Comment thread apps/google-docs/src/hooks/usePlanGeneration.ts Outdated
Comment thread apps/google-docs/src/hooks/usePlanGeneration.ts Outdated
Comment thread apps/google-docs/src/hooks/usePlanGeneration.ts Outdated
Comment thread apps/google-docs/src/hooks/usePlanGeneration.ts Outdated
Comment thread apps/google-docs/src/hooks/usePlanGeneration.ts Outdated
Comment thread apps/google-docs/src/hooks/usePlanGeneration.ts Outdated
Comment thread apps/google-docs/src/hooks/usePlanGeneration.ts Outdated
Comment thread apps/google-docs/src/hooks/usePlanGeneration.ts Outdated
Comment thread apps/google-docs/src/locations/Page.tsx Outdated
Comment thread apps/google-docs/src/locations/Page.tsx Outdated
Comment thread apps/google-docs/src/locations/Page.tsx Outdated
Comment thread apps/google-docs/src/locations/Page.tsx Outdated
Comment thread apps/google-docs/src/locations/Page.tsx Outdated
}, [isSubmitting, modalStates.isLoadingModalOpen, closeModal, clearPlan]);

// Handle plan generation completion
useEffect(() => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where did this come from

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need this to get the modals to switch when the preview is generated

Comment thread apps/google-docs/src/locations/Page.tsx Outdated
Comment thread apps/google-docs/contentful-app-manifest.json Outdated
Comment thread apps/google-docs/src/components/page/PreviewModal.tsx Outdated
Comment thread apps/google-docs/src/components/page/PreviewModal.tsx Outdated
Base automatically changed from google-docs-xmas-fb to master January 5, 2026 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants