Skip to content
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

feat(Amount): Negative Amount support #2320

Merged
merged 16 commits into from
Oct 18, 2024
Merged

Conversation

saurabhdaware
Copy link
Member

@saurabhdaware saurabhdaware commented Jul 24, 2024

Description

Changes

  • Upgrades i18nify library
  • Removes formatNumber and adds formatNumberByParts to support negative sign in amount
  • Fixes i18nify and phonenumber input compatibility issue of invalid range

Additional Information

Component Checklist

  • Update Component Status Page
  • Perform Manual Testing in Other Browsers
  • Add KitchenSink Story
  • Add Interaction Tests (if applicable)
  • Add changeset

Copy link

changeset-bot bot commented Jul 24, 2024

⚠️ No Changeset found

Latest commit: d9e314d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

github-actions bot commented Jul 24, 2024

✅ PR title follows Conventional Commits specification.

@saurabhdaware
Copy link
Member Author

Pausing on this for some time since it got a little large task. Will pick it up as proper task in next sprint

Copy link

codesandbox-ci bot commented Jul 24, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit d9e314d:

Sandbox Source
razorpay/blade: basic Configuration

@rzpcibot
Copy link
Collaborator

rzpcibot commented Jul 24, 2024

Bundle Size Report

Updated Components
Status Component Base Size (kb) Current Size (kb) Diff
Amount 1.125 1.275 +0.150 KB
ButtonGroup 1.113 1.112 -0.001 KB
PhoneNumberInput 59.566 59.577 +0.011 KB

Generated by 🚫 dangerJS against d9e314d

@saurabhdaware saurabhdaware changed the title feat(Amount): Negative amounts support feat(Amount): Negative Amount support Oct 18, 2024
/**
* Pollyfill function to get around the node 18 error
*
* This function is maintained by i18nify team. Reach out to them for any change regarding this.
Copy link
Member

Choose a reason for hiding this comment

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

Should this come from i18nify library itself then instead of being in blade repo?

Copy link
Member Author

Choose a reason for hiding this comment

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

I did suggest them this but they are saying they'll just document it on their end in documentation and consumers will have to add it. Can discuss it later separately as well. Wanted to get it resolved earlier for negative amount thing. But yup overall I too feel this should be in their repo

/**
* Wrapper that uses pollyfill of i18nify team
*/
const pollyfilledFormatNumberByParts: typeof formatNumberByParts = (value, options) => {
Copy link
Member

Choose a reason for hiding this comment

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

Also since this is a polyfill are we conditionally calling it or are we always calling it regardless.

eg: checking for formatToParts existence

Copy link
Member Author

Choose a reason for hiding this comment

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

I've put conditions inside this function itself. So we can always call this instead of formatNumberByParts. formatToParts is supported in most major browsers we target so its fine to not check that

@saurabhdaware saurabhdaware merged commit e57cbc0 into master Oct 18, 2024
14 checks passed
@saurabhdaware saurabhdaware deleted the fix/amount-negative-sign branch October 18, 2024 07:43
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.

3 participants