react-nomba-checkout-sdk 1.0.0 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,67 +0,0 @@
1
- import React, { Component } from "react";
2
- import { NombaCheckoutModal } from "./NombaCheckoutModal";
3
-
4
- interface NombaCheckoutButtonProps {
5
- orderId: string;
6
- buttonText?: string;
7
- buttonStyle?: React.CSSProperties;
8
- children?: React.ReactNode;
9
- onClose: () => void;
10
- }
11
-
12
- interface NombaCheckoutButtonState {
13
- showModal: boolean;
14
- }
15
-
16
- class NombaCheckoutButton extends Component<
17
- NombaCheckoutButtonProps,
18
- NombaCheckoutButtonState
19
- > {
20
- constructor(props: NombaCheckoutButtonProps) {
21
- super(props);
22
- this.state = {
23
- showModal: false,
24
- };
25
- }
26
-
27
- handleClose = () => {
28
- this.setState({ showModal: false });
29
- this.props.onClose?.();
30
- };
31
-
32
- render() {
33
- const { orderId, children, buttonStyle, buttonText } = this.props;
34
- const { showModal } = this.state;
35
-
36
- return (
37
- <div>
38
- <button
39
- style={buttonStyle || styles.button}
40
- onClick={
41
- showModal
42
- ? () => this.handleClose()
43
- : () => this.setState({ showModal: true })
44
- }
45
- >
46
- {children || buttonText || "Pay with Nomba"}
47
- </button>
48
-
49
- {showModal && (
50
- <NombaCheckoutModal orderId={orderId} onClose={this.handleClose} />
51
- )}
52
- </div>
53
- );
54
- }
55
- }
56
- const styles: { [key: string]: React.CSSProperties } = {
57
- button: {
58
- height: "48px",
59
- width: "100%",
60
- background: "#ffcc00",
61
- fontSize: "16px",
62
- fontWeight: 500,
63
- borderRadius: "8px",
64
- },
65
- };
66
-
67
- export { NombaCheckoutButton };