-
Notifications
You must be signed in to change notification settings - Fork 5.4k
17080 components leaddyno #17099
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
17080 components leaddyno #17099
Conversation
Sources - New Affiliates - New Leads - New Purchases Actions - Create Affiliate - Create Lead - Create Purchase - Retrieve Lead
WalkthroughThis update introduces a comprehensive LeadDyno integration, adding the main app implementation, actions for creating and retrieving affiliates, leads, and purchases, as well as polling sources for new affiliates, leads, and purchases. Supporting modules for event emission, test data, utility parsing, and a package dependency update are also included. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Action
participant LeadDynoApp
participant LeadDynoAPI
User->>Action: Trigger (e.g., create affiliate/lead/purchase)
Action->>LeadDynoApp: Call method (e.g., createAffiliate)
LeadDynoApp->>LeadDynoAPI: HTTP request (POST/GET)
LeadDynoAPI-->>LeadDynoApp: API response
LeadDynoApp-->>Action: Return data
Action-->>User: Export summary and response
sequenceDiagram
participant Source
participant BaseSource
participant LeadDynoApp
participant LeadDynoAPI
participant DB
Source->>BaseSource: run/deploy
BaseSource->>DB: Get last processed ID
BaseSource->>LeadDynoApp: Paginate API (list* methods)
LeadDynoApp->>LeadDynoAPI: HTTP GET
LeadDynoAPI-->>LeadDynoApp: API data
LeadDynoApp-->>BaseSource: Return items
BaseSource->>DB: Update last processed ID
BaseSource-->>Source: Emit new events
Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes found. Suggested labels
Poem
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
components/leaddyno/actions/create-purchase/create-purchase.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/leaddyno/common/utils.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs ✨ Finishing Touches
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. 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
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: 6
♻️ Duplicate comments (1)
components/leaddyno/leaddyno.app.mjs (1)
44-51
: Same dropdown issue for “Affiliate” propertyMake the same
{ label, value }
change here to render options correctly.
🧹 Nitpick comments (7)
components/leaddyno/package.json (2)
3-3
: Consider tagging releases with conventional semver incrementsJumping straight from
0.0.x
to0.1.0
is fine, but please confirm this reflects a breaking‐change or new-feature release per semver.
14-17
: Lock the platform dependency to an exact patch to guarantee reproducible buildsUsing a caret (
^3.1.0
) lets every CI run pull newer 3.x releases, which might introduce untested behaviour. Pinning ("3.1.0"
) or using an exact range ("~3.1.0"
) keeps builds deterministic.components/leaddyno/sources/new-purchases/new-purchases.mjs (1)
17-19
: Guard against undefined fields in summaryIf
purchase_code
orpurchase_amount
is missing the summary renders “undefined”. Consider a fallback:-return `New Purchase: ${item.purchase_code} - $${item.purchase_amount}`; +const code = item.purchase_code ?? item.id ?? "unknown"; +const amount = item.purchase_amount ?? 0; +return `New Purchase: ${code} – $${amount}`;components/leaddyno/sources/new-affiliates/new-affiliates.mjs (1)
17-19
: Guard against undefined
item.email
can benull/undefined
on some LeadDyno accounts (e.g., deleted or partially-created affiliates).
A short fallback avoids rendering “New Affiliate: undefined
”.- return `New Affiliate: ${item.email}`; + return `New Affiliate: ${item?.email ?? "unknown"}`;components/leaddyno/actions/create-lead/create-lead.mjs (1)
86-102
: Stripundefined
fields before POSTing
undefined
properties are still serialised byaxios
/fetch
as the string"undefined"
in some environments, leading to 422/400 errors from the API.
Filter them out before the request:- data: { - email: this.email, - first_name: this.firstName, - last_name: this.lastName, - address1: this.address1, - address2: this.address2, - city: this.city, - state: this.state, - zipcode: this.zipcode, - country: this.country, - phone: this.phone, - affiliate: this.affiliate, - custom_status: this.customStatus, - }, + data: Object.fromEntries( + Object.entries({ + email: this.email, + first_name: this.firstName, + last_name: this.lastName, + address1: this.address1, + address2: this.address2, + city: this.city, + state: this.state, + zipcode: this.zipcode, + country: this.country, + phone: this.phone, + affiliate: this.affiliate, + custom_status: this.customStatus, + }).filter(([, v]) => v !== undefined), + ),components/leaddyno/actions/create-affiliate/create-affiliate.mjs (1)
60-71
: Mirror payload-cleaning logic across actionsFor consistency and to avoid
"undefined"
string values, apply the sameObject.fromEntries(...filter())
approach used in the Create Lead refactor.components/leaddyno/sources/new-leads/new-leads.mjs (1)
17-19
: Guard against missing e-mail in summary generation
item.email
may be null/undefined for anonymous leads, producing “New Lead: undefined
”.
Add a sensible fallback to keep the UI tidy.- return `New Lead: ${item.email}`; + return `New Lead: ${item.email ?? item.id ?? "unknown"}`;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (13)
components/leaddyno/actions/create-affiliate/create-affiliate.mjs
(1 hunks)components/leaddyno/actions/create-lead/create-lead.mjs
(1 hunks)components/leaddyno/actions/create-purchase/create-purchase.mjs
(1 hunks)components/leaddyno/actions/retrieve-lead/retrieve-lead.mjs
(1 hunks)components/leaddyno/leaddyno.app.mjs
(1 hunks)components/leaddyno/package.json
(2 hunks)components/leaddyno/sources/common/base.mjs
(1 hunks)components/leaddyno/sources/new-affiliates/new-affiliates.mjs
(1 hunks)components/leaddyno/sources/new-affiliates/test-event.mjs
(1 hunks)components/leaddyno/sources/new-leads/new-leads.mjs
(1 hunks)components/leaddyno/sources/new-leads/test-event.mjs
(1 hunks)components/leaddyno/sources/new-purchases/new-purchases.mjs
(1 hunks)components/leaddyno/sources/new-purchases/test-event.mjs
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: Publish TypeScript components
- GitHub Check: Verify TypeScript components
- GitHub Check: pnpm publish
- GitHub Check: Lint Code Base
🔇 Additional comments (6)
components/leaddyno/sources/new-affiliates/test-event.mjs (1)
1-26
: LGTM – good anonymised fixturecomponents/leaddyno/leaddyno.app.mjs (1)
75-79
: Verify the query-param name for the API keyLeadDyno docs usually accept
api_key
, notkey
. If incorrect, every request will 401.components/leaddyno/sources/new-leads/test-event.mjs (1)
1-27
: Fixture looks goodcomponents/leaddyno/sources/new-purchases/test-event.mjs (1)
1-40
: Fixture looks goodThe sample structure matches LeadDyno’s purchase schema and provides realistic payloads for local testing.
components/leaddyno/sources/common/base.mjs (1)
29-33
: Earlybreak
may skip newer items on subsequent pages
paginate
usually streams page-by-page in descending order (newest first).
If page 1 contains one old item, thebreak
exits the loop before even requesting page 2, potentially missing newer records that simply didn’t fit into page 1.Consider continuing iteration but
continue
whenitem.id <= lastId
.
Alternatively, build the stop-condition into the paginator itself (if supported) to avoid extra requests.components/leaddyno/actions/retrieve-lead/retrieve-lead.mjs (1)
20-26
: Great – lean action with clear summaryThe action cleanly delegates to the app, exports a useful summary, and returns the raw response. No issues spotted here. 👍
components/leaddyno/actions/create-purchase/create-purchase.mjs
Outdated
Show resolved
Hide resolved
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: 1
🧹 Nitpick comments (2)
components/leaddyno/common/utils.mjs (2)
4-15
: Consider deep parsing & DRYing the array branchRight now, items that themselves contain JSON-encoded arrays/objects inside strings are parsed only one level deep.
A small recursive helper (or a single call toparseObject
inside themap
) keeps the implementation concise and uniformly handles nested structures.- return obj.map((item) => { - if (typeof item === "string") { - try { - return JSON.parse(item); - } catch (e) { - return item; - } - } - return item; - }); + return obj.map(parseObject);
16-23
: Nit: narrow thetry/catch
and avoid duplicated logicParsing logic is duplicated for array items and single strings. Extracting a tiny
safeJsonParse(str)
function reduces repetition and centralizes error handling.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
components/leaddyno/actions/create-purchase/create-purchase.mjs
(1 hunks)components/leaddyno/common/utils.mjs
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- components/leaddyno/actions/create-purchase/create-purchase.mjs
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!
* [Components] leaddyno PipedreamHQ#17080 Sources - New Affiliates - New Leads - New Purchases Actions - Create Affiliate - Create Lead - Create Purchase - Retrieve Lead * pnpm update * some adjusts
Resolves #17080
Summary by CodeRabbit