Skip to content

Add helper to identify async captures and remove them from timeline #937

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

Merged
merged 2 commits into from
Jun 4, 2025

Conversation

gciotola
Copy link
Contributor

@gciotola gciotola commented May 21, 2025

What I did

Add an helper to identify async captures.
I've also removed the order timeline event in case the capture is async.
It will be shown as succeeded or failed once the async job is completed.

How to test

Checklist

  • Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests).
  • Make sure to add/update documentation regarding your changes.
  • You are NOT deprecating/removing a feature.

Copy link

netlify bot commented May 21, 2025

Deploy Preview for commercelayer-app-elements ready!

Name Link
🔨 Latest commit b74b151
🔍 Latest deploy log https://app.netlify.com/projects/commercelayer-app-elements/deploys/6834b67b0be08e000828e385
😎 Deploy Preview https://deploy-preview-937--commercelayer-app-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@gciotola gciotola self-assigned this May 21, 2025
@gciotola gciotola added the enhancement New feature or request label May 21, 2025
@gciotola gciotola requested a review from Copilot May 21, 2025 16:45
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a helper function to identify asynchronous capture transactions and updates the order timeline logic to omit timeline events for async captures until the async job completes.

  • Added a new function (orderTransactionIsAnAsyncCapture) in the transactions helper.
  • Updated the order timeline reducer to skip async capture events.
  • Updated locale files (Italian and English) to include messages for pending async captures.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/app-elements/src/ui/resources/ResourceOrderTimeline.tsx Added check to skip timeline events for async captures.
packages/app-elements/src/main.ts Re-exported the async capture helper for external use.
packages/app-elements/src/locales/it.ts Added new Italian locale string for pending async capture.
packages/app-elements/src/locales/en.ts Added new English locale string for pending async capture.
packages/app-elements/src/helpers/transactions.ts Introduced the helper function to determine async capture transactions.
packages/app-elements/src/helpers/transactions.test.ts Provided unit tests for the new async capture helper function.

@gciotola gciotola marked this pull request as ready for review May 26, 2025 07:46
Copy link

pkg-pr-new bot commented May 26, 2025

npm i https://pkg.pr.new/commercelayer/app-elements/@commercelayer/app-elements@937

commit: b74b151

pfferrari
pfferrari previously approved these changes May 26, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a helper function to identify asynchronous capture transactions and updates the timeline so that async captures are removed and handled later. Key changes include:

  • Importing and using the helper function in the timeline reducer to skip async capture events.
  • Exporting the new helper from the main entry point.
  • Updating locale files with new translation strings for async capture statuses.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/app-elements/src/ui/resources/ResourceOrderTimeline.tsx Uses the helper function to filter out async capture events from the timeline.
packages/app-elements/src/main.ts Exports the new async capture helper for global usage.
packages/app-elements/src/locales/it.ts and en.ts Adds new translations for pending async capture status.
packages/app-elements/src/helpers/transactions.ts Implements the helper to determine async capture transactions.
packages/app-elements/src/helpers/transactions.test.ts Provides tests ensuring the helper correctly identifies async captures.

@gciotola gciotola merged commit 21d27f3 into main Jun 4, 2025
7 checks passed
@gciotola gciotola deleted the async-captures branch June 4, 2025 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants