@seamlessdocs/payment-modals 2.0.0-beta.9 → 2.0.0

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.
package/README.md CHANGED
@@ -1 +1,200 @@
1
- # Payment Modals
1
+ # Payment Modals
2
+
3
+ A React-based payment modal library for SeamlessDocs, providing a comprehensive set of reusable payment interface components for handling various payment workflows and user interactions.
4
+
5
+ ## Overview
6
+
7
+ This library offers a collection of payment modals designed to streamline payment processing workflows. It supports multiple payment methods including ACH (bank account) and credit card payments, with integration capabilities for GovOS Pay payment processing.
8
+
9
+ ## Features
10
+
11
+ - **Multiple Payment Methods**: Support for ACH and credit card payments
12
+ - **GovOS Pay Integration**: Seamless integration with GovOS Pay payment processing
13
+ - **Comprehensive Modal Set**: Includes modals for selection, processing, success, error, and payment forms
14
+ - **React 18 Compatible**: Built with React 18 using the modern `createRoot` API
15
+ - **Modular Architecture**: Component-based design with CSS modules for styling
16
+ - **Form Validation**: Built-in form handling with Formik for payment forms
17
+ - **Accessible UI**: Keyboard navigation and ARIA-compliant components
18
+
19
+ ## Available Modals
20
+
21
+ ### Payment Selection & Flow
22
+ - **ChooseModal**: Allows users to choose between payment options
23
+ - **SelectPaymentModal**: Payment method selection with fee display
24
+ - **PayNowModal**: Direct payment initiation modal
25
+
26
+ ### Payment Forms
27
+ - **ACHPaymentModal**: ACH/bank account payment form with fee breakdown
28
+ - **GovOSPayACHPaymentModal**: GovOS Pay ACH payment integration
29
+ - **GovOSPayCardPaymentModal**: GovOS Pay credit card payment integration
30
+ - **GovOSPayInvoiceSummaryModal**: Invoice summary and confirmation for GovOS Pay
31
+
32
+ ### Status Modals
33
+ - **ProcessingModal**: Displays during payment processing
34
+ - **SuccessModal**: Confirmation message after successful payment
35
+ - **ErrorModal**: Error handling with retry and skip options
36
+ - **ErrorOptionalModal**: Optional error modal variant
37
+ - **EmptyModal**: Empty state placeholder
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ npm install @seamlessdocs/payment-modals
43
+ # or
44
+ yarn add @seamlessdocs/payment-modals
45
+ ```
46
+
47
+ ## Usage
48
+
49
+ The library exposes a global `handlePaymentModal` object that provides methods to render different modal types. Ensure you have a container element with the id `payment-modal` in your HTML:
50
+
51
+ ```html
52
+ <div id="payment-modal"></div>
53
+ ```
54
+
55
+ ### Basic Example
56
+
57
+ ```javascript
58
+ // Choose Modal
59
+ window.handlePaymentModal.chooseModal({
60
+ title: 'Payment Required',
61
+ description: 'Please complete your payment',
62
+ withPayText: 'Pay Now',
63
+ callbacks: {
64
+ withoutPay: () => console.log('Skipped payment'),
65
+ withPay: () => console.log('Proceed to payment'),
66
+ close: () => console.log('Modal closed')
67
+ }
68
+ });
69
+
70
+ // ACH Payment Modal
71
+ window.handlePaymentModal.achPaymentModal({
72
+ amount: 100.00,
73
+ totalAmount: 105.00,
74
+ feeAmount: 5.00,
75
+ description: 'Service fee',
76
+ feeName: 'Processing fee',
77
+ callbacks: {
78
+ onPay: (paymentData) => console.log('Payment submitted', paymentData),
79
+ onClose: () => console.log('Modal closed')
80
+ }
81
+ });
82
+
83
+ // Processing Modal
84
+ window.handlePaymentModal.processingModal();
85
+
86
+ // Success Modal
87
+ window.handlePaymentModal.successModal({
88
+ description: 'Payment completed successfully'
89
+ });
90
+
91
+ // Error Modal
92
+ window.handlePaymentModal.errorModal({
93
+ isOptional: false,
94
+ errorText: 'Payment failed. Please try again.',
95
+ callbacks: {
96
+ skip: () => console.log('Skipped'),
97
+ retry: () => console.log('Retry payment'),
98
+ close: () => console.log('Modal closed')
99
+ }
100
+ });
101
+ ```
102
+
103
+ ### GovOS Pay Integration
104
+
105
+ ```javascript
106
+ // GovOS Pay Card Payment
107
+ window.handlePaymentModal.govOSPayCardPaymentModal({
108
+ amount: 100.00,
109
+ paymentCorrelationId: 'correlation-id',
110
+ paymentConfig: { /* Payrix config */ },
111
+ transactionMode: 'transaction', // or 'preauth'
112
+ transactionUrl: 'https://api.example.com/transactions',
113
+ getTransactionUrl: 'https://api.example.com/transactions/get',
114
+ updateTransactionUrl: 'https://api.example.com/transactions/update',
115
+ lineItems: [/* line items array */],
116
+ callbacks: {
117
+ onPay: (result) => console.log('Payment successful', result),
118
+ onClose: () => console.log('Modal closed')
119
+ }
120
+ });
121
+
122
+ // GovOS Pay ACH Payment
123
+ window.handlePaymentModal.govOSPayACHPaymentModal({
124
+ amount: 100.00,
125
+ paymentCorrelationId: 'correlation-id',
126
+ paymentConfig: { /* Payrix config */ },
127
+ transactionUrl: 'https://api.example.com/transactions',
128
+ getTransactionUrl: 'https://api.example.com/transactions/get',
129
+ updateTransactionUrl: 'https://api.example.com/transactions/update',
130
+ lineItems: [/* line items array */],
131
+ callbacks: {
132
+ onPay: (result) => console.log('Payment successful', result),
133
+ onClose: () => console.log('Modal closed')
134
+ }
135
+ });
136
+ ```
137
+
138
+ ## Development
139
+
140
+ ### Prerequisites
141
+
142
+ - Node.js >= 22.0.0
143
+ - Yarn or npm
144
+
145
+ ### Setup
146
+
147
+ ```bash
148
+ # Install dependencies
149
+ yarn install
150
+
151
+ # Start development server
152
+ yarn start
153
+
154
+ # Build for development
155
+ yarn dev
156
+
157
+ # Build for production
158
+ yarn build
159
+ ```
160
+
161
+ ### Project Structure
162
+
163
+ ```
164
+ src/
165
+ ├── Components/ # Modal components
166
+ │ ├── ACHPaymentModal/
167
+ │ ├── ChooseModal/
168
+ │ ├── ErrorModal/
169
+ │ ├── GovOSPayACHPaymentModal/
170
+ │ ├── GovOSPayCardPaymentModal/
171
+ │ └── ...
172
+ ├── assets/ # Images and static assets
173
+ ├── index.jsx # Main entry point
174
+ └── shims.js # Compatibility shims
175
+ ```
176
+
177
+ ## Dependencies
178
+
179
+ ### Core
180
+ - React 18.2.0
181
+ - React DOM 18.2.0
182
+ - Formik 2.1.5 (form handling)
183
+ - @kofile/platform-react-payrix 1.7.47 (GovOS Pay integration)
184
+
185
+ ### UI
186
+ - react-select 5.8.0
187
+ - @tippyjs/react 4.2.6
188
+ - classnames 2.2.6
189
+
190
+ ## Browser Support
191
+
192
+ Modern browsers with ES6+ support. The library uses React 18's `createRoot` API, which requires modern browser environments.
193
+
194
+ ## License
195
+
196
+ Copyright © SeamlessDocs. All rights reserved.
197
+
198
+ ## Repository
199
+
200
+ https://github.com/SeamlessDocsDev/PaymentModals