-
Notifications
You must be signed in to change notification settings - Fork 5.5k
PandaDoc: Create Document from Template *with Image* #17980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
WalkthroughThe PandaDoc "Create Document from Template" action was updated to support image fields. The code now detects image blocks in the template, exposes them as optional string URL properties, and includes user-supplied image URLs in the API payload. The package version was also incremented. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Action
participant PandaDocAPI
User->>Action: Provide templateId and image URLs
Action->>PandaDocAPI: GET /templates/:id/details
PandaDocAPI-->>Action: Return template fields & images
Action->>Action: Build props for fields & images
User->>Action: Submit document creation with image URLs
Action->>PandaDocAPI: POST /documents (with images array)
PandaDocAPI-->>Action: Return document creation result
Action-->>User: Return result
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes found. Poem
Note 🔌 MCP (Model Context Protocol) integration is now available in Early Access!Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
components/pandadoc/actions/create-document-from-template/create-document-from-template.mjs (1)
122-135: Image processing logic correctly implemented.The implementation properly:
- Initializes an empty images array
- Iterates through template images only if they exist
- Checks for user-provided image URLs using the block_uuid as the property key
- Constructs image objects with the correct structure (name and urls array) as per PandaDoc API specification
Consider adding URL validation for better error handling:
+ if (this[image.block_uuid] && this[image.block_uuid].trim()) { + // Optionally validate URL format here images.push({ name: image.name, urls: [ this[image.block_uuid], ], }); + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
components/pandadoc/actions/create-document-from-template/create-document-from-template.mjs(6 hunks)components/pandadoc/package.json(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2024-12-12T19:23:09.039Z
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14935
File: components/sailpoint/package.json:15-18
Timestamp: 2024-12-12T19:23:09.039Z
Learning: When developing Pipedream components, do not add built-in Node.js modules like `fs` to `package.json` dependencies, as they are native modules provided by the Node.js runtime.
Applied to files:
components/pandadoc/package.json
📚 Learning: 2024-10-30T15:24:39.294Z
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".
Applied to files:
components/pandadoc/actions/create-document-from-template/create-document-from-template.mjs
🔇 Additional comments (7)
components/pandadoc/package.json (1)
3-3: LGTM! Appropriate version bump for feature addition.The version increment from
1.0.1to1.0.2correctly reflects the addition of image support functionality to the PandaDoc component.components/pandadoc/actions/create-document-from-template/create-document-from-template.mjs (6)
8-8: LGTM! Version increment aligns with feature addition.The action version bump from
0.0.7to0.0.8correctly reflects the addition of image support functionality.
55-57: Good optimization to prevent unnecessary API calls.The early return when
templateIdis not set prevents unnecessary template fetching, improving performance.
58-62: Template fetch correctly extended to include images.The destructuring now includes both
fieldsandimagesfrom the template, aligning with the PR objective to support image handling.
73-81: Image properties correctly implemented.The implementation properly creates dynamic properties for each image using
block_uuidas the key and provides descriptive labels. This follows the same pattern as field handling and aligns with PandaDoc API requirements.
108-112: Template fetch consistently updated to include images.The destructuring correctly includes both
fields(aliased asitems) andimages(aliased astemplateImages) from the template response.
146-146: Images correctly included in API payload.The
imagesarray is properly added to the data payload sent to thecreateDocumentAPI call, completing the image support implementation.
GTFalcao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Resolves #17836
Summary by CodeRabbit
New Features
Chores