Skip to content

Commit

Permalink
added vapid input field in configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Umer Farooq committed Aug 8, 2024
1 parent c5eb9ea commit 9e18f58
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 8 deletions.
4 changes: 4 additions & 0 deletions enatega-multivendor-admin/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@

<head>


<script type="text/javascript">
(function(c,l,a,r,i,t,y){
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
})(window, document, "clarity", "script", "m8tm0wdr2j");
</script>

<script src="https://cdn.amplitude.com/libs/analytics-browser-2.7.4-min.js.gz"></script><script src="https://cdn.amplitude.com/libs/plugin-session-replay-browser-1.6.8-min.js.gz"></script><script src="https://cdn.amplitude.com/libs/plugin-autocapture-browser-0.9.0-min.js.gz"></script><script>window.amplitude.add(window.sessionReplay.plugin({sampleRate: 1})).promise.then(function() {window.amplitude.add(window.amplitudeAutocapturePlugin.plugin());window.amplitude.init('2f6189cefa2b2bd2a6d964a9970f81d6');});</script>
<!-- Begin Inspectlet Asynchronous Code -->

<script type="text/javascript">
(function () {
window.__insp = window.__insp || [];
Expand Down
1 change: 1 addition & 0 deletions enatega-multivendor-admin/src/apollo/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ export const saveFirebaseConfiguration = `
msgSenderId
appId
measurementId
vapidKey
}
}
`
Expand Down
1 change: 1 addition & 0 deletions enatega-multivendor-admin/src/apollo/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ export const getConfiguration = `query GetConfiguration{
skipEmailVerification
skipMobileVerification
costType
vapidKey
}
}`

Expand Down
2 changes: 1 addition & 1 deletion enatega-multivendor-admin/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const App = () => {
MEASUREMENT_ID,
GOOGLE_MAPS_KEY
} = ConfigurableValues()
console.log('GOOGLE_MAPS_KEY_App', GOOGLE_MAPS_KEY)

// const [mapsKey, setMapsKey] = useState(null)
// useEffect(() => {
// if (GOOGLE_MAPS_KEY) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function FirebaseConfiguration(props) {
const [msgSenderId] = useState(props.msgSenderId || '')
const [appId] = useState(props.appId || '')
const [measurementId] = useState(props.measurementId || '')
const [vapidKey] = useState(props.vapidKey || '')

const [firebaseKeyError, setFirebaseKeyError] = useState(null)
const [authDomainError, setAuthDomainError] = useState(null)
Expand All @@ -30,6 +31,7 @@ function FirebaseConfiguration(props) {
const [msgSenderIdError, setMsgSenderIdError] = useState(null)
const [appIdError, setAppIdError] = useState(null)
const [measurementIdError, setMeasurementIdError] = useState(null)
const [vapidKeyError, setVapidKeyError] = useState(null)

const [mutate, { loading }] = useMutation(SAVE_FIREBASE_CONFIGURATION)

Expand Down Expand Up @@ -286,6 +288,29 @@ function FirebaseConfiguration(props) {
/>
</Box>

<Box>
<Typography className={classes.labelText}>Vapid Key</Typography>
<Input
style={{ marginTop: -1 }}
id="input-vapidKey"
name="input-vapidKey"
placeholder="Vapid Key"
defaultValue={vapidKey}
onBlur={event =>
onBlur(setVapidKeyError, 'vapidKey', event.target.value)
}
disableUnderline
className={[
globalClasses.input,
vapidKeyError === false
? globalClasses.inputError
: vapidKeyError === true
? globalClasses.inputSuccess
: ''
]}
/>
</Box>

<Box>
<Button
className={globalClasses.button}
Expand All @@ -304,7 +329,8 @@ function FirebaseConfiguration(props) {
msgSenderId: formRef.current['input-msgSenderId'].value,
appId: formRef.current['input-appId'].value,
measurementId:
formRef.current['input-measurementId'].value
formRef.current['input-measurementId'].value,
vapidKey: formRef.current['input-vapidKey'].value ?? ''
}
}
})
Expand Down
12 changes: 6 additions & 6 deletions enatega-multivendor-admin/src/config/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import ConfigurationContext from '../context/Configuration'

const ConfigurableValues = () => {
const configuration = useContext(ConfigurationContext)
const SERVER_URL = 'https://enatega-multivendor.up.railway.app'
const WS_SERVER_URL = 'wss://enatega-multivendor.up.railway.app'
// const SERVER_URL = 'http://192.168.0.107:8001'
// const WS_SERVER_URL = 'ws://192.168.0.107:8001'
const SERVER_URL = 'https://enatega-multivendor-api-production.up.railway.app'
const WS_SERVER_URL = 'wss://enatega-multivendor-api-production.up.railway.app'
// const SERVER_URL = 'http://192.168.0.110:8001'
// const WS_SERVER_URL = 'ws://192.168.0.110:8001'
const GOOGLE_MAPS_KEY = configuration.googleApiKey
const FIREBASE_KEY = configuration.firebaseKey
const APP_ID = configuration.appId
Expand All @@ -18,10 +18,10 @@ const ConfigurableValues = () => {
const SENTRY_DSN = configuration.dashboardSentryUrl
const CLOUDINARY_UPLOAD_URL = configuration.cloudinaryUploadUrl
const CLOUDINARY_FOOD = configuration.cloudinaryApiKey
const VAPID_KEY =
'BOpVOtmawD0hzOR0F5NQTz_7oTlNVwgKX_EgElDnFuILsaE_jWYPIExAMIIGS-nYmy1lhf2QWFHQnDEFWNG_Z5w'
const VAPID_KEY = configuration.vapidKey
const PAID_VERSION = configuration.isPaidVersion


return {
GOOGLE_MAPS_KEY,
FIREBASE_KEY,
Expand Down
1 change: 1 addition & 0 deletions enatega-multivendor-admin/src/views/Configuration.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ const Configuration = props => {
msgSenderId={data && data.configuration.msgSenderId}
appId={data && data.configuration.appId}
measurementId={data && data.configuration.measurementId}
vapidKey={data && data.configuration.vapidKey}
/>
</Grid>
<Grid item sx={12} md={12} lg={5}>
Expand Down

0 comments on commit 9e18f58

Please sign in to comment.