Skip to content

Commit

Permalink
Update language list and add extra condition for checking the window.…
Browse files Browse the repository at this point in the history
…Frames object (#58)
  • Loading branch information
ioan-ghisoi-cko authored Jul 23, 2024
1 parent 3237651 commit 282a325
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frames-react",
"version": "1.1.1",
"version": "1.1.2",
"peerDependencies": {
"react": ">=16.8"
},
Expand Down
19 changes: 11 additions & 8 deletions src/frames/Frames.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@ export class Frames extends Component<FramesProps> {
}

shouldComponentUpdate(nextProps: FramesProps) {
if (nextProps.config.cardholder && nextProps.config.cardholder.name) {
window.Frames.cardholder.name = nextProps.config.cardholder.name;
}
if (nextProps.config.cardholder && nextProps.config.cardholder.billingAddress) {
window.Frames.cardholder.billingAddress = nextProps.config.cardholder.billingAddress;
}
if (nextProps.config.cardholder && nextProps.config.cardholder.phone) {
window.Frames.cardholder.phone = nextProps.config.cardholder.phone;
if (typeof window !== 'undefined' && window.Frames) {
if (nextProps.config.cardholder && nextProps.config.cardholder.name) {
window.Frames.cardholder.name = nextProps.config.cardholder.name;
}
if (nextProps.config.cardholder && nextProps.config.cardholder.billingAddress) {
window.Frames.cardholder.billingAddress =
nextProps.config.cardholder.billingAddress;
}
if (nextProps.config.cardholder && nextProps.config.cardholder.phone) {
window.Frames.cardholder.phone = nextProps.config.cardholder.phone;
}
}
return true;
}
Expand Down
24 changes: 23 additions & 1 deletion src/frames/types/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,29 @@ export interface FramesLocalization {
cardSchemeHeader?: string;
}

export type FramesLanguages = 'EN-GB' | 'ES-ES' | 'FR-FR' | 'DE-DE' | 'KR-KR' | 'IT-IT' | 'NL-NL';
export type FramesLanguages =
| 'AR'
| 'ZH-CH'
| 'ZH-HK'
| 'ZH-TW'
| 'DA-DK'
| 'NL-NL'
| 'EN-GB'
| 'FIL-PH'
| 'FI-FI'
| 'FR-FR'
| 'DE-DE'
| 'HI-IN'
| 'ID-ID'
| 'IT-IT'
| 'JA-JP'
| 'KO-KR'
| 'MS-MY'
| 'NB-NO'
| 'ES-ES'
| 'SV-SE'
| 'TH-TH'
| 'VI-VN';

export type FrameElementIdentifer = 'card-number' | 'expiry-date' | 'cvv';

Expand Down

0 comments on commit 282a325

Please sign in to comment.