Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Components] Create Blog Post - WIX #15954

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

jcortes
Copy link
Collaborator

@jcortes jcortes commented Mar 18, 2025

WHY

Resolves #15782

Summary by CodeRabbit

  • New Features

    • Introduced a new action for creating draft posts.
    • Enhanced integration with added support for retrieving identifiers such as categories, members, tags, and posts.
  • Chores

    • Updated version numbers across multiple components.
    • Upgraded a key dependency to improve overall performance and stability.

@jcortes jcortes self-assigned this Mar 18, 2025
Copy link

vercel bot commented Mar 18, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) Mar 18, 2025 9:20pm
pipedream-docs ⬜️ Ignored (Inspect) Mar 18, 2025 9:20pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Mar 18, 2025 9:20pm

Copy link
Contributor

coderabbitai bot commented Mar 18, 2025

Walkthrough

This pull request updates several Wix API integration modules by incrementing their version numbers from "0.0.1" to "0.0.2". A new module for creating draft posts has been introduced with complete API request and response handling. The package manifest has been updated to version "0.2.0" along with a dependency upgrade for @pipedream/platform. Additionally, the main application file has been enhanced with new properties and methods to fetch categories, members, tags, and posts from the Wix API.

Changes

Files Change Summary
components/wix_api_key/actions/add-products-to-collection.mjs, .../create-contact.mjs, .../create-product.mjs, .../get-contact.mjs,
components/wix_api_key/sources/new-member-registered.mjs, .../new-order-created.mjs, .../new-product-created.mjs
Updated version numbers from "0.0.1" to "0.0.2".
components/wix_api_key/actions/create-draft-post/create-draft-post.mjs New module added for creating draft posts with defined action, API request configuration, and response handling.
components/wix_api_key/package.json Updated package version from "0.1.0" to "0.2.0" and upgraded dependency @pipedream/platform from "^1.5.1" to "^3.0.3".
components/wix_api_key/wix_api_key.app.mjs Added new properties (categoryId, memberId, tagId, postId) and methods (listCategories, queryTags, queryPosts); modified getSiteHeaders to return "wix-account-id".

Sequence Diagram(s)

sequenceDiagram
  participant Client as Client
  participant DraftPost as CreateDraftPost Module
  participant WixAPI as Wix API Endpoint

  Client->>DraftPost: invoke run() with post details
  DraftPost->>WixAPI: POST request to create draft post
  WixAPI-->>DraftPost: Response (post ID and details)
  DraftPost->>Client: Return summary message and full response
Loading

Assessment against linked issues

