-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[Components] etermin #13290 #18415
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
base: master
Are you sure you want to change the base?
[Components] etermin #13290 #18415
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
WalkthroughAdds eTermin integration features: new Create Contact and Create Voucher actions; expands app with propDefinitions, HTTP helpers, and API wrappers; introduces constants; updates package version and dependency. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant W as Workflow
participant AC as CreateContact Action
participant APP as eTermin App
participant API as eTermin API
W->>AC: run({ $ })
AC->>APP: createContact({ updatewhenexistsgdt, salutation, ... })
APP->>APP: _makeRequest({ method: POST, url: /contact, body })
note over APP: Adds headers: publickey, salt, signature
APP->>API: POST /contact
API-->>APP: 201 Created + payload
APP-->>AC: Response
AC-->>W: $summary + response
sequenceDiagram
autonumber
participant W as Workflow
participant AV as CreateVoucher Action
participant APP as eTermin App
participant API as eTermin API
W->>AV: run({ $ })
AV->>APP: createVoucher({ id, description, priceinclvat, ... })
APP->>APP: _makeRequest({ method: POST, url: /voucher, body })
note over APP: Auth headers: publickey, salt, signature
APP->>API: POST /voucher
API-->>APP: 201 Created + payload
APP-->>AV: Response
AV-->>W: $summary + response
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ 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. 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.
Actionable comments posted: 8
🧹 Nitpick comments (5)
components/etermin/package.json (1)
3-3
: Version bump: add changelog and release notes.Please update CHANGELOG and PR “WHY” to explain the 0.7.0 changes and any migration notes.
components/etermin/common/constants.mjs (1)
1-6
: Type mismatch: prop expects string, options are numbers.
updateWhenExistsgdt
istype: "string"
in the app, but options are numeric. Use string values to avoid implicit coercion.Apply this diff:
export default { UPDATE_OPTIONS: [ - 1, - 2, + "1", + "2", ], };components/etermin/actions/create-voucher/create-voucher.mjs (1)
9-53
: Optional: align prop casing with app for consistency.Here we expose
priceInclVat
,isPercentage
, etc., consistent with app. Good. Consider documenting units/format (currency, date format).components/etermin/actions/create-contact/create-contact.mjs (1)
29-40
: Optional: align prop keys with app’s camelCase.Consider renaming
lastname
->lastName
,firstname
->firstName
for consistency with app propDefinitions, or keep lowercase but be consistent in usage.components/etermin/etermin.app.mjs (1)
59-63
: Consider numeric type (and units) for price fields
priceInclVat
asstring
can cause accidental string concatenation in actions. Prefer number and document the currency/units (e.g., cents vs. major units).Apply:
- priceInclVat: { - type: "string", + priceInclVat: { + type: "integer", label: "Price Including VAT", - description: "Price including VAT of the voucher", + description: "Price including VAT of the voucher (in cents).", },
📜 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 (5)
components/etermin/actions/create-contact/create-contact.mjs
(1 hunks)components/etermin/actions/create-voucher/create-voucher.mjs
(1 hunks)components/etermin/common/constants.mjs
(1 hunks)components/etermin/etermin.app.mjs
(1 hunks)components/etermin/package.json
(2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 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/etermin/actions/create-contact/create-contact.mjs
🧬 Code graph analysis (2)
components/etermin/actions/create-contact/create-contact.mjs (1)
components/etermin/actions/create-voucher/create-voucher.mjs (1)
response
(55-67)
components/etermin/actions/create-voucher/create-voucher.mjs (1)
components/etermin/actions/create-contact/create-contact.mjs (1)
response
(61-73)
⏰ 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: Verify TypeScript components
- GitHub Check: Publish TypeScript components
- GitHub Check: Lint Code Base
🔇 Additional comments (3)
components/etermin/package.json (1)
16-16
: Verify @pipedream/platform ^3.1.0 compatibility.Confirm no breaking changes in axios wrapper or auth handling between ^3.0.0 and ^3.1.0 for these actions. Run a quick e2e on both actions.
components/etermin/actions/create-contact/create-contact.mjs (1)
60-73
: PII in query string; send body as JSON instead.Switch POST payload from
params
todata
to avoid leaking PII in URLs.Apply this diff:
- const response = await this.app.createContact({ - $, - params: { + const response = await this.app.createContact({ + $, + data: { updatewhenexistsgdt: this.updateWhenExistsgdt, salutation: this.salutation, title: this.title, lastname: this.lastname, firstname: this.firstname, company: this.company, birthday: this.birthday, email: this.email, }, });If the API only accepts query params, confirm and document that decision due to PII implications.
components/etermin/etermin.app.mjs (1)
1-2
: constants default export verified — leave import unchangedcomponents/etermin/common/constants.mjs exports a default object containing UPDATE_OPTIONS; the current
import constants from "./common/constants.mjs"
is correct.
updatewhenexistsgdt: this.updateWhenExistsgdt, | ||
salutation: this.salutation, | ||
title: this.title, | ||
lastname: this.lastName, | ||
firstname: this.firstName, | ||
company: this.company, | ||
birthday: this.birthday, | ||
email: this.email, |
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.
Wrong identifiers: last/first name come through as undefined.
Props are lastname
/firstname
(lowercase), but you reference this.lastName
/this.firstName
.
Apply this diff:
- lastname: this.lastName,
- firstname: this.firstName,
+ lastname: this.lastname,
+ firstname: this.firstname,
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
updatewhenexistsgdt: this.updateWhenExistsgdt, | |
salutation: this.salutation, | |
title: this.title, | |
lastname: this.lastName, | |
firstname: this.firstName, | |
company: this.company, | |
birthday: this.birthday, | |
email: this.email, | |
updatewhenexistsgdt: this.updateWhenExistsgdt, | |
salutation: this.salutation, | |
title: this.title, | |
lastname: this.lastname, | |
firstname: this.firstname, | |
company: this.company, | |
birthday: this.birthday, | |
email: this.email, |
🤖 Prompt for AI Agents
In components/etermin/actions/create-contact/create-contact.mjs around lines 64
to 71, the code references this.lastName and this.firstName but the incoming
props are named lastname and firstname (lowercase), causing undefined values;
update the object to use this.lastname and this.firstname (and search/replace
any other occurrences in this file to match the prop casing) so the correct
values are passed through.
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.
I agree with coderabbit. The props are firstname
and lastname
.
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.
@michelle0927 Thank you for confirming! You're absolutely right - the props are indeed defined as firstname
and lastname
(lowercase), so the references in the run
method should match that casing to ensure the correct values are passed through to the API.
The fix CodeRabbit suggested will resolve the undefined values issue and ensure the contact creation works as intended.
🐰✨
╭─────╮
│ ^ ^ │
│ ◡ │ confirmed!
╰─────╯
If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!
priceInclVat: { | ||
propDefinition: [ | ||
app, | ||
"priceInclVat", | ||
], | ||
}, | ||
isPercentage: { | ||
propDefinition: [ | ||
app, | ||
"isPercentage", | ||
], | ||
}, | ||
customerEmail: { |
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.
Add missing priceOriginal prop to match payload.
If the API expects priceoriginal
, expose a priceOriginal
prop wired to the app.
Apply this diff (insert after priceInclVat):
priceInclVat: {
propDefinition: [
app,
"priceInclVat",
],
},
+ priceOriginal: {
+ propDefinition: [
+ app,
+ "priceOriginal",
+ ],
+ },
Note: You'll also need to add priceOriginal
to propDefinitions in etermin.app.mjs
(see separate comment).
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
priceInclVat: { | |
propDefinition: [ | |
app, | |
"priceInclVat", | |
], | |
}, | |
isPercentage: { | |
propDefinition: [ | |
app, | |
"isPercentage", | |
], | |
}, | |
customerEmail: { | |
priceInclVat: { | |
propDefinition: [ | |
app, | |
"priceInclVat", | |
], | |
}, | |
priceOriginal: { | |
propDefinition: [ | |
app, | |
"priceOriginal", | |
], | |
}, | |
isPercentage: { | |
propDefinition: [ | |
app, | |
"isPercentage", | |
], | |
}, | |
customerEmail: { |
🤖 Prompt for AI Agents
In components/etermin/actions/create-voucher/create-voucher.mjs around lines 23
to 35, the action props are missing a priceOriginal mapping required by the API;
insert a new priceOriginal property immediately after priceInclVat that wires to
the app propDefinition (propDefinition: [app, "priceOriginal"]). Also update
propDefinitions in etermin.app.mjs to include priceOriginal so the app exposes
that prop key to actions.
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.
I agree with coderabbit. Prop priceOriginal
is missing.
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.
@michelle0927 Thank you for confirming! Yes, the priceOriginal
prop is missing and needs to be added to match the API payload requirements. The action currently references priceoriginal
in the run method but doesn't expose it as a prop for users to configure.
const response = await this.app.createVoucher({ | ||
$, | ||
params: { | ||
id: this.id, | ||
description: this.description, | ||
priceinclvat: this.priceInClvat, | ||
priceoriginal: this.priceOriginal, | ||
ispercentage: this.isPercentage, | ||
customeremail: this.customerEmail, | ||
validfrom: this.validFrom, | ||
validuntil: this.validUntil, | ||
}, | ||
}); |
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.
🧩 Analysis chain
PII in query string; send body as JSON instead.
POSTing customer data via params
puts PII in URLs/logs. Prefer data
.
Apply this diff:
- const response = await this.app.createVoucher({
- $,
- params: {
+ const response = await this.app.createVoucher({
+ $,
+ data: {
id: this.id,
description: this.description,
- priceinclvat: this.priceInClvat,
- priceoriginal: this.priceOriginal,
+ priceinclvat: this.priceInclVat,
+ ...(this.priceOriginal != null ? { priceoriginal: this.priceOriginal } : {}),
ispercentage: this.isPercentage,
customeremail: this.customerEmail,
validfrom: this.validFrom,
validuntil: this.validUntil,
},
});
Confirm the eTermin endpoint accepts JSON; if it requires form-encoded, set headers: { "Content-Type": "application/x-www-form-urlencoded" }
and send a serialized body.
🏁 Script executed:
#!/bin/bash
# Search for the definition and implementation of createVoucher in the codebase
rg -nP "\bcreateVoucher\b" -n -C3 .
Length of output: 1036
🏁 Script executed:
#!/bin/bash
sed -n '1,260p' components/etermin/etermin.app.mjs
Length of output: 3097
🏁 Script executed:
#!/bin/bash
rg -n "swagger" -i -C3 .
rg -n "openapi" -i -C3 .
rg -n "docs" -i -C3 .
Length of output: 265540
🏁 Script executed:
#!/bin/bash
# Fetch eTermin API spec and inspect /voucher POST request details
curl -s https://api.swaggerhub.com/apis/etermin.net/eTermin-API/1.0.0/swagger.json \
| jq '.paths["/voucher"].post | {parameters, requestBody}'
Length of output: 47
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Dumping /voucher path from SwaggerHub JSON (if present)..."
curl -sS "https://api.swaggerhub.com/apis/etermin.net/eTermin-API/1.0.0/swagger.json" -o /tmp/etermin_swagger.json || true
jq 'paths | map(tostring) | .[]' /tmp/etermin_swagger.json | head -n 20 || true
echo "--- Searching for 'voucher' in swagger JSON ---"
jq '.. | objects | select(has("paths") or has("components"))' /tmp/etermin_swagger.json | head -n 1 || true
jq '.. | select(type=="object" and (.path? // .) | tostring | test("voucher"; "i") )' /tmp/etermin_swagger.json | jq -c '.' | head -n 10 || true
echo "--- Full /voucher entry (if exists) ---"
jq '.paths["/voucher"]' /tmp/etermin_swagger.json || true
echo "--- All paths containing voucher ---"
jq 'keys[] as $k | select($k | test("voucher"; "i")) | $k' /tmp/etermin_swagger.json.paths || true
Length of output: 456
🏁 Script executed:
#!/bin/bash
sed -n '1,240p' components/etermin/actions/create-voucher/create-voucher.mjs
Length of output: 1503
Move PII out of the query string — send POST body (data) and fix typos
- File: components/etermin/actions/create-voucher/create-voucher.mjs (run() — lines ~55-67). Replace params with data so customerEmail (PII) is sent in the request body, not the URL. Fix variable typos (this.priceInClvat → this.priceInclVat) and remove/define priceOriginal (currently not a prop).
- Suggested patch (keeps API field names, moves payload to body, makes priceoriginal optional):
- const response = await this.app.createVoucher({
- $,
- params: {
+ const response = await this.app.createVoucher({
+ $,
+ data: {
id: this.id,
description: this.description,
- priceinclvat: this.priceInClvat,
- priceoriginal: this.priceOriginal,
+ priceinclvat: this.priceInclVat,
+ ...(this.priceOriginal != null ? { priceoriginal: this.priceOriginal } : {}),
ispercentage: this.isPercentage,
customeremail: this.customerEmail,
validfrom: this.validFrom,
validuntil: this.validUntil,
},
});
- I could not find a requestBody definition for /voucher in the SwaggerHub JSON (swagger.json returned null for /voucher). Verify the eTermin endpoint accepts JSON; if it requires form-encoded data, set headers: { "Content-Type": "application/x-www-form-urlencoded" } and send a serialized body instead.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const response = await this.app.createVoucher({ | |
$, | |
params: { | |
id: this.id, | |
description: this.description, | |
priceinclvat: this.priceInClvat, | |
priceoriginal: this.priceOriginal, | |
ispercentage: this.isPercentage, | |
customeremail: this.customerEmail, | |
validfrom: this.validFrom, | |
validuntil: this.validUntil, | |
}, | |
}); | |
const response = await this.app.createVoucher({ | |
$, | |
data: { | |
id: this.id, | |
description: this.description, | |
priceinclvat: this.priceInclVat, | |
...(this.priceOriginal != null ? { priceoriginal: this.priceOriginal } : {}), | |
ispercentage: this.isPercentage, | |
customeremail: this.customerEmail, | |
validfrom: this.validFrom, | |
validuntil: this.validUntil, | |
}, | |
}); |
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.
I agree with coderabbit. Need to send data
instead of params
.
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.
@michelle0927 Thank you for confirming! Yes, sending customer email and other sensitive data via query parameters (params
) would expose PII in URLs and logs, which is a security concern. Moving to data
will send the payload in the request body as intended for POST requests.
The suggested fix also resolves the typos (priceInClvat
→ priceInclVat
) and handles the undefined priceOriginal
property appropriately by making it optional.
If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!
priceinclvat: this.priceInClvat, | ||
priceoriginal: this.priceOriginal, |
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.
Broken payload mapping: typo and missing prop.
this.priceInClvat
is a typo; should bethis.priceInclVat
.priceoriginal
referencesthis.priceOriginal
, but there’s nopriceOriginal
prop defined here (or in the app).
Apply this diff:
- priceinclvat: this.priceInClvat,
- priceoriginal: this.priceOriginal,
+ priceinclvat: this.priceInclVat,
+ // priceoriginal requires a prop; see follow-up comment to add it in app + action
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
priceinclvat: this.priceInClvat, | |
priceoriginal: this.priceOriginal, | |
priceinclvat: this.priceInclVat, | |
// priceoriginal requires a prop; see follow-up comment to add it in app + action |
🤖 Prompt for AI Agents
In components/etermin/actions/create-voucher/create-voucher.mjs around lines
60-61, fix the broken payload mapping: correct the typo by mapping priceinclvat
to this.priceInclVat (not this.priceInClvat), and ensure priceoriginal is mapped
from a real source — either add a component prop named priceOriginal and map
priceoriginal: this.priceOriginal, or compute/derive the original price here and
use that value; update the component's props/initialization accordingly so the
referenced property actually exists.
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.
I agree with coderabbit. Need to fix typo in priceInclVat
.
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.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if priceOriginal is defined in the app propDefinitions
cat components/etermin/etermin.app.mjs | grep -A5 -B5 "priceOriginal"
Length of output: 0
🏁 Script executed:
#!/bin/bash
# Check what propDefinitions are available in the app file
cat components/etermin/etermin.app.mjs
Length of output: 3097
@michelle0927 Thank you for confirming! You're absolutely right about the typo.
I've checked the app file and confirmed there are two issues that need fixing:
- Typo confirmed:
this.priceInClvat
should bethis.priceInclVat
✅ - Missing prop:
this.priceOriginal
doesn't exist in the app's propDefinitions
Looking at the available propDefinitions, I only see these voucher-related props:
id
,description
,priceInclVat
,isPercentage
,customerEmail
,validFrom
,validUntil
For the priceoriginal
parameter, you have a few options:
Option 1: Add a priceOriginal
propDefinition to the app file
Option 2: Remove the priceoriginal
parameter if it's not required by the API
Option 3: Compute it from priceInclVat
if there's a relationship (e.g., original = inclVat / (1 + vatRate))
Could you clarify what the priceoriginal
parameter should represent and how you'd like to handle it? I can help implement whichever approach you prefer.
// Current broken code:
priceinclvat: this.priceInClvat, // typo
priceoriginal: this.priceOriginal, // missing prop
// Fix for typo:
priceinclvat: this.priceInclVat, // ✅
// Still need to decide what to do with priceoriginal
updateWhenExistsgdt: { | ||
type: "string", | ||
label: "Update When Exists", | ||
description: "Set to 1 to check if the contact is already existing. If so the existing contact gets updated. Needs email or firstname, lastname and birthday", | ||
options: constants.UPDATE_OPTIONS, | ||
}, |
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.
🧩 Analysis chain
Typo in prop key: “updateWhenExistsgdt” likely unintended; also tighten copy
The key name looks misspelled and will leak into action props. Rename to updateWhenExists
and adjust description.
Apply:
- updateWhenExistsgdt: {
+ updateWhenExists: {
type: "string",
label: "Update When Exists",
- description: "Set to 1 to check if the contact is already existing. If so the existing contact gets updated. Needs email or firstname, lastname and birthday",
+ description: "Set to 1 to check if the contact already exists. If found, the existing contact is updated. Requires email, or first name + last name + birthday.",
options: constants.UPDATE_OPTIONS,
},
If actions reference the old key, update them accordingly:
🏁 Script executed:
#!/bin/bash
# Find usages of the old key in eTermin actions
rg -nC2 '\bupdateWhenExistsgdt\b' --type=ts --type=js --type=jsx --type=tsx components/etermin
Length of output: 27
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== rg search for 'updateWhenExistsgdt' =="
if command -v rg >/dev/null 2>&1; then
rg -nC2 'updateWhenExistsgdt' || true
else
echo "rg not found; falling back to grep"
grep -R -n --line-number -C2 'updateWhenExistsgdt' . || true
fi
echo "== rg search for 'updateWhenExists' =="
if command -v rg >/dev/null 2>&1; then
rg -nC2 '\bupdateWhenExists\b' -S || true
else
grep -R -n --line-number -C2 'updateWhenExists' . || true
fi
echo "== list components/etermin files =="
if [ -d components/etermin ]; then
find components/etermin -maxdepth 2 -type f -print || true
if [ -f components/etermin/etermin.app.mjs ]; then
echo "== head of components/etermin/etermin.app.mjs =="
sed -n '1,200p' components/etermin/etermin.app.mjs || true
else
echo "components/etermin/etermin.app.mjs not found"
fi
else
echo "components/etermin directory not found"
fi
Length of output: 4820
Rename prop key to updateWhenExists
and update action usages
- Fix prop definition in components/etermin/etermin.app.mjs — rename key and tighten description (apply diff below).
- updateWhenExistsgdt: {
+ updateWhenExists: {
type: "string",
label: "Update When Exists",
- description: "Set to 1 to check if the contact is already existing. If so the existing contact gets updated. Needs email or firstname, lastname and birthday",
+ description: "Set to 1 to check if the contact already exists. If found, the existing contact is updated. Requires email, or first name + last name + birthday.",
options: constants.UPDATE_OPTIONS,
},
- Update components/etermin/actions/create-contact/create-contact.mjs: change the propDefinition reference from
"updateWhenExistsgdt"
→"updateWhenExists"
and replace any use ofthis.updateWhenExistsgdt
withthis.updateWhenExists
(leave the outgoing API param keyupdatewhenexistsgdt
if that matches the API).
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
updateWhenExistsgdt: { | |
type: "string", | |
label: "Update When Exists", | |
description: "Set to 1 to check if the contact is already existing. If so the existing contact gets updated. Needs email or firstname, lastname and birthday", | |
options: constants.UPDATE_OPTIONS, | |
}, | |
updateWhenExists: { | |
type: "string", | |
label: "Update When Exists", | |
description: "Set to 1 to check if the contact already exists. If found, the existing contact is updated. Requires email, or first name + last name + birthday.", | |
options: constants.UPDATE_OPTIONS, | |
}, |
🤖 Prompt for AI Agents
In components/etermin/etermin.app.mjs around lines 8-13 the prop key is
misspelled as "updateWhenExistsgdt"; rename the prop key to "updateWhenExists"
and tighten the description accordingly (keep type, label, options but update
description text). Then in
components/etermin/actions/create-contact/create-contact.mjs update the
propDefinition reference from "updateWhenExistsgdt" to "updateWhenExists" and
replace any usages of this.updateWhenExistsgdt with this.updateWhenExists while
leaving the outgoing API parameter key (e.g., "updatewhenexistsgdt") unchanged
if required by the API.
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.
Agree with coderabbit. Need to fix the prop description.
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.
🧩 Analysis chain
@michelle0927 Thanks for confirming! Let me check for all references to the misspelled prop and provide the complete fix.
Based on the search results and the need to fix the prop key, here's the complete fix:
1. Fix the prop definition in components/etermin/etermin.app.mjs
:
updateWhenExists: {
type: "string",
label: "Update When Exists",
description: "Set to 1 to check if the contact already exists. If found, the existing contact is updated. Requires email, or first name + last name + birthday.",
options: constants.UPDATE_OPTIONS,
},
2. Update the action file components/etermin/actions/create-contact/create-contact.mjs
:
- Change the propDefinition reference from
"updateWhenExistsgdt"
to"updateWhenExists"
- Update any usage of
this.updateWhenExistsgdt
tothis.updateWhenExists
- Keep the API parameter key as
updatewhenexistsgdt
if that's what the eTermin API expects
This ensures consistency across the codebase while maintaining API compatibility.
🏁 Script executed:
#!/bin/bash
# Find all references to the misspelled prop name
echo "=== Searching for 'updateWhenExistsgdt' references ==="
rg -n "updateWhenExistsgdt" components/etermin/
echo -e "\n=== Searching for any variations ==="
rg -n -i "updatewhenexists" components/etermin/
echo -e "\n=== List all eTermin action files ==="
find components/etermin/actions -name "*.mjs" -type f 2>/dev/null || echo "No action files found"
Length of output: 991
Perfect! I can see exactly where the misspelled prop is used. Here's the complete fix for all affected files:
1. Fix in components/etermin/etermin.app.mjs
(Line 8):
updateWhenExists: {
type: "string",
label: "Update When Exists",
description: "Set to 1 to check if the contact already exists. If found, the existing contact is updated. Requires email, or first name + last name + birthday.",
options: constants.UPDATE_OPTIONS,
},
2. Fix in components/etermin/actions/create-contact/create-contact.mjs
:
You'll need to update 3 places in this file:
- Line 11: Change the prop name
updateWhenExists: {
- Line 14: Update the propDefinition reference
"updateWhenExists",
- Line 64: Update the property access (but keep the API parameter key)
updatewhenexistsgdt: this.updateWhenExists,
This maintains API compatibility by keeping the parameter key updatewhenexistsgdt
that the eTermin API expects, while fixing the internal prop naming throughout the codebase.
The create-voucher action doesn't use this prop, so no changes are needed there.
🧠 Learnings used
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".
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.
@michelle0927 Thank you for confirming! The fix is already outlined in the previous comment. The misspelled prop key updateWhenExistsgdt
should be renamed to updateWhenExists
in both:
components/etermin/etermin.app.mjs
- Update the prop definition and improve the descriptioncomponents/etermin/actions/create-contact/create-contact.mjs
- Update the propDefinition reference and property access
The API parameter key updatewhenexistsgdt
can remain unchanged to maintain compatibility with the eTermin API.
🧠 Learnings used
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".
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#14229
File: components/americommerce/actions/update-customer/update-customer.mjs:89-94
Timestamp: 2024-10-08T16:42:59.225Z
Learning: When defining boolean properties in AmeriCommerce components (e.g., in `update-customer.mjs`), ensure that the label and description are consistent and clearly indicate the intent, especially when using negations like "No Account", to avoid confusion.
type: "boolean", | ||
label: "Is Percentage", | ||
description: "Indicates if the value of the vaucher is a percentage", | ||
}, |
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.
User-facing typo: “vaucher” → “voucher”
Fix the typo in the description.
Apply:
- description: "Indicates if the value of the vaucher is a percentage",
+ description: "Indicates if the value of the voucher is a percentage",
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
type: "boolean", | |
label: "Is Percentage", | |
description: "Indicates if the value of the vaucher is a percentage", | |
}, | |
type: "boolean", | |
label: "Is Percentage", | |
description: "Indicates if the value of the voucher is a percentage", | |
}, |
🤖 Prompt for AI Agents
In components/etermin/etermin.app.mjs around lines 65 to 68, the description
string contains a typo "vaucher"; update the description to read "Indicates if
the value of the voucher is a percentage" (replace "vaucher" with "voucher") and
check nearby strings for the same misspelling to correct them as well.
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.
Agree with coderabbit. Need to fix typo.
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.
@michelle0927 Thank you for confirming! You're absolutely right - the typo needs to be fixed.
The correction needed is in Line 66 of components/etermin/etermin.app.mjs
:
description: "Indicates if the value of the voucher is a percentage",
Simply change "vaucher" to "voucher" in the description string for the isPercentage
propDefinition.
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: 5
🧹 Nitpick comments (3)
components/etermin/actions/create-contact/create-contact.mjs (1)
29-39
: Optional: Align prop keys with app propDefinitions for consistency.Rename
lastname
→lastName
,firstname
→firstName
to mirror app fields and avoid future mapping errors.- lastname: { + lastName: { propDefinition: [ app, "lastName", ], }, - firstname: { + firstName: { propDefinition: [ app, "firstName", ], },And update
run
accordingly.components/etermin/actions/create-voucher/create-voucher.mjs (1)
6-6
: Doc link OK; consider adding required/optional notes.If API enforces required fields (e.g., id or price), reflect that in prop descriptions.
components/etermin/etermin.app.mjs (1)
59-83
: Fix typos & verify voucher field types.File: components/etermin/etermin.app.mjs (lines 59–83)
- Typos: "vaucher" → "voucher"; "offer" → "voucher".
- Type suggestion: prefer number for priceInclVat (allow decimals/cents) and boolean for isPercentage — eTermin support shows vouchers can be absolute amounts (e.g. "10" → €10) or percentages (e.g. "50%"), but official API field types weren't found.
- Action: provide the exact API endpoint or a sample request body so we can confirm whether priceInclVat must be integer (cents) or decimal and whether isPercentage is 0/1 or true/false.
- description: "Indicates if the value of the vaucher is a percentage", + description: "Indicates if the value of the voucher is a percentage", @@ - description: "Email address of the customer receiving the offer", + description: "Email address of the customer receiving the voucher",
📜 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 (5)
components/etermin/actions/create-contact/create-contact.mjs
(1 hunks)components/etermin/actions/create-voucher/create-voucher.mjs
(1 hunks)components/etermin/common/constants.mjs
(1 hunks)components/etermin/etermin.app.mjs
(1 hunks)components/etermin/package.json
(2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 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/etermin/actions/create-contact/create-contact.mjs
🧬 Code graph analysis (2)
components/etermin/actions/create-voucher/create-voucher.mjs (1)
components/etermin/actions/create-contact/create-contact.mjs (1)
response
(61-73)
components/etermin/actions/create-contact/create-contact.mjs (1)
components/etermin/actions/create-voucher/create-voucher.mjs (1)
response
(55-67)
🔇 Additional comments (3)
components/etermin/package.json (1)
3-3
: Version bump OK — confirm @pipedream/platform ^3.1.0 compatibility.Repository uses the platform axios helper widely (e.g. packages/prompts/src/index.ts imports axios from "@pipedream/platform"; implementation in platform/lib/axios.ts) — cannot auto-verify v3.1 compatibility. Run CI/tests and confirm v3.1 does not change the axios helper signature or defineComponent/export behavior before merging.
components/etermin/etermin.app.mjs (1)
89-106
: POST payload must be application/x-www-form-urlencoded; confirm no POSTs useparams
eTermin requires POST fields as form-encoded and headers "publickey", "salt", "signature". _makeRequest sets those headers, but I could not locate POST callers using
params
under components/etermin — change POST requests to send the payload in axiosdata
as form-encoded (e.g., qs.stringify) and set Content-Type: application/x-www-form-urlencoded if any callers currently pass payload viaparams
. Location: components/etermin/etermin.app.mjs (lines 89–106).components/etermin/common/constants.mjs (1)
2-5
: Change UPDATE_OPTIONS to labeled "0"/"1" string values and verify eTermin parameter/valuesNo public eTermin docs were found for the parameter "updatewhenexistsgdt" — cannot confirm allowed values; apply the change below only after verifying the parameter name and that it accepts 0/1 (strings).
File: components/etermin/common/constants.mjs (lines 2-5)
export default { - UPDATE_OPTIONS: [ - 1, - 2, - ], + UPDATE_OPTIONS: [ + { label: "No (0) — don't update existing", value: "0" }, + { label: "Yes (1) — update if exists", value: "1" }, + ], };
updatewhenexistsgdt: this.updateWhenExistsgdt, | ||
salutation: this.salutation, | ||
title: this.title, | ||
lastname: this.lastName, | ||
firstname: this.firstName, | ||
company: this.company, | ||
birthday: this.birthday, | ||
email: this.email, |
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.
Fix broken mappings for last/first name.
Props are lastname
/firstname
; mapping references this.lastName
/this.firstName
, causing undefined fields sent to API.
params: {
updatewhenexistsgdt: this.updateWhenExistsgdt,
salutation: this.salutation,
title: this.title,
- lastname: this.lastName,
- firstname: this.firstName,
+ lastname: this.lastname,
+ firstname: this.firstname,
company: this.company,
birthday: this.birthday,
email: this.email,
},
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
updatewhenexistsgdt: this.updateWhenExistsgdt, | |
salutation: this.salutation, | |
title: this.title, | |
lastname: this.lastName, | |
firstname: this.firstName, | |
company: this.company, | |
birthday: this.birthday, | |
email: this.email, | |
updatewhenexistsgdt: this.updateWhenExistsgdt, | |
salutation: this.salutation, | |
title: this.title, | |
lastname: this.lastname, | |
firstname: this.firstname, | |
company: this.company, | |
birthday: this.birthday, | |
email: this.email, |
🤖 Prompt for AI Agents
In components/etermin/actions/create-contact/create-contact.mjs around lines
64-71 the mapping uses this.lastName and this.firstName but the component props
are named lastname and firstname; change the mappings to use this.lastname and
this.firstname (and verify casing consistently across the file), so lastname:
this.lastname and firstname: this.firstname are sent to the API.
priceinclvat: this.priceInClvat, | ||
priceoriginal: this.priceOriginal, | ||
ispercentage: this.isPercentage, | ||
customeremail: this.customerEmail, | ||
validfrom: this.validFrom, | ||
validuntil: this.validUntil, | ||
}, |
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.
🧩 Analysis chain
Fix typos and remove/define missing fields to prevent runtime errors.
this.priceInClvat
→this.priceInclVat
(typo).this.priceOriginal
is not defined in props/app; either add its propDefinition or drop it.- Consider normalizing boolean to 0/1 if API expects numeric.
params: {
id: this.id,
description: this.description,
- priceinclvat: this.priceInClvat,
- priceoriginal: this.priceOriginal,
- ispercentage: this.isPercentage,
+ priceinclvat: this.priceInclVat,
+ // priceoriginal: this.priceOriginal, // Uncomment only if you add a prop and API requires it
+ ispercentage: this.isPercentage ? 1 : 0,
customeremail: this.customerEmail,
validfrom: this.validFrom,
validuntil: this.validUntil,
},
🏁 Script executed:
#!/bin/bash
# Find other typos/mismatches
rg -n -C1 'priceInClvat|priceOriginal|priceoriginal|priceinclvat|ispercentage|customeremail|validfrom|validuntil' components/etermin
Length of output: 799
🌐 Web query:
Does eTermin’s voucher API require `priceoriginal`? If yes, what’s its exact name and type?
💡 Result:
Short answer: No — eTermin’s voucher endpoints do not use a field called priceoriginal. eTermin’s docs/Integrations show voucher fields like "Price (incl. VAT)" / "Price Incl. VAT" when creating vouchers (e.g., in eTermin support articles and the Zapier eTermin "Create Voucher" action). [1][2]
Sources:
- eTermin support: creating/selling vouchers (shows voucher price/price incl. VAT). [1]
- Zapier eTermin integration (Create Voucher action lists "Price Incl. VAT"). [2]
Fix typo, remove unused field, and optionally normalize boolean in create-voucher.
- File: components/etermin/actions/create-voucher/create-voucher.mjs (lines 60–66): change this.priceInClvat → this.priceInclVat; drop priceoriginal (eTermin voucher API does not use priceOriginal); send ispercentage as 0/1 only if the API requires numeric flags.
params: {
id: this.id,
description: this.description,
- priceinclvat: this.priceInClvat,
- priceoriginal: this.priceOriginal,
- ispercentage: this.isPercentage,
+ priceinclvat: this.priceInclVat,
+ // priceoriginal: this.priceOriginal, // remove unless you add a prop and API requires it
+ ispercentage: this.isPercentage ? 1 : 0, // use numeric only if API expects it
customeremail: this.customerEmail,
validfrom: this.validFrom,
validuntil: this.validUntil,
},
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
priceinclvat: this.priceInClvat, | |
priceoriginal: this.priceOriginal, | |
ispercentage: this.isPercentage, | |
customeremail: this.customerEmail, | |
validfrom: this.validFrom, | |
validuntil: this.validUntil, | |
}, | |
priceinclvat: this.priceInclVat, | |
// priceoriginal: this.priceOriginal, // remove unless you add a prop and API requires it | |
ispercentage: this.isPercentage ? 1 : 0, // use numeric only if API expects it | |
customeremail: this.customerEmail, | |
validfrom: this.validFrom, | |
validuntil: this.validUntil, | |
}, |
🤖 Prompt for AI Agents
In components/etermin/actions/create-voucher/create-voucher.mjs around lines 60
to 66, fix the typo and unused field: rename this.priceInClvat to
this.priceInclVat, remove the priceoriginal property entirely (eTermin API
doesn't use it), and normalize ispercentage to the API-expected numeric flag by
sending (this.isPercentage ? 1 : 0) instead of a raw boolean.
updatewhenexistsgdt: this.updateWhenExistsgdt, | ||
salutation: this.salutation, | ||
title: this.title, | ||
lastname: this.lastName, | ||
firstname: this.firstName, | ||
company: this.company, | ||
birthday: this.birthday, | ||
email: this.email, |
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.
I agree with coderabbit. The props are firstname
and lastname
.
priceInclVat: { | ||
propDefinition: [ | ||
app, | ||
"priceInclVat", | ||
], | ||
}, | ||
isPercentage: { | ||
propDefinition: [ | ||
app, | ||
"isPercentage", | ||
], | ||
}, | ||
customerEmail: { |
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.
I agree with coderabbit. Prop priceOriginal
is missing.
priceinclvat: this.priceInClvat, | ||
priceoriginal: this.priceOriginal, |
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.
I agree with coderabbit. Need to fix typo in priceInclVat
.
const response = await this.app.createVoucher({ | ||
$, | ||
params: { | ||
id: this.id, | ||
description: this.description, | ||
priceinclvat: this.priceInClvat, | ||
priceoriginal: this.priceOriginal, | ||
ispercentage: this.isPercentage, | ||
customeremail: this.customerEmail, | ||
validfrom: this.validFrom, | ||
validuntil: this.validUntil, | ||
}, | ||
}); |
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.
I agree with coderabbit. Need to send data
instead of params
.
updateWhenExistsgdt: { | ||
type: "string", | ||
label: "Update When Exists", | ||
description: "Set to 1 to check if the contact is already existing. If so the existing contact gets updated. Needs email or firstname, lastname and birthday", | ||
options: constants.UPDATE_OPTIONS, | ||
}, |
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.
Agree with coderabbit. Need to fix the prop description.
id: { | ||
type: "string", | ||
label: "ID", | ||
description: "ID of the voucher", | ||
}, |
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.
Prop id
needs to use async options.
type: "boolean", | ||
label: "Is Percentage", | ||
description: "Indicates if the value of the vaucher is a percentage", | ||
}, |
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.
Agree with coderabbit. Need to fix typo.
Hi @lcaresia, one more comment: Remember to add annotations to the new components. Slack context |
WHY
Summary by CodeRabbit