@verii/components-organizations-registrar 1.0.0 → 1.0.2

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.
Files changed (73) hide show
  1. package/dist/chunks/HolderWalletSelection.BYj3foq0.js +167 -0
  2. package/dist/chunks/HolderWalletSelection.BYj3foq0.js.map +1 -0
  3. package/dist/chunks/HolderWalletSelection.BvPFTrTh.js +166 -0
  4. package/dist/chunks/HolderWalletSelection.BvPFTrTh.js.map +1 -0
  5. package/dist/chunks/{ServicesEdit.BnnqC203.js → ServicesEdit.CrmS66vz.js} +75 -50
  6. package/dist/chunks/ServicesEdit.CrmS66vz.js.map +1 -0
  7. package/dist/chunks/{ServicesEdit.DDgjS5kU.js → ServicesEdit.DFxcohIF.js} +75 -50
  8. package/dist/chunks/ServicesEdit.DFxcohIF.js.map +1 -0
  9. package/dist/chunks/{SetInvitationService.PxAGwk-I.js → SetInvitationService.BeU7-IBo.js} +3 -3
  10. package/dist/chunks/{SetInvitationService.PxAGwk-I.js.map → SetInvitationService.BeU7-IBo.js.map} +1 -1
  11. package/dist/chunks/{SetInvitationService.ZT5lP003.js → SetInvitationService.DtVH6OkH.js} +3 -3
  12. package/dist/chunks/{SetInvitationService.ZT5lP003.js.map → SetInvitationService.DtVH6OkH.js.map} +1 -1
  13. package/dist/chunks/{ValidateTextInput.D5kgjulG.js → ValidateTextInput.1Fv1GPyZ.js} +2 -2
  14. package/dist/chunks/{ValidateTextInput.D5kgjulG.js.map → ValidateTextInput.1Fv1GPyZ.js.map} +1 -1
  15. package/dist/chunks/{ValidateTextInput.DEBaVB1L.js → ValidateTextInput.DPruGgff.js} +2 -2
  16. package/dist/chunks/{ValidateTextInput.DEBaVB1L.js.map → ValidateTextInput.DPruGgff.js.map} +1 -1
  17. package/dist/chunks/{index.Cmn4FlUL.js → index.BDTIIDNe.js} +251 -114
  18. package/dist/chunks/index.BDTIIDNe.js.map +1 -0
  19. package/dist/chunks/{index.YjnxLFjk.js → index.CaxYybSL.js} +115 -56
  20. package/dist/chunks/index.CaxYybSL.js.map +1 -0
  21. package/dist/chunks/{index.DIizFYFZ.js → index.Cjk52g3G.js} +115 -56
  22. package/dist/chunks/index.Cjk52g3G.js.map +1 -0
  23. package/dist/chunks/{index.DMWKdmxs.js → index.DFMQZMWE.js} +12 -2
  24. package/dist/chunks/index.DFMQZMWE.js.map +1 -0
  25. package/dist/chunks/{index.DND10PiY.js → index.DTlm8AhC.js} +11 -1
  26. package/dist/chunks/index.DTlm8AhC.js.map +1 -0
  27. package/dist/chunks/{index.CYCWawJT.js → index.DmF-wFBs.js} +249 -112
  28. package/dist/chunks/index.DmF-wFBs.js.map +1 -0
  29. package/dist/chunks/{serviceTypes.D7c4G5GY.js → serviceTypes.BWVBK33e.js} +52 -31
  30. package/dist/chunks/serviceTypes.BWVBK33e.js.map +1 -0
  31. package/dist/chunks/{serviceTypes.CxLXtDIT.js → serviceTypes.BbBTNXB9.js} +52 -31
  32. package/dist/chunks/serviceTypes.BbBTNXB9.js.map +1 -0
  33. package/dist/components/common.cjs +1 -1
  34. package/dist/components/common.js +1 -1
  35. package/dist/components/invitations.cjs +1 -1
  36. package/dist/components/invitations.js +1 -1
  37. package/dist/components/organizations.cjs +1 -1
  38. package/dist/components/organizations.js +1 -1
  39. package/dist/components/services.cjs +1 -1
  40. package/dist/components/services.js +1 -1
  41. package/dist/index.cjs +1 -1
  42. package/dist/index.js +1 -1
  43. package/dist/pages/invitations.cjs +5 -6
  44. package/dist/pages/invitations.cjs.map +1 -1
  45. package/dist/pages/invitations.js +4 -5
  46. package/dist/pages/invitations.js.map +1 -1
  47. package/dist/pages/organizations.cjs +11 -16
  48. package/dist/pages/organizations.cjs.map +1 -1
  49. package/dist/pages/organizations.js +10 -15
  50. package/dist/pages/organizations.js.map +1 -1
  51. package/dist/pages/services.cjs +27 -30
  52. package/dist/pages/services.cjs.map +1 -1
  53. package/dist/pages/services.js +26 -29
  54. package/dist/pages/services.js.map +1 -1
  55. package/package.json +3 -3
  56. package/dist/chunks/ServicesEdit.BnnqC203.js.map +0 -1
  57. package/dist/chunks/ServicesEdit.DDgjS5kU.js.map +0 -1
  58. package/dist/chunks/index.CYCWawJT.js.map +0 -1
  59. package/dist/chunks/index.Cmn4FlUL.js.map +0 -1
  60. package/dist/chunks/index.DIizFYFZ.js.map +0 -1
  61. package/dist/chunks/index.DMWKdmxs.js.map +0 -1
  62. package/dist/chunks/index.DND10PiY.js.map +0 -1
  63. package/dist/chunks/index.YjnxLFjk.js.map +0 -1
  64. package/dist/chunks/invitations.BI_Qo5Ca.js +0 -10
  65. package/dist/chunks/invitations.BI_Qo5Ca.js.map +0 -1
  66. package/dist/chunks/invitations.BbK6WSY8.js +0 -11
  67. package/dist/chunks/invitations.BbK6WSY8.js.map +0 -1
  68. package/dist/chunks/serviceTypes.CxLXtDIT.js.map +0 -1
  69. package/dist/chunks/serviceTypes.D7c4G5GY.js.map +0 -1
  70. package/dist/chunks/useIsIssuingInspection.C76mY_wb.js +0 -14
  71. package/dist/chunks/useIsIssuingInspection.C76mY_wb.js.map +0 -1
  72. package/dist/chunks/useIsIssuingInspection.DavhBs5B.js +0 -13
  73. package/dist/chunks/useIsIssuingInspection.DavhBs5B.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"services.cjs","sources":["../../src/pages/services/ServiceCreateForm.jsx","../../src/pages/services/useDeleteService.js","../../src/pages/services/ServicesList.jsx"],"sourcesContent":["/**\n * Copyright 2023 Velocity Team\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useRef, useState, useCallback } from 'react';\nimport { kebabCase } from 'lodash-es';\nimport { useRedirect, useCreate, useGetList } from 'react-admin';\nimport { useLocation, useNavigate } from 'react-router';\nimport PropTypes from 'prop-types';\n\nimport Popup from '@/components/common/Popup.jsx';\nimport { credentialTypesByServiceTypes } from '@/utils/serviceTypes.js';\nimport { dataResources } from '@/utils/remoteDataProvider.js';\nimport { getNewServiceIndex } from '@/utils/invitations.js';\nimport useSelectedOrganization from '@/state/selectedOrganizationState.js';\nimport { useIsIssuingInspection } from './hooks/useIsIssuingInspection.js';\nimport { ServiceTypeSelection } from './components/ServiceTypeSelection/index.jsx';\nimport { ServiceEndpointSelection } from './components/ServiceEndpointSelection/index.jsx';\nimport { SecretKeysPopup } from './components/SecretKeysPopup/index.jsx';\n\nconst defaultAuthClient = { clientSecret: '', clientId: '' };\n\nconst ServiceCreateForm = ({ onServiceCreated, services, InterceptOnCreate }) => {\n const { pathname } = useLocation();\n const redirect = useRedirect();\n const navigate = useNavigate();\n const [createService] = useCreate();\n\n const [did] = useSelectedOrganization();\n const openedStateRef = useRef(true);\n const isModalOpened = /\\/services\\/create/.test(pathname);\n\n const [serviceId, setServiceId] = useState('');\n const [selectedCAO, setSelectedCAO] = useState('');\n\n const { data: credentialAgentOperators, isLoading: isLoadingCAO } = useGetList(\n dataResources.SEARCH_PROFILES,\n {\n filter: { serviceTypes: 'CredentialAgentOperator' },\n },\n );\n\n const [selectedStep, setSelectedStep] = useState(1);\n const [selectedServiceType, setSelectedServiceType] = useState('');\n const [authClient, setAuthClient] = useState(defaultAuthClient);\n const [createServiceInProgress, setCreateServiceInProgress] = useState(false);\n\n const [isInterceptOnCreateOpen, setIsInterceptOnCreateOpen] = useState(false);\n const [isKeysPopupOpened, setIsKeysPopupOpened] = useState(false);\n\n const { isIssuingOrInspection, isCAO } = useIsIssuingInspection(selectedServiceType);\n\n const onClose = useCallback(() => {\n navigate(-1);\n }, [navigate]);\n\n // clear previous state after close\n useEffect(() => {\n const reset = () => {\n setSelectedStep(1);\n setSelectedServiceType('');\n setAuthClient(defaultAuthClient);\n };\n if (openedStateRef.current === false && isModalOpened) {\n reset();\n }\n // eslint-disable-next-line better-mutation/no-mutation\n openedStateRef.current = isModalOpened;\n\n return reset;\n }, [isModalOpened]);\n\n useEffect(() => {\n if (InterceptOnCreate && serviceId) {\n setIsInterceptOnCreateOpen(true);\n }\n }, [InterceptOnCreate, serviceId]);\n\n const onCreateService = async ({ serviceEndpoint }) => {\n const type = selectedServiceType.id.match(/.+v1/);\n const kebabType = kebabCase(type[0]);\n const id = `${did}#${kebabType}-${getNewServiceIndex(services, kebabType)}`;\n try {\n setCreateServiceInProgress(true);\n const result = await createService(\n dataResources.SERVICES,\n {\n data: {\n organizationId: did,\n payload: {\n id,\n serviceEndpoint,\n type: type[0],\n credentialTypes: credentialTypesByServiceTypes[selectedServiceType.id],\n },\n },\n },\n { returnPromise: true },\n );\n setCreateServiceInProgress(false);\n setServiceId(result.id);\n if (result.authClient) {\n setAuthClient(result.authClient);\n } else {\n setSelectedCAO(serviceEndpoint.split('#')[0]);\n }\n onServiceCreated();\n } catch (e) {\n setCreateServiceInProgress(false);\n }\n };\n\n return (\n <>\n <Popup\n onClose={onClose}\n title=\"\"\n isOpen={isModalOpened}\n mainContainerStyles={styles.mainContainer}\n disableCloseButton={createServiceInProgress}\n >\n {selectedStep === 1 && (\n <ServiceTypeSelection\n selectedServiceType={selectedServiceType}\n setSelectedServiceType={setSelectedServiceType}\n isLoading={isLoadingCAO}\n handleNext={() => setSelectedStep(2)}\n />\n )}\n {selectedStep === 2 && (\n <ServiceEndpointSelection\n credentialAgentOperators={credentialAgentOperators}\n isIssueOrInspection={isIssuingOrInspection}\n inProgress={createServiceInProgress}\n onCreate={onCreateService}\n handleBack={() => setSelectedStep(1)}\n />\n )}\n </Popup>\n\n <InterceptOnCreate\n isInterceptOnCreateOpen={isInterceptOnCreateOpen}\n serviceId={serviceId}\n onNext={() => setIsKeysPopupOpened(true)}\n onClose={() => {\n redirect('list', 'services');\n }}\n isIssueOrInspection={isIssuingOrInspection}\n selectedCAO={selectedCAO}\n isCAO={isCAO}\n />\n\n <SecretKeysPopup\n isOpen={isKeysPopupOpened}\n secretKeys={{ authClients: [authClient] }}\n onClose={() => {\n setIsKeysPopupOpened(false);\n navigate(-1);\n }}\n wording={{\n title:\n // eslint-disable-next-line max-len\n 'Here are your secret identifiers. Please keep a copy of these as they will not be availableonce you close this dialog. You may need to pass this to the admin of your Credential Agent.',\n subtitle: 'Download or copy your secret encryption keys and keep them somewhere safe.',\n }}\n warningWording={{\n title: 'You must download a copy of your keys before exiting',\n subtitle:\n 'They will not be available again and are critical for managing your organization data.',\n }}\n />\n </>\n );\n};\n\nconst styles = {\n mainContainer: { pt: 2 },\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nServiceCreateForm.propTypes = {\n onServiceCreated: PropTypes.func,\n services: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string.isRequired,\n }),\n ).isRequired,\n InterceptOnCreate: PropTypes.elementType,\n};\n\nexport default ServiceCreateForm;\n","/**\n * Copyright 2023 Velocity Team\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useState } from 'react';\nimport { useDelete } from 'react-admin';\nimport { dataResources } from '../../utils/remoteDataProvider.js';\nimport useSelectedOrganization from '../../state/selectedOrganizationState.js';\n\nconst useDeleteService = (refetch) => {\n const [did] = useSelectedOrganization();\n const [serviceToDelete, setServiceToDelete] = useState(null);\n const [isDeletingService, setIsDeletingService] = useState(false);\n const [deleteOne] = useDelete(\n dataResources.SERVICES,\n {\n id: serviceToDelete,\n },\n {\n onSettled: () =>\n refetch().finally(() => {\n setIsDeletingService(false);\n setServiceToDelete(null);\n }),\n },\n );\n\n const handleServiceDeleteConfirm = async () => {\n setIsDeletingService(true);\n try {\n await deleteOne(dataResources.SERVICES, {\n id: serviceToDelete.id,\n previousData: {\n organizationId: did,\n },\n });\n } catch (e) {\n setIsDeletingService(false);\n throw e;\n }\n };\n\n return { handleServiceDeleteConfirm, isDeletingService, serviceToDelete, setServiceToDelete };\n};\n\nexport default useDeleteService;\n","/**\n * Copyright 2023 Velocity Team\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useMemo } from 'react';\nimport { useSearchParams } from 'react-router';\nimport { Box, Button, Container, Stack, Typography } from '@mui/material';\nimport EditIcon from '@mui/icons-material/Edit';\nimport DeleteIcon from '@mui/icons-material/Delete';\nimport { useGetOne, useRedirect, useUpdate } from 'react-admin';\n\nimport PropTypes from 'prop-types';\nimport ListItem from '@/components/common/ListItem.jsx';\nimport Loading from '@/components/Loading.jsx';\nimport ServicesEdit from '@/components/services/ServicesEdit.jsx';\nimport ServicesDelete from '@/components/services/ServicesDelete.jsx';\nimport useSelectedOrganization from '@/state/selectedOrganizationState.js';\nimport { dataResources } from '@/utils/remoteDataProvider.js';\nimport useParticipantAgreementState from '@/state/participantAgreementState.js';\nimport ServiceCreateForm from './ServiceCreateForm.jsx';\nimport { serviceTypeTitlesMap } from '../../utils/serviceTypes.js';\nimport useDeleteService from './useDeleteService.js';\n\nconst SAVE_ERROR_MESSAGE =\n 'We were unable to update your service with the details provided. Please check to ensure you have provided valid information and then try again.';\n\nconst getAmountTitle = (total) => `${total} active service${total > 1 ? 's' : ''}`;\n\nconst ServicesList = ({\n // override props, defaulting to your internal components\n EditComponent = ServicesEdit,\n CreateComponent = ServiceCreateForm,\n DeleteComponent = ServicesDelete,\n AdditionalServiceProperties = {},\n}) => {\n const [params, setParams] = useSearchParams();\n const currentlyEditableServiceId = params.get('id');\n const [did] = useSelectedOrganization();\n\n const [, setParticipantAgreementApproved] = useParticipantAgreementState();\n\n const {\n data,\n isLoading,\n isFetching,\n refetch: refetchOrganizationServices,\n } = useGetOne('organizations', { id: did }, { enabled: !!did });\n\n const { handleServiceDeleteConfirm, isDeletingService, serviceToDelete, setServiceToDelete } =\n useDeleteService(refetchOrganizationServices);\n\n const services = useMemo(() => data?.didDoc?.service || [], [data?.didDoc?.service]);\n const servicesActivated = useMemo(\n () =>\n services.map((item) => ({\n ...item,\n activated: data?.activatedServiceIds?.includes(item.id) || false,\n })),\n [services, data],\n );\n\n const totalActivatedServices = servicesActivated.filter(({ activated }) => activated).length;\n const currentlyEditableService = useMemo(\n () =>\n currentlyEditableServiceId\n ? services.find((item) => item.id === currentlyEditableServiceId)\n : null,\n [services, currentlyEditableServiceId],\n );\n\n const [updateService] = useUpdate(undefined, undefined, {\n onSuccess: () => {\n setParticipantAgreementApproved(true);\n\n refetchOrganizationServices();\n },\n });\n\n const serviceTitle = (service) => {\n if (service.type === 'VlcContactIssuer_v1') {\n if (service.credentialTypes?.includes('EmailV1.0')) {\n return 'Primary Source Email Issuer (eg. Email Service Provider)';\n }\n return 'Primary Source Phone Issuer (eg. Telco)';\n }\n return serviceTypeTitlesMap[service.type] || service.type;\n };\n\n // eslint-disable-next-line consistent-return\n const onSave = async ({ serviceEndpoint }) => {\n try {\n await updateService(\n dataResources.SERVICES,\n {\n id: currentlyEditableService.id,\n data: {\n organizationId: did,\n payload: {\n serviceEndpoint,\n },\n },\n },\n { returnPromise: true },\n );\n } catch (e) {\n return {\n serviceEndpoint: SAVE_ERROR_MESSAGE,\n };\n }\n };\n\n const editAction = useMemo(\n () => ({\n title: 'EDIT',\n icon: <EditIcon />,\n action: (id) => setParams({ id }),\n }),\n [setParams],\n );\n\n const deleteAction = useMemo(\n () => ({\n title: 'DELETE',\n icon: <DeleteIcon />,\n action: (id) => setServiceToDelete(id),\n }),\n [setServiceToDelete],\n );\n\n const isLoadingVisible = isLoading || isFetching;\n\n const redirect = useRedirect();\n const handleCloseEdit = () => {\n setParams({});\n };\n\n return (\n <Container maxWidth=\"xl\" sx={{ mt: 5 }}>\n <Typography variant=\"h3\">Manage Services</Typography>\n <Box sx={{ mt: 2, mb: 4, maxWidth: '720px' }}>\n <Typography variant=\"subtitle1\">\n Setup the services your organization is to be offering across the Velocity Network™:\n Issuing, Verifying, Operating a Credential Agent and/or operating a Node.\n </Typography>\n </Box>\n <Stack\n sx={{ mb: 2 }}\n flexDirection=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"flex-end\"\n >\n <Button variant=\"outlined\" onClick={() => redirect('create', 'services')}>\n Add service +\n </Button>\n {!!totalActivatedServices && (\n <Typography color=\"secondary.light\" sx={{ fontSize: 14 }}>\n {getAmountTitle(totalActivatedServices)}\n </Typography>\n )}\n </Stack>\n {isLoadingVisible && <Loading sx={{ pt: '60px' }} />}\n {!isLoadingVisible &&\n servicesActivated.map((service) => (\n <ListItem\n key={service.id}\n id={service.id}\n title={serviceTitle(service)}\n status={\n service.activated\n ? { title: 'ACTIVATED', color: 'primary.success' }\n : { title: 'INACTIVE', color: 'primary.main' }\n }\n showActions\n actions={[editAction, deleteAction]}\n content={[\n [\n { name: 'service id', value: service.id },\n { name: 'service endpoint', value: service.serviceEndpoint },\n ...(service.credentialTypes\n ? [\n {\n name: 'credential types',\n value: service.credentialTypes.join(', '),\n },\n ]\n : []),\n ...(AdditionalServiceProperties && AdditionalServiceProperties[service.type]\n ? [\n {\n name: AdditionalServiceProperties[service.type]?.name,\n value: AdditionalServiceProperties[service.type]?.value,\n },\n ]\n : []),\n ],\n ]}\n />\n ))}\n <EditComponent\n onClose={handleCloseEdit}\n onSave={onSave}\n selectedService={currentlyEditableService}\n />\n <CreateComponent onServiceCreated={refetchOrganizationServices} services={services} />\n <DeleteComponent\n isLoading={isDeletingService}\n onClose={() => setServiceToDelete(null)}\n onConfirm={handleServiceDeleteConfirm}\n selectedService={serviceToDelete}\n />\n </Container>\n );\n};\n// eslint-disable-next-line better-mutation/no-mutation\nServicesList.propTypes = {\n EditComponent: PropTypes.elementType,\n CreateComponent: PropTypes.elementType,\n DeleteComponent: PropTypes.elementType,\n AdditionalServiceProperties: PropTypes.object,\n};\n\nexport default ServicesList;\n"],"names":["useLocation","useRedirect","useNavigate","useCreate","useSelectedOrganization","useRef","useState","useGetList","dataResources","useIsIssuingInspection","useCallback","useEffect","kebabCase","getNewServiceIndex","credentialTypesByServiceTypes","jsxs","Fragment","Popup","jsx","ServiceTypeSelection","ServiceEndpointSelection","SecretKeysPopup","useDelete","ServicesEdit","ServicesDelete","useSearchParams","useParticipantAgreementState","useGetOne","useMemo","useUpdate","serviceTypeTitlesMap","Container","Typography","Box","Stack","Button","Loading","ListItem"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAM,oBAAoB,EAAE,cAAc,IAAI,UAAU,GAAA;AAExD,MAAM,oBAAoB,CAAC,EAAE,kBAAkB,UAAU,wBAAwB;AAC/E,QAAM,EAAE,SAAA,IAAaA,wBAAA;AACrB,QAAM,WAAWC,WAAAA,YAAA;AACjB,QAAM,WAAWC,YAAAA,YAAA;AACjB,QAAM,CAAC,aAAa,IAAIC,qBAAA;AAExB,QAAM,CAAC,GAAG,IAAIC,kDAAA;AACd,QAAM,iBAAiBC,MAAAA,OAAO,IAAI;AAClC,QAAM,gBAAgB,qBAAqB,KAAK,QAAQ;AAExD,QAAM,CAAC,WAAW,YAAY,IAAIC,MAAAA,SAAS,EAAE;AAC7C,QAAM,CAAC,aAAa,cAAc,IAAIA,MAAAA,SAAS,EAAE;AAEjD,QAAM,EAAE,MAAM,0BAA0B,WAAW,iBAAiBC,WAAAA;AAAAA,IAClEC,mBAAAA,cAAc;AAAA,IACd;AAAA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"}
1
+ {"version":3,"file":"services.cjs","sources":["../../src/pages/services/utils/buildServiceContent.js","../../src/pages/services/ServiceCreateForm.jsx","../../src/pages/services/useDeleteService.js","../../src/pages/services/ServicesList.jsx"],"sourcesContent":["export const buildServiceContent = (item, title) => {\n if (!item) return [];\n\n const value = Array.isArray(item) ? item.join(', ') : item;\n return [{ name: title, value }];\n};\n","/**\n * Copyright 2023 Velocity Team\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useRef, useState, useCallback } from 'react';\nimport { useRedirect, useCreate, useGetList } from 'react-admin';\nimport { useLocation, useNavigate } from 'react-router';\nimport PropTypes from 'prop-types';\n\nimport Popup from '@/components/common/Popup.jsx';\nimport { dataResources } from '@/utils/remoteDataProvider.js';\nimport useSelectedOrganization from '@/state/selectedOrganizationState.js';\nimport { useIsIssuingInspection } from './hooks/useIsIssuingInspection.js';\nimport { ServiceTypeSelection } from './components/ServiceTypeSelection/index.jsx';\nimport { ServiceEndpointSelection } from './components/ServiceEndpointSelection/index.jsx';\nimport { SecretKeysPopup } from './components/SecretKeysPopup/index.jsx';\nimport { buildPayload } from './utils/buildPayload.js';\n\nconst defaultAuthClient = { clientSecret: '', clientId: '' };\n\nconst ServiceCreateForm = ({ onServiceCreated, services, InterceptOnCreate }) => {\n const { pathname } = useLocation();\n const redirect = useRedirect();\n const navigate = useNavigate();\n const [createService] = useCreate();\n\n const [did] = useSelectedOrganization();\n const openedStateRef = useRef(true);\n const isModalOpened = /\\/services\\/create/.test(pathname);\n\n const [serviceId, setServiceId] = useState('');\n const [selectedCAO, setSelectedCAO] = useState('');\n\n const { data: credentialAgentOperators, isLoading: isLoadingCAO } = useGetList(\n dataResources.SEARCH_PROFILES,\n {\n filter: { serviceTypes: 'CredentialAgentOperator' },\n },\n );\n\n const [selectedStep, setSelectedStep] = useState(1);\n const [selectedServiceType, setSelectedServiceType] = useState('');\n const [authClient, setAuthClient] = useState(defaultAuthClient);\n const [createServiceInProgress, setCreateServiceInProgress] = useState(false);\n\n const [isInterceptOnCreateOpen, setIsInterceptOnCreateOpen] = useState(false);\n const [isKeysPopupOpened, setIsKeysPopupOpened] = useState(false);\n\n const { isIssuingOrInspection, isCAO } = useIsIssuingInspection(selectedServiceType);\n\n const onClose = useCallback(() => {\n navigate(-1);\n }, [navigate]);\n\n // clear previous state after close\n useEffect(() => {\n const reset = () => {\n setSelectedStep(1);\n setSelectedServiceType('');\n setAuthClient(defaultAuthClient);\n };\n if (openedStateRef.current === false && isModalOpened) {\n reset();\n }\n // eslint-disable-next-line better-mutation/no-mutation\n openedStateRef.current = isModalOpened;\n\n return reset;\n }, [isModalOpened]);\n\n useEffect(() => {\n if (InterceptOnCreate && serviceId) {\n setIsInterceptOnCreateOpen(true);\n }\n }, [InterceptOnCreate, serviceId]);\n\n const onCreateService = async (service) => {\n const type = selectedServiceType.id.match(/.+v1/);\n const payload = buildPayload(service, type[0], did, services);\n try {\n setCreateServiceInProgress(true);\n const result = await createService(\n dataResources.SERVICES,\n {\n data: {\n organizationId: did,\n payload,\n },\n },\n { returnPromise: true },\n );\n setCreateServiceInProgress(false);\n setServiceId(result.id);\n if (result.authClient) {\n setAuthClient(result.authClient);\n } else {\n setSelectedCAO(service.serviceEndpoint.split('#')[0]);\n }\n onServiceCreated();\n } catch (e) {\n setCreateServiceInProgress(false);\n }\n };\n\n return (\n <>\n <Popup\n onClose={onClose}\n title=\"\"\n isOpen={isModalOpened}\n mainContainerStyles={styles.mainContainer}\n disableCloseButton={createServiceInProgress}\n >\n {selectedStep === 1 && (\n <ServiceTypeSelection\n selectedServiceType={selectedServiceType}\n setSelectedServiceType={setSelectedServiceType}\n isLoading={isLoadingCAO}\n handleNext={() => setSelectedStep(2)}\n />\n )}\n {selectedStep === 2 && (\n <ServiceEndpointSelection\n credentialAgentOperators={credentialAgentOperators}\n selectedServiceType={selectedServiceType}\n inProgress={createServiceInProgress}\n onCreate={onCreateService}\n handleBack={() => setSelectedStep(1)}\n />\n )}\n </Popup>\n\n <InterceptOnCreate\n isInterceptOnCreateOpen={isInterceptOnCreateOpen}\n serviceId={serviceId}\n onNext={() => setIsKeysPopupOpened(true)}\n onClose={() => {\n redirect('list', 'services');\n }}\n isIssueOrInspection={isIssuingOrInspection}\n selectedCAO={selectedCAO}\n isCAO={isCAO}\n />\n\n <SecretKeysPopup\n isOpen={isKeysPopupOpened}\n secretKeys={{ authClients: [authClient] }}\n onClose={() => {\n setIsKeysPopupOpened(false);\n navigate(-1);\n }}\n wording={{\n title:\n // eslint-disable-next-line max-len\n 'Here are your secret identifiers. Please keep a copy of these as they will not be availableonce you close this dialog. You may need to pass this to the admin of your Credential Agent.',\n subtitle: 'Download or copy your secret encryption keys and keep them somewhere safe.',\n }}\n warningWording={{\n title: 'You must download a copy of your keys before exiting',\n subtitle:\n 'They will not be available again and are critical for managing your organization data.',\n }}\n />\n </>\n );\n};\n\nconst styles = {\n mainContainer: { pt: 2 },\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nServiceCreateForm.propTypes = {\n onServiceCreated: PropTypes.func,\n services: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string.isRequired,\n }),\n ).isRequired,\n InterceptOnCreate: PropTypes.elementType,\n};\n\nexport default ServiceCreateForm;\n","/**\n * Copyright 2023 Velocity Team\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useState } from 'react';\nimport { useDelete } from 'react-admin';\nimport { dataResources } from '../../utils/remoteDataProvider.js';\nimport useSelectedOrganization from '../../state/selectedOrganizationState.js';\n\nconst useDeleteService = (refetch) => {\n const [did] = useSelectedOrganization();\n const [serviceToDelete, setServiceToDelete] = useState(null);\n const [isDeletingService, setIsDeletingService] = useState(false);\n const [deleteOne] = useDelete(\n dataResources.SERVICES,\n {\n id: serviceToDelete,\n },\n {\n onSettled: () =>\n refetch().finally(() => {\n setIsDeletingService(false);\n setServiceToDelete(null);\n }),\n },\n );\n\n const handleServiceDeleteConfirm = async () => {\n setIsDeletingService(true);\n try {\n await deleteOne(dataResources.SERVICES, {\n id: serviceToDelete.id,\n previousData: {\n organizationId: did,\n },\n });\n } catch (e) {\n setIsDeletingService(false);\n throw e;\n }\n };\n\n return { handleServiceDeleteConfirm, isDeletingService, serviceToDelete, setServiceToDelete };\n};\n\nexport default useDeleteService;\n","/**\n * Copyright 2023 Velocity Team\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useMemo } from 'react';\nimport { useSearchParams } from 'react-router';\nimport { Box, Button, Container, Stack, Typography } from '@mui/material';\nimport EditIcon from '@mui/icons-material/Edit';\nimport DeleteIcon from '@mui/icons-material/Delete';\nimport { useGetOne, useRedirect, useUpdate } from 'react-admin';\nimport PropTypes from 'prop-types';\nimport { omit } from 'lodash-es';\n\nimport ListItem from '@/components/common/ListItem.jsx';\nimport Loading from '@/components/Loading.jsx';\nimport ServicesEdit from '@/components/services/ServicesEdit.jsx';\nimport ServicesDelete from '@/components/services/ServicesDelete.jsx';\nimport useSelectedOrganization from '@/state/selectedOrganizationState.js';\nimport { dataResources } from '@/utils/remoteDataProvider.js';\nimport useParticipantAgreementState from '@/state/participantAgreementState.js';\nimport ServiceCreateForm from './ServiceCreateForm.jsx';\nimport { serviceTypeTitlesMap } from '../../utils/serviceTypes.js';\nimport { buildServiceContent } from './utils/buildServiceContent.js';\nimport useDeleteService from './useDeleteService.js';\n\nconst SAVE_ERROR_MESSAGE =\n 'We were unable to update your service with the details provided. Please check to ensure you have provided valid information and then try again.';\n\nconst getAmountTitle = (total) => `${total} active service${total > 1 ? 's' : ''}`;\n\nconst ServicesList = ({\n // override props, defaulting to your internal components\n EditComponent = ServicesEdit,\n CreateComponent = ServiceCreateForm,\n DeleteComponent = ServicesDelete,\n AdditionalServiceProperties = {},\n}) => {\n const [params, setParams] = useSearchParams();\n const currentlyEditableServiceId = params.get('id');\n const [did] = useSelectedOrganization();\n\n const [, setParticipantAgreementApproved] = useParticipantAgreementState();\n\n const {\n data,\n isLoading,\n isFetching,\n refetch: refetchOrganizationServices,\n } = useGetOne('organizations', { id: did }, { enabled: !!did });\n\n const { handleServiceDeleteConfirm, isDeletingService, serviceToDelete, setServiceToDelete } =\n useDeleteService(refetchOrganizationServices);\n\n const services = useMemo(() => data?.services || [], [data?.services]);\n const servicesActivated = useMemo(\n () =>\n services.map((item) => ({\n ...item,\n activated: data?.activatedServiceIds?.includes(item.id) || false,\n })),\n [services, data],\n );\n\n const totalActivatedServices = servicesActivated.filter(({ activated }) => activated).length;\n const currentlyEditableService = useMemo(\n () =>\n currentlyEditableServiceId\n ? services.find((item) => item.id === currentlyEditableServiceId)\n : null,\n [services, currentlyEditableServiceId],\n );\n\n const [updateService] = useUpdate(undefined, undefined, {\n onSuccess: () => {\n setParticipantAgreementApproved(true);\n\n refetchOrganizationServices();\n },\n });\n\n const serviceTitle = (service) => {\n if (service.type === 'VlcContactIssuer_v1') {\n if (service.credentialTypes?.includes('EmailV1.0')) {\n return 'Primary Source Email Issuer (eg. Email Service Provider)';\n }\n return 'Primary Source Phone Issuer (eg. Telco)';\n }\n return serviceTypeTitlesMap[service.type] || service.type;\n };\n\n // eslint-disable-next-line consistent-return\n const onSave = async (payload) => {\n try {\n await updateService(\n dataResources.SERVICES,\n {\n id: currentlyEditableService.id,\n data: {\n organizationId: did,\n payload: omit(payload, ['id', 'type']),\n },\n },\n { returnPromise: true },\n );\n } catch (e) {\n return {\n serviceEndpoint: SAVE_ERROR_MESSAGE,\n };\n }\n };\n\n const editAction = useMemo(\n () => ({\n title: 'EDIT',\n icon: <EditIcon />,\n action: (id) => setParams({ id }),\n }),\n [setParams],\n );\n\n const deleteAction = useMemo(\n () => ({\n title: 'DELETE',\n icon: <DeleteIcon />,\n action: (id) => setServiceToDelete(id),\n }),\n [setServiceToDelete],\n );\n\n const isLoadingVisible = isLoading || isFetching;\n\n const redirect = useRedirect();\n const handleCloseEdit = () => {\n setParams({});\n };\n\n return (\n <Container maxWidth=\"xl\" sx={{ mt: 5 }}>\n <Typography variant=\"h3\">Manage Services</Typography>\n <Box sx={{ mt: 2, mb: 4, maxWidth: '720px' }}>\n <Typography variant=\"subtitle1\">\n Setup the services your organization is to be offering across the Velocity Network™:\n Issuing, Verifying, Operating a Credential Agent and/or operating a Node.\n </Typography>\n </Box>\n <Stack\n sx={{ mb: 2 }}\n flexDirection=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"flex-end\"\n >\n <Button variant=\"outlined\" onClick={() => redirect('create', 'services')}>\n Add service +\n </Button>\n {!!totalActivatedServices && (\n <Typography color=\"secondary.light\" sx={{ fontSize: 14 }}>\n {getAmountTitle(totalActivatedServices)}\n </Typography>\n )}\n </Stack>\n {isLoadingVisible && <Loading sx={{ pt: '60px' }} />}\n {!isLoadingVisible &&\n servicesActivated.map((service) => (\n <ListItem\n key={service.id}\n id={service.id}\n title={serviceTitle(service)}\n status={\n service.activated\n ? { title: 'ACTIVATED', color: 'primary.success' }\n : { title: 'INACTIVE', color: 'primary.main' }\n }\n showActions\n actions={[editAction, deleteAction]}\n content={[\n [\n { name: 'service id', value: service.id },\n { name: 'service endpoint', value: service.serviceEndpoint },\n ...buildServiceContent(service.credentialTypes, 'credential types'),\n ...buildServiceContent(service.name, 'wallet name'),\n ...buildServiceContent(service.supportedExchangeProtocols, 'protocols'),\n ...buildServiceContent(service.playStoreUrl, 'play store url'),\n ...buildServiceContent(service.googlePlayId, 'google play id'),\n ...buildServiceContent(service.appleAppStoreUrl, 'apple app store url'),\n ...buildServiceContent(service.appleAppId, 'apple app id'),\n ...(AdditionalServiceProperties && AdditionalServiceProperties[service.type]\n ? [\n {\n name: AdditionalServiceProperties[service.type]?.name,\n value: AdditionalServiceProperties[service.type]?.value,\n },\n ]\n : []),\n ],\n ]}\n />\n ))}\n <EditComponent\n onClose={handleCloseEdit}\n onSave={onSave}\n selectedService={currentlyEditableService}\n />\n <CreateComponent onServiceCreated={refetchOrganizationServices} services={services} />\n <DeleteComponent\n isLoading={isDeletingService}\n onClose={() => setServiceToDelete(null)}\n onConfirm={handleServiceDeleteConfirm}\n selectedService={serviceToDelete}\n />\n </Container>\n );\n};\n// eslint-disable-next-line better-mutation/no-mutation\nServicesList.propTypes = {\n EditComponent: PropTypes.elementType,\n CreateComponent: PropTypes.elementType,\n DeleteComponent: PropTypes.elementType,\n AdditionalServiceProperties: PropTypes.object,\n};\n\nexport default ServicesList;\n"],"names":["useLocation","useRedirect","useNavigate","useCreate","useSelectedOrganization","useRef","useState","useGetList","dataResources","useIsIssuingInspection","useCallback","useEffect","buildPayload","jsxs","Fragment","Popup","jsx","ServiceTypeSelection","ServiceEndpointSelection","SecretKeysPopup","useDelete","ServicesEdit","ServicesDelete","useSearchParams","useParticipantAgreementState","useGetOne","useMemo","useUpdate","serviceTypeTitlesMap","omit","Container","Typography","Box","Stack","Button","Loading","ListItem"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAO,MAAM,sBAAsB,CAAC,MAAM,UAAU;AAClD,MA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,IAAI,IACvE;AAAA,cACE;AAAA,gBACE,MAAM,4BAA4B,QAAQ,IAAI,GAAG;AAAA,gBACjD,OAAO,4BAA4B,QAAQ,IAAI,GAAG;AAAA,cAAA;AAAA,YACpD,IAEF,CAAA;AAAA,UAAC;AAAA,QACP;AAAA,MACF;AAAA,MA9BK,QAAQ;AAAA,IAAA,CAgChB;AAAA,IACHpB,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,SAAS;AAAA,QACT;AAAA,QACA,iBAAiB;AAAA,MAAA;AAAA,IAAA;AAAA,IAEnBA,2BAAAA,IAAC,iBAAA,EAAgB,kBAAkB,6BAA6B,SAAA,CAAoB;AAAA,IACpFA,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW;AAAA,QACX,SAAS,MAAM,mBAAmB,IAAI;AAAA,QACtC,WAAW;AAAA,QACX,iBAAiB;AAAA,MAAA;AAAA,IAAA;AAAA,EACnB,GACF;AAEJ;AAEA,aAAa,YAAY;AAAA,EACvB,eAAe,UAAU;AAAA,EACzB,iBAAiB,UAAU;AAAA,EAC3B,iBAAiB,UAAU;AAAA,EAC3B,6BAA6B,UAAU;AACzC;;;;"}
@@ -1,24 +1,28 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { useRef, useState, useCallback, useEffect, useMemo } from "react";
3
- import { kebabCase } from "lodash-es";
4
3
  import { useRedirect, useCreate, useGetList, useDelete, useGetOne, useUpdate } from "react-admin";
5
4
  import { useLocation, useNavigate, useSearchParams } from "react-router";
6
5
  import PropTypes from "prop-types";
7
6
  import { P as Popup } from "../chunks/Popup.C5odWCD_.js";
8
- import { c as credentialTypesByServiceTypes, a as serviceTypeTitlesMap } from "../chunks/serviceTypes.CxLXtDIT.js";
9
7
  import { d as dataResources } from "../chunks/remoteDataProvider.gtTXA1-g.js";
10
- import { g as getNewServiceIndex } from "../chunks/invitations.BbK6WSY8.js";
11
8
  import { u as useSelectedOrganization } from "../chunks/selectedOrganizationState.DBpKeOn0.js";
12
- import { u as useIsIssuingInspection } from "../chunks/useIsIssuingInspection.C76mY_wb.js";
13
- import { S as ServiceTypeSelection, a as ServiceEndpointSelection } from "../chunks/index.Cmn4FlUL.js";
14
- import { S as SecretKeysPopup } from "../chunks/index.DMWKdmxs.js";
9
+ import { u as useIsIssuingInspection } from "../chunks/HolderWalletSelection.BYj3foq0.js";
10
+ import { S as ServiceTypeSelection, a as ServiceEndpointSelection, b as buildPayload } from "../chunks/index.BDTIIDNe.js";
11
+ import { S as SecretKeysPopup } from "../chunks/index.DFMQZMWE.js";
15
12
  import { Container, Typography, Box, Stack, Button } from "@mui/material";
16
13
  import EditIcon from "@mui/icons-material/Edit";
17
14
  import DeleteIcon from "@mui/icons-material/Delete";
15
+ import { omit } from "lodash-es";
18
16
  import { L as ListItem } from "../chunks/ListItem.DgXqrom8.js";
19
17
  import { L as Loading } from "../chunks/Loading.Bcm3xNJU.js";
20
- import { a as ServicesEdit, S as ServicesDelete } from "../chunks/ServicesEdit.DDgjS5kU.js";
18
+ import { a as ServicesEdit, S as ServicesDelete } from "../chunks/ServicesEdit.DFxcohIF.js";
21
19
  import { u as useParticipantAgreementState } from "../chunks/participantAgreementState.DFCQsamR.js";
20
+ import { a as serviceTypeTitlesMap } from "../chunks/serviceTypes.BbBTNXB9.js";
21
+ const buildServiceContent = (item, title) => {
22
+ if (!item) return [];
23
+ const value = Array.isArray(item) ? item.join(", ") : item;
24
+ return [{ name: title, value }];
25
+ };
22
26
  const defaultAuthClient = { clientSecret: "", clientId: "" };
23
27
  const ServiceCreateForm = ({ onServiceCreated, services, InterceptOnCreate }) => {
24
28
  const { pathname } = useLocation();
@@ -63,10 +67,9 @@ const ServiceCreateForm = ({ onServiceCreated, services, InterceptOnCreate }) =>
63
67
  setIsInterceptOnCreateOpen(true);
64
68
  }
65
69
  }, [InterceptOnCreate, serviceId]);
66
- const onCreateService = async ({ serviceEndpoint }) => {
70
+ const onCreateService = async (service) => {
67
71
  const type = selectedServiceType.id.match(/.+v1/);
68
- const kebabType = kebabCase(type[0]);
69
- const id = `${did}#${kebabType}-${getNewServiceIndex(services, kebabType)}`;
72
+ const payload = buildPayload(service, type[0], did, services);
70
73
  try {
71
74
  setCreateServiceInProgress(true);
72
75
  const result = await createService(
@@ -74,12 +77,7 @@ const ServiceCreateForm = ({ onServiceCreated, services, InterceptOnCreate }) =>
74
77
  {
75
78
  data: {
76
79
  organizationId: did,
77
- payload: {
78
- id,
79
- serviceEndpoint,
80
- type: type[0],
81
- credentialTypes: credentialTypesByServiceTypes[selectedServiceType.id]
82
- }
80
+ payload
83
81
  }
84
82
  },
85
83
  { returnPromise: true }
@@ -89,7 +87,7 @@ const ServiceCreateForm = ({ onServiceCreated, services, InterceptOnCreate }) =>
89
87
  if (result.authClient) {
90
88
  setAuthClient(result.authClient);
91
89
  } else {
92
- setSelectedCAO(serviceEndpoint.split("#")[0]);
90
+ setSelectedCAO(service.serviceEndpoint.split("#")[0]);
93
91
  }
94
92
  onServiceCreated();
95
93
  } catch (e) {
@@ -119,7 +117,7 @@ const ServiceCreateForm = ({ onServiceCreated, services, InterceptOnCreate }) =>
119
117
  ServiceEndpointSelection,
120
118
  {
121
119
  credentialAgentOperators,
122
- isIssueOrInspection: isIssuingOrInspection,
120
+ selectedServiceType,
123
121
  inProgress: createServiceInProgress,
124
122
  onCreate: onCreateService,
125
123
  handleBack: () => setSelectedStep(1)
@@ -230,7 +228,7 @@ const ServicesList = ({
230
228
  refetch: refetchOrganizationServices
231
229
  } = useGetOne("organizations", { id: did }, { enabled: !!did });
232
230
  const { handleServiceDeleteConfirm, isDeletingService, serviceToDelete, setServiceToDelete } = useDeleteService(refetchOrganizationServices);
233
- const services = useMemo(() => data?.didDoc?.service || [], [data?.didDoc?.service]);
231
+ const services = useMemo(() => data?.services || [], [data?.services]);
234
232
  const servicesActivated = useMemo(
235
233
  () => services.map((item) => ({
236
234
  ...item,
@@ -258,7 +256,7 @@ const ServicesList = ({
258
256
  }
259
257
  return serviceTypeTitlesMap[service.type] || service.type;
260
258
  };
261
- const onSave = async ({ serviceEndpoint }) => {
259
+ const onSave = async (payload) => {
262
260
  try {
263
261
  await updateService(
264
262
  dataResources.SERVICES,
@@ -266,9 +264,7 @@ const ServicesList = ({
266
264
  id: currentlyEditableService.id,
267
265
  data: {
268
266
  organizationId: did,
269
- payload: {
270
- serviceEndpoint
271
- }
267
+ payload: omit(payload, ["id", "type"])
272
268
  }
273
269
  },
274
270
  { returnPromise: true }
@@ -329,12 +325,13 @@ const ServicesList = ({
329
325
  [
330
326
  { name: "service id", value: service.id },
331
327
  { name: "service endpoint", value: service.serviceEndpoint },
332
- ...service.credentialTypes ? [
333
- {
334
- name: "credential types",
335
- value: service.credentialTypes.join(", ")
336
- }
337
- ] : [],
328
+ ...buildServiceContent(service.credentialTypes, "credential types"),
329
+ ...buildServiceContent(service.name, "wallet name"),
330
+ ...buildServiceContent(service.supportedExchangeProtocols, "protocols"),
331
+ ...buildServiceContent(service.playStoreUrl, "play store url"),
332
+ ...buildServiceContent(service.googlePlayId, "google play id"),
333
+ ...buildServiceContent(service.appleAppStoreUrl, "apple app store url"),
334
+ ...buildServiceContent(service.appleAppId, "apple app id"),
338
335
  ...AdditionalServiceProperties && AdditionalServiceProperties[service.type] ? [
339
336
  {
340
337
  name: AdditionalServiceProperties[service.type]?.name,
@@ -1 +1 @@
1
- {"version":3,"file":"services.js","sources":["../../src/pages/services/ServiceCreateForm.jsx","../../src/pages/services/useDeleteService.js","../../src/pages/services/ServicesList.jsx"],"sourcesContent":["/**\n * Copyright 2023 Velocity Team\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useRef, useState, useCallback } from 'react';\nimport { kebabCase } from 'lodash-es';\nimport { useRedirect, useCreate, useGetList } from 'react-admin';\nimport { useLocation, useNavigate } from 'react-router';\nimport PropTypes from 'prop-types';\n\nimport Popup from '@/components/common/Popup.jsx';\nimport { credentialTypesByServiceTypes } from '@/utils/serviceTypes.js';\nimport { dataResources } from '@/utils/remoteDataProvider.js';\nimport { getNewServiceIndex } from '@/utils/invitations.js';\nimport useSelectedOrganization from '@/state/selectedOrganizationState.js';\nimport { useIsIssuingInspection } from './hooks/useIsIssuingInspection.js';\nimport { ServiceTypeSelection } from './components/ServiceTypeSelection/index.jsx';\nimport { ServiceEndpointSelection } from './components/ServiceEndpointSelection/index.jsx';\nimport { SecretKeysPopup } from './components/SecretKeysPopup/index.jsx';\n\nconst defaultAuthClient = { clientSecret: '', clientId: '' };\n\nconst ServiceCreateForm = ({ onServiceCreated, services, InterceptOnCreate }) => {\n const { pathname } = useLocation();\n const redirect = useRedirect();\n const navigate = useNavigate();\n const [createService] = useCreate();\n\n const [did] = useSelectedOrganization();\n const openedStateRef = useRef(true);\n const isModalOpened = /\\/services\\/create/.test(pathname);\n\n const [serviceId, setServiceId] = useState('');\n const [selectedCAO, setSelectedCAO] = useState('');\n\n const { data: credentialAgentOperators, isLoading: isLoadingCAO } = useGetList(\n dataResources.SEARCH_PROFILES,\n {\n filter: { serviceTypes: 'CredentialAgentOperator' },\n },\n );\n\n const [selectedStep, setSelectedStep] = useState(1);\n const [selectedServiceType, setSelectedServiceType] = useState('');\n const [authClient, setAuthClient] = useState(defaultAuthClient);\n const [createServiceInProgress, setCreateServiceInProgress] = useState(false);\n\n const [isInterceptOnCreateOpen, setIsInterceptOnCreateOpen] = useState(false);\n const [isKeysPopupOpened, setIsKeysPopupOpened] = useState(false);\n\n const { isIssuingOrInspection, isCAO } = useIsIssuingInspection(selectedServiceType);\n\n const onClose = useCallback(() => {\n navigate(-1);\n }, [navigate]);\n\n // clear previous state after close\n useEffect(() => {\n const reset = () => {\n setSelectedStep(1);\n setSelectedServiceType('');\n setAuthClient(defaultAuthClient);\n };\n if (openedStateRef.current === false && isModalOpened) {\n reset();\n }\n // eslint-disable-next-line better-mutation/no-mutation\n openedStateRef.current = isModalOpened;\n\n return reset;\n }, [isModalOpened]);\n\n useEffect(() => {\n if (InterceptOnCreate && serviceId) {\n setIsInterceptOnCreateOpen(true);\n }\n }, [InterceptOnCreate, serviceId]);\n\n const onCreateService = async ({ serviceEndpoint }) => {\n const type = selectedServiceType.id.match(/.+v1/);\n const kebabType = kebabCase(type[0]);\n const id = `${did}#${kebabType}-${getNewServiceIndex(services, kebabType)}`;\n try {\n setCreateServiceInProgress(true);\n const result = await createService(\n dataResources.SERVICES,\n {\n data: {\n organizationId: did,\n payload: {\n id,\n serviceEndpoint,\n type: type[0],\n credentialTypes: credentialTypesByServiceTypes[selectedServiceType.id],\n },\n },\n },\n { returnPromise: true },\n );\n setCreateServiceInProgress(false);\n setServiceId(result.id);\n if (result.authClient) {\n setAuthClient(result.authClient);\n } else {\n setSelectedCAO(serviceEndpoint.split('#')[0]);\n }\n onServiceCreated();\n } catch (e) {\n setCreateServiceInProgress(false);\n }\n };\n\n return (\n <>\n <Popup\n onClose={onClose}\n title=\"\"\n isOpen={isModalOpened}\n mainContainerStyles={styles.mainContainer}\n disableCloseButton={createServiceInProgress}\n >\n {selectedStep === 1 && (\n <ServiceTypeSelection\n selectedServiceType={selectedServiceType}\n setSelectedServiceType={setSelectedServiceType}\n isLoading={isLoadingCAO}\n handleNext={() => setSelectedStep(2)}\n />\n )}\n {selectedStep === 2 && (\n <ServiceEndpointSelection\n credentialAgentOperators={credentialAgentOperators}\n isIssueOrInspection={isIssuingOrInspection}\n inProgress={createServiceInProgress}\n onCreate={onCreateService}\n handleBack={() => setSelectedStep(1)}\n />\n )}\n </Popup>\n\n <InterceptOnCreate\n isInterceptOnCreateOpen={isInterceptOnCreateOpen}\n serviceId={serviceId}\n onNext={() => setIsKeysPopupOpened(true)}\n onClose={() => {\n redirect('list', 'services');\n }}\n isIssueOrInspection={isIssuingOrInspection}\n selectedCAO={selectedCAO}\n isCAO={isCAO}\n />\n\n <SecretKeysPopup\n isOpen={isKeysPopupOpened}\n secretKeys={{ authClients: [authClient] }}\n onClose={() => {\n setIsKeysPopupOpened(false);\n navigate(-1);\n }}\n wording={{\n title:\n // eslint-disable-next-line max-len\n 'Here are your secret identifiers. Please keep a copy of these as they will not be availableonce you close this dialog. You may need to pass this to the admin of your Credential Agent.',\n subtitle: 'Download or copy your secret encryption keys and keep them somewhere safe.',\n }}\n warningWording={{\n title: 'You must download a copy of your keys before exiting',\n subtitle:\n 'They will not be available again and are critical for managing your organization data.',\n }}\n />\n </>\n );\n};\n\nconst styles = {\n mainContainer: { pt: 2 },\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nServiceCreateForm.propTypes = {\n onServiceCreated: PropTypes.func,\n services: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string.isRequired,\n }),\n ).isRequired,\n InterceptOnCreate: PropTypes.elementType,\n};\n\nexport default ServiceCreateForm;\n","/**\n * Copyright 2023 Velocity Team\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useState } from 'react';\nimport { useDelete } from 'react-admin';\nimport { dataResources } from '../../utils/remoteDataProvider.js';\nimport useSelectedOrganization from '../../state/selectedOrganizationState.js';\n\nconst useDeleteService = (refetch) => {\n const [did] = useSelectedOrganization();\n const [serviceToDelete, setServiceToDelete] = useState(null);\n const [isDeletingService, setIsDeletingService] = useState(false);\n const [deleteOne] = useDelete(\n dataResources.SERVICES,\n {\n id: serviceToDelete,\n },\n {\n onSettled: () =>\n refetch().finally(() => {\n setIsDeletingService(false);\n setServiceToDelete(null);\n }),\n },\n );\n\n const handleServiceDeleteConfirm = async () => {\n setIsDeletingService(true);\n try {\n await deleteOne(dataResources.SERVICES, {\n id: serviceToDelete.id,\n previousData: {\n organizationId: did,\n },\n });\n } catch (e) {\n setIsDeletingService(false);\n throw e;\n }\n };\n\n return { handleServiceDeleteConfirm, isDeletingService, serviceToDelete, setServiceToDelete };\n};\n\nexport default useDeleteService;\n","/**\n * Copyright 2023 Velocity Team\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useMemo } from 'react';\nimport { useSearchParams } from 'react-router';\nimport { Box, Button, Container, Stack, Typography } from '@mui/material';\nimport EditIcon from '@mui/icons-material/Edit';\nimport DeleteIcon from '@mui/icons-material/Delete';\nimport { useGetOne, useRedirect, useUpdate } from 'react-admin';\n\nimport PropTypes from 'prop-types';\nimport ListItem from '@/components/common/ListItem.jsx';\nimport Loading from '@/components/Loading.jsx';\nimport ServicesEdit from '@/components/services/ServicesEdit.jsx';\nimport ServicesDelete from '@/components/services/ServicesDelete.jsx';\nimport useSelectedOrganization from '@/state/selectedOrganizationState.js';\nimport { dataResources } from '@/utils/remoteDataProvider.js';\nimport useParticipantAgreementState from '@/state/participantAgreementState.js';\nimport ServiceCreateForm from './ServiceCreateForm.jsx';\nimport { serviceTypeTitlesMap } from '../../utils/serviceTypes.js';\nimport useDeleteService from './useDeleteService.js';\n\nconst SAVE_ERROR_MESSAGE =\n 'We were unable to update your service with the details provided. Please check to ensure you have provided valid information and then try again.';\n\nconst getAmountTitle = (total) => `${total} active service${total > 1 ? 's' : ''}`;\n\nconst ServicesList = ({\n // override props, defaulting to your internal components\n EditComponent = ServicesEdit,\n CreateComponent = ServiceCreateForm,\n DeleteComponent = ServicesDelete,\n AdditionalServiceProperties = {},\n}) => {\n const [params, setParams] = useSearchParams();\n const currentlyEditableServiceId = params.get('id');\n const [did] = useSelectedOrganization();\n\n const [, setParticipantAgreementApproved] = useParticipantAgreementState();\n\n const {\n data,\n isLoading,\n isFetching,\n refetch: refetchOrganizationServices,\n } = useGetOne('organizations', { id: did }, { enabled: !!did });\n\n const { handleServiceDeleteConfirm, isDeletingService, serviceToDelete, setServiceToDelete } =\n useDeleteService(refetchOrganizationServices);\n\n const services = useMemo(() => data?.didDoc?.service || [], [data?.didDoc?.service]);\n const servicesActivated = useMemo(\n () =>\n services.map((item) => ({\n ...item,\n activated: data?.activatedServiceIds?.includes(item.id) || false,\n })),\n [services, data],\n );\n\n const totalActivatedServices = servicesActivated.filter(({ activated }) => activated).length;\n const currentlyEditableService = useMemo(\n () =>\n currentlyEditableServiceId\n ? services.find((item) => item.id === currentlyEditableServiceId)\n : null,\n [services, currentlyEditableServiceId],\n );\n\n const [updateService] = useUpdate(undefined, undefined, {\n onSuccess: () => {\n setParticipantAgreementApproved(true);\n\n refetchOrganizationServices();\n },\n });\n\n const serviceTitle = (service) => {\n if (service.type === 'VlcContactIssuer_v1') {\n if (service.credentialTypes?.includes('EmailV1.0')) {\n return 'Primary Source Email Issuer (eg. Email Service Provider)';\n }\n return 'Primary Source Phone Issuer (eg. Telco)';\n }\n return serviceTypeTitlesMap[service.type] || service.type;\n };\n\n // eslint-disable-next-line consistent-return\n const onSave = async ({ serviceEndpoint }) => {\n try {\n await updateService(\n dataResources.SERVICES,\n {\n id: currentlyEditableService.id,\n data: {\n organizationId: did,\n payload: {\n serviceEndpoint,\n },\n },\n },\n { returnPromise: true },\n );\n } catch (e) {\n return {\n serviceEndpoint: SAVE_ERROR_MESSAGE,\n };\n }\n };\n\n const editAction = useMemo(\n () => ({\n title: 'EDIT',\n icon: <EditIcon />,\n action: (id) => setParams({ id }),\n }),\n [setParams],\n );\n\n const deleteAction = useMemo(\n () => ({\n title: 'DELETE',\n icon: <DeleteIcon />,\n action: (id) => setServiceToDelete(id),\n }),\n [setServiceToDelete],\n );\n\n const isLoadingVisible = isLoading || isFetching;\n\n const redirect = useRedirect();\n const handleCloseEdit = () => {\n setParams({});\n };\n\n return (\n <Container maxWidth=\"xl\" sx={{ mt: 5 }}>\n <Typography variant=\"h3\">Manage Services</Typography>\n <Box sx={{ mt: 2, mb: 4, maxWidth: '720px' }}>\n <Typography variant=\"subtitle1\">\n Setup the services your organization is to be offering across the Velocity Network™:\n Issuing, Verifying, Operating a Credential Agent and/or operating a Node.\n </Typography>\n </Box>\n <Stack\n sx={{ mb: 2 }}\n flexDirection=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"flex-end\"\n >\n <Button variant=\"outlined\" onClick={() => redirect('create', 'services')}>\n Add service +\n </Button>\n {!!totalActivatedServices && (\n <Typography color=\"secondary.light\" sx={{ fontSize: 14 }}>\n {getAmountTitle(totalActivatedServices)}\n </Typography>\n )}\n </Stack>\n {isLoadingVisible && <Loading sx={{ pt: '60px' }} />}\n {!isLoadingVisible &&\n servicesActivated.map((service) => (\n <ListItem\n key={service.id}\n id={service.id}\n title={serviceTitle(service)}\n status={\n service.activated\n ? { title: 'ACTIVATED', color: 'primary.success' }\n : { title: 'INACTIVE', color: 'primary.main' }\n }\n showActions\n actions={[editAction, deleteAction]}\n content={[\n [\n { name: 'service id', value: service.id },\n { name: 'service endpoint', value: service.serviceEndpoint },\n ...(service.credentialTypes\n ? [\n {\n name: 'credential types',\n value: service.credentialTypes.join(', '),\n },\n ]\n : []),\n ...(AdditionalServiceProperties && AdditionalServiceProperties[service.type]\n ? [\n {\n name: AdditionalServiceProperties[service.type]?.name,\n value: AdditionalServiceProperties[service.type]?.value,\n },\n ]\n : []),\n ],\n ]}\n />\n ))}\n <EditComponent\n onClose={handleCloseEdit}\n onSave={onSave}\n selectedService={currentlyEditableService}\n />\n <CreateComponent onServiceCreated={refetchOrganizationServices} services={services} />\n <DeleteComponent\n isLoading={isDeletingService}\n onClose={() => setServiceToDelete(null)}\n onConfirm={handleServiceDeleteConfirm}\n selectedService={serviceToDelete}\n />\n </Container>\n );\n};\n// eslint-disable-next-line better-mutation/no-mutation\nServicesList.propTypes = {\n EditComponent: PropTypes.elementType,\n CreateComponent: PropTypes.elementType,\n DeleteComponent: PropTypes.elementType,\n AdditionalServiceProperties: PropTypes.object,\n};\n\nexport default ServicesList;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAgCA,MAAM,oBAAoB,EAAE,cAAc,IAAI,UAAU,GAAA;AAExD,MAAM,oBAAoB,CAAC,EAAE,kBAAkB,UAAU,wBAAwB;AAC/E,QAAM,EAAE,SAAA,IAAa,YAAA;AACrB,QAAM,WAAW,YAAA;AACjB,QAAM,WAAW,YAAA;AACjB,QAAM,CAAC,aAAa,IAAI,UAAA;AAExB,QAAM,CAAC,GAAG,IAAI,wBAAA;AACd,QAAM,iBAAiB,OAAO,IAAI;AAClC,QAAM,gBAAgB,qBAAqB,KAAK,QAAQ;AAExD,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,EAAE;AAC7C,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,EAAE;AAEjD,QAAM,EAAE,MAAM,0BAA0B,WAAW,iBAAiB;AAAA,IAClE,cAAc;AAAA,IACd;AAAA,MACE,QAAQ,EAAE,cAAc,0BAAA;AAAA,IAA0B;AAAA,EACpD;AAGF,QAAM,CAAC,cAAc,eAAe,IAAI,SAAS,CAAC;AAClD,QAAM,CAAC,qBAAqB,sBAAsB,IAAI,SAAS,EAAE;AACjE,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,iBAAiB;AAC9D,QAAM,CAAC,yBAAyB,0BAA0B,IAAI,SAAS,KAAK;AAE5E,QAAM,CAAC,yBAAyB,0BAA0B,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AA;AAAA,IAAA;AAAA,IAEnB,oBAAC,iBAAA,EAAgB,kBAAkB,6BAA6B,SAAA,CAAoB;AAAA,IACpF;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW;AAAA,QACX,SAAS,MAAM,mBAAmB,IAAI;AAAA,QACtC,WAAW;AAAA,QACX,iBAAiB;AAAA,MAAA;AAAA,IAAA;AAAA,EACnB,GACF;AAEJ;AAEA,aAAa,YAAY;AAAA,EACvB,eAAe,UAAU;AAAA,EACzB,iBAAiB,UAAU;AAAA,EAC3B,iBAAiB,UAAU;AAAA,EAC3B,6BAA6B,UAAU;AACzC;"}
1
+ {"version":3,"file":"services.js","sources":["../../src/pages/services/utils/buildServiceContent.js","../../src/pages/services/ServiceCreateForm.jsx","../../src/pages/services/useDeleteService.js","../../src/pages/services/ServicesList.jsx"],"sourcesContent":["export const buildServiceContent = (item, title) => {\n if (!item) return [];\n\n const value = Array.isArray(item) ? item.join(', ') : item;\n return [{ name: title, value }];\n};\n","/**\n * Copyright 2023 Velocity Team\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useRef, useState, useCallback } from 'react';\nimport { useRedirect, useCreate, useGetList } from 'react-admin';\nimport { useLocation, useNavigate } from 'react-router';\nimport PropTypes from 'prop-types';\n\nimport Popup from '@/components/common/Popup.jsx';\nimport { dataResources } from '@/utils/remoteDataProvider.js';\nimport useSelectedOrganization from '@/state/selectedOrganizationState.js';\nimport { useIsIssuingInspection } from './hooks/useIsIssuingInspection.js';\nimport { ServiceTypeSelection } from './components/ServiceTypeSelection/index.jsx';\nimport { ServiceEndpointSelection } from './components/ServiceEndpointSelection/index.jsx';\nimport { SecretKeysPopup } from './components/SecretKeysPopup/index.jsx';\nimport { buildPayload } from './utils/buildPayload.js';\n\nconst defaultAuthClient = { clientSecret: '', clientId: '' };\n\nconst ServiceCreateForm = ({ onServiceCreated, services, InterceptOnCreate }) => {\n const { pathname } = useLocation();\n const redirect = useRedirect();\n const navigate = useNavigate();\n const [createService] = useCreate();\n\n const [did] = useSelectedOrganization();\n const openedStateRef = useRef(true);\n const isModalOpened = /\\/services\\/create/.test(pathname);\n\n const [serviceId, setServiceId] = useState('');\n const [selectedCAO, setSelectedCAO] = useState('');\n\n const { data: credentialAgentOperators, isLoading: isLoadingCAO } = useGetList(\n dataResources.SEARCH_PROFILES,\n {\n filter: { serviceTypes: 'CredentialAgentOperator' },\n },\n );\n\n const [selectedStep, setSelectedStep] = useState(1);\n const [selectedServiceType, setSelectedServiceType] = useState('');\n const [authClient, setAuthClient] = useState(defaultAuthClient);\n const [createServiceInProgress, setCreateServiceInProgress] = useState(false);\n\n const [isInterceptOnCreateOpen, setIsInterceptOnCreateOpen] = useState(false);\n const [isKeysPopupOpened, setIsKeysPopupOpened] = useState(false);\n\n const { isIssuingOrInspection, isCAO } = useIsIssuingInspection(selectedServiceType);\n\n const onClose = useCallback(() => {\n navigate(-1);\n }, [navigate]);\n\n // clear previous state after close\n useEffect(() => {\n const reset = () => {\n setSelectedStep(1);\n setSelectedServiceType('');\n setAuthClient(defaultAuthClient);\n };\n if (openedStateRef.current === false && isModalOpened) {\n reset();\n }\n // eslint-disable-next-line better-mutation/no-mutation\n openedStateRef.current = isModalOpened;\n\n return reset;\n }, [isModalOpened]);\n\n useEffect(() => {\n if (InterceptOnCreate && serviceId) {\n setIsInterceptOnCreateOpen(true);\n }\n }, [InterceptOnCreate, serviceId]);\n\n const onCreateService = async (service) => {\n const type = selectedServiceType.id.match(/.+v1/);\n const payload = buildPayload(service, type[0], did, services);\n try {\n setCreateServiceInProgress(true);\n const result = await createService(\n dataResources.SERVICES,\n {\n data: {\n organizationId: did,\n payload,\n },\n },\n { returnPromise: true },\n );\n setCreateServiceInProgress(false);\n setServiceId(result.id);\n if (result.authClient) {\n setAuthClient(result.authClient);\n } else {\n setSelectedCAO(service.serviceEndpoint.split('#')[0]);\n }\n onServiceCreated();\n } catch (e) {\n setCreateServiceInProgress(false);\n }\n };\n\n return (\n <>\n <Popup\n onClose={onClose}\n title=\"\"\n isOpen={isModalOpened}\n mainContainerStyles={styles.mainContainer}\n disableCloseButton={createServiceInProgress}\n >\n {selectedStep === 1 && (\n <ServiceTypeSelection\n selectedServiceType={selectedServiceType}\n setSelectedServiceType={setSelectedServiceType}\n isLoading={isLoadingCAO}\n handleNext={() => setSelectedStep(2)}\n />\n )}\n {selectedStep === 2 && (\n <ServiceEndpointSelection\n credentialAgentOperators={credentialAgentOperators}\n selectedServiceType={selectedServiceType}\n inProgress={createServiceInProgress}\n onCreate={onCreateService}\n handleBack={() => setSelectedStep(1)}\n />\n )}\n </Popup>\n\n <InterceptOnCreate\n isInterceptOnCreateOpen={isInterceptOnCreateOpen}\n serviceId={serviceId}\n onNext={() => setIsKeysPopupOpened(true)}\n onClose={() => {\n redirect('list', 'services');\n }}\n isIssueOrInspection={isIssuingOrInspection}\n selectedCAO={selectedCAO}\n isCAO={isCAO}\n />\n\n <SecretKeysPopup\n isOpen={isKeysPopupOpened}\n secretKeys={{ authClients: [authClient] }}\n onClose={() => {\n setIsKeysPopupOpened(false);\n navigate(-1);\n }}\n wording={{\n title:\n // eslint-disable-next-line max-len\n 'Here are your secret identifiers. Please keep a copy of these as they will not be availableonce you close this dialog. You may need to pass this to the admin of your Credential Agent.',\n subtitle: 'Download or copy your secret encryption keys and keep them somewhere safe.',\n }}\n warningWording={{\n title: 'You must download a copy of your keys before exiting',\n subtitle:\n 'They will not be available again and are critical for managing your organization data.',\n }}\n />\n </>\n );\n};\n\nconst styles = {\n mainContainer: { pt: 2 },\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nServiceCreateForm.propTypes = {\n onServiceCreated: PropTypes.func,\n services: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string.isRequired,\n }),\n ).isRequired,\n InterceptOnCreate: PropTypes.elementType,\n};\n\nexport default ServiceCreateForm;\n","/**\n * Copyright 2023 Velocity Team\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useState } from 'react';\nimport { useDelete } from 'react-admin';\nimport { dataResources } from '../../utils/remoteDataProvider.js';\nimport useSelectedOrganization from '../../state/selectedOrganizationState.js';\n\nconst useDeleteService = (refetch) => {\n const [did] = useSelectedOrganization();\n const [serviceToDelete, setServiceToDelete] = useState(null);\n const [isDeletingService, setIsDeletingService] = useState(false);\n const [deleteOne] = useDelete(\n dataResources.SERVICES,\n {\n id: serviceToDelete,\n },\n {\n onSettled: () =>\n refetch().finally(() => {\n setIsDeletingService(false);\n setServiceToDelete(null);\n }),\n },\n );\n\n const handleServiceDeleteConfirm = async () => {\n setIsDeletingService(true);\n try {\n await deleteOne(dataResources.SERVICES, {\n id: serviceToDelete.id,\n previousData: {\n organizationId: did,\n },\n });\n } catch (e) {\n setIsDeletingService(false);\n throw e;\n }\n };\n\n return { handleServiceDeleteConfirm, isDeletingService, serviceToDelete, setServiceToDelete };\n};\n\nexport default useDeleteService;\n","/**\n * Copyright 2023 Velocity Team\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useMemo } from 'react';\nimport { useSearchParams } from 'react-router';\nimport { Box, Button, Container, Stack, Typography } from '@mui/material';\nimport EditIcon from '@mui/icons-material/Edit';\nimport DeleteIcon from '@mui/icons-material/Delete';\nimport { useGetOne, useRedirect, useUpdate } from 'react-admin';\nimport PropTypes from 'prop-types';\nimport { omit } from 'lodash-es';\n\nimport ListItem from '@/components/common/ListItem.jsx';\nimport Loading from '@/components/Loading.jsx';\nimport ServicesEdit from '@/components/services/ServicesEdit.jsx';\nimport ServicesDelete from '@/components/services/ServicesDelete.jsx';\nimport useSelectedOrganization from '@/state/selectedOrganizationState.js';\nimport { dataResources } from '@/utils/remoteDataProvider.js';\nimport useParticipantAgreementState from '@/state/participantAgreementState.js';\nimport ServiceCreateForm from './ServiceCreateForm.jsx';\nimport { serviceTypeTitlesMap } from '../../utils/serviceTypes.js';\nimport { buildServiceContent } from './utils/buildServiceContent.js';\nimport useDeleteService from './useDeleteService.js';\n\nconst SAVE_ERROR_MESSAGE =\n 'We were unable to update your service with the details provided. Please check to ensure you have provided valid information and then try again.';\n\nconst getAmountTitle = (total) => `${total} active service${total > 1 ? 's' : ''}`;\n\nconst ServicesList = ({\n // override props, defaulting to your internal components\n EditComponent = ServicesEdit,\n CreateComponent = ServiceCreateForm,\n DeleteComponent = ServicesDelete,\n AdditionalServiceProperties = {},\n}) => {\n const [params, setParams] = useSearchParams();\n const currentlyEditableServiceId = params.get('id');\n const [did] = useSelectedOrganization();\n\n const [, setParticipantAgreementApproved] = useParticipantAgreementState();\n\n const {\n data,\n isLoading,\n isFetching,\n refetch: refetchOrganizationServices,\n } = useGetOne('organizations', { id: did }, { enabled: !!did });\n\n const { handleServiceDeleteConfirm, isDeletingService, serviceToDelete, setServiceToDelete } =\n useDeleteService(refetchOrganizationServices);\n\n const services = useMemo(() => data?.services || [], [data?.services]);\n const servicesActivated = useMemo(\n () =>\n services.map((item) => ({\n ...item,\n activated: data?.activatedServiceIds?.includes(item.id) || false,\n })),\n [services, data],\n );\n\n const totalActivatedServices = servicesActivated.filter(({ activated }) => activated).length;\n const currentlyEditableService = useMemo(\n () =>\n currentlyEditableServiceId\n ? services.find((item) => item.id === currentlyEditableServiceId)\n : null,\n [services, currentlyEditableServiceId],\n );\n\n const [updateService] = useUpdate(undefined, undefined, {\n onSuccess: () => {\n setParticipantAgreementApproved(true);\n\n refetchOrganizationServices();\n },\n });\n\n const serviceTitle = (service) => {\n if (service.type === 'VlcContactIssuer_v1') {\n if (service.credentialTypes?.includes('EmailV1.0')) {\n return 'Primary Source Email Issuer (eg. Email Service Provider)';\n }\n return 'Primary Source Phone Issuer (eg. Telco)';\n }\n return serviceTypeTitlesMap[service.type] || service.type;\n };\n\n // eslint-disable-next-line consistent-return\n const onSave = async (payload) => {\n try {\n await updateService(\n dataResources.SERVICES,\n {\n id: currentlyEditableService.id,\n data: {\n organizationId: did,\n payload: omit(payload, ['id', 'type']),\n },\n },\n { returnPromise: true },\n );\n } catch (e) {\n return {\n serviceEndpoint: SAVE_ERROR_MESSAGE,\n };\n }\n };\n\n const editAction = useMemo(\n () => ({\n title: 'EDIT',\n icon: <EditIcon />,\n action: (id) => setParams({ id }),\n }),\n [setParams],\n );\n\n const deleteAction = useMemo(\n () => ({\n title: 'DELETE',\n icon: <DeleteIcon />,\n action: (id) => setServiceToDelete(id),\n }),\n [setServiceToDelete],\n );\n\n const isLoadingVisible = isLoading || isFetching;\n\n const redirect = useRedirect();\n const handleCloseEdit = () => {\n setParams({});\n };\n\n return (\n <Container maxWidth=\"xl\" sx={{ mt: 5 }}>\n <Typography variant=\"h3\">Manage Services</Typography>\n <Box sx={{ mt: 2, mb: 4, maxWidth: '720px' }}>\n <Typography variant=\"subtitle1\">\n Setup the services your organization is to be offering across the Velocity Network™:\n Issuing, Verifying, Operating a Credential Agent and/or operating a Node.\n </Typography>\n </Box>\n <Stack\n sx={{ mb: 2 }}\n flexDirection=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"flex-end\"\n >\n <Button variant=\"outlined\" onClick={() => redirect('create', 'services')}>\n Add service +\n </Button>\n {!!totalActivatedServices && (\n <Typography color=\"secondary.light\" sx={{ fontSize: 14 }}>\n {getAmountTitle(totalActivatedServices)}\n </Typography>\n )}\n </Stack>\n {isLoadingVisible && <Loading sx={{ pt: '60px' }} />}\n {!isLoadingVisible &&\n servicesActivated.map((service) => (\n <ListItem\n key={service.id}\n id={service.id}\n title={serviceTitle(service)}\n status={\n service.activated\n ? { title: 'ACTIVATED', color: 'primary.success' }\n : { title: 'INACTIVE', color: 'primary.main' }\n }\n showActions\n actions={[editAction, deleteAction]}\n content={[\n [\n { name: 'service id', value: service.id },\n { name: 'service endpoint', value: service.serviceEndpoint },\n ...buildServiceContent(service.credentialTypes, 'credential types'),\n ...buildServiceContent(service.name, 'wallet name'),\n ...buildServiceContent(service.supportedExchangeProtocols, 'protocols'),\n ...buildServiceContent(service.playStoreUrl, 'play store url'),\n ...buildServiceContent(service.googlePlayId, 'google play id'),\n ...buildServiceContent(service.appleAppStoreUrl, 'apple app store url'),\n ...buildServiceContent(service.appleAppId, 'apple app id'),\n ...(AdditionalServiceProperties && AdditionalServiceProperties[service.type]\n ? [\n {\n name: AdditionalServiceProperties[service.type]?.name,\n value: AdditionalServiceProperties[service.type]?.value,\n },\n ]\n : []),\n ],\n ]}\n />\n ))}\n <EditComponent\n onClose={handleCloseEdit}\n onSave={onSave}\n selectedService={currentlyEditableService}\n />\n <CreateComponent onServiceCreated={refetchOrganizationServices} services={services} />\n <DeleteComponent\n isLoading={isDeletingService}\n onClose={() => setServiceToDelete(null)}\n onConfirm={handleServiceDeleteConfirm}\n selectedService={serviceToDelete}\n />\n </Container>\n );\n};\n// eslint-disable-next-line better-mutation/no-mutation\nServicesList.propTypes = {\n EditComponent: PropTypes.elementType,\n CreateComponent: PropTypes.elementType,\n DeleteComponent: PropTypes.elementType,\n AdditionalServiceProperties: PropTypes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,MAAM,mBAAmB,IAAI;AAAA,QACtC,WAAW;AAAA,QACX,iBAAiB;AAAA,MAAA;AAAA,IAAA;AAAA,EACnB,GACF;AAEJ;AAEA,aAAa,YAAY;AAAA,EACvB,eAAe,UAAU;AAAA,EACzB,iBAAiB,UAAU;AAAA,EAC3B,iBAAiB,UAAU;AAAA,EAC3B,6BAA6B,UAAU;AACzC;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verii/components-organizations-registrar",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {
@@ -103,7 +103,7 @@
103
103
  "@testing-library/user-event": "14.6.1",
104
104
  "@types/react": "19.1.12",
105
105
  "@types/react-dom": "19.1.9",
106
- "@verii/tests-helpers": "1.0.0",
106
+ "@verii/tests-helpers": "1.0.2",
107
107
  "@vitejs/plugin-react-swc": "4.0.1",
108
108
  "eslint": "8.57.1",
109
109
  "eslint-config-airbnb-base": "14.2.1",
@@ -130,5 +130,5 @@
130
130
  "lib"
131
131
  ]
132
132
  },
133
- "gitHead": "cd16eb096562d76aed1a11a1adabcc34aa26324a"
133
+ "gitHead": "1a5a2e5c5983278f9f2a107adb13cade1bfae501"
134
134
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"ServicesEdit.BnnqC203.js","sources":["../../src/components/services/ServicesDelete.jsx","../../src/components/services/ServicesEdit.jsx"],"sourcesContent":["/**\n * Copyright 2023 Velocity Team\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Button, Typography, Stack } from '@mui/material';\nimport PropTypes from 'prop-types';\n\nimport Popup from '../common/Popup.jsx';\n\nconst ServicesDelete = ({ onClose, onConfirm, selectedService, isLoading }) => {\n return (\n <Popup\n title=\"Delete service\"\n onClose={isLoading ? () => {} : onClose}\n isOpen={Boolean(selectedService)}\n >\n <Typography>Are you sure you want to delete {selectedService} service?</Typography>\n <Stack sx={styles.buttonBlock}>\n <Button\n onClick={onConfirm}\n disabled={isLoading}\n variant=\"outlined\"\n sx={styles.button}\n autoFocus\n >\n Delete\n </Button>\n <Button\n onClick={onClose}\n disabled={isLoading}\n variant=\"outlined\"\n sx={[styles.button, styles.cancelButton]}\n >\n Cancel\n </Button>\n </Stack>\n </Popup>\n );\n};\n\nconst styles = {\n buttonBlock: {\n display: 'flex',\n flexDirection: 'row-reverse',\n marginTop: '40px',\n justifyContent: 'center',\n },\n button: {\n px: 4,\n py: 1,\n fontSize: '16px',\n width: '160px',\n },\n cancelButton: { marginRight: '20px', color: 'text.primary', borderColor: 'secondary.light' },\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nServicesDelete.propTypes = {\n onClose: PropTypes.func,\n onConfirm: PropTypes.func,\n // eslint-disable-next-line react/forbid-prop-types\n selectedService: PropTypes.object,\n isLoading: PropTypes.bool,\n};\n\nexport default ServicesDelete;\n","/**\n * Copyright 2023 Velocity Team\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useState, useCallback } from 'react';\nimport { Form, TextInput, SaveButton, required } from 'react-admin';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport PropTypes from 'prop-types';\nimport { Stack } from '@mui/material';\nimport { useIsIssuingInspection } from '@/pages/services/hooks/useIsIssuingInspection.js';\n\nimport Popup from '../common/Popup.jsx';\nimport { validateServiceEndpoint } from '../organizations/CreateOrganizationUtils.js';\n\nconst ServicesEdit = ({ onClose, onSave, selectedService, InterceptOnCreate }) => {\n const { isIssuingOrInspection, isCAO } = useIsIssuingInspection({ id: selectedService?.type });\n const [isInterceptOnCreateOpen, setIsInterceptOnCreateOpen] = useState(false);\n const [selectedCAO, setSelectedCAO] = useState(\n isIssuingOrInspection ? selectedService?.serviceEndpoint.split('#')[0] : null,\n );\n const handleOnSave = useCallback(\n (data) => {\n onSave(data);\n if (InterceptOnCreate) {\n setSelectedCAO(() => data.serviceEndpoint.split('#')[0]);\n setIsInterceptOnCreateOpen(() => true);\n }\n },\n [onSave, InterceptOnCreate],\n );\n\n const handleOnClose = useCallback(() => {\n setIsInterceptOnCreateOpen(false);\n onClose();\n }, [onClose]);\n\n const isModifyingServiceEnabled = !!InterceptOnCreate;\n\n return (\n <>\n <Popup\n title=\"Edit your service details here:\"\n onClose={onClose}\n isOpen={Boolean(selectedService)}\n >\n <Form\n record={{ serviceEndpoint: selectedService?.serviceEndpoint }}\n onSubmit={handleOnSave}\n mode=\"onChange\"\n >\n <FormContent\n isIssuingOrInspection={isIssuingOrInspection}\n isModifyingServiceEnabled={isModifyingServiceEnabled}\n />\n </Form>\n </Popup>\n <InterceptOnCreate\n isInterceptOnCreateOpen={isInterceptOnCreateOpen}\n serviceId={selectedService?.id}\n onNext={() => onClose()}\n onClose={handleOnClose}\n isIssueOrInspection={isIssuingOrInspection}\n selectedCAO={selectedCAO}\n isCAO={isCAO}\n />\n </>\n );\n};\n\nconst FormContent = ({ isIssuingOrInspection, isModifyingServiceEnabled }) => {\n const validateArray = [required('Service endpoint URL field is required')];\n if (!isIssuingOrInspection) {\n validateArray.push(...validateServiceEndpoint);\n }\n return (\n <Stack>\n <TextInput\n source=\"serviceEndpoint\"\n label=\"Service endpoint URL\"\n validate={validateArray}\n parse={(value) => value.trim()}\n />\n <SaveButton\n variant=\"outlined\"\n icon={null}\n label=\"Save\"\n sx={sx.saveButton}\n alwaysEnable={isModifyingServiceEnabled}\n />\n </Stack>\n );\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nFormContent.propTypes = {\n isIssuingOrInspection: PropTypes.bool.isRequired,\n isModifyingServiceEnabled: PropTypes.bool.isRequired,\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nServicesEdit.propTypes = {\n onClose: PropTypes.func,\n onSave: PropTypes.func,\n // eslint-disable-next-line react/forbid-prop-types\n selectedService: PropTypes.object,\n InterceptOnCreate: PropTypes.elementType,\n};\n\nconst sx = {\n saveButton: { width: 'fit-content', alignSelf: 'center', px: 4, py: 1, mt: 2 },\n};\n\nexport default ServicesEdit;\n"],"names":["jsxs","Popup","Typography","Stack","jsx","Button","useIsIssuingInspection","useState","useCallback","Fragment","Form","required","validateServiceEndpoint","TextInput","SaveButton"],"mappings":";;;;;;;;;AAqBA,MAAM,iBAAiB,CAAC,EAAE,SAAS,WAAW,iBAAiB,gBAAgB;AAC7E,SACEA,2BAAAA;AAAAA,IAACC,MAAAA;AAAAA,IAAA;AAAA,MACC,OAAM;AAAA,MACN,SAAS,YAAY,MAAM;AAAA,MAAC,IAAI;AAAA,MAChC,QAAQ,QAAQ,eAAe;AAAA,MAE/B,UAAA;AAAA,QAAAD,gCAACE,SAAAA,YAAA,EAAW,UAAA;AAAA,UAAA;AAAA,UAAiC;AAAA,UAAgB;AAAA,QAAA,GAAS;AAAA,QACtEF,2BAAAA,KAACG,SAAAA,OAAA,EAAM,IAAI,OAAO,aAChB,UAAA;AAAA,UAAAC,2BAAAA;AAAAA,YAACC,SAAAA;AAAAA,YAAA;AAAA,cACC,SAAS;AAAA,cACT,UAAU;AAAA,cACV,SAAQ;AAAA,cACR,IAAI,OAAO;AAAA,cACX,WAAS;AAAA,cACV,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UAGDD,2BAAAA;AAAAA,YAACC,SAAAA;AAAAA,YAAA;AAAA,cACC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,MAAM;AAAA,QACN,OAAM;AAAA,QACN,IAAI,GAAG;AAAA,QACP,cAAc;AAAA,MAAA;AAAA,IAAA;AAAA,EAChB,GACF;AAEJ;AAGA,YAAY,YAAY;AAAA,EACtB,uBAAuB,UAAU,KAAK;AAAA,EACtC,2BAA2B,UAAU,KAAK;AAC5C;AAGA,aAAa,YAAY;AAAA,EACvB,SAAS,UAAU;AAAA,EACnB,QAAQ,UAAU;AAAA;AAAA,EAElB,iBAAiB,UAAU;AAAA,EAC3B,mBAAmB,UAAU;AAC/B;AAEA,MAAM,KAAK;AAAA,EACT,YAAY,EAAE,OAAO,eAAe,WAAW,UAAU,IAAI,GAAG,IAAI,GAAG,IAAI,EAAA;AAC7E;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ServicesEdit.DDgjS5kU.js","sources":["../../src/components/services/ServicesDelete.jsx","../../src/components/services/ServicesEdit.jsx"],"sourcesContent":["/**\n * Copyright 2023 Velocity Team\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Button, Typography, Stack } from '@mui/material';\nimport PropTypes from 'prop-types';\n\nimport Popup from '../common/Popup.jsx';\n\nconst ServicesDelete = ({ onClose, onConfirm, selectedService, isLoading }) => {\n return (\n <Popup\n title=\"Delete service\"\n onClose={isLoading ? () => {} : onClose}\n isOpen={Boolean(selectedService)}\n >\n <Typography>Are you sure you want to delete {selectedService} service?</Typography>\n <Stack sx={styles.buttonBlock}>\n <Button\n onClick={onConfirm}\n disabled={isLoading}\n variant=\"outlined\"\n sx={styles.button}\n autoFocus\n >\n Delete\n </Button>\n <Button\n onClick={onClose}\n disabled={isLoading}\n variant=\"outlined\"\n sx={[styles.button, styles.cancelButton]}\n >\n Cancel\n </Button>\n </Stack>\n </Popup>\n );\n};\n\nconst styles = {\n buttonBlock: {\n display: 'flex',\n flexDirection: 'row-reverse',\n marginTop: '40px',\n justifyContent: 'center',\n },\n button: {\n px: 4,\n py: 1,\n fontSize: '16px',\n width: '160px',\n },\n cancelButton: { marginRight: '20px', color: 'text.primary', borderColor: 'secondary.light' },\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nServicesDelete.propTypes = {\n onClose: PropTypes.func,\n onConfirm: PropTypes.func,\n // eslint-disable-next-line react/forbid-prop-types\n selectedService: PropTypes.object,\n isLoading: PropTypes.bool,\n};\n\nexport default ServicesDelete;\n","/**\n * Copyright 2023 Velocity Team\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useState, useCallback } from 'react';\nimport { Form, TextInput, SaveButton, required } from 'react-admin';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport PropTypes from 'prop-types';\nimport { Stack } from '@mui/material';\nimport { useIsIssuingInspection } from '@/pages/services/hooks/useIsIssuingInspection.js';\n\nimport Popup from '../common/Popup.jsx';\nimport { validateServiceEndpoint } from '../organizations/CreateOrganizationUtils.js';\n\nconst ServicesEdit = ({ onClose, onSave, selectedService, InterceptOnCreate }) => {\n const { isIssuingOrInspection, isCAO } = useIsIssuingInspection({ id: selectedService?.type });\n const [isInterceptOnCreateOpen, setIsInterceptOnCreateOpen] = useState(false);\n const [selectedCAO, setSelectedCAO] = useState(\n isIssuingOrInspection ? selectedService?.serviceEndpoint.split('#')[0] : null,\n );\n const handleOnSave = useCallback(\n (data) => {\n onSave(data);\n if (InterceptOnCreate) {\n setSelectedCAO(() => data.serviceEndpoint.split('#')[0]);\n setIsInterceptOnCreateOpen(() => true);\n }\n },\n [onSave, InterceptOnCreate],\n );\n\n const handleOnClose = useCallback(() => {\n setIsInterceptOnCreateOpen(false);\n onClose();\n }, [onClose]);\n\n const isModifyingServiceEnabled = !!InterceptOnCreate;\n\n return (\n <>\n <Popup\n title=\"Edit your service details here:\"\n onClose={onClose}\n isOpen={Boolean(selectedService)}\n >\n <Form\n record={{ serviceEndpoint: selectedService?.serviceEndpoint }}\n onSubmit={handleOnSave}\n mode=\"onChange\"\n >\n <FormContent\n isIssuingOrInspection={isIssuingOrInspection}\n isModifyingServiceEnabled={isModifyingServiceEnabled}\n />\n </Form>\n </Popup>\n <InterceptOnCreate\n isInterceptOnCreateOpen={isInterceptOnCreateOpen}\n serviceId={selectedService?.id}\n onNext={() => onClose()}\n onClose={handleOnClose}\n isIssueOrInspection={isIssuingOrInspection}\n selectedCAO={selectedCAO}\n isCAO={isCAO}\n />\n </>\n );\n};\n\nconst FormContent = ({ isIssuingOrInspection, isModifyingServiceEnabled }) => {\n const validateArray = [required('Service endpoint URL field is required')];\n if (!isIssuingOrInspection) {\n validateArray.push(...validateServiceEndpoint);\n }\n return (\n <Stack>\n <TextInput\n source=\"serviceEndpoint\"\n label=\"Service endpoint URL\"\n validate={validateArray}\n parse={(value) => value.trim()}\n />\n <SaveButton\n variant=\"outlined\"\n icon={null}\n label=\"Save\"\n sx={sx.saveButton}\n alwaysEnable={isModifyingServiceEnabled}\n />\n </Stack>\n );\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nFormContent.propTypes = {\n isIssuingOrInspection: PropTypes.bool.isRequired,\n isModifyingServiceEnabled: PropTypes.bool.isRequired,\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nServicesEdit.propTypes = {\n onClose: PropTypes.func,\n onSave: PropTypes.func,\n // eslint-disable-next-line react/forbid-prop-types\n selectedService: PropTypes.object,\n InterceptOnCreate: PropTypes.elementType,\n};\n\nconst sx = {\n saveButton: { width: 'fit-content', alignSelf: 'center', px: 4, py: 1, mt: 2 },\n};\n\nexport default ServicesEdit;\n"],"names":[],"mappings":";;;;;;;;AAqBA,MAAM,iBAAiB,CAAC,EAAE,SAAS,WAAW,iBAAiB,gBAAgB;AAC7E,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,OAAM;AAAA,MACN,SAAS,YAAY,MAAM;AAAA,MAAC,IAAI;AAAA,MAChC,QAAQ,QAAQ,eAAe;AAAA,MAE/B,UAAA;AAAA,QAAA,qBAAC,YAAA,EAAW,UAAA;AAAA,UAAA;AAAA,UAAiC;AAAA,UAAgB;AAAA,QAAA,GAAS;AAAA,QACtE,qBAAC,OAAA,EAAM,IAAI,OAAO,aAChB,UAAA;AAAA,UAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,SAAS;AAAA,cACT,UAAU;AAAA,cACV,SAAQ;AAAA,cACR,IAAI,OAAO;AAAA,cACX,WAAS;AAAA,cACV,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UAGD;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,SAAS;AAAA,cACT,UAAU;AAAA,cACV,SAAQ;AAAA,cACR,IAAI,CAAC,OAAO,QAAQ,OAAO,YAAY;AAAA,cACxC,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAED,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;AAEA,MAAM,SAAS;AAAA,EACb,aAAa;AAAA,IACX,SAAS;AAAA,IACT,eAAe;AAAA,IACf,WAAW;AAAA,IACX,gBAAgB;AAAA,EAAA;AAAA,EAElB,QAAQ;AAAA,IACN,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,UAAU;AAAA,IACV,OAAO;AAAA,EAAA;AAAA,EAET,cAAc,EAAE,aAAa,QAAQ,OAAO,gBAAgB,aAAa,kBAAA;AAC3E;AAGA,eAAe,YAAY;AAAA,EACz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iBAAiB;AAAA,QAC5B,QAAQ,MAAM,QAAA;AAAA,QACd,SAAS;AAAA,QACT,qBAAqB;AAAA,QACrB;AAAA,QACA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;AAEA,MAAM,cAAc,CAAC,EAAE,uBAAuB,gCAAgC;AAC5E,QAAM,gBAAgB,CAAC,SAAS,wCAAwC,CAAC;AACzE,MAAI,CAAC,uBAAuB;AAC1B,kBAAc,KAAK,GAAG,uBAAuB;AAAA,EAC/C;AACA,8BACG,OAAA,EACC,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,QAAO;AAAA,QACP,OAAM;AAAA,QACN,UAAU;AAAA,QACV,OAAO,CAAC,UAAU,MAAM,KAAA;AAAA,MAAK;AAAA,IAAA;AAAA,IAE/B;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,SAAQ;AAAA,QACR,MAAM;AAAA,QACN,OAAM;AAAA,QACN,IAAI,GAAG;AAAA,QACP,cAAc;AAAA,MAAA;AAAA,IAAA;AAAA,EAChB,GACF;AAEJ;AAGA,YAAY,YAAY;AAAA,EACtB,uBAAuB,UAAU,KAAK;AAAA,EACtC,2BAA2B,UAAU,KAAK;AAC5C;AAGA,aAAa,YAAY;AAAA,EACvB,SAAS,UAAU;AAAA,EACnB,QAAQ,UAAU;AAAA;AAAA,EAElB,iBAAiB,UAAU;AAAA,EAC3B,mBAAmB,UAAU;AAC/B;AAEA,MAAM,KAAK;AAAA,EACT,YAAY,EAAE,OAAO,eAAe,WAAW,UAAU,IAAI,GAAG,IAAI,GAAG,IAAI,EAAA;AAC7E;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.CYCWawJT.js","sources":["../../src/pages/services/utils/isAddButtonDisabled.js","../../src/components/common/Autocomplete.jsx","../../src/pages/services/components/ServiceEndpointSelection/index.jsx","../../src/pages/services/components/ServiceTypeSelection/index.jsx"],"sourcesContent":["export const isAddButtonDisabled = (\n inProgress,\n isIssueOrInspection,\n selectedCAO,\n serviceEndpoint,\n) => {\n return (\n !(\n (isIssueOrInspection && serviceEndpoint && selectedCAO) ||\n (!isIssueOrInspection && serviceEndpoint)\n ) || inProgress\n );\n};\n","import { useEffect, useCallback, useMemo, forwardRef } from 'react';\nimport { AutocompleteInput, useInput } from 'react-admin';\nimport PropTypes from 'prop-types';\n\n// eslint-disable-next-line prefer-arrow-functions/prefer-arrow-functions\nconst Autocomplete = forwardRef(function Autocomplete(\n {\n label,\n value: defaultValue,\n onChange,\n disabled,\n items,\n stringValue: format,\n inputText,\n styles,\n source = '',\n parse = (value) => value,\n },\n ref,\n) {\n const {\n field,\n fieldState: { error },\n } = useInput({ source, defaultValue, onChange, parse });\n\n const sortedItems = useMemo(() => {\n return items\n ? [...items].sort((a, b) => {\n return (a.name || '').localeCompare(b.name || '');\n })\n : [];\n }, [items]);\n\n const defaultInputText = useCallback(\n (choice) => {\n const formatted = format(choice);\n if (typeof formatted === 'string') {\n return formatted;\n }\n return formatted && formatted.props && formatted.props.children\n ? formatted.props.children.toString()\n : '';\n },\n [format],\n );\n\n useEffect(() => {\n if (sortedItems?.length === 1) {\n field.onChange(sortedItems[0]);\n }\n }, [sortedItems, field]);\n\n return (\n <AutocompleteInput\n {...field}\n ref={ref}\n label={label}\n choices={sortedItems || []}\n optionText={format}\n inputText={inputText || defaultInputText}\n optionValue=\"id\"\n disabled={disabled || (items && items.length === 1)}\n sx={styles}\n error={!!error}\n helperText={error ? error.message : ''}\n fullWidth\n />\n );\n});\n\n// eslint-disable-next-line better-mutation/no-mutation\nAutocomplete.propTypes = {\n label: PropTypes.string.isRequired,\n // eslint-disable-next-line react/forbid-prop-types\n value: PropTypes.any,\n onChange: PropTypes.func,\n disabled: PropTypes.bool,\n // eslint-disable-next-line react/forbid-prop-types\n items: PropTypes.array,\n stringValue: PropTypes.func,\n inputText: PropTypes.func,\n // eslint-disable-next-line react/forbid-prop-types\n styles: PropTypes.object,\n source: PropTypes.string,\n // eslint-disable-next-line react/forbid-prop-types\n defaultValue: PropTypes.any,\n parse: PropTypes.func,\n};\n\nexport default Autocomplete;\n","import { useState, useMemo } from 'react';\nimport { Box, Button, Stack, Typography, Tooltip, Link } from '@mui/material';\nimport KeyboardArrowLeftIcon from '@mui/icons-material/KeyboardArrowLeft';\nimport { Form, FormDataConsumer, SaveButton, TextInput, required } from 'react-admin';\nimport InfoIcon from '@mui/icons-material/Info';\n\nimport PropTypes from 'prop-types';\nimport CustomDropDown from '@/components/common/CustomDropDown.jsx';\nimport Autocomplete from '@/components/common/Autocomplete.jsx';\nimport OrganizationAvatar from '@/components/common/OrganizationAvatar.jsx';\nimport { validateServiceEndpoint } from '@/components/organizations/CreateOrganizationUtils.js';\nimport { chainNames } from '@/utils/chainNames.js';\nimport { useConfig } from '@/utils/ConfigContext.js';\n\nimport { getTitle, isAddButtonDisabled } from '../../utils/index.js';\n\nconst selectedStep = 2;\n\n// eslint-disable-next-line prefer-arrow-functions/prefer-arrow-functions\nexport const ServiceEndpointSelection = ({\n credentialAgentOperators,\n isIssueOrInspection,\n inProgress,\n onCreate,\n handleBack,\n}) => {\n const config = useConfig();\n const [selectedCAO, setSelectedCAO] = useState('');\n const [selectedServiceId, setSelectedServiceId] = useState('');\n const getOptionAsText = (item) => item.name;\n\n const CAO = useMemo(() => {\n if (selectedCAO) {\n return credentialAgentOperators.find((item) => item.id === selectedCAO);\n }\n return '';\n }, [credentialAgentOperators, selectedCAO]);\n\n return (\n <>\n <Typography variant=\"pm\" sx={styles.step}>\n Step 2/2\n </Typography>\n <Typography sx={styles.title} mb={2}>\n {getTitle(selectedStep)}\n </Typography>\n <Typography>Please complete the details below to continue</Typography>\n <Form onSubmit={onCreate} mode=\"onChange\" defaultValues={{ serviceEndpoint: '' }}>\n <Stack sx={styles.endpointForm}>\n {isIssueOrInspection ? (\n <Stack sx={{ mt: 2 }}>\n <Stack flexDirection=\"row\" alignItems=\"center\" sx={styles.selectCAOContainer}>\n <Autocomplete\n source=\"serviceCAO\"\n label=\"Select Credential Agent Operator\"\n value={selectedCAO}\n onChange={setSelectedCAO}\n items={credentialAgentOperators}\n /* eslint-disable-next-line react/no-unstable-nested-components */\n stringValue={(item) => (\n <Box sx={styles.menuItemLogo} component=\"div\">\n <span>{item.name}</span>\n <OrganizationAvatar size={32} name={item.name} logo={item.logo} />\n </Box>\n )}\n inputText={getOptionAsText}\n disabled={false}\n styles={styles.selectCAO}\n />\n <Box sx={{ ml: 2 }}>\n <Tooltip title=\"The Credential Agent Operator your organization will use to integrate with Velocity Network™\">\n <InfoIcon color=\"info\" fontSize=\"small\" cursor=\"pointer\" />\n </Tooltip>\n </Box>\n </Stack>\n <Stack flexDirection=\"row\" alignItems=\"center\" mt={1} mb={4}>\n <CustomDropDown\n label='Select \"Service ID\"'\n value={selectedServiceId}\n onChange={setSelectedServiceId}\n items={CAO.service || []}\n stringValue={(item) => `${item.id} (${item.serviceEndpoint})`}\n disabled={!selectedCAO}\n source=\"serviceEndpoint\"\n parse={(value) => `${selectedCAO}${value.id}`}\n />\n <Box sx={{ ml: 2 }}>\n <Tooltip\n title=\"The agent's service ID your organization needs to use. \n If there are multiple service IDs available, please contact your Credential Agent Operator to know which one to select.\"\n >\n <InfoIcon color=\"info\" fontSize=\"small\" cursor=\"pointer\" />\n </Tooltip>\n </Box>\n </Stack>\n </Stack>\n ) : (\n <TextInput\n source=\"serviceEndpoint\"\n label=\"Service endpoint URL\"\n validate={[\n required('Service endpoint URL field is required'),\n ...validateServiceEndpoint,\n ]}\n parse={(value) => value?.trim() ?? ''}\n disabled={inProgress}\n />\n )}\n {config.chainName !== chainNames.testnet && (\n <Typography variant=\"subtitle1\" sx={{ marginTop: '10px' }}>\n <span>By clicking Add, you agree to our </span>\n <Link\n target=\"_blank\"\n href=\"https://www.velocitynetwork.foundation/main2/participation-agreements\"\n >\n Participant Agreement\n </Link>\n </Typography>\n )}\n <Box sx={styles.buttonBlock}>\n <Button\n variant=\"outlined\"\n sx={[styles.button, styles.backButton]}\n onClick={handleBack}\n startIcon={<KeyboardArrowLeftIcon />}\n disabled={inProgress}\n >\n Back\n </Button>\n <FormDataConsumer>\n {({ formData }) => {\n const isDisabled = isAddButtonDisabled(\n inProgress,\n isIssueOrInspection,\n formData.serviceCAO,\n formData.serviceEndpoint,\n );\n\n return (\n <SaveButton\n variant=\"outlined\"\n alwaysEnable={false}\n disabled={isDisabled}\n icon={null}\n label=\"Add\"\n sx={[styles.button, styles.saveButton, isDisabled && styles.saveButtonDisabled]}\n />\n );\n }}\n </FormDataConsumer>\n </Box>\n </Stack>\n </Form>\n </>\n );\n};\n\nconst styles = {\n step: { color: (theme) => theme.palette.primary.main, pb: '20px', display: 'block' },\n title: {\n fontSize: '32px',\n fontWeight: '600',\n lineHeight: '38px',\n },\n endpointForm: {\n marginTop: '20px',\n },\n selectCAOContainer: {\n width: '100%',\n marginBottom: '20px',\n },\n selectCAO: {\n width: '100%',\n '& .MuiInputBase-root': {\n width: '100%',\n },\n '& .MuiSelect-select': {\n display: 'flex',\n justifyContent: 'space-between',\n alignItems: 'center',\n py: 0,\n },\n '& .MuiFormHelperText-root': {\n display: 'none',\n },\n },\n menuItemLogo: {\n display: 'flex',\n flex: '1',\n justifyContent: 'space-between',\n alignItems: 'center',\n },\n buttonBlock: {\n display: 'flex',\n marginTop: '40px',\n justifyContent: 'center',\n },\n button: { px: 4, py: 1, fontSize: '16px', width: '160px' },\n backButton: {\n marginRight: '20px',\n borderColor: 'secondary.light',\n color: 'text.primary',\n },\n saveButton: {\n display: 'flex',\n flexDirection: 'row-reverse',\n gap: '10px',\n '&:disabled': {\n color: 'primary.main',\n borderColor: 'primary.main',\n },\n },\n saveButtonDisabled: {\n '&:disabled': {\n color: 'text.disabled',\n borderColor: 'secondary.light',\n },\n },\n};\n// eslint-disable-next-line better-mutation/no-mutation\nServiceEndpointSelection.propTypes = {\n credentialAgentOperators: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string.isRequired,\n name: PropTypes.string.isRequired,\n logo: PropTypes.string,\n service: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string.isRequired,\n serviceEndpoint: PropTypes.string.isRequired,\n }),\n ),\n }),\n ).isRequired,\n isIssueOrInspection: PropTypes.bool.isRequired,\n inProgress: PropTypes.bool.isRequired,\n onCreate: PropTypes.func.isRequired,\n handleBack: PropTypes.func.isRequired,\n};\n\nexport default ServiceEndpointSelection;\n","import { Box, Button, Typography } from '@mui/material';\nimport KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';\nimport { Form } from 'react-admin';\nimport PropTypes from 'prop-types';\nimport Loading from '@/components/Loading.jsx';\nimport CustomDropDown from '@/components/common/CustomDropDown.jsx';\nimport serviceTypes from '@/utils/serviceTypes.js';\n\nimport { getTitle } from '../../utils/index.js';\n\nconst selectedStep = 1;\n\nexport const ServiceTypeSelection = ({\n handleNext,\n isLoading,\n selectedServiceType,\n setSelectedServiceType,\n onDoLater,\n}) => {\n return (\n <>\n <Typography variant=\"pm\" sx={styles.step}>\n Step 1/2\n </Typography>\n <Typography variant=\"h1\" mb={2}>\n {getTitle(selectedStep)}\n </Typography>\n <Typography mb={4}>Select the type of service you wish to add.</Typography>\n <Form record={{}}>\n <CustomDropDown\n source=\"selectedServiceType\"\n label=\"Select type of service\"\n value={selectedServiceType}\n onChange={setSelectedServiceType}\n items={serviceTypes}\n stringValue={(item) => item.title}\n parse={(value) => value.id}\n disabled={false}\n />\n <Box sx={[styles.buttonBlock, !onDoLater && styles.rightButton]}>\n {onDoLater && (\n <Button sx={[styles.button]} variant=\"outlined\" color=\"secondary\" onClick={onDoLater}>\n Do Later\n </Button>\n )}\n <Button\n disabled={!selectedServiceType || isLoading}\n variant=\"outlined\"\n sx={[styles.button]}\n endIcon={\n selectedServiceType && isLoading ? (\n <Loading color=\"error\" sx={styles.loader} size={26} />\n ) : (\n <KeyboardArrowRightIcon />\n )\n }\n onClick={handleNext}\n >\n Next\n </Button>\n </Box>\n </Form>\n </>\n );\n};\n\nconst styles = {\n buttonBlock: {\n display: 'flex',\n marginTop: '40px',\n justifyContent: 'center',\n alignItems: 'center',\n gap: '30px',\n },\n rightButton: {\n justifyContent: 'flex-end',\n },\n step: { color: (theme) => theme.palette.primary.main, pb: '20px', display: 'block' },\n button: { px: 4, py: 1, fontSize: '16px', width: '160px' },\n};\n// eslint-disable-next-line better-mutation/no-mutation\nServiceTypeSelection.propTypes = {\n handleNext: PropTypes.func.isRequired,\n isLoading: PropTypes.bool,\n selectedServiceType: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.number]),\n setSelectedServiceType: PropTypes.func.isRequired,\n onDoLater: PropTypes.func,\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nServiceTypeSelection.defaultProps = {\n isLoading: false,\n selectedServiceType: null,\n onDoLater: null,\n};\n\nexport default ServiceTypeSelection;\n"],"names":["forwardRef","Autocomplete","styles","useInput","useMemo","useCallback","useEffect","jsx","AutocompleteInput","selectedStep","useConfig","useState","jsxs","Fragment","Typography","getTitle","Form","Stack","Box","OrganizationAvatar","Tooltip","CustomDropDown","TextInput","required","validateServiceEndpoint","chainNames","Link","Button","FormDataConsumer","SaveButton","serviceTypes","Loading"],"mappings":";;;;;;;;;;;;;;;;;AAAO,MAAM,sBAAsB,CACjC,YACA,qBACA,aACA,oBACG;AACH,SACE,EACG,uBAAuB,mBAAmB,eAC1C,CAAC,uBAAuB,oBACtB;AAET;ACPA,MAAM,eAAeA,MAAAA,WAAW,SAASC,cACvC;AAAA,EACE;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA,QAAAC;AAAA,EACA,SAAS;AAAA,EACT,QAAQ,CAAC,UAAU;AACrB,GACA,KACA;AACA,QAAM;AAAA,IACJ;AAAA,IACA,YAAY,EAAE,MAAA;AAAA,EAAM,IAClBC,WAAAA,SAAS,EAAE,QAAQ,cAAc,UAAU,OAAO;AAEtD,QAAM,cAAcC,MAAAA,QAAQ,MAAM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;AAAA,EACrB,qBAAqB,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,QAAQ,UAAU,MAAM,CAAC;AAAA,EAC/F,wBAAwB,UAAU,KAAK;AAAA,EACvC,WAAW,UAAU;AACvB;AAGA,qBAAqB,eAAe;AAAA,EAClC,WAAW;AAAA,EACX,qBAAqB;AAAA,EACrB,WAAW;AACb;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.Cmn4FlUL.js","sources":["../../src/pages/services/utils/isAddButtonDisabled.js","../../src/components/common/Autocomplete.jsx","../../src/pages/services/components/ServiceEndpointSelection/index.jsx","../../src/pages/services/components/ServiceTypeSelection/index.jsx"],"sourcesContent":["export const isAddButtonDisabled = (\n inProgress,\n isIssueOrInspection,\n selectedCAO,\n serviceEndpoint,\n) => {\n return (\n !(\n (isIssueOrInspection && serviceEndpoint && selectedCAO) ||\n (!isIssueOrInspection && serviceEndpoint)\n ) || inProgress\n );\n};\n","import { useEffect, useCallback, useMemo, forwardRef } from 'react';\nimport { AutocompleteInput, useInput } from 'react-admin';\nimport PropTypes from 'prop-types';\n\n// eslint-disable-next-line prefer-arrow-functions/prefer-arrow-functions\nconst Autocomplete = forwardRef(function Autocomplete(\n {\n label,\n value: defaultValue,\n onChange,\n disabled,\n items,\n stringValue: format,\n inputText,\n styles,\n source = '',\n parse = (value) => value,\n },\n ref,\n) {\n const {\n field,\n fieldState: { error },\n } = useInput({ source, defaultValue, onChange, parse });\n\n const sortedItems = useMemo(() => {\n return items\n ? [...items].sort((a, b) => {\n return (a.name || '').localeCompare(b.name || '');\n })\n : [];\n }, [items]);\n\n const defaultInputText = useCallback(\n (choice) => {\n const formatted = format(choice);\n if (typeof formatted === 'string') {\n return formatted;\n }\n return formatted && formatted.props && formatted.props.children\n ? formatted.props.children.toString()\n : '';\n },\n [format],\n );\n\n useEffect(() => {\n if (sortedItems?.length === 1) {\n field.onChange(sortedItems[0]);\n }\n }, [sortedItems, field]);\n\n return (\n <AutocompleteInput\n {...field}\n ref={ref}\n label={label}\n choices={sortedItems || []}\n optionText={format}\n inputText={inputText || defaultInputText}\n optionValue=\"id\"\n disabled={disabled || (items && items.length === 1)}\n sx={styles}\n error={!!error}\n helperText={error ? error.message : ''}\n fullWidth\n />\n );\n});\n\n// eslint-disable-next-line better-mutation/no-mutation\nAutocomplete.propTypes = {\n label: PropTypes.string.isRequired,\n // eslint-disable-next-line react/forbid-prop-types\n value: PropTypes.any,\n onChange: PropTypes.func,\n disabled: PropTypes.bool,\n // eslint-disable-next-line react/forbid-prop-types\n items: PropTypes.array,\n stringValue: PropTypes.func,\n inputText: PropTypes.func,\n // eslint-disable-next-line react/forbid-prop-types\n styles: PropTypes.object,\n source: PropTypes.string,\n // eslint-disable-next-line react/forbid-prop-types\n defaultValue: PropTypes.any,\n parse: PropTypes.func,\n};\n\nexport default Autocomplete;\n","import { useState, useMemo } from 'react';\nimport { Box, Button, Stack, Typography, Tooltip, Link } from '@mui/material';\nimport KeyboardArrowLeftIcon from '@mui/icons-material/KeyboardArrowLeft';\nimport { Form, FormDataConsumer, SaveButton, TextInput, required } from 'react-admin';\nimport InfoIcon from '@mui/icons-material/Info';\n\nimport PropTypes from 'prop-types';\nimport CustomDropDown from '@/components/common/CustomDropDown.jsx';\nimport Autocomplete from '@/components/common/Autocomplete.jsx';\nimport OrganizationAvatar from '@/components/common/OrganizationAvatar.jsx';\nimport { validateServiceEndpoint } from '@/components/organizations/CreateOrganizationUtils.js';\nimport { chainNames } from '@/utils/chainNames.js';\nimport { useConfig } from '@/utils/ConfigContext.js';\n\nimport { getTitle, isAddButtonDisabled } from '../../utils/index.js';\n\nconst selectedStep = 2;\n\n// eslint-disable-next-line prefer-arrow-functions/prefer-arrow-functions\nexport const ServiceEndpointSelection = ({\n credentialAgentOperators,\n isIssueOrInspection,\n inProgress,\n onCreate,\n handleBack,\n}) => {\n const config = useConfig();\n const [selectedCAO, setSelectedCAO] = useState('');\n const [selectedServiceId, setSelectedServiceId] = useState('');\n const getOptionAsText = (item) => item.name;\n\n const CAO = useMemo(() => {\n if (selectedCAO) {\n return credentialAgentOperators.find((item) => item.id === selectedCAO);\n }\n return '';\n }, [credentialAgentOperators, selectedCAO]);\n\n return (\n <>\n <Typography variant=\"pm\" sx={styles.step}>\n Step 2/2\n </Typography>\n <Typography sx={styles.title} mb={2}>\n {getTitle(selectedStep)}\n </Typography>\n <Typography>Please complete the details below to continue</Typography>\n <Form onSubmit={onCreate} mode=\"onChange\" defaultValues={{ serviceEndpoint: '' }}>\n <Stack sx={styles.endpointForm}>\n {isIssueOrInspection ? (\n <Stack sx={{ mt: 2 }}>\n <Stack flexDirection=\"row\" alignItems=\"center\" sx={styles.selectCAOContainer}>\n <Autocomplete\n source=\"serviceCAO\"\n label=\"Select Credential Agent Operator\"\n value={selectedCAO}\n onChange={setSelectedCAO}\n items={credentialAgentOperators}\n /* eslint-disable-next-line react/no-unstable-nested-components */\n stringValue={(item) => (\n <Box sx={styles.menuItemLogo} component=\"div\">\n <span>{item.name}</span>\n <OrganizationAvatar size={32} name={item.name} logo={item.logo} />\n </Box>\n )}\n inputText={getOptionAsText}\n disabled={false}\n styles={styles.selectCAO}\n />\n <Box sx={{ ml: 2 }}>\n <Tooltip title=\"The Credential Agent Operator your organization will use to integrate with Velocity Network™\">\n <InfoIcon color=\"info\" fontSize=\"small\" cursor=\"pointer\" />\n </Tooltip>\n </Box>\n </Stack>\n <Stack flexDirection=\"row\" alignItems=\"center\" mt={1} mb={4}>\n <CustomDropDown\n label='Select \"Service ID\"'\n value={selectedServiceId}\n onChange={setSelectedServiceId}\n items={CAO.service || []}\n stringValue={(item) => `${item.id} (${item.serviceEndpoint})`}\n disabled={!selectedCAO}\n source=\"serviceEndpoint\"\n parse={(value) => `${selectedCAO}${value.id}`}\n />\n <Box sx={{ ml: 2 }}>\n <Tooltip\n title=\"The agent's service ID your organization needs to use. \n If there are multiple service IDs available, please contact your Credential Agent Operator to know which one to select.\"\n >\n <InfoIcon color=\"info\" fontSize=\"small\" cursor=\"pointer\" />\n </Tooltip>\n </Box>\n </Stack>\n </Stack>\n ) : (\n <TextInput\n source=\"serviceEndpoint\"\n label=\"Service endpoint URL\"\n validate={[\n required('Service endpoint URL field is required'),\n ...validateServiceEndpoint,\n ]}\n parse={(value) => value?.trim() ?? ''}\n disabled={inProgress}\n />\n )}\n {config.chainName !== chainNames.testnet && (\n <Typography variant=\"subtitle1\" sx={{ marginTop: '10px' }}>\n <span>By clicking Add, you agree to our </span>\n <Link\n target=\"_blank\"\n href=\"https://www.velocitynetwork.foundation/main2/participation-agreements\"\n >\n Participant Agreement\n </Link>\n </Typography>\n )}\n <Box sx={styles.buttonBlock}>\n <Button\n variant=\"outlined\"\n sx={[styles.button, styles.backButton]}\n onClick={handleBack}\n startIcon={<KeyboardArrowLeftIcon />}\n disabled={inProgress}\n >\n Back\n </Button>\n <FormDataConsumer>\n {({ formData }) => {\n const isDisabled = isAddButtonDisabled(\n inProgress,\n isIssueOrInspection,\n formData.serviceCAO,\n formData.serviceEndpoint,\n );\n\n return (\n <SaveButton\n variant=\"outlined\"\n alwaysEnable={false}\n disabled={isDisabled}\n icon={null}\n label=\"Add\"\n sx={[styles.button, styles.saveButton, isDisabled && styles.saveButtonDisabled]}\n />\n );\n }}\n </FormDataConsumer>\n </Box>\n </Stack>\n </Form>\n </>\n );\n};\n\nconst styles = {\n step: { color: (theme) => theme.palette.primary.main, pb: '20px', display: 'block' },\n title: {\n fontSize: '32px',\n fontWeight: '600',\n lineHeight: '38px',\n },\n endpointForm: {\n marginTop: '20px',\n },\n selectCAOContainer: {\n width: '100%',\n marginBottom: '20px',\n },\n selectCAO: {\n width: '100%',\n '& .MuiInputBase-root': {\n width: '100%',\n },\n '& .MuiSelect-select': {\n display: 'flex',\n justifyContent: 'space-between',\n alignItems: 'center',\n py: 0,\n },\n '& .MuiFormHelperText-root': {\n display: 'none',\n },\n },\n menuItemLogo: {\n display: 'flex',\n flex: '1',\n justifyContent: 'space-between',\n alignItems: 'center',\n },\n buttonBlock: {\n display: 'flex',\n marginTop: '40px',\n justifyContent: 'center',\n },\n button: { px: 4, py: 1, fontSize: '16px', width: '160px' },\n backButton: {\n marginRight: '20px',\n borderColor: 'secondary.light',\n color: 'text.primary',\n },\n saveButton: {\n display: 'flex',\n flexDirection: 'row-reverse',\n gap: '10px',\n '&:disabled': {\n color: 'primary.main',\n borderColor: 'primary.main',\n },\n },\n saveButtonDisabled: {\n '&:disabled': {\n color: 'text.disabled',\n borderColor: 'secondary.light',\n },\n },\n};\n// eslint-disable-next-line better-mutation/no-mutation\nServiceEndpointSelection.propTypes = {\n credentialAgentOperators: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string.isRequired,\n name: PropTypes.string.isRequired,\n logo: PropTypes.string,\n service: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string.isRequired,\n serviceEndpoint: PropTypes.string.isRequired,\n }),\n ),\n }),\n ).isRequired,\n isIssueOrInspection: PropTypes.bool.isRequired,\n inProgress: PropTypes.bool.isRequired,\n onCreate: PropTypes.func.isRequired,\n handleBack: PropTypes.func.isRequired,\n};\n\nexport default ServiceEndpointSelection;\n","import { Box, Button, Typography } from '@mui/material';\nimport KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';\nimport { Form } from 'react-admin';\nimport PropTypes from 'prop-types';\nimport Loading from '@/components/Loading.jsx';\nimport CustomDropDown from '@/components/common/CustomDropDown.jsx';\nimport serviceTypes from '@/utils/serviceTypes.js';\n\nimport { getTitle } from '../../utils/index.js';\n\nconst selectedStep = 1;\n\nexport const ServiceTypeSelection = ({\n handleNext,\n isLoading,\n selectedServiceType,\n setSelectedServiceType,\n onDoLater,\n}) => {\n return (\n <>\n <Typography variant=\"pm\" sx={styles.step}>\n Step 1/2\n </Typography>\n <Typography variant=\"h1\" mb={2}>\n {getTitle(selectedStep)}\n </Typography>\n <Typography mb={4}>Select the type of service you wish to add.</Typography>\n <Form record={{}}>\n <CustomDropDown\n source=\"selectedServiceType\"\n label=\"Select type of service\"\n value={selectedServiceType}\n onChange={setSelectedServiceType}\n items={serviceTypes}\n stringValue={(item) => item.title}\n parse={(value) => value.id}\n disabled={false}\n />\n <Box sx={[styles.buttonBlock, !onDoLater && styles.rightButton]}>\n {onDoLater && (\n <Button sx={[styles.button]} variant=\"outlined\" color=\"secondary\" onClick={onDoLater}>\n Do Later\n </Button>\n )}\n <Button\n disabled={!selectedServiceType || isLoading}\n variant=\"outlined\"\n sx={[styles.button]}\n endIcon={\n selectedServiceType && isLoading ? (\n <Loading color=\"error\" sx={styles.loader} size={26} />\n ) : (\n <KeyboardArrowRightIcon />\n )\n }\n onClick={handleNext}\n >\n Next\n </Button>\n </Box>\n </Form>\n </>\n );\n};\n\nconst styles = {\n buttonBlock: {\n display: 'flex',\n marginTop: '40px',\n justifyContent: 'center',\n alignItems: 'center',\n gap: '30px',\n },\n rightButton: {\n justifyContent: 'flex-end',\n },\n step: { color: (theme) => theme.palette.primary.main, pb: '20px', display: 'block' },\n button: { px: 4, py: 1, fontSize: '16px', width: '160px' },\n};\n// eslint-disable-next-line better-mutation/no-mutation\nServiceTypeSelection.propTypes = {\n handleNext: PropTypes.func.isRequired,\n isLoading: PropTypes.bool,\n selectedServiceType: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.number]),\n setSelectedServiceType: PropTypes.func.isRequired,\n onDoLater: PropTypes.func,\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nServiceTypeSelection.defaultProps = {\n isLoading: false,\n selectedServiceType: null,\n onDoLater: null,\n};\n\nexport default ServiceTypeSelection;\n"],"names":["Autocomplete","styles","selectedStep"],"mappings":";;;;;;;;;;;;;;;;AAAO,MAAM,sBAAsB,CACjC,YACA,qBACA,aACA,oBACG;AACH,SACE,EACG,uBAAuB,mBAAmB,eAC1C,CAAC,uBAAuB,oBACtB;AAET;ACPA,MAAM,eAAe,WAAW,SAASA,cACvC;AAAA,EACE;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA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