Skip to content

Conversation

@luancazarine
Copy link
Collaborator

@luancazarine luancazarine commented Nov 3, 2025

Resolves #13314

Summary by CodeRabbit

  • New Features

    • Added "New Popup Form Data" source to emit events when popup forms are submitted; includes a sample test event for validation.
  • Chores

    • Bumped PopupSmart component to v0.1.0 and added platform integration dependency.
    • Improved API integration with authenticated requests and refined pagination for lead retrieval.

… requests, and introduce a new source for emitting popup form data events.
@luancazarine luancazarine linked an issue Nov 3, 2025 that may be closed by this pull request
@vercel
Copy link

vercel bot commented Nov 3, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
pipedream-docs Ignored Ignored Nov 4, 2025 3:41pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Nov 4, 2025 3:41pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 3, 2025

Walkthrough

The PR introduces a PopupSmart polling source for new popup form data, adds API helpers and pagination to the PopupSmart app, bumps the package version to 0.1.0 with a dependency on @pipedream/platform, and adds a sample test event payload.

Changes

Cohort / File(s) Summary
Package metadata
components/popupsmart/package.json
Version updated 0.0.20.1.0; added dependencies with @pipedream/platform": "^3.1.0.
App helpers & API methods
components/popupsmart/popupsmart.app.mjs
Removed propDefinitions and authKeys(); added _baseUrl(), _headers(), _makeRequest() (axios wrapper), listLeads() and paginate() async generator for authenticated requests and pagination.
New polling source
components/popupsmart/sources/new-popup-form-data/new-popup-form-data.mjs
New source exporting polling logic: props (popupsmart, db, timer, campaignId), persisted last-date helpers (_getLastDate, _setLastDate), startEvent() using paginate() + listLeads(), deploy hook triggers initial fetch, run emits date-filtered events in reverse chronological order.
Sample test data
components/popupsmart/sources/new-popup-form-data/test-event.mjs
New test event object with full form payload (metadata, user context, location, UTM, formData, flags).

Sequence Diagram(s)

sequenceDiagram
    actor Timer
    participant Source as new-popup-form-data
    participant App as popupsmart.app
    participant API as PopupSmart API
    participant DB as Database

    Timer->>Source: trigger (deploy or interval)
    Source->>DB: _getLastDate()
    DB-->>Source: lastDate
    Source->>App: paginate(fn=listLeads, params...)
    loop per page
        App->>API: GET /api/leads?limit=100&offset=...
        API-->>App: leads page
        App-->>Source: yield lead (one-by-one)
    end
    Source->>Source: filter leads by date > lastDate (reverse order)
    Source->>Source: emit event(id, summary, ts) for each matching lead
    Source->>DB: _setLastDate(new latest date)
    DB-->>Source: saved
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Pay attention to:
    • Pagination termination and offset/limit logic in paginate()
    • Request composition, headers, and error handling in _makeRequest()
    • Date persistence and timezone/format handling in _getLastDate() / _setLastDate()
    • Event ordering, deduplication, and deploy-time initial fetch behavior in the source

Poem

🐰 I hopped through code with eager paws,
Pages fetched and tokens passed the laws,
New leads danced into my lair,
Dates checked, events popped in the air—
A tiny hop, a joyous cause!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description only contains 'Resolves #13314' and does not follow the template structure requiring a WHY section explanation. Add a WHY section explaining the purpose and rationale for implementing the popupsmart component integration.
Title check ❓ Inconclusive The title is vague and uses generic phrasing without clearly conveying what the popupsmart component implementation entails. Consider a more specific title like 'Add popupsmart component with polling source' to better describe the main changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR successfully implements all requirements from issue #13314: a popupsmart component with the new-popup-form-data polling source that emits events with required campaignId prop.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the popupsmart component and new-popup-form-data source as specified in the linked issue #13314.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 13314-components-popupsmart

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1a5abf4 and 7978e51.

📒 Files selected for processing (1)
  • components/popupsmart/sources/new-popup-form-data/new-popup-form-data.mjs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/popupsmart/sources/new-popup-form-data/new-popup-form-data.mjs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: pnpm publish
  • GitHub Check: Lint Code Base
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components

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

Comment @coderabbitai help to get the list of available commands and usage tips.

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: 2

🧹 Nitpick comments (1)
components/popupsmart/sources/new-popup-form-data/new-popup-form-data.mjs (1)

34-63: Consider explicit date sorting for reliability.

The code assumes the API returns leads in descending date order (newest first) when setting lastDate from responseArray[0] (line 54) and when reversing for emission (line 56). If the API doesn't guarantee this order or changes in the future, both the lastDate tracking and event emission order will be incorrect.

