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

Typescript: Fix type for paymentMethodsConfiguration #2363

Merged
merged 2 commits into from
Oct 18, 2023

Conversation

ribeiroguilherme
Copy link
Contributor

Summary

We were using discriminating union types for the PaymentMethodsConfiguration object.

That means that, if merchant passes config like:

const config =  {
  card: {
    hideCVC: true,
  },
  directEbanking: {
    name: 'Sofort'
  }
};

The type inference for the 'card' would not work, as it will be considered as [key: string]: UIElementProps; according to the discriminated union type inferred by Typescript.

In this PR, we make a union type instead. And in order to properly map non-mapped TxVariants, we should use the any keyword, otherwise all entry-values will fallback to [key: string]: UIElementProps; type

Fixed issue:
#2349
#2320

@changeset-bot
Copy link

changeset-bot bot commented Oct 18, 2023

🦋 Changeset detected

Latest commit: 57adaa0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@adyen/adyen-web Patch

Not sure what this means? Click here to learn what changesets are.

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

@github-actions
Copy link
Contributor

Size Change: -21 B (0%)

Total Size: 1.08 MB

Filename Size Change
packages/lib/dist/adyen.js 286 kB -5 B (0%)
packages/lib/dist/cjs/index.js 247 kB -5 B (0%)
packages/lib/dist/es.modern/index.js 119 kB -6 B (0%)
packages/lib/dist/es/index.js 139 kB -5 B (0%)
ℹ️ View Unchanged
Filename Size
packages/lib/dist/es.modern/ar.js 6.54 kB
packages/lib/dist/es.modern/cs-CZ.js 5.81 kB
packages/lib/dist/es.modern/da-DK.js 5.29 kB
packages/lib/dist/es.modern/de-DE.js 5.7 kB
packages/lib/dist/es.modern/el-GR.js 7.44 kB
packages/lib/dist/es.modern/es-ES.js 5.37 kB
packages/lib/dist/es.modern/fi-FI.js 5.38 kB
packages/lib/dist/es.modern/fr-FR.js 5.56 kB
packages/lib/dist/es.modern/hr-HR.js 5.61 kB
packages/lib/dist/es.modern/hu-HU.js 5.86 kB
packages/lib/dist/es.modern/it-IT.js 5.44 kB
packages/lib/dist/es.modern/ja-JP.js 6.27 kB
packages/lib/dist/es.modern/ko-KR.js 5.91 kB
packages/lib/dist/es.modern/nl-NL.js 5.4 kB
packages/lib/dist/es.modern/no-NO.js 5.27 kB
packages/lib/dist/es.modern/pl-PL.js 5.87 kB
packages/lib/dist/es.modern/pt-BR.js 5.43 kB
packages/lib/dist/es.modern/pt-PT.js 5.55 kB
packages/lib/dist/es.modern/ro-RO.js 5.68 kB
packages/lib/dist/es.modern/ru-RU.js 6.89 kB
packages/lib/dist/es.modern/sk-SK.js 5.97 kB
packages/lib/dist/es.modern/sl-SI.js 5.52 kB
packages/lib/dist/es.modern/sv-SE.js 5.23 kB
packages/lib/dist/es.modern/zh-CN.js 5.72 kB
packages/lib/dist/es.modern/zh-TW.js 5.86 kB
packages/lib/dist/es/ar.js 6.54 kB
packages/lib/dist/es/cs-CZ.js 5.81 kB
packages/lib/dist/es/da-DK.js 5.29 kB
packages/lib/dist/es/de-DE.js 5.7 kB
packages/lib/dist/es/el-GR.js 7.44 kB
packages/lib/dist/es/es-ES.js 5.37 kB
packages/lib/dist/es/fi-FI.js 5.38 kB
packages/lib/dist/es/fr-FR.js 5.56 kB
packages/lib/dist/es/hr-HR.js 5.61 kB
packages/lib/dist/es/hu-HU.js 5.86 kB
packages/lib/dist/es/it-IT.js 5.44 kB
packages/lib/dist/es/ja-JP.js 6.27 kB
packages/lib/dist/es/ko-KR.js 5.91 kB
packages/lib/dist/es/nl-NL.js 5.4 kB
packages/lib/dist/es/no-NO.js 5.27 kB
packages/lib/dist/es/pl-PL.js 5.87 kB
packages/lib/dist/es/pt-BR.js 5.43 kB
packages/lib/dist/es/pt-PT.js 5.55 kB
packages/lib/dist/es/ro-RO.js 5.68 kB
packages/lib/dist/es/ru-RU.js 6.89 kB
packages/lib/dist/es/sk-SK.js 5.97 kB
packages/lib/dist/es/sl-SI.js 5.52 kB
packages/lib/dist/es/sv-SE.js 5.23 kB
packages/lib/dist/es/zh-CN.js 5.72 kB
packages/lib/dist/es/zh-TW.js 5.86 kB

compressed-size-action

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@ribeiroguilherme ribeiroguilherme merged commit 4f9a683 into main Oct 18, 2023
10 checks passed
@ribeiroguilherme ribeiroguilherme deleted the fix/payment-method-configuration-types branch October 18, 2023 09:54
@github-actions github-actions bot mentioned this pull request Oct 18, 2023
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