@zezosoft/react-native-zezopay 1.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/LICENSE +21 -0
- package/README.md +150 -0
- package/lib/module/ZezoPay/Payments/Providers/PaymentGateways.types.d.js +2 -0
- package/lib/module/ZezoPay/Payments/Providers/PaymentGateways.types.d.js.map +1 -0
- package/lib/module/ZezoPay/Payments/Providers/Razorpay/Razorpay.js +39 -0
- package/lib/module/ZezoPay/Payments/Providers/Razorpay/Razorpay.js.map +1 -0
- package/lib/module/ZezoPay/Payments/Providers/index.js +10 -0
- package/lib/module/ZezoPay/Payments/Providers/index.js.map +1 -0
- package/lib/module/ZezoPay/ZezoPay.js +176 -0
- package/lib/module/ZezoPay/ZezoPay.js.map +1 -0
- package/lib/module/ZezoPay/components/Header.js +97 -0
- package/lib/module/ZezoPay/components/Header.js.map +1 -0
- package/lib/module/ZezoPay/components/PayButton.js +143 -0
- package/lib/module/ZezoPay/components/PayButton.js.map +1 -0
- package/lib/module/ZezoPay/components/PaymentMethod.js +250 -0
- package/lib/module/ZezoPay/components/PaymentMethod.js.map +1 -0
- package/lib/module/ZezoPay/components/Summary.js +184 -0
- package/lib/module/ZezoPay/components/Summary.js.map +1 -0
- package/lib/module/ZezoPay/components/VoucherBox.js +124 -0
- package/lib/module/ZezoPay/components/VoucherBox.js.map +1 -0
- package/lib/module/ZezoPay/index.js +5 -0
- package/lib/module/ZezoPay/index.js.map +1 -0
- package/lib/module/ZezoPay/types/index.js +4 -0
- package/lib/module/ZezoPay/types/index.js.map +1 -0
- package/lib/module/ZezoPay/utils/hooks/useAsync.js +32 -0
- package/lib/module/ZezoPay/utils/hooks/useAsync.js.map +1 -0
- package/lib/module/ZezoPay/utils/hooks/useZezoPay.js +270 -0
- package/lib/module/ZezoPay/utils/hooks/useZezoPay.js.map +1 -0
- package/lib/module/ZezoPay/utils/index.js +15 -0
- package/lib/module/ZezoPay/utils/index.js.map +1 -0
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/ZezoPay/Payments/Providers/Razorpay/Razorpay.d.ts +7 -0
- package/lib/typescript/src/ZezoPay/Payments/Providers/Razorpay/Razorpay.d.ts.map +1 -0
- package/lib/typescript/src/ZezoPay/Payments/Providers/index.d.ts +7 -0
- package/lib/typescript/src/ZezoPay/Payments/Providers/index.d.ts.map +1 -0
- package/lib/typescript/src/ZezoPay/ZezoPay.d.ts +5 -0
- package/lib/typescript/src/ZezoPay/ZezoPay.d.ts.map +1 -0
- package/lib/typescript/src/ZezoPay/components/Header.d.ts +12 -0
- package/lib/typescript/src/ZezoPay/components/Header.d.ts.map +1 -0
- package/lib/typescript/src/ZezoPay/components/PayButton.d.ts +12 -0
- package/lib/typescript/src/ZezoPay/components/PayButton.d.ts.map +1 -0
- package/lib/typescript/src/ZezoPay/components/PaymentMethod.d.ts +12 -0
- package/lib/typescript/src/ZezoPay/components/PaymentMethod.d.ts.map +1 -0
- package/lib/typescript/src/ZezoPay/components/Summary.d.ts +7 -0
- package/lib/typescript/src/ZezoPay/components/Summary.d.ts.map +1 -0
- package/lib/typescript/src/ZezoPay/components/VoucherBox.d.ts +9 -0
- package/lib/typescript/src/ZezoPay/components/VoucherBox.d.ts.map +1 -0
- package/lib/typescript/src/ZezoPay/index.d.ts +3 -0
- package/lib/typescript/src/ZezoPay/index.d.ts.map +1 -0
- package/lib/typescript/src/ZezoPay/types/index.d.ts +65 -0
- package/lib/typescript/src/ZezoPay/types/index.d.ts.map +1 -0
- package/lib/typescript/src/ZezoPay/utils/hooks/useAsync.d.ts +6 -0
- package/lib/typescript/src/ZezoPay/utils/hooks/useAsync.d.ts.map +1 -0
- package/lib/typescript/src/ZezoPay/utils/hooks/useZezoPay.d.ts +46 -0
- package/lib/typescript/src/ZezoPay/utils/hooks/useZezoPay.d.ts.map +1 -0
- package/lib/typescript/src/ZezoPay/utils/index.d.ts +6 -0
- package/lib/typescript/src/ZezoPay/utils/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +181 -0
- package/src/ZezoPay/Payments/Providers/PaymentGateways.types.d.ts +48 -0
- package/src/ZezoPay/Payments/Providers/Razorpay/Razorpay.ts +46 -0
- package/src/ZezoPay/Payments/Providers/index.ts +8 -0
- package/src/ZezoPay/ZezoPay.tsx +174 -0
- package/src/ZezoPay/components/Header.tsx +107 -0
- package/src/ZezoPay/components/PayButton.tsx +132 -0
- package/src/ZezoPay/components/PaymentMethod.tsx +259 -0
- package/src/ZezoPay/components/Summary.tsx +188 -0
- package/src/ZezoPay/components/VoucherBox.tsx +133 -0
- package/src/ZezoPay/index.ts +2 -0
- package/src/ZezoPay/types/index.ts +69 -0
- package/src/ZezoPay/utils/hooks/useAsync.ts +38 -0
- package/src/ZezoPay/utils/hooks/useZezoPay.ts +325 -0
- package/src/ZezoPay/utils/index.ts +16 -0
- package/src/index.tsx +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 ZezoSoft
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# @zezosoft/react-native-zezopay
|
|
2
|
+
|
|
3
|
+
**ZezoPay React Native SDK** – Seamlessly integrate secure payments for subscriptions, digital products, or one-time purchases in your React Native app. ZezoPay provides a smooth checkout experience, manages payment flows, and returns results via callbacks.
|
|
4
|
+
|
|
5
|
+
Currently supports **Razorpay**, with more payment providers coming soon.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🚀 Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @zezosoft/react-native-zezopay
|
|
13
|
+
# or
|
|
14
|
+
yarn add @zezosoft/react-native-zezopay
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 📦 Quick Start Example
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import React from 'react';
|
|
23
|
+
import { View, Alert } from 'react-native';
|
|
24
|
+
import { ZezoPay } from '@zezosoft/react-native-zezopay';
|
|
25
|
+
|
|
26
|
+
export default function App() {
|
|
27
|
+
const handleSuccess = (data) => {
|
|
28
|
+
console.log('Payment Successful:', data);
|
|
29
|
+
|
|
30
|
+
const won = Math.random() < 0.3; // 30% chance lottery
|
|
31
|
+
if (won) Alert.alert('🎉 Congratulations!', 'You won a prize!');
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
|
|
36
|
+
<ZezoPay
|
|
37
|
+
publicKey="YOUR_PUBLIC_KEY"
|
|
38
|
+
title="Checkout"
|
|
39
|
+
onBack={() => console.log('Back pressed')}
|
|
40
|
+
summaryItems={[
|
|
41
|
+
{
|
|
42
|
+
id: 'pro',
|
|
43
|
+
name: 'Pro Plan',
|
|
44
|
+
price: 200,
|
|
45
|
+
discount: { type: 'fixed', amount: 20 },
|
|
46
|
+
duration: '3 months',
|
|
47
|
+
},
|
|
48
|
+
]}
|
|
49
|
+
userInfo={{
|
|
50
|
+
_id: '123',
|
|
51
|
+
name: 'John Doe',
|
|
52
|
+
email: 'john@example.com',
|
|
53
|
+
phone: '9876543210',
|
|
54
|
+
}}
|
|
55
|
+
callback={{ onSuccess: handleSuccess }}
|
|
56
|
+
/>
|
|
57
|
+
</View>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 📝 ZezoPay Component Props
|
|
65
|
+
|
|
66
|
+
| Prop | Required | Description |
|
|
67
|
+
| ------------------ | -------- | ----------------------------------------------------------------------------- |
|
|
68
|
+
| `publicKey` | ✅ | ZezoPay public key for authentication. |
|
|
69
|
+
| `subscriptionId` | ❌ | Optional subscription plan ID. |
|
|
70
|
+
| `digitalProductId` | ❌ | Optional digital product ID for one-time purchases. |
|
|
71
|
+
| `summaryItems` | ✅ | Array of items for checkout summary, including price, discount, and duration. |
|
|
72
|
+
| `userInfo` | ✅ | Customer information (`_id`, `name`, `email`, `phone`). |
|
|
73
|
+
| `title` | ✅ | Checkout screen title. |
|
|
74
|
+
| `onBack` | ✅ | Callback triggered when the back button is pressed. |
|
|
75
|
+
| `callback` | ❌ | Object containing `onSuccess` and `onFailure` callbacks. |
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 🔄 Callbacks (`callback` prop)
|
|
80
|
+
|
|
81
|
+
| Callback | Description |
|
|
82
|
+
| ----------- | -------------------------------------------------------------- |
|
|
83
|
+
| `onSuccess` | Triggered after a successful payment. Returns payment details. |
|
|
84
|
+
| `onFailure` | Triggered if payment fails or is canceled. Returns error info. |
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## 👤 Summary Items & User Info
|
|
89
|
+
|
|
90
|
+
**Example Summary Item:**
|
|
91
|
+
|
|
92
|
+
```js
|
|
93
|
+
summaryItems = [
|
|
94
|
+
{
|
|
95
|
+
id: 'pro',
|
|
96
|
+
name: 'Pro Plan',
|
|
97
|
+
price: 200,
|
|
98
|
+
discount: { type: 'fixed', amount: 20 }, // or { type: 'percentage', amount: 10 }
|
|
99
|
+
duration: '3 months',
|
|
100
|
+
},
|
|
101
|
+
];
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Example User Info:**
|
|
105
|
+
|
|
106
|
+
```js
|
|
107
|
+
userInfo = {
|
|
108
|
+
_id: '123',
|
|
109
|
+
name: 'John Doe',
|
|
110
|
+
email: 'john@example.com',
|
|
111
|
+
phone: '9876543210',
|
|
112
|
+
};
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## 💳 Supported Payment Providers
|
|
118
|
+
|
|
119
|
+
**Available now:**
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
'razorpay'
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Coming soon:**
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
'stripe' | 'ccavenue' | 'phonepe'
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## 👨💻 Contributors
|
|
134
|
+
|
|
135
|
+
<p align="left">
|
|
136
|
+
<a href="https://github.com/Naresh-Dhamu" target="_blank">
|
|
137
|
+
<img src="https://avatars.githubusercontent.com/u/89912059?v=4" width="100" height="100" style="border-radius:50%;" alt="Naresh Dhamu" /><br />
|
|
138
|
+
<strong>Naresh Dhamu</strong>
|
|
139
|
+
</a>
|
|
140
|
+
</p>
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## 📜 License
|
|
145
|
+
|
|
146
|
+
Released under the [MIT License](LICENSE)
|
|
147
|
+
|
|
148
|
+
<p align="center">
|
|
149
|
+
⚡ Powered by <a href="https://zezosoft.com" target="_blank"><strong>ZezoSoft</strong></a>
|
|
150
|
+
</p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["ZezoPay/Payments/Providers/PaymentGateways.types.d.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @author Naresh Dhamu
|
|
5
|
+
* @lastModified Thu 25 Sep 2025 at 11:34 AM
|
|
6
|
+
*/
|
|
7
|
+
import RazorpayCheckout from 'react-native-razorpay';
|
|
8
|
+
class Razorpay {
|
|
9
|
+
constructor() {
|
|
10
|
+
// init Razorpay
|
|
11
|
+
this.init();
|
|
12
|
+
}
|
|
13
|
+
init() {
|
|
14
|
+
// check if Razorpay already initialized
|
|
15
|
+
}
|
|
16
|
+
async open(options) {
|
|
17
|
+
RazorpayCheckout.open({
|
|
18
|
+
key: options.publicKey,
|
|
19
|
+
amount: options.amount,
|
|
20
|
+
currency: options.currency,
|
|
21
|
+
name: options.name || '',
|
|
22
|
+
description: options.description ? options.description?.length > 255 ? options.description.slice(0, 255) : options.description : '',
|
|
23
|
+
order_id: options.order_id,
|
|
24
|
+
image: options.image,
|
|
25
|
+
prefill: {
|
|
26
|
+
name: options?.prefill?.user_name || '',
|
|
27
|
+
email: options?.prefill?.user_email || '',
|
|
28
|
+
contact: options?.prefill?.user_phone || ''
|
|
29
|
+
},
|
|
30
|
+
theme: options.theme
|
|
31
|
+
}).then(response => {
|
|
32
|
+
options.handler?.(response);
|
|
33
|
+
}).catch(error => {
|
|
34
|
+
options.OnError?.(error);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export default Razorpay;
|
|
39
|
+
//# sourceMappingURL=Razorpay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["RazorpayCheckout","Razorpay","constructor","init","open","options","key","publicKey","amount","currency","name","description","length","slice","order_id","image","prefill","user_name","email","user_email","contact","user_phone","theme","then","response","handler","catch","error","OnError"],"sourceRoot":"../../../../../../src","sources":["ZezoPay/Payments/Providers/Razorpay/Razorpay.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA,OAAOA,gBAAgB,MAAM,uBAAuB;AAEpD,MAAMC,QAAQ,CAA4B;EACxCC,WAAWA,CAAA,EAAG;IACZ;IACA,IAAI,CAACC,IAAI,CAAC,CAAC;EACb;EAEAA,IAAIA,CAAA,EAAG;IACL;EAAA;EAGF,MAAMC,IAAIA,CAACC,OAAmC,EAAE;IAC9CL,gBAAgB,CAACI,IAAI,CAAC;MACpBE,GAAG,EAAED,OAAO,CAACE,SAAS;MACtBC,MAAM,EAAEH,OAAO,CAACG,MAAM;MACtBC,QAAQ,EAAEJ,OAAO,CAACI,QAAQ;MAC1BC,IAAI,EAAEL,OAAO,CAACK,IAAI,IAAI,EAAE;MACxBC,WAAW,EAAEN,OAAO,CAACM,WAAW,GAC5BN,OAAO,CAACM,WAAW,EAAEC,MAAM,GAAG,GAAG,GAC/BP,OAAO,CAACM,WAAW,CAACE,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GACjCR,OAAO,CAACM,WAAW,GACrB,EAAE;MACNG,QAAQ,EAAET,OAAO,CAACS,QAAQ;MAC1BC,KAAK,EAAEV,OAAO,CAACU,KAAK;MACpBC,OAAO,EAAE;QACPN,IAAI,EAAEL,OAAO,EAAEW,OAAO,EAAEC,SAAS,IAAI,EAAE;QACvCC,KAAK,EAAEb,OAAO,EAAEW,OAAO,EAAEG,UAAU,IAAI,EAAE;QACzCC,OAAO,EAAEf,OAAO,EAAEW,OAAO,EAAEK,UAAU,IAAI;MAC3C,CAAC;MACDC,KAAK,EAAEjB,OAAO,CAACiB;IACjB,CAAC,CAAC,CACCC,IAAI,CAAEC,QAAQ,IAAK;MAClBnB,OAAO,CAACoB,OAAO,GAAGD,QAAQ,CAAC;IAC7B,CAAC,CAAC,CACDE,KAAK,CAAEC,KAAK,IAAK;MAChBtB,OAAO,CAACuB,OAAO,GAAGD,KAAK,CAAC;IAC1B,CAAC,CAAC;EACN;AACF;AAEA,eAAe1B,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Razorpay"],"sourceRoot":"../../../../../src","sources":["ZezoPay/Payments/Providers/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;AAEA,OAAOA,QAAQ,MAAM,wBAAqB;AAE1C,SAASA,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View, StyleSheet, Keyboard, TouchableWithoutFeedback, StatusBar, Text } from 'react-native';
|
|
5
|
+
import { ArrowLeft } from 'lucide-react-native';
|
|
6
|
+
import { scale, verticalScale, moderateScale } from 'react-native-size-matters';
|
|
7
|
+
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
|
8
|
+
import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
|
|
9
|
+
import Header from "./components/Header.js";
|
|
10
|
+
import PaymentMethod from "./components/PaymentMethod.js";
|
|
11
|
+
import { Summary } from "./components/Summary.js";
|
|
12
|
+
import PayButton from "./components/PayButton.js";
|
|
13
|
+
import { useZezoPay } from "./utils/hooks/useZezoPay.js";
|
|
14
|
+
import { formatCurrency } from "./utils/index.js";
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
const ZezoPay = ({
|
|
17
|
+
title = 'Payments',
|
|
18
|
+
summaryItems,
|
|
19
|
+
onBack,
|
|
20
|
+
userInfo,
|
|
21
|
+
publicKey,
|
|
22
|
+
digitalProductId,
|
|
23
|
+
subscriptionId,
|
|
24
|
+
callback
|
|
25
|
+
}) => {
|
|
26
|
+
const {
|
|
27
|
+
selectedPayment,
|
|
28
|
+
setSelectedPayment,
|
|
29
|
+
summaryItems: items,
|
|
30
|
+
totalPrice,
|
|
31
|
+
isSuccess,
|
|
32
|
+
error,
|
|
33
|
+
isProcessing,
|
|
34
|
+
providers,
|
|
35
|
+
loading,
|
|
36
|
+
providerError,
|
|
37
|
+
removeItem,
|
|
38
|
+
handlePayNow
|
|
39
|
+
} = useZezoPay({
|
|
40
|
+
publicKey: publicKey,
|
|
41
|
+
userInfo: {
|
|
42
|
+
_id: userInfo._id,
|
|
43
|
+
name: userInfo?.name || '',
|
|
44
|
+
email: userInfo?.email || ''
|
|
45
|
+
},
|
|
46
|
+
subscriptionId: subscriptionId,
|
|
47
|
+
digitalProductId: digitalProductId,
|
|
48
|
+
summaryItems: summaryItems || [],
|
|
49
|
+
callback
|
|
50
|
+
});
|
|
51
|
+
return /*#__PURE__*/_jsx(SafeAreaProvider, {
|
|
52
|
+
children: /*#__PURE__*/_jsxs(SafeAreaView, {
|
|
53
|
+
style: styles.safeArea,
|
|
54
|
+
edges: ['bottom', 'left', 'right'],
|
|
55
|
+
children: [/*#__PURE__*/_jsx(StatusBar, {
|
|
56
|
+
barStyle: "dark-content",
|
|
57
|
+
backgroundColor: styles.safeArea.backgroundColor
|
|
58
|
+
}), /*#__PURE__*/_jsx(SafeAreaView, {
|
|
59
|
+
style: styles.headerSafeArea,
|
|
60
|
+
edges: ['top'],
|
|
61
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
62
|
+
style: styles.headerWrapper,
|
|
63
|
+
children: /*#__PURE__*/_jsx(Header, {
|
|
64
|
+
title: title,
|
|
65
|
+
onBack: onBack,
|
|
66
|
+
leftIcon: /*#__PURE__*/_jsx(ArrowLeft, {
|
|
67
|
+
size: moderateScale(24),
|
|
68
|
+
color: "#000"
|
|
69
|
+
})
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
}), /*#__PURE__*/_jsx(TouchableWithoutFeedback, {
|
|
73
|
+
onPress: Keyboard.dismiss,
|
|
74
|
+
accessible: false,
|
|
75
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
76
|
+
style: styles.container,
|
|
77
|
+
children: [/*#__PURE__*/_jsx(KeyboardAwareScrollView, {
|
|
78
|
+
style: styles.scrollView,
|
|
79
|
+
contentContainerStyle: styles.scrollContent,
|
|
80
|
+
keyboardShouldPersistTaps: "handled",
|
|
81
|
+
enableOnAndroid: true,
|
|
82
|
+
extraScrollHeight: verticalScale(20),
|
|
83
|
+
showsVerticalScrollIndicator: false,
|
|
84
|
+
contentInsetAdjustmentBehavior: "never",
|
|
85
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
86
|
+
style: styles.content,
|
|
87
|
+
children: [/*#__PURE__*/_jsx(PaymentMethod, {
|
|
88
|
+
providers: providers || [],
|
|
89
|
+
onProviderChange: setSelectedPayment,
|
|
90
|
+
selectedProvider: selectedPayment,
|
|
91
|
+
isLoading: loading,
|
|
92
|
+
error: providerError?.message
|
|
93
|
+
}), /*#__PURE__*/_jsx(Summary, {
|
|
94
|
+
items: items,
|
|
95
|
+
onRemoveItem: removeItem
|
|
96
|
+
})]
|
|
97
|
+
})
|
|
98
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
99
|
+
style: styles.bottomContainer,
|
|
100
|
+
children: [error ? /*#__PURE__*/_jsx(View, {
|
|
101
|
+
style: styles.errorWrapper,
|
|
102
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
103
|
+
style: styles.errorText,
|
|
104
|
+
children: error
|
|
105
|
+
})
|
|
106
|
+
}) : null, /*#__PURE__*/_jsx(PayButton, {
|
|
107
|
+
onPaymentInitiate: handlePayNow,
|
|
108
|
+
status: isSuccess ? 'success' : isProcessing ? 'processing' : !selectedPayment || totalPrice === 0 ? 'disabled' : 'idle',
|
|
109
|
+
paymentButtonText: `Pay ${formatCurrency({
|
|
110
|
+
amount: totalPrice,
|
|
111
|
+
minimumFractionDigits: 0
|
|
112
|
+
})}`,
|
|
113
|
+
noteText: "Powered by Zezo Pay"
|
|
114
|
+
})]
|
|
115
|
+
})]
|
|
116
|
+
})
|
|
117
|
+
})]
|
|
118
|
+
})
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
const styles = StyleSheet.create({
|
|
122
|
+
safeArea: {
|
|
123
|
+
flex: 1,
|
|
124
|
+
backgroundColor: '#FFFFFF'
|
|
125
|
+
},
|
|
126
|
+
headerSafeArea: {
|
|
127
|
+
backgroundColor: '#FFFFFF'
|
|
128
|
+
},
|
|
129
|
+
headerWrapper: {
|
|
130
|
+
borderBottomWidth: 1,
|
|
131
|
+
borderBottomColor: '#E5E7EB',
|
|
132
|
+
zIndex: 10
|
|
133
|
+
},
|
|
134
|
+
container: {
|
|
135
|
+
flex: 1,
|
|
136
|
+
position: 'relative'
|
|
137
|
+
},
|
|
138
|
+
scrollView: {
|
|
139
|
+
flex: 1,
|
|
140
|
+
paddingBottom: verticalScale(80)
|
|
141
|
+
},
|
|
142
|
+
scrollContent: {
|
|
143
|
+
flexGrow: 1,
|
|
144
|
+
paddingTop: verticalScale(10),
|
|
145
|
+
paddingBottom: verticalScale(80)
|
|
146
|
+
},
|
|
147
|
+
content: {
|
|
148
|
+
paddingHorizontal: scale(16)
|
|
149
|
+
},
|
|
150
|
+
bottomContainer: {
|
|
151
|
+
position: 'absolute',
|
|
152
|
+
bottom: 0,
|
|
153
|
+
left: 0,
|
|
154
|
+
right: 0,
|
|
155
|
+
paddingHorizontal: scale(16),
|
|
156
|
+
paddingVertical: verticalScale(16),
|
|
157
|
+
backgroundColor: '#FFFFFF',
|
|
158
|
+
borderTopWidth: 1,
|
|
159
|
+
borderTopColor: '#E5E7EB',
|
|
160
|
+
alignItems: 'center',
|
|
161
|
+
zIndex: 5
|
|
162
|
+
},
|
|
163
|
+
errorWrapper: {
|
|
164
|
+
marginBottom: verticalScale(8),
|
|
165
|
+
width: '100%',
|
|
166
|
+
alignItems: 'center'
|
|
167
|
+
},
|
|
168
|
+
errorText: {
|
|
169
|
+
color: '#DC2626',
|
|
170
|
+
fontSize: moderateScale(14),
|
|
171
|
+
fontWeight: '500',
|
|
172
|
+
textAlign: 'center'
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
export default ZezoPay;
|
|
176
|
+
//# sourceMappingURL=ZezoPay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","View","StyleSheet","Keyboard","TouchableWithoutFeedback","StatusBar","Text","ArrowLeft","scale","verticalScale","moderateScale","KeyboardAwareScrollView","SafeAreaProvider","SafeAreaView","Header","PaymentMethod","Summary","PayButton","useZezoPay","formatCurrency","jsx","_jsx","jsxs","_jsxs","ZezoPay","title","summaryItems","onBack","userInfo","publicKey","digitalProductId","subscriptionId","callback","selectedPayment","setSelectedPayment","items","totalPrice","isSuccess","error","isProcessing","providers","loading","providerError","removeItem","handlePayNow","_id","name","email","children","style","styles","safeArea","edges","barStyle","backgroundColor","headerSafeArea","headerWrapper","leftIcon","size","color","onPress","dismiss","accessible","container","scrollView","contentContainerStyle","scrollContent","keyboardShouldPersistTaps","enableOnAndroid","extraScrollHeight","showsVerticalScrollIndicator","contentInsetAdjustmentBehavior","content","onProviderChange","selectedProvider","isLoading","message","onRemoveItem","bottomContainer","errorWrapper","errorText","onPaymentInitiate","status","paymentButtonText","amount","minimumFractionDigits","noteText","create","flex","borderBottomWidth","borderBottomColor","zIndex","position","paddingBottom","flexGrow","paddingTop","paddingHorizontal","bottom","left","right","paddingVertical","borderTopWidth","borderTopColor","alignItems","marginBottom","width","fontSize","fontWeight","textAlign"],"sourceRoot":"../../../src","sources":["ZezoPay/ZezoPay.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACEC,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epF,OAAO","ignoreList":[]}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View, Text, Pressable, StyleSheet, Platform } from 'react-native';
|
|
5
|
+
import { ArrowLeft } from 'lucide-react-native';
|
|
6
|
+
import { scale, moderateScale } from 'react-native-size-matters';
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
const Header = ({
|
|
9
|
+
title,
|
|
10
|
+
titleStyle,
|
|
11
|
+
containerStyle,
|
|
12
|
+
leftIcon,
|
|
13
|
+
onBack
|
|
14
|
+
}) => {
|
|
15
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
16
|
+
style: [styles.header, containerStyle],
|
|
17
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
18
|
+
style: styles.gridItemLeft,
|
|
19
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
20
|
+
style: styles.backBtnContainer,
|
|
21
|
+
children: /*#__PURE__*/_jsx(Pressable, {
|
|
22
|
+
onPress: onBack,
|
|
23
|
+
android_ripple: {
|
|
24
|
+
color: 'rgba(0,0,0,0.1)',
|
|
25
|
+
borderless: false,
|
|
26
|
+
radius: scale(100)
|
|
27
|
+
},
|
|
28
|
+
style: ({
|
|
29
|
+
pressed
|
|
30
|
+
}) => [styles.backBtnWrapper, pressed && Platform.OS === 'ios' && styles.backBtnPressed],
|
|
31
|
+
hitSlop: 10,
|
|
32
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
33
|
+
style: styles.backBtn,
|
|
34
|
+
children: leftIcon ? leftIcon : /*#__PURE__*/_jsx(ArrowLeft, {
|
|
35
|
+
size: moderateScale(20),
|
|
36
|
+
color: "#000"
|
|
37
|
+
})
|
|
38
|
+
})
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
42
|
+
style: styles.gridItem,
|
|
43
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
44
|
+
style: [styles.title, titleStyle],
|
|
45
|
+
numberOfLines: 1,
|
|
46
|
+
children: title
|
|
47
|
+
})
|
|
48
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
49
|
+
style: styles.gridItem
|
|
50
|
+
})]
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
const styles = StyleSheet.create({
|
|
54
|
+
header: {
|
|
55
|
+
flexDirection: 'row',
|
|
56
|
+
alignItems: 'center',
|
|
57
|
+
width: '100%',
|
|
58
|
+
height: scale(44),
|
|
59
|
+
paddingHorizontal: scale(16),
|
|
60
|
+
justifyContent: 'space-between'
|
|
61
|
+
},
|
|
62
|
+
gridItem: {
|
|
63
|
+
flex: 1,
|
|
64
|
+
alignItems: 'center',
|
|
65
|
+
justifyContent: 'center'
|
|
66
|
+
},
|
|
67
|
+
gridItemLeft: {
|
|
68
|
+
flex: 1,
|
|
69
|
+
alignItems: 'flex-start',
|
|
70
|
+
justifyContent: 'center'
|
|
71
|
+
},
|
|
72
|
+
backBtnContainer: {
|
|
73
|
+
borderRadius: scale(100),
|
|
74
|
+
overflow: 'hidden' // crucial for Android ripple
|
|
75
|
+
},
|
|
76
|
+
backBtnWrapper: {
|
|
77
|
+
borderRadius: scale(100)
|
|
78
|
+
},
|
|
79
|
+
backBtn: {
|
|
80
|
+
justifyContent: 'center',
|
|
81
|
+
alignItems: 'center',
|
|
82
|
+
padding: scale(10),
|
|
83
|
+
width: scale(35),
|
|
84
|
+
height: scale(35)
|
|
85
|
+
},
|
|
86
|
+
backBtnPressed: {
|
|
87
|
+
backgroundColor: 'rgba(0,0,0,0.1)' // iOS pressed effect
|
|
88
|
+
},
|
|
89
|
+
title: {
|
|
90
|
+
fontSize: moderateScale(18),
|
|
91
|
+
fontWeight: '700',
|
|
92
|
+
color: '#000',
|
|
93
|
+
textAlign: 'center'
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
export default Header;
|
|
97
|
+
//# sourceMappingURL=Header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","View","Text","Pressable","StyleSheet","Platform","ArrowLeft","scale","moderateScale","jsx","_jsx","jsxs","_jsxs","Header","title","titleStyle","containerStyle","leftIcon","onBack","style","styles","header","children","gridItemLeft","backBtnContainer","onPress","android_ripple","color","borderless","radius","pressed","backBtnWrapper","OS","backBtnPressed","hitSlop","backBtn","size","gridItem","numberOfLines","create","flexDirection","alignItems","width","height","paddingHorizontal","justifyContent","flex","borderRadius","overflow","padding","backgroundColor","fontSize","fontWeight","textAlign"],"sourceRoot":"../../../../src","sources":["ZezoPay/components/Header.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,cAAc;AAE1E,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,SAASC,KAAK,EAAEC,aAAa,QAAQ,2BAA2B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAUjE,MAAMC,MAA6B,GAAGA,CAAC;EACrCC,KAAK;EACLC,UAAU;EACVC,cAAc;EACdC,QAAQ;EACRC;AACF,CAAC,KAAK;EACJ,oBACEN,KAAA,CAACX,IAAI;IAACkB,KAAK,EAAE,CAACC,MAAM,CAACC,MAAM,EAAEL,cAAc,CAAE;IAAAM,QAAA,gBAE3CZ,IAAA,CAACT,IAAI;MAACkB,KAAK,EAAEC,MAAM,CAACG,YAAa;MAAAD,QAAA,eAC/BZ,IAAA,CAACT,IAAI;QAACkB,KAAK,EAAEC,MAAM,CAACI,gBAAiB;QAAAF,QAAA,eACnCZ,IAAA,CAACP,SAAS;UACRsB,OAAO,EAAEP,MAAO;UAChBQ,cAAc,EAAE;YACdC,KAAK,EAAE,iBAAiB;YACxBC,UAAU,EAAE,KAAK;YACjBC,MAAM,EAAEtB,KAAK,CAAC,GAAG;UACnB,CAAE;UACFY,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C;IACPL,UAAU,EAAE,YAAY;IACxBI,cAAc,EAAE;EAClB,CAAC;EACDrB,gBAAgB,EAAE;IAChBuB,YAAY,EAAExC,KAAK,CAAC,GAAG,CAAC;IACxByC,QAAQ,EAAE,QAAQ,CAAE;EACtB,CAAC;EACDjB,cAAc,EAAE;IACdgB,YAAY,EAAExC,KAAK,CAAC,GAAG;EACzB,CAAC;EACD4B,OAAO,EAAE;IACPU,cAAc,EAAE,QAAQ;IACxBJ,UAAU,EAAE,QAAQ;IACpBQ,OAAO,EAAE1C,KAAK,CAAC,EAAE,CAAC;IAClBmC,KAAK,EAAEnC,KAAK,CAAC,EAAE,CAAC;IAChBoC,MAAM,EAAEpC,KAAK,CAAC,EAAE;EAClB,CAAC;EACD0B,cAAc,EAAE;IACdiB,eAAe,EAAE,iBAAiB,CAAE;EACtC,CAAC;EACDpC,KAAK,EAAE;IACLqC,QAAQ,EAAE3C,aAAa,CAAC,EAAE,CAAC;IAC3B4C,UAAU,EAAE,KAAK;IACjBzB,KAAK,EAAE,MAAM;IACb0B,SAAS,EAAE;EACb;AACF,CAAC,CAAC;AAEF,eAAexC,MAAM","ignoreList":[]}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View, Text, Pressable, StyleSheet, ActivityIndicator } from 'react-native';
|
|
5
|
+
import { scale, verticalScale, moderateScale } from 'react-native-size-matters';
|
|
6
|
+
import LinearGradient from 'react-native-linear-gradient';
|
|
7
|
+
import { Check } from 'lucide-react-native';
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const PayButton = ({
|
|
10
|
+
onPaymentInitiate,
|
|
11
|
+
status = 'idle',
|
|
12
|
+
paymentButtonText = 'Pay Now',
|
|
13
|
+
paymentProcessingText = 'Processing...',
|
|
14
|
+
paymentSuccessText = 'Payment Successful',
|
|
15
|
+
noteText = 'Powered by Zezo Pay'
|
|
16
|
+
}) => {
|
|
17
|
+
const colorsMap = {
|
|
18
|
+
idle: ['#0251ca', '#063482'],
|
|
19
|
+
processing: ['#0a84ff', '#1784e6'],
|
|
20
|
+
success: ['#28a745', '#1c7c31'],
|
|
21
|
+
disabled: ['#556fadff', '#3d71e9ff']
|
|
22
|
+
};
|
|
23
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
24
|
+
style: styles.container,
|
|
25
|
+
children: [status === 'success' ? /*#__PURE__*/_jsx(View, {
|
|
26
|
+
style: styles.shadowWrapper,
|
|
27
|
+
children: /*#__PURE__*/_jsxs(LinearGradient, {
|
|
28
|
+
colors: colorsMap.success,
|
|
29
|
+
start: {
|
|
30
|
+
x: 0,
|
|
31
|
+
y: 0
|
|
32
|
+
},
|
|
33
|
+
end: {
|
|
34
|
+
x: 1,
|
|
35
|
+
y: 0
|
|
36
|
+
},
|
|
37
|
+
style: styles.paymentButton,
|
|
38
|
+
children: [/*#__PURE__*/_jsx(Check, {
|
|
39
|
+
size: 20,
|
|
40
|
+
color: "#fff"
|
|
41
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
42
|
+
style: [styles.successText, {
|
|
43
|
+
marginLeft: scale(8)
|
|
44
|
+
}],
|
|
45
|
+
children: paymentSuccessText
|
|
46
|
+
})]
|
|
47
|
+
})
|
|
48
|
+
}) : /*#__PURE__*/_jsx(Pressable, {
|
|
49
|
+
onPress: onPaymentInitiate,
|
|
50
|
+
disabled: status === 'processing' || status === 'disabled',
|
|
51
|
+
style: ({
|
|
52
|
+
pressed
|
|
53
|
+
}) => [{
|
|
54
|
+
opacity: pressed ? 0.85 : 1,
|
|
55
|
+
width: '100%'
|
|
56
|
+
}],
|
|
57
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
58
|
+
style: styles.shadowWrapper,
|
|
59
|
+
children: /*#__PURE__*/_jsx(LinearGradient, {
|
|
60
|
+
colors: colorsMap[status],
|
|
61
|
+
start: {
|
|
62
|
+
x: 0,
|
|
63
|
+
y: 0
|
|
64
|
+
},
|
|
65
|
+
end: {
|
|
66
|
+
x: 1,
|
|
67
|
+
y: 0
|
|
68
|
+
},
|
|
69
|
+
style: styles.paymentButton,
|
|
70
|
+
children: status === 'processing' ? /*#__PURE__*/_jsxs(View, {
|
|
71
|
+
style: {
|
|
72
|
+
flexDirection: 'row',
|
|
73
|
+
alignItems: 'center'
|
|
74
|
+
},
|
|
75
|
+
children: [/*#__PURE__*/_jsx(ActivityIndicator, {
|
|
76
|
+
color: "#fff",
|
|
77
|
+
style: {
|
|
78
|
+
marginRight: scale(8)
|
|
79
|
+
}
|
|
80
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
81
|
+
style: styles.paymentText,
|
|
82
|
+
children: paymentProcessingText
|
|
83
|
+
})]
|
|
84
|
+
}) : /*#__PURE__*/_jsx(Text, {
|
|
85
|
+
style: styles.paymentText,
|
|
86
|
+
children: paymentButtonText
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
})
|
|
90
|
+
}), noteText && /*#__PURE__*/_jsx(Text, {
|
|
91
|
+
style: styles.noteText,
|
|
92
|
+
children: noteText
|
|
93
|
+
})]
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
const styles = StyleSheet.create({
|
|
97
|
+
container: {
|
|
98
|
+
width: '100%',
|
|
99
|
+
alignItems: 'center'
|
|
100
|
+
},
|
|
101
|
+
shadowWrapper: {
|
|
102
|
+
width: '100%',
|
|
103
|
+
height: verticalScale(50),
|
|
104
|
+
borderRadius: scale(12),
|
|
105
|
+
shadowColor: '#000',
|
|
106
|
+
shadowOffset: {
|
|
107
|
+
width: 0,
|
|
108
|
+
height: 3
|
|
109
|
+
},
|
|
110
|
+
shadowOpacity: 0.2,
|
|
111
|
+
shadowRadius: 4,
|
|
112
|
+
elevation: 3,
|
|
113
|
+
backgroundColor: '#0000',
|
|
114
|
+
justifyContent: 'center'
|
|
115
|
+
},
|
|
116
|
+
paymentButton: {
|
|
117
|
+
width: '100%',
|
|
118
|
+
height: '100%',
|
|
119
|
+
borderRadius: scale(12),
|
|
120
|
+
justifyContent: 'center',
|
|
121
|
+
alignItems: 'center',
|
|
122
|
+
flexDirection: 'row'
|
|
123
|
+
},
|
|
124
|
+
paymentText: {
|
|
125
|
+
color: '#fff',
|
|
126
|
+
fontSize: moderateScale(18),
|
|
127
|
+
fontWeight: '700'
|
|
128
|
+
},
|
|
129
|
+
successText: {
|
|
130
|
+
color: '#fff',
|
|
131
|
+
fontSize: moderateScale(18),
|
|
132
|
+
fontWeight: '700'
|
|
133
|
+
},
|
|
134
|
+
noteText: {
|
|
135
|
+
marginTop: verticalScale(10),
|
|
136
|
+
fontSize: moderateScale(13),
|
|
137
|
+
fontWeight: '600',
|
|
138
|
+
color: '#FF7847',
|
|
139
|
+
textAlign: 'center'
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
export default PayButton;
|
|
143
|
+
//# sourceMappingURL=PayButton.js.map
|