Consider adding explicit sorting after building the response array:

      let responseArray = [];
      for await (const lead of leads) {
        if (Date.parse(lead.date) > lastDate) {
          responseArray.push(lead);
        }
      }

      // Sort by date descending to ensure correct lastDate tracking
      responseArray.sort((a, b) => Date.parse(b.date) - Date.parse(a.date));

      if (responseArray.length) {
        this._setLastDate(Date.parse(responseArray[0].date));
      }
      for (const item of responseArray.reverse()) {

This makes the code more robust and independent of API ordering guarantees.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7e653f2 and 06a96cd.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • components/popupsmart/package.json (2 hunks)
  • components/popupsmart/popupsmart.app.mjs (1 hunks)
  • components/popupsmart/sources/new-popup-form-data/new-popup-form-data.mjs (1 hunks)
  • components/popupsmart/sources/new-popup-form-data/test-event.mjs (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📚 Learning: 2025-10-20T01:01:02.970Z
Learnt from: js07
Repo: PipedreamHQ/pipedream PR: 18744
File: components/slack_v2/actions/send-large-message/send-large-message.mjs:49-64
Timestamp: 2025-10-20T01:01:02.970Z
Learning: In components/slack_v2/actions/send-large-message/send-large-message.mjs, the metadata_event_payload prop is typed as string, so the code only needs to handle string-to-JSON parsing and does not need to handle object inputs.

Applied to files:

  • components/popupsmart/sources/new-popup-form-data/test-event.mjs
📚 Learning: 2025-06-04T17:52:05.780Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: In the Salesloft API integration (components/salesloft/salesloft.app.mjs), the _makeRequest method returns response.data which directly contains arrays for list endpoints like listPeople, listCadences, listUsers, and listAccounts. The propDefinitions correctly call .map() directly on these responses without needing to destructure a nested data property.

Applied to files:

  • components/popupsmart/popupsmart.app.mjs
📚 Learning: 2025-09-15T22:01:11.472Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 18362
File: components/leonardo_ai/actions/generate-image/generate-image.mjs:103-105
Timestamp: 2025-09-15T22:01:11.472Z
Learning: In Pipedream components, pipedream/platform's axios implementation automatically excludes undefined values from HTTP requests, so there's no need to manually check for truthiness before including properties in request payloads.

Applied to files:

  • components/popupsmart/popupsmart.app.mjs
📚 Learning: 2025-06-04T17:52:05.780Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: The Salesloft API list endpoints (listPeople, listCadences, listUsers, listAccounts) return arrays directly in the response body, not wrapped in a metadata object with a nested data property. The _makeRequest method correctly returns response.data which contains the arrays that can be mapped over directly in propDefinitions.

Applied to files:

  • components/popupsmart/popupsmart.app.mjs
📚 Learning: 2024-12-12T19:23:09.039Z
Learnt from: jcortes
Repo: PipedreamHQ/pipedream PR: 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/popupsmart/package.json
📚 Learning: 2024-10-10T19:18:27.998Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 14265
File: components/the_magic_drip/sources/common.mjs:35-43
Timestamp: 2024-10-10T19:18:27.998Z
Learning: In `components/the_magic_drip/sources/common.mjs`, when processing items in `getAndProcessData`, `savedIds` is intentionally updated with IDs of both emitted and non-emitted items to avoid emitting retroactive events upon first deployment and ensure only new events are emitted as they occur.

Applied to files:

  • components/popupsmart/sources/new-popup-form-data/new-popup-form-data.mjs
🧬 Code graph analysis (1)
components/popupsmart/popupsmart.app.mjs (1)
components/popupsmart/sources/new-popup-form-data/new-popup-form-data.mjs (1)
  • leads (36-42)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: pnpm publish
  • GitHub Check: Lint Code Base
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
🔇 Additional comments (5)
components/popupsmart/package.json (1)

3-16: LGTM!

The version bump to 0.1.0 is appropriate for the new source component functionality, and the @pipedream/platform dependency is correctly added to support the new API helpers.

components/popupsmart/sources/new-popup-form-data/test-event.mjs (1)

1-31: LGTM!

The test event payload is comprehensive and includes all relevant fields for a popup form submission event. The structure aligns well with the source component's expectations.

components/popupsmart/popupsmart.app.mjs (1)

8-31: LGTM!

The API helper methods are well-structured. The _baseUrl, _headers, and _makeRequest methods provide a clean abstraction for authenticated API calls, and listLeads correctly delegates to _makeRequest.

components/popupsmart/sources/new-popup-form-data/new-popup-form-data.mjs (2)

12-33: LGTM!

The props configuration and state management methods (_getLastDate and _setLastDate) are well-structured and follow Pipedream patterns correctly.


65-74: LGTM!

The deploy hook and run method follow standard Pipedream polling source patterns. The deploy hook correctly fetches an initial batch of 25 items, while the run method processes all new items on each timer execution.

… handling and improve performance by eliminating unnecessary array creation.
Copy link
Collaborator

@michelle0927 michelle0927 left a comment

Choose a reason for hiding this comment

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

LGTM! Ready for QA!

@vunguyenhung
Copy link
Collaborator

For Integration QA:

@vunguyenhung
Copy link
Collaborator

Hi everyone, all test cases are passed! Ready for release!

Test reports

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.

[Components] popupsmart

4 participants