Objective Addressed Explanation
Create Blog Post - WIX (#15782): Automatically create draft posts

Suggested reviewers

  • michelle0927

Poem

Hopping through the lines of code, I sing,
Versions bump and new features now take wing.
Draft posts bloom like carrots in spring,
API calls dance and data starts to cling.
With joyous hops, I cheer the change—
Code so fresh, it makes my heart rearrange! 🐰💻

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

components/wix_api_key/actions/add-products-to-collection/add-products-to-collection.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

components/wix_api_key/actions/create-draft-post/create-draft-post.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

components/wix_api_key/actions/create-contact/create-contact.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

  • 6 others

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.
✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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/wix_api_key/actions/create-draft-post/create-draft-post.mjs (1)

7-7: Consider version consistency.

The version is set to 0.0.1, but other components in this PR have been updated to 0.0.2. Consider whether this should also start at 0.0.2 for consistency.

-  version: "0.0.1",
+  version: "0.0.2",
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 233ece2 and b7473d3.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (10)
  • components/wix_api_key/actions/add-products-to-collection/add-products-to-collection.mjs (1 hunks)
  • components/wix_api_key/actions/create-contact/create-contact.mjs (1 hunks)
  • components/wix_api_key/actions/create-draft-post/create-draft-post.mjs (1 hunks)
  • components/wix_api_key/actions/create-product/create-product.mjs (1 hunks)
  • components/wix_api_key/actions/get-contact/get-contact.mjs (1 hunks)
  • components/wix_api_key/package.json (2 hunks)
  • components/wix_api_key/sources/new-member-registered/new-member-registered.mjs (1 hunks)
  • components/wix_api_key/sources/new-order-created/new-order-created.mjs (1 hunks)
  • components/wix_api_key/sources/new-product-created/new-product-created.mjs (1 hunks)
  • components/wix_api_key/wix_api_key.app.mjs (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Publish TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Verify TypeScript components
🔇 Additional comments (22)
components/wix_api_key/actions/create-product/create-product.mjs (1)

7-7: Version Update Consistency.
The version field has been incremented to "0.0.2", which keeps this module in line with the other Wix API integration modules and the overall package version update.

components/wix_api_key/actions/create-contact/create-contact.mjs (1)

7-7: Consistent Version Increment.
The update from "0.0.1" to "0.0.2" for the version property is straightforward and aligns with the other files in this component. No further changes are necessary.

components/wix_api_key/actions/add-products-to-collection/add-products-to-collection.mjs (1)

7-7: Maintaining Version Uniformity.
Updating the version field to "0.0.2" ensures uniformity across the different Wix action modules. The change is simple and effective.

components/wix_api_key/sources/new-product-created/new-product-created.mjs (1)

9-9: Version Update Verification.
The version property has been updated to "0.0.2". The rest of the code, including integration with common methods and constants, remains unchanged and correctly structured.

components/wix_api_key/sources/new-member-registered/new-member-registered.mjs (1)

9-9: Uniform Versioning Achieved.
The version field update to "0.0.2" aligns this source module with the overall upgrade. The changes are minimal and correctly implemented.

components/wix_api_key/sources/new-order-created/new-order-created.mjs (1)

9-9: Version bump from 0.0.1 to 0.0.2 looks good.

This version update is consistent with the coordinated versioning effort across multiple Wix components in this PR.

components/wix_api_key/actions/get-contact/get-contact.mjs (1)

7-7: Version bump from 0.0.1 to 0.0.2 looks good.

This version update aligns with the coordinated versioning effort across the Wix API components.

components/wix_api_key/package.json (2)

3-3: Package version update to 0.2.0 matches the scope of changes.

The minor version bump (0.1.0 → 0.2.0) appropriately reflects the addition of the new "Create Draft Post" action and the coordinated component version updates.


16-16:

❓ Verification inconclusive

Significant dependency update.

The dependency on @pipedream/platform has been updated from ^1.5.1 to ^3.0.3, which is a major version jump. Ensure all components are compatible with this new version.


🏁 Script executed:

#!/bin/bash
# Check for any breaking changes that might affect existing components
echo "Checking for any imports of potentially removed/changed features from @pipedream/platform..."
grep -r "from \"@pipedream/platform\"" --include="*.mjs" components/wix_api_key/
grep -r "require(\"@pipedream/platform\")" --include="*.js" components/wix_api_key/

Length of output: 526


Major Dependency Update – Compatibility Verification Required

The dependency on @pipedream/platform has been updated from ^1.5.1 to ^3.0.3, representing a major version jump. We found that the updated dependency is imported in two locations:

  • components/wix_api_key/wix_api_key.app.mjs: Imports { axios } from @pipedream/platform.
  • components/wix_api_key/sources/common/common.mjs: Contains an import from @pipedream/platform.

Given the significant version bump, please verify that these components are fully compatible with v3.0.3. This might involve reviewing the official migration guide or performing additional testing to ensure that no breaking API changes affect the current functionality.

components/wix_api_key/actions/create-draft-post/create-draft-post.mjs (5)

1-7: Well-structured new action component.

The component header and metadata are well-defined with appropriate documentation links.


9-112: Props are comprehensive and well-documented.

The component includes a thorough set of props with appropriate types, labels, and descriptions. The use of propDefinitions for related entities (categoryId, memberId, tagId, postId) demonstrates good reuse of existing definitions.


113-121: API request method is properly encapsulated.

The createDraftPost method follows the pattern used in other components, leveraging the app's _makeRequest method with appropriate endpoint configuration.


122-159: Well-implemented run method.

The run method effectively:

  1. Destructures all necessary props
  2. Organizes data in the expected API structure
  3. Provides a clear success message with the created draft post ID
  4. Returns the complete response

138-155:

❓ Verification inconclusive

Verify Wix API endpoint structure.

The request structure looks good, but it's always helpful to verify against the latest Wix API documentation to ensure all required fields are included and formatted correctly.


🌐 Web query:

Wix Blog API draft-posts endpoint structure and required fields

💡 Result:

To create and manage draft blog posts using the Wix Blog API, you'll use the /blog/v3/draft-posts endpoints. Here's the essential structure and requirements:

Draft Post Creation Structure

Send a POST request to https://www.wixapis.com/blog/v3/draft-posts with these components:

{
  "draftPost": {
    "title": "Your Post Title",
    "contentId": "auto-generated",
    "memberId": "REQUIRED_MEMBER_ID",
    "language": "en",
    "featured": false,
    "contentData": {
      "nodes": [
        {
          "type": "PARAGRAPH",
          "textData": {
            "text": "Your content here..."
          }
        }
      ]
    }
  }
}

Required Fields

  1. title: Post title (string).
  2. memberId: ID of the author (string)[1][18].

Key Optional Fields

  • contentData: Rich-text content using Wix's structured node system (e.g., PARAGRAPH, IMAGE, HEADING)[6].
  • featured: Boolean for featured status (default: false).
  • language: ISO language code (default: en).

Common Endpoints

Endpoint Method Description
/draft-posts POST Creates a draft post[1][18].
/draft-posts/{id}/publish POST Publishes a draft post[7].
/draft-posts GET Lists up to 100 drafts (sorted by editedDate descending)[16].

Troubleshooting

  • HTTP 400 Errors:

    • Ensure fieldsToInclude in GET requests uses a single value (e.g., RICH_CONTENT or CONTENT)[2][4].
    • Validate node structures for contentData (e.g., IMAGE nodes require imageData.src.url)[6].
  • Authorization: Include API key in headers[1]:

    Authorization: YOUR_API_KEY
    Content-Type: application/json

For advanced content formatting, refer to Wix's unstructured documentation on node types, and use community examples as guidance[6].

Citations:


Action: Confirm Field Mapping Against Wix API Documentation

The request structure in this file appears correct at a glance since it includes the essential fields (title, memberId, language, etc.). However, based on the latest Wix Blog API documentation for the draft-posts endpoint, please verify that:

  • Any additional fields (e.g., categoryIds, hashtags, commentingEnabled, tagIds, and relatedPostIds) are intentionally included and properly mapped by your integration. These are not standard per the Wix API sample, which focuses on fields like title, memberId, and optionally contentData.
  • If rich content is expected for the draft post, ensure that the absence of a contentData property is acceptable within your use case.
  • Confirm that the extra parameters (publish, fieldsets) are transformed as needed before the request is sent to Wix.

Overall, the code is clear, but please manually verify that the custom fields align with your backend processing logic and the Wix API requirements.

components/wix_api_key/wix_api_key.app.mjs (8)

136-156: LGTM - Good implementation of the categoryId property

The implementation follows the established pattern in the codebase for defining properties with options that fetch data from the API. The pagination logic is properly implemented, and the mapping of category objects to value-label pairs is clean.


157-177: LGTM - Well-structured memberId property definition

This property definition correctly implements fetching members and mapping them to appropriate value-label pairs. The use of optional chaining in the mapping function helps prevent errors when dealing with potentially undefined values.


178-202: LGTM - Proper implementation of tagId property

The tagId implementation correctly uses the queryTags method with appropriate pagination. The structure is consistent with other property definitions in the file.


203-236: LGTM - Well-implemented postId property with search capability

The postId property implementation includes a nice added feature with the useQuery flag and filter implementation, allowing for searching posts by title. The pagination and mapping are properly implemented.


249-253: LGTM - Improved getSiteHeaders method

The update to getSiteHeaders now properly handles the case when no siteId is provided, returning just the wix-account-id. This is a good improvement that maintains backward compatibility.


342-347: LGTM - Clean implementation of the listCategories method

The listCategories method follows the established pattern in the codebase and correctly leverages the _makeRequest method.


348-354: LGTM - Properly implemented queryTags method

The queryTags method correctly uses POST for the API request and follows the same pattern as other query methods in the file.


355-361: LGTM - Well-structured queryPosts method

The queryPosts method is correctly implemented with appropriate HTTP method and path. The implementation is consistent with other methods in the file.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Blog Post - WIX
1 participant