authscape 1.0.50 → 1.0.55

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/.babelrc ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "presets": ["@babel/preset-react", "@babel/preset-env"]
3
+ }
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import Button from '@mui/material/Button';
3
+ import Dialog from '@mui/material/Dialog';
4
+ import DialogActions from '@mui/material/DialogActions';
5
+ import DialogContent from '@mui/material/DialogContent';
6
+ import DialogContentText from '@mui/material/DialogContentText';
7
+ import DialogTitle from '@mui/material/DialogTitle';
8
+
9
+ export default function confirmationModal({title, description, cancelClicked, okClicked, open = false, cancelTitle = "Cancel", okTitle = "OK"}) {
10
+ return (
11
+ <Dialog
12
+ open={open}
13
+ onClose={cancelClicked}
14
+ aria-labelledby="alert-dialog-title"
15
+ aria-describedby="alert-dialog-description">
16
+ <DialogTitle id="alert-dialog-title">
17
+ {title}
18
+ </DialogTitle>
19
+ <DialogContent>
20
+ <DialogContentText id="alert-dialog-description">
21
+ {description}
22
+ </DialogContentText>
23
+ </DialogContent>
24
+ <DialogActions>
25
+ <Button onClick={cancelClicked}>{cancelTitle}</Button>
26
+ <Button onClick={okClicked}>
27
+ {okTitle}
28
+ </Button>
29
+ </DialogActions>
30
+ </Dialog>
31
+ );
32
+ }
@@ -0,0 +1,220 @@
1
+ import React, {useEffect, useState} from 'react';
2
+ import {Elements} from '@stripe/react-stripe-js';
3
+ import {loadStripe} from '@stripe/stripe-js';
4
+ import Box from '@mui/material/Box';
5
+ import Dialog from '@mui/material/Dialog';
6
+ import DialogActions from '@mui/material/DialogActions';
7
+ import DialogContent from '@mui/material/DialogContent';
8
+ import DialogTitle from '@mui/material/DialogTitle';
9
+ import CheckoutForm from './checkoutForm';
10
+ import ApiService from 'authscape/services/apiService';
11
+ import IconButton from '@mui/material/IconButton';
12
+ import CloseIcon from '@mui/icons-material/Close';
13
+ import Tabs from '@mui/material/Tabs';
14
+ import Tab from '@mui/material/Tab';
15
+ import Typography from '@mui/material/Typography';
16
+ import Select from '@mui/material/Select';
17
+ import MenuItem from '@mui/material/MenuItem';
18
+ import Button from '@mui/material/Button';
19
+ import PaymentRoundedIcon from '@mui/icons-material/PaymentRounded';
20
+ import apiService from 'authscape/services/apiService';
21
+ import Grid from '@mui/material/Grid';
22
+
23
+ export default function PaymentModal({title, description, amount, priceId, setIsLoading, isOpen, invoiceId, onModalClose}) {
24
+
25
+ const stripePromise = loadStripe(process.env.stripePublicKey);
26
+ const [options, setOptions] = useState(null);
27
+ const [value, setValue] = React.useState(0);
28
+ const [paymentMethods, setPaymentMethods] = React.useState([]);
29
+ const [paymentMethod, setPaymentMethod] = React.useState(null);
30
+
31
+ const paymentMethodOpened = async () => {
32
+ let response = await ApiService().post("/StripePayment/ConnectCustomer", {
33
+ paymentRequestType: 3,
34
+ amount: amount,
35
+ priceId: priceId
36
+ });
37
+
38
+ setOptions({
39
+ clientSecret: response.data,
40
+ });
41
+
42
+ let responsePayments = await ApiService().get("/NCAInvoices/GetPaymentMethods");
43
+ if (responsePayments != null && responsePayments.status == 200)
44
+ {
45
+ setPaymentMethods(responsePayments.data);
46
+ }
47
+ }
48
+
49
+
50
+ useEffect(() => {
51
+
52
+ if (isOpen)
53
+ {
54
+ paymentMethodOpened();
55
+ }
56
+
57
+ }, [isOpen]);
58
+
59
+ const handleChange = (event, newValue) => {
60
+ setValue(newValue);
61
+ };
62
+
63
+ function a11yProps(index) {
64
+ return {
65
+ id: `simple-tab-${index}`,
66
+ 'aria-controls': `simple-tabpanel-${index}`,
67
+ };
68
+ }
69
+
70
+ const PaymentMethod = ({id, last4, clicked}) => {
71
+ return (
72
+ <Box fullWidth={true} sx={{height: 160, width:"100%", marginTop:2, backgroundColor:"#2196F3", position:"relative", border: "1px solid #2196F3", borderRadius: 1, display:"flex", flexDirection:"column", justifyContent:"center", textAlign:"center", cursor:"pointer"}}
73
+ onClick={() => {
74
+ clicked(id);
75
+ }}>
76
+ <Typography gutterBottom variant="body" component="div" sx={{fontSize:14, position:"absolute", left:15, top:10, color:"white"}}>
77
+ Visa
78
+ </Typography>
79
+ <Typography gutterBottom variant="body" component="div" sx={{verticalAlign:"middle", fontSize:18, color:"white"}}>
80
+ * * * * &nbsp; * * * * &nbsp; * * * * &nbsp; {last4}
81
+ </Typography>
82
+
83
+ <Grid container spacing={1} sx={{position:"absolute", bottom:8, marginLeft:0, width: "100%"}}>
84
+ <Grid item xs={6} sx={{paddingLeft:2}}>
85
+ <Typography gutterBottom variant="body" component="div" sx={{textAlign:"left", fontSize:12, marginTop:1, paddingLeft:1, color:"#e9e9e9"}}>
86
+ CARD HOLDER
87
+ </Typography>
88
+
89
+ <Typography gutterBottom variant="body" component="div" sx={{textAlign:"left", fontSize:12, marginTop:"-9px", paddingLeft:1, color:"white" }}>
90
+ Brandon Zuech
91
+ </Typography>
92
+ </Grid>
93
+ <Grid item xs={6} sx={{textAlign:"right", paddingRight:2}}>
94
+ <Typography gutterBottom variant="body" component="div" sx={{fontSize:12, marginLeft:2, marginTop:1, color:"#e9e9e9"}}>
95
+ EXPIRES
96
+ </Typography>
97
+
98
+ <Typography gutterBottom variant="body" component="div" sx={{fontSize:12, marginLeft:2, marginTop:"-9px", color:"white"}}>
99
+ 08/21
100
+ </Typography>
101
+ </Grid>
102
+ </Grid>
103
+ </Box>
104
+ );
105
+ };
106
+
107
+ function TabPanel(props) {
108
+ const { children, value, index, ...other } = props;
109
+
110
+ return (
111
+ <div
112
+ role="tabpanel"
113
+ hidden={value !== index}
114
+ id={`simple-tabpanel-${index}`}
115
+ aria-labelledby={`simple-tab-${index}`}
116
+ {...other}
117
+ >
118
+ {value === index && (
119
+ <Box sx={{ p: 3 }}>
120
+ <Typography>{children}</Typography>
121
+ </Box>
122
+ )}
123
+ </div>
124
+ );
125
+ }
126
+
127
+ return (
128
+ <Dialog
129
+ fullWidth={true}
130
+ maxWidth={"sm"}
131
+ open={isOpen}
132
+ onClose={() => onModalClose()}>
133
+ <DialogTitle>{title}
134
+
135
+ <IconButton
136
+ aria-label="close"
137
+ onClick={() => {
138
+
139
+ onModalClose();
140
+ }}
141
+ sx={{
142
+ position: 'absolute',
143
+ right: 8,
144
+ top: 8,
145
+ color: (theme) => theme.palette.grey[500],
146
+ }}>
147
+ <CloseIcon />
148
+ </IconButton>
149
+ </DialogTitle>
150
+ <DialogContent>
151
+ {description}
152
+
153
+ <Box sx={{ width: '100%' }}>
154
+ <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
155
+ <Tabs value={value} onChange={handleChange} aria-label="basic tabs example">
156
+ <Tab label="Existing Payment Method" {...a11yProps(0)} />
157
+ <Tab label="Add Payment Method" {...a11yProps(1)} />
158
+ </Tabs>
159
+ </Box>
160
+ <TabPanel value={value} index={0}>
161
+
162
+ <Select
163
+ sx={{marginTop:4}}
164
+ fullWidth={true}
165
+ id="demo-simple-select"
166
+ value={paymentMethod}
167
+ onChange={(val) => {
168
+ setPaymentMethod(val.target.value);
169
+ }}>
170
+ {paymentMethods != null && paymentMethods.map((paymentMethod) => {
171
+ return (
172
+ <MenuItem value={paymentMethod.id} fullWidth={true} sx={{width:"100%"}}>
173
+ <PaymentMethod id={paymentMethod.id} last4={paymentMethod.last4} clicked={() => {
174
+
175
+ }} />
176
+ </MenuItem>)
177
+ })}
178
+ </Select>
179
+
180
+ <Button startIcon={<PaymentRoundedIcon/>} type="submit" variant="contained" disabled={paymentMethod == null} sx={{marginTop:2}} onClick={async () => {
181
+
182
+ setIsLoading(true);
183
+ let response = await apiService().post("/NCAInvoices/PayInvoice", {
184
+ InvoiceId: invoiceId,
185
+ WalletId: paymentMethod
186
+ });
187
+ setIsLoading(false);
188
+
189
+ if (response != null && response.status == 200)
190
+ {
191
+ window.location.reload();
192
+ }
193
+ else
194
+ {
195
+ alert("We had an issue with the payment method");
196
+ }
197
+
198
+
199
+ }}>Pay Now</Button>
200
+
201
+ </TabPanel>
202
+ <TabPanel value={value} index={1}>
203
+ <div>
204
+ <Box mt={4} mb={2}>
205
+ {options != null &&
206
+ <Elements stripe={stripePromise} options={options}>
207
+ <CheckoutForm />
208
+ </Elements>
209
+ }
210
+ </Box>
211
+ </div>
212
+ </TabPanel>
213
+ </Box>
214
+
215
+ </DialogContent>
216
+ <DialogActions>
217
+ </DialogActions>
218
+ </Dialog>
219
+ )
220
+ }
package/index.js CHANGED
@@ -1,6 +1,13 @@
1
- function awesomeEmojiLog(message) {
2
- if (message === undefined) throw new Error("No Message Found");
3
- console.log("😎", message)
4
- };
1
+ import React, { Component } from 'react';
5
2
 
6
- module.exports = awesomeEmojiLog
3
+ export default class DummyComponent extends Component {
4
+
5
+ render () {
6
+
7
+ return (
8
+ <div>I am a dummy react npm module</div>
9
+ )
10
+
11
+ }
12
+
13
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authscape",
3
- "version": "1.0.50",
3
+ "version": "1.0.55",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -10,8 +10,13 @@
10
10
  "author": "zuechb",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
+ "@babel/cli": "^7.18.6",
14
+ "@babel/core": "^7.18.6",
15
+ "@babel/preset-env": "^7.18.6",
16
+ "@babel/preset-react": "^7.18.6",
13
17
  "@emotion/react": "^11.9.3",
14
18
  "@emotion/styled": "^11.9.3",
19
+ "@mui/icons-material": "^5.8.4",
15
20
  "@mui/material": "^5.8.6",
16
21
  "@stripe/react-stripe-js": "^1.9.0",
17
22
  "@stripe/stripe-js": "^1.32.0",
File without changes