-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - esendex #16943
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
New Components - esendex #16943
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
WalkthroughThis change introduces a new Esendex app integration, including core API methods, two action components for sending SMS and voice messages, a polling source for new message events, and supporting constants. It removes an old TypeScript app file and Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Action (SMS/Voice)
participant Esendex App
participant Esendex API
User->>Action (SMS/Voice): Provide message details and credentials
Action (SMS/Voice)->>Esendex App: Call sendMessage() with parameters
Esendex App->>Esendex API: POST /messagedispatcher with message payload
Esendex API-->>Esendex App: Return API response
Esendex App-->>Action (SMS/Voice): Return result
Action (SMS/Voice)-->>User: Emit summary/response
sequenceDiagram
participant Source (New Message)
participant Esendex App
participant Esendex API
participant User Workflow
Source (New Message)->>Esendex App: listMessages(since last timestamp)
Esendex App->>Esendex API: GET /messageheaders
Esendex API-->>Esendex App: Return message headers
Esendex App-->>Source (New Message): Return messages
Source (New Message)-->>User Workflow: Emit event for each new message
Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
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/esendex/actions/send-sms-message/send-sms-message.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/esendex/sources/new-message-received/new-message-received.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/esendex/actions/send-voice-message/send-voice-message.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
⏰ Context from checks skipped due to timeout of 90000ms (4)
✨ 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 (
|
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: 7
🧹 Nitpick comments (3)
components/esendex/actions/send-voice-message/send-voice-message.mjs (2)
80-80: Fix typo in export summary."voicemessage" should be "voice message" for better readability.
Apply this fix:
- $.export("$summary", `Successfully sent voicemessage to ${this.to}`); + $.export("$summary", `Successfully sent voice message to ${this.to}`);
18-22: Consider adding phone number validation.The phone number field accepts any string but should ideally validate the format to prevent API errors and improve user experience.
Consider adding validation pattern or format description:
to: { type: "string", label: "To", - description: "The phone number to send the message to. E.g. `447700900123`", + description: "The phone number to send the message to in international format (digits only). E.g. `447700900123`", + pattern: "^[1-9]\\d{1,14}$", },components/esendex/actions/send-sms-message/send-sms-message.mjs (1)
31-31: Consider shortening the description for better readability.The description for the "from" prop is quite lengthy and could be simplified while retaining the essential information.
- description: "The default alphanumeric originator that the message appears to originate from. This must be either a valid phone number or an alphanumeric value with a maximum length of 11 characters, that may contain letters, numbers and the following special characters: * $ ? ! " # % & _ - , @ ' +. Special characters may not work for all networks in France.", + description: "The alphanumeric originator (max 11 chars). Must be a valid phone number or alphanumeric string with supported special characters: * $ ? ! \" # % & _ - , @ ' +. Note: Special characters may not work for all networks in France.",
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (9)
components/esendex/.gitignore(0 hunks)components/esendex/actions/send-sms-message/send-sms-message.mjs(1 hunks)components/esendex/actions/send-voice-message/send-voice-message.mjs(1 hunks)components/esendex/app/esendex.app.ts(0 hunks)components/esendex/common/constants.mjs(1 hunks)components/esendex/esendex.app.mjs(1 hunks)components/esendex/package.json(1 hunks)components/esendex/sources/new-message-received/new-message-received.mjs(1 hunks)components/esendex/sources/new-message-received/test-event.mjs(1 hunks)
💤 Files with no reviewable changes (2)
- components/esendex/.gitignore
- components/esendex/app/esendex.app.ts
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: pnpm publish
- GitHub Check: Publish TypeScript components
- GitHub Check: Verify TypeScript components
🔇 Additional comments (6)
components/esendex/common/constants.mjs (1)
1-59: LGTM! Well-structured constants module.The constants are well-organized and appropriately named. The locale codes for languages are correct, and the message statuses cover comprehensive states for message lifecycle tracking.
components/esendex/package.json (1)
3-18: LGTM! Package metadata properly updated.The version bump to 0.1.0 and dependency additions are appropriate for the new Esendex integration. The shift from a build output to direct source file as the main entry point aligns with the migration away from TypeScript.
components/esendex/sources/new-message-received/test-event.mjs (1)
1-29: LGTM! Comprehensive test event data.The test event provides a realistic example of an Esendex message with all the expected fields including timestamps, status, phone numbers, and message metadata. This will be useful for testing the source component.
components/esendex/esendex.app.mjs (1)
24-35: Well-structured API request method.The
_makeRequestmethod properly implements basic authentication and follows good patterns for API client design.components/esendex/sources/new-message-received/new-message-received.mjs (2)
65-71: Good handling of XML response normalization.The logic properly handles both single message and array responses from the XML parser, ensuring consistent array processing.
78-90:❓ Verification inconclusive
Verify timestamp comparison logic for edge cases.
The timestamp comparison logic looks correct, but consider potential edge cases where
laststatusatmight be null or invalid.
🏁 Script executed:
#!/bin/bash # Description: Check for any existing examples of timestamp handling patterns in similar components # Search for similar timestamp comparison patterns in other source components rg -A 5 -B 5 "Date\.parse.*laststatusat|Date\.parse.*timestamp" --type jsLength of output: 75
Verify timestamp comparison logic for edge cases
It’s unclear whether
message.laststatusatcan ever be null, undefined, or an invalid string—callingDate.parseon those will returnNaN, which may lead to unexpected behavior (everything compares false). Please confirm the format guarantees oflaststatusatin your message schema, and if it can be missing or malformed, add a guard:
- Check that
message.laststatusatis a non-empty string before parsing.- Ensure
Date.parse(message.laststatusat)is notNaN(e.g.!isNaN(Date.parse(...))) before comparing.- Decide how to handle messages with invalid or missing timestamps (skip, default to
0, etc.).No other instances of similar timestamp handling were found in the codebase; please verify this approach against your message definitions.
components/esendex/actions/send-voice-message/send-voice-message.mjs
Outdated
Show resolved
Hide resolved
components/esendex/actions/send-voice-message/send-voice-message.mjs
Outdated
Show resolved
Hide resolved
components/esendex/actions/send-sms-message/send-sms-message.mjs
Outdated
Show resolved
Hide resolved
components/esendex/sources/new-message-received/new-message-received.mjs
Outdated
Show resolved
Hide resolved
components/esendex/sources/new-message-received/new-message-received.mjs
Show resolved
Hide resolved
jcortes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @michelle0927 lgtm! Ready for QA!
Resolves #16898
Summary by CodeRabbit