@verii/components-organizations-registrar 1.1.0 → 1.1.1

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.
@@ -493,4 +493,4 @@ SecretKeysPopup.propTypes = {
493
493
  //#endregion
494
494
  export { getTitle as a, getNewServiceIndex as i, buildServiceContent as n, isAddButtonDisabled as o, buildPayload as r, downloadTxtAsFile_default as s, SecretKeysPopup as t };
495
495
 
496
- //# sourceMappingURL=SecretKeysPopup.0XsoiVZ9.js.map
496
+ //# sourceMappingURL=SecretKeysPopup.D_ws7IBv.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SecretKeysPopup.0XsoiVZ9.js","names":[],"sources":["../../src/pages/services/components/SecretKeysPopup/WarningSecretKeysPopup/index.jsx","../../src/utils/downloadTxtAsFile.js","../../src/pages/services/hooks/useKeyDownload.js","../../src/pages/services/utils/formatSecrets.js","../../src/pages/services/utils/isAddButtonDisabled.js","../../src/pages/services/utils/getTitle.js","../../src/utils/invitations.js","../../src/pages/services/utils/buildPayload.js","../../src/pages/services/utils/buildServiceContent.js","../../src/pages/services/components/SecretKeysPopup/ServiceSecretKeys/index.jsx","../../src/pages/services/components/SecretKeysPopup/index.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 { Box, Typography, Button, useTheme } from '@mui/material';\nimport DownloadIcon from '@mui/icons-material/Download';\nimport InfoIcon from '@mui/icons-material/Info';\nimport PropTypes from 'prop-types';\n\nimport Popup from '@/components/common/Popup.jsx';\nimport Loading from '@/components/Loading.jsx';\n\nconst titleDefault =\n 'Wait! Before you close this window, please make sure you have saved a copy of your keys';\nconst subTitleDefault =\n // eslint-disable-next-line max-len\n 'Your organization’s unique keys are critical for managing your organization’s data on Velocity Network™. This information will not be available once you close this window.';\nconst buttonLabelDefault = 'Download keys';\n\nconst WarningSecretKeysPopup = ({\n isModalOpened,\n onClose,\n title = titleDefault,\n subTitle = subTitleDefault,\n buttonLabel = buttonLabelDefault,\n isLoading = false,\n onClick,\n}) => {\n const theme = useTheme();\n\n return (\n <Popup\n onClose={onClose}\n title=\"\"\n isOpen={isModalOpened}\n mainContainerStyles={styles.mainContainer}\n isBackBoxVisible\n backBoxColor={theme.palette.warning.main}\n disableCloseButton={isLoading}\n >\n <InfoIcon color=\"warning\" sx={styles.icon} />\n <Typography sx={styles.title}>{title}</Typography>\n <Typography textAlign=\"center\">{subTitle}</Typography>\n\n <Box sx={styles.buttonBlock}>\n <Button\n variant=\"outlined\"\n endIcon={\n isLoading ? <Loading color=\"error\" sx={styles.loader} size={26} /> : <DownloadIcon />\n }\n disabled={isLoading}\n sx={styles.button}\n onClick={onClick}\n >\n {buttonLabel}\n </Button>\n </Box>\n </Popup>\n );\n};\n\nconst styles = {\n mainContainer: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n pt: '19px',\n },\n title: {\n fontWeight: 600,\n fontSize: '32px',\n lineHeight: '39px',\n textAlign: 'center',\n mb: '32px',\n mt: '35px',\n },\n button: { px: 4, py: 1, fontSize: '16px' },\n buttonBlock: {\n marginTop: '52px',\n },\n icon: { width: '50px', height: '50px' },\n loader: { pl: '10px' },\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nWarningSecretKeysPopup.propTypes = {\n isModalOpened: PropTypes.bool,\n onClose: PropTypes.func,\n title: PropTypes.string,\n subTitle: PropTypes.string,\n buttonLabel: PropTypes.string,\n isLoading: PropTypes.bool,\n onClick: PropTypes.func,\n};\n\nexport default WarningSecretKeysPopup;\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 */\nconst download = (fileName, onLoading, onError, onClick, callback) => {\n const request = new XMLHttpRequest();\n request.responseType = 'blob';\n request.open('GET', fileName);\n\n request.addEventListener('load', () => {\n callback();\n });\n request.onloadstart = () => {\n onClick(true);\n onLoading(true);\n };\n request.onloadend = () => {\n onLoading(false);\n };\n request.onerror = () => {\n onError(true);\n };\n request.onabort = () => {\n onError(true);\n };\n\n request.send();\n};\n/* eslint-disable better-mutation/no-mutation */\nconst downloadTxtAsFile = (text, name) => {\n const a = document.createElement('a');\n const file = new Blob([text], { type: 'application/json' });\n\n a.href = URL.createObjectURL(file);\n a.download = name;\n a.click();\n a.remove();\n};\n\nexport default (fileName, text, onLoading, onError, onClick) => {\n download(fileName, onLoading, onError, onClick, () => {\n downloadTxtAsFile(text, fileName);\n });\n};\n","import { useState, useCallback } from 'react';\nimport downloadTxtAsFile from '@/utils/downloadTxtAsFile.js';\nimport { copyTextToClipboard, objectToString } from '@/utils/index.jsx';\n\nexport const useKeyDownload = () => {\n const [isDownloaded, setIsDownloaded] = useState(false);\n const [isLoadingKeys, setIsLoadingKeys] = useState(false);\n const [isLoadingKeysError, setIsLoadingKeysError] = useState(false);\n const [isCopied, setIsCopied] = useState(false);\n\n const onCopy = useCallback((secretKeys) => {\n copyTextToClipboard(objectToString(secretKeys), (error) => {\n setIsCopied(!error);\n });\n }, []);\n\n const onDownload = useCallback((secretKeys) => {\n setIsLoadingKeys(true);\n const keys = objectToString(secretKeys);\n downloadTxtAsFile(\n 'keys.json',\n keys,\n (isLoading) => setIsLoadingKeys(isLoading),\n (isError) => setIsLoadingKeysError(isError),\n (isClicked) => setIsDownloaded(isClicked),\n );\n }, []);\n\n return { isDownloaded, isLoadingKeys, isLoadingKeysError, isCopied, onDownload, onCopy };\n};\n\nexport default useKeyDownload;\n","export const formatSecrets = (secretKeys) => {\n return secretKeys\n ? [\n ...(secretKeys.keys\n ? secretKeys.keys.map((item) => ({\n ...item,\n id: item.didDocumentKey.id.replace('#', ''),\n }))\n : []),\n ...(secretKeys.authClients\n ? secretKeys.authClients.reduce(\n (acc, { clientId, clientSecret }) => [\n ...acc,\n { id: 'Client Id', key: clientId },\n { id: 'Client Secret', key: clientSecret },\n ],\n [],\n )\n : []),\n ]\n : [];\n};\n","const hasValue = (value) => {\n if (Array.isArray(value)) {\n return value.length > 0;\n }\n\n return Boolean(value);\n};\n\nconst hasRequiredFields = (fields, formData) => {\n if (!formData) {\n return false;\n }\n\n return fields.every((field) => hasValue(formData[field]));\n};\n\nconst requiredFieldsByServiceType = [\n {\n isActive: ({ isIssuingOrInspection }) => isIssuingOrInspection,\n requiredFields: ['serviceEndpoint', 'serviceCAO'],\n },\n {\n isActive: ({ isCAO }) => isCAO,\n requiredFields: ['serviceEndpoint'],\n },\n {\n isActive: ({ isWebWallet }) => isWebWallet,\n requiredFields: ['name', 'logo', 'serviceEndpoint', 'supportedExchangeProtocols'],\n },\n {\n isActive: ({ isHolderWallet }) => isHolderWallet,\n requiredFields: [\n 'name',\n 'logo',\n 'serviceEndpoint',\n 'supportedExchangeProtocols',\n 'playStoreUrl',\n 'googlePlayId',\n 'appleAppStoreUrl',\n 'appleAppId',\n ],\n },\n];\n\nexport const isAddButtonDisabled = (\n inProgress,\n isIssuingOrInspection,\n isCAO,\n isWebWallet,\n isHolderWallet,\n formData,\n) => {\n if (inProgress) {\n return true;\n }\n\n const serviceType = requiredFieldsByServiceType.find((item) =>\n item.isActive({ isIssuingOrInspection, isCAO, isWebWallet, isHolderWallet }),\n );\n\n if (!serviceType) {\n return true;\n }\n\n return !hasRequiredFields(serviceType.requiredFields, formData);\n};\n","export const getTitle = (step) => {\n switch (step) {\n case 2:\n return \"You're one step away from setting up your new service on Velocity Network™\";\n case 3:\n return 'Set a Secure Messages URL';\n case 4:\n return 'Congratulations!';\n default:\n return 'Select type of service to add';\n }\n};\n","export const getNewServiceIndex = (services, kebabType) => {\n // eslint-disable-next-line better-mutation/no-mutating-methods\n const servicesOfSameType = services\n .filter((item) => item.id.split('#')[1]?.startsWith(kebabType))\n .sort();\n\n return (\n // eslint-disable-next-line better-mutation/no-mutating-methods\n parseInt(servicesOfSameType[servicesOfSameType.length - 1]?.id.split('-').reverse()[0], 10) +\n 1 || 1\n );\n};\n","import { kebabCase } from 'lodash-es';\nimport { CREDENTIAL_TYPES_IDS } from '@/utils/serviceTypes.js';\nimport { getNewServiceIndex } from '@/utils/invitations.js';\n\nconst addProp = (name, value) => (value ? { [name]: value } : {});\n\nexport const buildPayload = (service, type, did, services) => {\n const kebabType = kebabCase(type);\n const { name, logo, supportedExchangeProtocols, serviceEndpoint } = service;\n\n const genericPayload = {\n ...(did &&\n services && { id: `${did}#${kebabType}-${getNewServiceIndex(services, kebabType)}` }),\n serviceEndpoint,\n type,\n };\n if (type === CREDENTIAL_TYPES_IDS.VLC_WEB_WALLET_PROVIDER) {\n return {\n ...genericPayload,\n ...addProp('logoUrl', logo),\n ...addProp('supportedExchangeProtocols', supportedExchangeProtocols),\n ...addProp('name', name),\n };\n }\n if (type === CREDENTIAL_TYPES_IDS.VLC_HOLDER_APP_PROVIDER) {\n const { playStoreUrl, googlePlayId, appleAppStoreUrl, appleAppId } = service;\n return {\n ...genericPayload,\n ...addProp('logoUrl', logo),\n ...addProp('supportedExchangeProtocols', supportedExchangeProtocols),\n ...addProp('name', name),\n ...addProp('playStoreUrl', playStoreUrl),\n ...addProp('googlePlayId', googlePlayId),\n ...addProp('appleAppStoreUrl', appleAppStoreUrl),\n ...addProp('appleAppId', appleAppId),\n };\n }\n return genericPayload;\n};\n","export const buildServiceContent = (item, title, isLink = false) => {\n if (!item) return [];\n\n const value = Array.isArray(item) ? item.join(', ') : item;\n return [{ name: title, value, isLink }];\n};\n","import { useMemo } from 'react';\nimport { Box, Button, Grid, Typography } from '@mui/material';\nimport InfoIcon from '@mui/icons-material/Info';\nimport DownloadIcon from '@mui/icons-material/Download';\nimport { Form } from 'react-admin';\nimport PropTypes from 'prop-types';\n\nimport { getTitle, formatSecrets } from '@/pages/services/utils/index.js';\n\nconst selectedStep = 4;\n\nexport const ServiceSecretKeys = ({\n secretKeys,\n subtitle,\n description,\n onDownload,\n onCopy,\n isCopied,\n}) => {\n const formattedKeys = useMemo(() => formatSecrets(secretKeys), [secretKeys]);\n\n return (\n <>\n <Typography sx={styles.title} mb={2}>\n {getTitle(selectedStep)}\n </Typography>\n <Typography sx={styles.subtitle}>{subtitle}</Typography>\n <Typography>{description}</Typography>\n <Form>\n {formattedKeys.map((item) => (\n <Grid container spacing={2} columns={14} key={item.id} sx={styles.keysBlock}>\n <Key label={item.id} />\n <Value value={item.key} />\n </Grid>\n ))}\n <Box sx={styles.doNotDisclosureBlock}>\n <InfoIcon />\n <Typography marginLeft=\"20px\">\n Do not disclose these keys to unauthorized persons or transmit via unsecured channels.\n </Typography>\n </Box>\n\n <Box sx={styles.buttonsBlock}>\n <Button\n variant=\"outlined\"\n color=\"secondary\"\n sx={[styles.button, { marginRight: '30px' }]}\n onClick={() => onCopy(secretKeys)}\n >\n {isCopied ? 'Copied' : 'Copy'}\n </Button>\n <Button\n variant=\"outlined\"\n endIcon={<DownloadIcon />}\n sx={styles.button}\n onClick={() => onDownload(secretKeys)}\n >\n Download\n </Button>\n </Box>\n </Form>\n </>\n );\n};\n\nconst Key = ({ label }) => (\n <Grid size={{ xs: 4 }} sx={styles.keyLabel}>\n <Typography>{label}</Typography>\n </Grid>\n);\n\nconst Value = ({ value }) => (\n <Grid size={{ xs: 10 }}>\n <Typography sx={styles.keyValue}>{value}</Typography>\n </Grid>\n);\n\nconst styles = {\n title: {\n fontSize: '32px',\n fontWeight: '600',\n lineHeight: '38px',\n },\n subtitle: {\n fontWeight: '600',\n fontSize: '16px',\n marginBottom: '24px',\n },\n doNotDisclosureBlock: {\n color: 'secondary.light',\n fontSize: '14px',\n display: 'flex',\n flexDirection: 'row',\n marginTop: '30px',\n },\n keysBlock: {\n marginTop: '30px',\n },\n keyLabel: {\n display: 'flex',\n alignItems: 'center',\n wordBreak: 'break-all',\n },\n keyValue: {\n width: '100%',\n borderColor: 'divider.main',\n borderWidth: '1px',\n borderStyle: 'solid',\n borderRadius: '6px',\n padding: '16px',\n boxSizing: 'border-box',\n wordBreak: 'break-word',\n },\n buttonsBlock: {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'center',\n marginTop: '40px',\n },\n button: { px: 4, py: 1, fontSize: '16px', width: '160px' },\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nServiceSecretKeys.propTypes = {\n // eslint-disable-next-line react/forbid-prop-types\n secretKeys: PropTypes.object,\n subtitle: PropTypes.string,\n description: PropTypes.string,\n onCopy: PropTypes.func,\n isCopied: PropTypes.bool,\n onDownload: PropTypes.func,\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nKey.propTypes = {\n label: PropTypes.string.isRequired,\n};\n// eslint-disable-next-line better-mutation/no-mutation\nValue.propTypes = {\n value: PropTypes.string.isRequired,\n};\n\nexport default ServiceSecretKeys;\n","import { useCallback, useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport Popup from '@/components/common/Popup.jsx';\nimport WarningSecretKeysPopup from './WarningSecretKeysPopup/index.jsx';\nimport { useKeyDownload } from '../../hooks/useKeyDownload.js';\nimport { ServiceSecretKeys } from './ServiceSecretKeys/index.jsx';\n\nexport const SecretKeysPopup = ({ isOpen, secretKeys, onClose, wording, warningWording }) => {\n const { onDownload, onCopy, isLoadingKeys, isLoadingKeysError, isDownloaded, isCopied } =\n useKeyDownload();\n\n const [isOpenWarningSecretPopup, setIsOpenWarningSecretPopup] = useState(false);\n\n const handleClose = useCallback(() => {\n if ((!isCopied && !isDownloaded) || isLoadingKeysError) {\n setIsOpenWarningSecretPopup(true);\n } else {\n onClose();\n }\n }, [isCopied, isDownloaded, isLoadingKeysError, onClose]);\n\n useEffect(() => {\n if (isOpenWarningSecretPopup && !isLoadingKeys && !isLoadingKeysError && isDownloaded) {\n onClose();\n }\n }, [isOpenWarningSecretPopup, isLoadingKeys, isLoadingKeysError, isDownloaded, onClose]);\n\n return (\n <Popup\n onClose={handleClose}\n title=\"\"\n isOpen={isOpen}\n mainContainerStyles={styles.mainContainer}\n disableCloseButton={isLoadingKeys}\n >\n <>\n <ServiceSecretKeys\n secretKeys={secretKeys}\n onDownload={onDownload}\n onCopy={onCopy}\n isCopied={isCopied}\n subtitle={wording.title}\n description={wording.subtitle}\n />\n <WarningSecretKeysPopup\n isModalOpened={isOpenWarningSecretPopup}\n onClose={onClose}\n title={warningWording.title}\n subtitle={warningWording.subtitle}\n onClick={() => onDownload(secretKeys)}\n isLoading={isLoadingKeys}\n />\n </>\n </Popup>\n );\n};\n\nconst styles = {\n mainContainer: { pt: 2 },\n};\n// eslint-disable-next-line better-mutation/no-mutation\nSecretKeysPopup.propTypes = {\n isOpen: PropTypes.bool.isRequired,\n // eslint-disable-next-line react/forbid-prop-types\n secretKeys: PropTypes.object.isRequired,\n onClose: PropTypes.func.isRequired,\n wording: PropTypes.shape({\n title: PropTypes.string.isRequired,\n subtitle: PropTypes.string.isRequired,\n }).isRequired,\n warningWording: PropTypes.shape({\n title: PropTypes.string.isRequired,\n subtitle: PropTypes.string.isRequired,\n }).isRequired,\n};\n\nexport default SecretKeysPopup;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAM,eACJ;AACF,IAAM,kBAEJ;AACF,IAAM,qBAAqB;AAE3B,IAAM,0BAA0B,EAC9B,eACA,SACA,QAAQ,cACR,WAAW,iBACX,cAAc,oBACd,YAAY,OACZ,cACI;CACJ,MAAM,QAAQ,UAAU;AAExB,QACE,qBAAC,OAAD;EACW;EACT,OAAM;E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EAAQ,CAAC;AAEzD,iBAAgB;AACd,MAAI,4BAA4B,CAAC,iBAAiB,CAAC,sBAAsB,aACvE,UAAS;IAEV;EAAC;EAA0B;EAAe;EAAoB;EAAc;EAAQ,CAAC;AAExF,QACE,oBAAC,OAAD;EACE,SAAS;EACT,OAAM;EACE;EACR,qBAAqB,OAAO;EAC5B,oBAAoB;YAEpB,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,mBAAD;GACc;GACA;GACJ;GACE;GACV,UAAU,QAAQ;GAClB,aAAa,QAAQ;GACrB,CAAA,EACF,oBAAC,wBAAD;GACE,eAAe;GACN;GACT,OAAO,eAAe;GACtB,UAAU,eAAe;GACzB,eAAe,WAAW,WAAW;GACrC,WAAW;GACX,CAAA,CACD,EAAA,CAAA;EACG,CAAA;;AAIZ,IAAM,SAAS,EACb,eAAe,EAAE,IAAI,GAAG,EACzB;AAED,gBAAgB,YAAY;CAC1B,QAAQ,UAAU,KAAK;CAEvB,YAAY,UAAU,OAAO;CAC7B,SAAS,UAAU,KAAK;CACxB,SAAS,UAAU,MAAM;EACvB,OAAO,UAAU,OAAO;EACxB,UAAU,UAAU,OAAO;EAC5B,CAAC,CAAC;CACH,gBAAgB,UAAU,MAAM;EAC9B,OAAO,UAAU,OAAO;EACxB,UAAU,UAAU,OAAO;EAC5B,CAAC,CAAC;CACJ"}
1
+ {"version":3,"file":"SecretKeysPopup.D_ws7IBv.js","names":[],"sources":["../../src/pages/services/components/SecretKeysPopup/WarningSecretKeysPopup/index.jsx","../../src/utils/downloadTxtAsFile.js","../../src/pages/services/hooks/useKeyDownload.js","../../src/pages/services/utils/formatSecrets.js","../../src/pages/services/utils/isAddButtonDisabled.js","../../src/pages/services/utils/getTitle.js","../../src/utils/invitations.js","../../src/pages/services/utils/buildPayload.js","../../src/pages/services/utils/buildServiceContent.js","../../src/pages/services/components/SecretKeysPopup/ServiceSecretKeys/index.jsx","../../src/pages/services/components/SecretKeysPopup/index.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 { Box, Typography, Button, useTheme } from '@mui/material';\nimport DownloadIcon from '@mui/icons-material/Download';\nimport InfoIcon from '@mui/icons-material/Info';\nimport PropTypes from 'prop-types';\n\nimport Popup from '@/components/common/Popup.jsx';\nimport Loading from '@/components/Loading.jsx';\n\nconst titleDefault =\n 'Wait! Before you close this window, please make sure you have saved a copy of your keys';\nconst subTitleDefault =\n // eslint-disable-next-line max-len\n 'Your organization’s unique keys are critical for managing your organization’s data on Velocity Network™. This information will not be available once you close this window.';\nconst buttonLabelDefault = 'Download keys';\n\nconst WarningSecretKeysPopup = ({\n isModalOpened,\n onClose,\n title = titleDefault,\n subTitle = subTitleDefault,\n buttonLabel = buttonLabelDefault,\n isLoading = false,\n onClick,\n}) => {\n const theme = useTheme();\n\n return (\n <Popup\n onClose={onClose}\n title=\"\"\n isOpen={isModalOpened}\n mainContainerStyles={styles.mainContainer}\n isBackBoxVisible\n backBoxColor={theme.palette.warning.main}\n disableCloseButton={isLoading}\n >\n <InfoIcon color=\"warning\" sx={styles.icon} />\n <Typography sx={styles.title}>{title}</Typography>\n <Typography textAlign=\"center\">{subTitle}</Typography>\n\n <Box sx={styles.buttonBlock}>\n <Button\n variant=\"outlined\"\n endIcon={\n isLoading ? <Loading color=\"error\" sx={styles.loader} size={26} /> : <DownloadIcon />\n }\n disabled={isLoading}\n sx={styles.button}\n onClick={onClick}\n >\n {buttonLabel}\n </Button>\n </Box>\n </Popup>\n );\n};\n\nconst styles = {\n mainContainer: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n pt: '19px',\n },\n title: {\n fontWeight: 600,\n fontSize: '32px',\n lineHeight: '39px',\n textAlign: 'center',\n mb: '32px',\n mt: '35px',\n },\n button: { px: 4, py: 1, fontSize: '16px' },\n buttonBlock: {\n marginTop: '52px',\n },\n icon: { width: '50px', height: '50px' },\n loader: { pl: '10px' },\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nWarningSecretKeysPopup.propTypes = {\n isModalOpened: PropTypes.bool,\n onClose: PropTypes.func,\n title: PropTypes.string,\n subTitle: PropTypes.string,\n buttonLabel: PropTypes.string,\n isLoading: PropTypes.bool,\n onClick: PropTypes.func,\n};\n\nexport default WarningSecretKeysPopup;\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 */\nconst download = (fileName, onLoading, onError, onClick, callback) => {\n const request = new XMLHttpRequest();\n request.responseType = 'blob';\n request.open('GET', fileName);\n\n request.addEventListener('load', () => {\n callback();\n });\n request.onloadstart = () => {\n onClick(true);\n onLoading(true);\n };\n request.onloadend = () => {\n onLoading(false);\n };\n request.onerror = () => {\n onError(true);\n };\n request.onabort = () => {\n onError(true);\n };\n\n request.send();\n};\n/* eslint-disable better-mutation/no-mutation */\nconst downloadTxtAsFile = (text, name) => {\n const a = document.createElement('a');\n const file = new Blob([text], { type: 'application/json' });\n\n a.href = URL.createObjectURL(file);\n a.download = name;\n a.click();\n a.remove();\n};\n\nexport default (fileName, text, onLoading, onError, onClick) => {\n download(fileName, onLoading, onError, onClick, () => {\n downloadTxtAsFile(text, fileName);\n });\n};\n","import { useState, useCallback } from 'react';\nimport downloadTxtAsFile from '@/utils/downloadTxtAsFile.js';\nimport { copyTextToClipboard, objectToString } from '@/utils/index.jsx';\n\nexport const useKeyDownload = () => {\n const [isDownloaded, setIsDownloaded] = useState(false);\n const [isLoadingKeys, setIsLoadingKeys] = useState(false);\n const [isLoadingKeysError, setIsLoadingKeysError] = useState(false);\n const [isCopied, setIsCopied] = useState(false);\n\n const onCopy = useCallback((secretKeys) => {\n copyTextToClipboard(objectToString(secretKeys), (error) => {\n setIsCopied(!error);\n });\n }, []);\n\n const onDownload = useCallback((secretKeys) => {\n setIsLoadingKeys(true);\n const keys = objectToString(secretKeys);\n downloadTxtAsFile(\n 'keys.json',\n keys,\n (isLoading) => setIsLoadingKeys(isLoading),\n (isError) => setIsLoadingKeysError(isError),\n (isClicked) => setIsDownloaded(isClicked),\n );\n }, []);\n\n return { isDownloaded, isLoadingKeys, isLoadingKeysError, isCopied, onDownload, onCopy };\n};\n\nexport default useKeyDownload;\n","export const formatSecrets = (secretKeys) => {\n return secretKeys\n ? [\n ...(secretKeys.keys\n ? secretKeys.keys.map((item) => ({\n ...item,\n id: item.didDocumentKey.id.replace('#', ''),\n }))\n : []),\n ...(secretKeys.authClients\n ? secretKeys.authClients.reduce(\n (acc, { clientId, clientSecret }) => [\n ...acc,\n { id: 'Client Id', key: clientId },\n { id: 'Client Secret', key: clientSecret },\n ],\n [],\n )\n : []),\n ]\n : [];\n};\n","const hasValue = (value) => {\n if (Array.isArray(value)) {\n return value.length > 0;\n }\n\n return Boolean(value);\n};\n\nconst hasRequiredFields = (fields, formData) => {\n if (!formData) {\n return false;\n }\n\n return fields.every((field) => hasValue(formData[field]));\n};\n\nconst requiredFieldsByServiceType = [\n {\n isActive: ({ isIssuingOrInspection }) => isIssuingOrInspection,\n requiredFields: ['serviceEndpoint', 'serviceCAO'],\n },\n {\n isActive: ({ isCAO }) => isCAO,\n requiredFields: ['serviceEndpoint'],\n },\n {\n isActive: ({ isWebWallet }) => isWebWallet,\n requiredFields: ['name', 'logo', 'serviceEndpoint', 'supportedExchangeProtocols'],\n },\n {\n isActive: ({ isHolderWallet }) => isHolderWallet,\n requiredFields: [\n 'name',\n 'logo',\n 'serviceEndpoint',\n 'supportedExchangeProtocols',\n 'playStoreUrl',\n 'googlePlayId',\n 'appleAppStoreUrl',\n 'appleAppId',\n ],\n },\n];\n\nexport const isAddButtonDisabled = (\n inProgress,\n isIssuingOrInspection,\n isCAO,\n isWebWallet,\n isHolderWallet,\n formData,\n) => {\n if (inProgress) {\n return true;\n }\n\n const serviceType = requiredFieldsByServiceType.find((item) =>\n item.isActive({ isIssuingOrInspection, isCAO, isWebWallet, isHolderWallet }),\n );\n\n if (!serviceType) {\n return true;\n }\n\n return !hasRequiredFields(serviceType.requiredFields, formData);\n};\n","export const getTitle = (step) => {\n switch (step) {\n case 2:\n return \"You're one step away from setting up your new service on Velocity Network™\";\n case 3:\n return 'Set a Secure Messages URL';\n case 4:\n return 'Congratulations!';\n default:\n return 'Select type of service to add';\n }\n};\n","export const getNewServiceIndex = (services, kebabType) => {\n // eslint-disable-next-line better-mutation/no-mutating-methods\n const servicesOfSameType = services\n .filter((item) => item.id.split('#')[1]?.startsWith(kebabType))\n .sort();\n\n return (\n // eslint-disable-next-line better-mutation/no-mutating-methods\n parseInt(servicesOfSameType[servicesOfSameType.length - 1]?.id.split('-').reverse()[0], 10) +\n 1 || 1\n );\n};\n","import { kebabCase } from 'lodash-es';\nimport { CREDENTIAL_TYPES_IDS } from '@/utils/serviceTypes.js';\nimport { getNewServiceIndex } from '@/utils/invitations.js';\n\nconst addProp = (name, value) => (value ? { [name]: value } : {});\n\nexport const buildPayload = (service, type, did, services) => {\n const kebabType = kebabCase(type);\n const { name, logo, supportedExchangeProtocols, serviceEndpoint } = service;\n\n const genericPayload = {\n ...(did &&\n services && { id: `${did}#${kebabType}-${getNewServiceIndex(services, kebabType)}` }),\n serviceEndpoint,\n type,\n };\n if (type === CREDENTIAL_TYPES_IDS.VLC_WEB_WALLET_PROVIDER) {\n return {\n ...genericPayload,\n ...addProp('logoUrl', logo),\n ...addProp('supportedExchangeProtocols', supportedExchangeProtocols),\n ...addProp('name', name),\n };\n }\n if (type === CREDENTIAL_TYPES_IDS.VLC_HOLDER_APP_PROVIDER) {\n const { playStoreUrl, googlePlayId, appleAppStoreUrl, appleAppId } = service;\n return {\n ...genericPayload,\n ...addProp('logoUrl', logo),\n ...addProp('supportedExchangeProtocols', supportedExchangeProtocols),\n ...addProp('name', name),\n ...addProp('playStoreUrl', playStoreUrl),\n ...addProp('googlePlayId', googlePlayId),\n ...addProp('appleAppStoreUrl', appleAppStoreUrl),\n ...addProp('appleAppId', appleAppId),\n };\n }\n return genericPayload;\n};\n","export const buildServiceContent = (item, title, isLink = false) => {\n if (!item) return [];\n\n const value = Array.isArray(item) ? item.join(', ') : item;\n return [{ name: title, value, isLink }];\n};\n","import { useMemo } from 'react';\nimport { Box, Button, Grid, Typography } from '@mui/material';\nimport InfoIcon from '@mui/icons-material/Info';\nimport DownloadIcon from '@mui/icons-material/Download';\nimport { Form } from 'react-admin';\nimport PropTypes from 'prop-types';\n\nimport { getTitle, formatSecrets } from '@/pages/services/utils/index.js';\n\nconst selectedStep = 4;\n\nexport const ServiceSecretKeys = ({\n secretKeys,\n subtitle,\n description,\n onDownload,\n onCopy,\n isCopied,\n}) => {\n const formattedKeys = useMemo(() => formatSecrets(secretKeys), [secretKeys]);\n\n return (\n <>\n <Typography sx={styles.title} mb={2}>\n {getTitle(selectedStep)}\n </Typography>\n <Typography sx={styles.subtitle}>{subtitle}</Typography>\n <Typography>{description}</Typography>\n <Form>\n {formattedKeys.map((item) => (\n <Grid container spacing={2} columns={14} key={item.id} sx={styles.keysBlock}>\n <Key label={item.id} />\n <Value value={item.key} />\n </Grid>\n ))}\n <Box sx={styles.doNotDisclosureBlock}>\n <InfoIcon />\n <Typography marginLeft=\"20px\">\n Do not disclose these keys to unauthorized persons or transmit via unsecured channels.\n </Typography>\n </Box>\n\n <Box sx={styles.buttonsBlock}>\n <Button\n variant=\"outlined\"\n color=\"secondary\"\n sx={[styles.button, { marginRight: '30px' }]}\n onClick={() => onCopy(secretKeys)}\n >\n {isCopied ? 'Copied' : 'Copy'}\n </Button>\n <Button\n variant=\"outlined\"\n endIcon={<DownloadIcon />}\n sx={styles.button}\n onClick={() => onDownload(secretKeys)}\n >\n Download\n </Button>\n </Box>\n </Form>\n </>\n );\n};\n\nconst Key = ({ label }) => (\n <Grid size={{ xs: 4 }} sx={styles.keyLabel}>\n <Typography>{label}</Typography>\n </Grid>\n);\n\nconst Value = ({ value }) => (\n <Grid size={{ xs: 10 }}>\n <Typography sx={styles.keyValue}>{value}</Typography>\n </Grid>\n);\n\nconst styles = {\n title: {\n fontSize: '32px',\n fontWeight: '600',\n lineHeight: '38px',\n },\n subtitle: {\n fontWeight: '600',\n fontSize: '16px',\n marginBottom: '24px',\n },\n doNotDisclosureBlock: {\n color: 'secondary.light',\n fontSize: '14px',\n display: 'flex',\n flexDirection: 'row',\n marginTop: '30px',\n },\n keysBlock: {\n marginTop: '30px',\n },\n keyLabel: {\n display: 'flex',\n alignItems: 'center',\n wordBreak: 'break-all',\n },\n keyValue: {\n width: '100%',\n borderColor: 'divider.main',\n borderWidth: '1px',\n borderStyle: 'solid',\n borderRadius: '6px',\n padding: '16px',\n boxSizing: 'border-box',\n wordBreak: 'break-word',\n },\n buttonsBlock: {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'center',\n marginTop: '40px',\n },\n button: { px: 4, py: 1, fontSize: '16px', width: '160px' },\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nServiceSecretKeys.propTypes = {\n // eslint-disable-next-line react/forbid-prop-types\n secretKeys: PropTypes.object,\n subtitle: PropTypes.string,\n description: PropTypes.string,\n onCopy: PropTypes.func,\n isCopied: PropTypes.bool,\n onDownload: PropTypes.func,\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nKey.propTypes = {\n label: PropTypes.string.isRequired,\n};\n// eslint-disable-next-line better-mutation/no-mutation\nValue.propTypes = {\n value: PropTypes.string.isRequired,\n};\n\nexport default ServiceSecretKeys;\n","import { useCallback, useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport Popup from '@/components/common/Popup.jsx';\nimport WarningSecretKeysPopup from './WarningSecretKeysPopup/index.jsx';\nimport { useKeyDownload } from '../../hooks/useKeyDownload.js';\nimport { ServiceSecretKeys } from './ServiceSecretKeys/index.jsx';\n\nexport const SecretKeysPopup = ({ isOpen, secretKeys, onClose, wording, warningWording }) => {\n const { onDownload, onCopy, isLoadingKeys, isLoadingKeysError, isDownloaded, isCopied } =\n useKeyDownload();\n\n const [isOpenWarningSecretPopup, setIsOpenWarningSecretPopup] = useState(false);\n\n const handleClose = useCallback(() => {\n if ((!isCopied && !isDownloaded) || isLoadingKeysError) {\n setIsOpenWarningSecretPopup(true);\n } else {\n onClose();\n }\n }, [isCopied, isDownloaded, isLoadingKeysError, onClose]);\n\n useEffect(() => {\n if (isOpenWarningSecretPopup && !isLoadingKeys && !isLoadingKeysError && isDownloaded) {\n onClose();\n }\n }, [isOpenWarningSecretPopup, isLoadingKeys, isLoadingKeysError, isDownloaded, onClose]);\n\n return (\n <Popup\n onClose={handleClose}\n title=\"\"\n isOpen={isOpen}\n mainContainerStyles={styles.mainContainer}\n disableCloseButton={isLoadingKeys}\n >\n <>\n <ServiceSecretKeys\n secretKeys={secretKeys}\n onDownload={onDownload}\n onCopy={onCopy}\n isCopied={isCopied}\n subtitle={wording.title}\n description={wording.subtitle}\n />\n <WarningSecretKeysPopup\n isModalOpened={isOpenWarningSecretPopup}\n onClose={onClose}\n title={warningWording.title}\n subtitle={warningWording.subtitle}\n onClick={() => onDownload(secretKeys)}\n isLoading={isLoadingKeys}\n />\n </>\n </Popup>\n );\n};\n\nconst styles = {\n mainContainer: { pt: 2 },\n};\n// eslint-disable-next-line better-mutation/no-mutation\nSecretKeysPopup.propTypes = {\n isOpen: PropTypes.bool.isRequired,\n // eslint-disable-next-line react/forbid-prop-types\n secretKeys: PropTypes.object.isRequired,\n onClose: PropTypes.func.isRequired,\n wording: PropTypes.shape({\n title: PropTypes.string.isRequired,\n subtitle: PropTypes.string.isRequired,\n }).isRequired,\n warningWording: PropTypes.shape({\n title: PropTypes.string.isRequired,\n subtitle: PropTypes.string.isRequired,\n }).isRequired,\n};\n\nexport default SecretKeysPopup;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAM,eACJ;AACF,IAAM,kBAEJ;AACF,IAAM,qBAAqB;AAE3B,IAAM,0BAA0B,EAC9B,eACA,SACA,QAAQ,cACR,WAAW,iBACX,cAAc,oBACd,YAAY,OACZ,cACI;CACJ,MAAM,QAAQ,UAAU;AAExB,QACE,qBAAC,OAAD;EACW;EACT,OAAM;EACN,QAAQ;EACR,qBAAqB,SAAO;EAC5B,kBAAA;EACA,cAAc,MAAM,QAAQ,QAAQ;EACpC,oBAAoB;YAPtB;GASE,oBAAC,UAAD;IAAU,OAAM;IAAU,IAAI,SAAO;IAAQ,CAAA;GAC7C,oBAAC,YAAD;IAAY,IAAI,SAAO;cAAQ;IAAmB,CAAA;GAClD,oBAAC,YAAD;IAAY,WAAU;cAAU;IAAsB,CAAA;GAEtD,oBAAC,KAAD;IAAK,IAAI,SAAO;cACd,oBAAC,UAAD;KACE,SAAQ;KACR,SACE,YAAY,oBAAC,SAAD;MAAS,OAAM;MAAQ,IAAI,SAAO;MAAQ,MAAM;MAAM,CAAA,GAAG,oBAAC,cAAD,EAAgB,CAAA;KAEvF,UAAU;KACV,IAAI,SAAO;KACF;eAER;KACM,CAAA;IACL,CAAA;GACA;;;AAIZ,IAAM,WAAS;CACb,eAAe;EACb,SAAS;EACT,eAAe;EACf,YAAY;EACZ,IAAI;EACL;CACD,OAAO;EACL,YAAY;EACZ,UAAU;EACV,YAAY;EACZ,WAAW;EACX,IAAI;EACJ,IAAI;EACL;CACD,QAAQ;EAAE,IAAI;EAAG,IAAI;EAAG,UAAU;EAAQ;CAC1C,aAAa,EACX,WAAW,QACZ;CACD,MA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OAAO;EACxB,UAAU,UAAU,OAAO;EAC5B,CAAC,CAAC;CACJ"}
@@ -537,4 +537,4 @@ Object.defineProperty(exports, "isAddButtonDisabled", {
537
537
  }
538
538
  });
539
539
 
540
- //# sourceMappingURL=SecretKeysPopup.C9L--WZW.js.map
540
+ //# sourceMappingURL=SecretKeysPopup.dEI2kM66.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SecretKeysPopup.C9L--WZW.js","names":["objectToString","CREDENTIAL_TYPES_IDS"],"sources":["../../src/pages/services/components/SecretKeysPopup/WarningSecretKeysPopup/index.jsx","../../src/utils/downloadTxtAsFile.js","../../src/pages/services/hooks/useKeyDownload.js","../../src/pages/services/utils/formatSecrets.js","../../src/pages/services/utils/isAddButtonDisabled.js","../../src/pages/services/utils/getTitle.js","../../src/utils/invitations.js","../../src/pages/services/utils/buildPayload.js","../../src/pages/services/utils/buildServiceContent.js","../../src/pages/services/components/SecretKeysPopup/ServiceSecretKeys/index.jsx","../../src/pages/services/components/SecretKeysPopup/index.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 { Box, Typography, Button, useTheme } from '@mui/material';\nimport DownloadIcon from '@mui/icons-material/Download';\nimport InfoIcon from '@mui/icons-material/Info';\nimport PropTypes from 'prop-types';\n\nimport Popup from '@/components/common/Popup.jsx';\nimport Loading from '@/components/Loading.jsx';\n\nconst titleDefault =\n 'Wait! Before you close this window, please make sure you have saved a copy of your keys';\nconst subTitleDefault =\n // eslint-disable-next-line max-len\n 'Your organization’s unique keys are critical for managing your organization’s data on Velocity Network™. This information will not be available once you close this window.';\nconst buttonLabelDefault = 'Download keys';\n\nconst WarningSecretKeysPopup = ({\n isModalOpened,\n onClose,\n title = titleDefault,\n subTitle = subTitleDefault,\n buttonLabel = buttonLabelDefault,\n isLoading = false,\n onClick,\n}) => {\n const theme = useTheme();\n\n return (\n <Popup\n onClose={onClose}\n title=\"\"\n isOpen={isModalOpened}\n mainContainerStyles={styles.mainContainer}\n isBackBoxVisible\n backBoxColor={theme.palette.warning.main}\n disableCloseButton={isLoading}\n >\n <InfoIcon color=\"warning\" sx={styles.icon} />\n <Typography sx={styles.title}>{title}</Typography>\n <Typography textAlign=\"center\">{subTitle}</Typography>\n\n <Box sx={styles.buttonBlock}>\n <Button\n variant=\"outlined\"\n endIcon={\n isLoading ? <Loading color=\"error\" sx={styles.loader} size={26} /> : <DownloadIcon />\n }\n disabled={isLoading}\n sx={styles.button}\n onClick={onClick}\n >\n {buttonLabel}\n </Button>\n </Box>\n </Popup>\n );\n};\n\nconst styles = {\n mainContainer: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n pt: '19px',\n },\n title: {\n fontWeight: 600,\n fontSize: '32px',\n lineHeight: '39px',\n textAlign: 'center',\n mb: '32px',\n mt: '35px',\n },\n button: { px: 4, py: 1, fontSize: '16px' },\n buttonBlock: {\n marginTop: '52px',\n },\n icon: { width: '50px', height: '50px' },\n loader: { pl: '10px' },\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nWarningSecretKeysPopup.propTypes = {\n isModalOpened: PropTypes.bool,\n onClose: PropTypes.func,\n title: PropTypes.string,\n subTitle: PropTypes.string,\n buttonLabel: PropTypes.string,\n isLoading: PropTypes.bool,\n onClick: PropTypes.func,\n};\n\nexport default WarningSecretKeysPopup;\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 */\nconst download = (fileName, onLoading, onError, onClick, callback) => {\n const request = new XMLHttpRequest();\n request.responseType = 'blob';\n request.open('GET', fileName);\n\n request.addEventListener('load', () => {\n callback();\n });\n request.onloadstart = () => {\n onClick(true);\n onLoading(true);\n };\n request.onloadend = () => {\n onLoading(false);\n };\n request.onerror = () => {\n onError(true);\n };\n request.onabort = () => {\n onError(true);\n };\n\n request.send();\n};\n/* eslint-disable better-mutation/no-mutation */\nconst downloadTxtAsFile = (text, name) => {\n const a = document.createElement('a');\n const file = new Blob([text], { type: 'application/json' });\n\n a.href = URL.createObjectURL(file);\n a.download = name;\n a.click();\n a.remove();\n};\n\nexport default (fileName, text, onLoading, onError, onClick) => {\n download(fileName, onLoading, onError, onClick, () => {\n downloadTxtAsFile(text, fileName);\n });\n};\n","import { useState, useCallback } from 'react';\nimport downloadTxtAsFile from '@/utils/downloadTxtAsFile.js';\nimport { copyTextToClipboard, objectToString } from '@/utils/index.jsx';\n\nexport const useKeyDownload = () => {\n const [isDownloaded, setIsDownloaded] = useState(false);\n const [isLoadingKeys, setIsLoadingKeys] = useState(false);\n const [isLoadingKeysError, setIsLoadingKeysError] = useState(false);\n const [isCopied, setIsCopied] = useState(false);\n\n const onCopy = useCallback((secretKeys) => {\n copyTextToClipboard(objectToString(secretKeys), (error) => {\n setIsCopied(!error);\n });\n }, []);\n\n const onDownload = useCallback((secretKeys) => {\n setIsLoadingKeys(true);\n const keys = objectToString(secretKeys);\n downloadTxtAsFile(\n 'keys.json',\n keys,\n (isLoading) => setIsLoadingKeys(isLoading),\n (isError) => setIsLoadingKeysError(isError),\n (isClicked) => setIsDownloaded(isClicked),\n );\n }, []);\n\n return { isDownloaded, isLoadingKeys, isLoadingKeysError, isCopied, onDownload, onCopy };\n};\n\nexport default useKeyDownload;\n","export const formatSecrets = (secretKeys) => {\n return secretKeys\n ? [\n ...(secretKeys.keys\n ? secretKeys.keys.map((item) => ({\n ...item,\n id: item.didDocumentKey.id.replace('#', ''),\n }))\n : []),\n ...(secretKeys.authClients\n ? secretKeys.authClients.reduce(\n (acc, { clientId, clientSecret }) => [\n ...acc,\n { id: 'Client Id', key: clientId },\n { id: 'Client Secret', key: clientSecret },\n ],\n [],\n )\n : []),\n ]\n : [];\n};\n","const hasValue = (value) => {\n if (Array.isArray(value)) {\n return value.length > 0;\n }\n\n return Boolean(value);\n};\n\nconst hasRequiredFields = (fields, formData) => {\n if (!formData) {\n return false;\n }\n\n return fields.every((field) => hasValue(formData[field]));\n};\n\nconst requiredFieldsByServiceType = [\n {\n isActive: ({ isIssuingOrInspection }) => isIssuingOrInspection,\n requiredFields: ['serviceEndpoint', 'serviceCAO'],\n },\n {\n isActive: ({ isCAO }) => isCAO,\n requiredFields: ['serviceEndpoint'],\n },\n {\n isActive: ({ isWebWallet }) => isWebWallet,\n requiredFields: ['name', 'logo', 'serviceEndpoint', 'supportedExchangeProtocols'],\n },\n {\n isActive: ({ isHolderWallet }) => isHolderWallet,\n requiredFields: [\n 'name',\n 'logo',\n 'serviceEndpoint',\n 'supportedExchangeProtocols',\n 'playStoreUrl',\n 'googlePlayId',\n 'appleAppStoreUrl',\n 'appleAppId',\n ],\n },\n];\n\nexport const isAddButtonDisabled = (\n inProgress,\n isIssuingOrInspection,\n isCAO,\n isWebWallet,\n isHolderWallet,\n formData,\n) => {\n if (inProgress) {\n return true;\n }\n\n const serviceType = requiredFieldsByServiceType.find((item) =>\n item.isActive({ isIssuingOrInspection, isCAO, isWebWallet, isHolderWallet }),\n );\n\n if (!serviceType) {\n return true;\n }\n\n return !hasRequiredFields(serviceType.requiredFields, formData);\n};\n","export const getTitle = (step) => {\n switch (step) {\n case 2:\n return \"You're one step away from setting up your new service on Velocity Network™\";\n case 3:\n return 'Set a Secure Messages URL';\n case 4:\n return 'Congratulations!';\n default:\n return 'Select type of service to add';\n }\n};\n","export const getNewServiceIndex = (services, kebabType) => {\n // eslint-disable-next-line better-mutation/no-mutating-methods\n const servicesOfSameType = services\n .filter((item) => item.id.split('#')[1]?.startsWith(kebabType))\n .sort();\n\n return (\n // eslint-disable-next-line better-mutation/no-mutating-methods\n parseInt(servicesOfSameType[servicesOfSameType.length - 1]?.id.split('-').reverse()[0], 10) +\n 1 || 1\n );\n};\n","import { kebabCase } from 'lodash-es';\nimport { CREDENTIAL_TYPES_IDS } from '@/utils/serviceTypes.js';\nimport { getNewServiceIndex } from '@/utils/invitations.js';\n\nconst addProp = (name, value) => (value ? { [name]: value } : {});\n\nexport const buildPayload = (service, type, did, services) => {\n const kebabType = kebabCase(type);\n const { name, logo, supportedExchangeProtocols, serviceEndpoint } = service;\n\n const genericPayload = {\n ...(did &&\n services && { id: `${did}#${kebabType}-${getNewServiceIndex(services, kebabType)}` }),\n serviceEndpoint,\n type,\n };\n if (type === CREDENTIAL_TYPES_IDS.VLC_WEB_WALLET_PROVIDER) {\n return {\n ...genericPayload,\n ...addProp('logoUrl', logo),\n ...addProp('supportedExchangeProtocols', supportedExchangeProtocols),\n ...addProp('name', name),\n };\n }\n if (type === CREDENTIAL_TYPES_IDS.VLC_HOLDER_APP_PROVIDER) {\n const { playStoreUrl, googlePlayId, appleAppStoreUrl, appleAppId } = service;\n return {\n ...genericPayload,\n ...addProp('logoUrl', logo),\n ...addProp('supportedExchangeProtocols', supportedExchangeProtocols),\n ...addProp('name', name),\n ...addProp('playStoreUrl', playStoreUrl),\n ...addProp('googlePlayId', googlePlayId),\n ...addProp('appleAppStoreUrl', appleAppStoreUrl),\n ...addProp('appleAppId', appleAppId),\n };\n }\n return genericPayload;\n};\n","export const buildServiceContent = (item, title, isLink = false) => {\n if (!item) return [];\n\n const value = Array.isArray(item) ? item.join(', ') : item;\n return [{ name: title, value, isLink }];\n};\n","import { useMemo } from 'react';\nimport { Box, Button, Grid, Typography } from '@mui/material';\nimport InfoIcon from '@mui/icons-material/Info';\nimport DownloadIcon from '@mui/icons-material/Download';\nimport { Form } from 'react-admin';\nimport PropTypes from 'prop-types';\n\nimport { getTitle, formatSecrets } from '@/pages/services/utils/index.js';\n\nconst selectedStep = 4;\n\nexport const ServiceSecretKeys = ({\n secretKeys,\n subtitle,\n description,\n onDownload,\n onCopy,\n isCopied,\n}) => {\n const formattedKeys = useMemo(() => formatSecrets(secretKeys), [secretKeys]);\n\n return (\n <>\n <Typography sx={styles.title} mb={2}>\n {getTitle(selectedStep)}\n </Typography>\n <Typography sx={styles.subtitle}>{subtitle}</Typography>\n <Typography>{description}</Typography>\n <Form>\n {formattedKeys.map((item) => (\n <Grid container spacing={2} columns={14} key={item.id} sx={styles.keysBlock}>\n <Key label={item.id} />\n <Value value={item.key} />\n </Grid>\n ))}\n <Box sx={styles.doNotDisclosureBlock}>\n <InfoIcon />\n <Typography marginLeft=\"20px\">\n Do not disclose these keys to unauthorized persons or transmit via unsecured channels.\n </Typography>\n </Box>\n\n <Box sx={styles.buttonsBlock}>\n <Button\n variant=\"outlined\"\n color=\"secondary\"\n sx={[styles.button, { marginRight: '30px' }]}\n onClick={() => onCopy(secretKeys)}\n >\n {isCopied ? 'Copied' : 'Copy'}\n </Button>\n <Button\n variant=\"outlined\"\n endIcon={<DownloadIcon />}\n sx={styles.button}\n onClick={() => onDownload(secretKeys)}\n >\n Download\n </Button>\n </Box>\n </Form>\n </>\n );\n};\n\nconst Key = ({ label }) => (\n <Grid size={{ xs: 4 }} sx={styles.keyLabel}>\n <Typography>{label}</Typography>\n </Grid>\n);\n\nconst Value = ({ value }) => (\n <Grid size={{ xs: 10 }}>\n <Typography sx={styles.keyValue}>{value}</Typography>\n </Grid>\n);\n\nconst styles = {\n title: {\n fontSize: '32px',\n fontWeight: '600',\n lineHeight: '38px',\n },\n subtitle: {\n fontWeight: '600',\n fontSize: '16px',\n marginBottom: '24px',\n },\n doNotDisclosureBlock: {\n color: 'secondary.light',\n fontSize: '14px',\n display: 'flex',\n flexDirection: 'row',\n marginTop: '30px',\n },\n keysBlock: {\n marginTop: '30px',\n },\n keyLabel: {\n display: 'flex',\n alignItems: 'center',\n wordBreak: 'break-all',\n },\n keyValue: {\n width: '100%',\n borderColor: 'divider.main',\n borderWidth: '1px',\n borderStyle: 'solid',\n borderRadius: '6px',\n padding: '16px',\n boxSizing: 'border-box',\n wordBreak: 'break-word',\n },\n buttonsBlock: {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'center',\n marginTop: '40px',\n },\n button: { px: 4, py: 1, fontSize: '16px', width: '160px' },\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nServiceSecretKeys.propTypes = {\n // eslint-disable-next-line react/forbid-prop-types\n secretKeys: PropTypes.object,\n subtitle: PropTypes.string,\n description: PropTypes.string,\n onCopy: PropTypes.func,\n isCopied: PropTypes.bool,\n onDownload: PropTypes.func,\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nKey.propTypes = {\n label: PropTypes.string.isRequired,\n};\n// eslint-disable-next-line better-mutation/no-mutation\nValue.propTypes = {\n value: PropTypes.string.isRequired,\n};\n\nexport default ServiceSecretKeys;\n","import { useCallback, useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport Popup from '@/components/common/Popup.jsx';\nimport WarningSecretKeysPopup from './WarningSecretKeysPopup/index.jsx';\nimport { useKeyDownload } from '../../hooks/useKeyDownload.js';\nimport { ServiceSecretKeys } from './ServiceSecretKeys/index.jsx';\n\nexport const SecretKeysPopup = ({ isOpen, secretKeys, onClose, wording, warningWording }) => {\n const { onDownload, onCopy, isLoadingKeys, isLoadingKeysError, isDownloaded, isCopied } =\n useKeyDownload();\n\n const [isOpenWarningSecretPopup, setIsOpenWarningSecretPopup] = useState(false);\n\n const handleClose = useCallback(() => {\n if ((!isCopied && !isDownloaded) || isLoadingKeysError) {\n setIsOpenWarningSecretPopup(true);\n } else {\n onClose();\n }\n }, [isCopied, isDownloaded, isLoadingKeysError, onClose]);\n\n useEffect(() => {\n if (isOpenWarningSecretPopup && !isLoadingKeys && !isLoadingKeysError && isDownloaded) {\n onClose();\n }\n }, [isOpenWarningSecretPopup, isLoadingKeys, isLoadingKeysError, isDownloaded, onClose]);\n\n return (\n <Popup\n onClose={handleClose}\n title=\"\"\n isOpen={isOpen}\n mainContainerStyles={styles.mainContainer}\n disableCloseButton={isLoadingKeys}\n >\n <>\n <ServiceSecretKeys\n secretKeys={secretKeys}\n onDownload={onDownload}\n onCopy={onCopy}\n isCopied={isCopied}\n subtitle={wording.title}\n description={wording.subtitle}\n />\n <WarningSecretKeysPopup\n isModalOpened={isOpenWarningSecretPopup}\n onClose={onClose}\n title={warningWording.title}\n subtitle={warningWording.subtitle}\n onClick={() => onDownload(secretKeys)}\n isLoading={isLoadingKeys}\n />\n </>\n </Popup>\n );\n};\n\nconst styles = {\n mainContainer: { pt: 2 },\n};\n// eslint-disable-next-line better-mutation/no-mutation\nSecretKeysPopup.propTypes = {\n isOpen: PropTypes.bool.isRequired,\n // eslint-disable-next-line react/forbid-prop-types\n secretKeys: PropTypes.object.isRequired,\n onClose: PropTypes.func.isRequired,\n wording: PropTypes.shape({\n title: PropTypes.string.isRequired,\n subtitle: PropTypes.string.isRequired,\n }).isRequired,\n warningWording: PropTypes.shape({\n title: PropTypes.string.isRequired,\n subtitle: PropTypes.string.isRequired,\n }).isRequired,\n};\n\nexport default SecretKeysPopup;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAM,eACJ;AACF,IAAM,kBAEJ;AACF,IAAM,qBAAqB;AAE3B,IAAM,0BAA0B,EAC9B,eACA,SACA,QAAQ,cACR,WAAW,iBACX,cAAc,oBACd,YAAY,OACZ,cACI;CACJ,MAAM,SAAA,GAAA,cAAA,WAAkB;AAExB,QACE,iBAAA,GAAA,kBAAA,MAAC,cAAA,OAAD;EACW;EACT,OAAM;EACN,QAAQ;EACR,qBAAqB,SAAO;EAC5B,kBAAA;EACA,cAAc,MAAM,QAAQ,QAAQ;EACpC,oB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ClB,aAAa,QAAQ;GACrB,CAAA,EACF,iBAAA,GAAA,kBAAA,KAAC,wBAAD;GACE,eAAe;GACN;GACT,OAAO,eAAe;GACtB,UAAU,eAAe;GACzB,eAAe,WAAW,WAAW;GACrC,WAAW;GACX,CAAA,CACD,EAAA,CAAA;EACG,CAAA;;AAIZ,IAAM,SAAS,EACb,eAAe,EAAE,IAAI,GAAG,EACzB;AAED,gBAAgB,YAAY;CAC1B,QAAQ,WAAA,QAAU,KAAK;CAEvB,YAAY,WAAA,QAAU,OAAO;CAC7B,SAAS,WAAA,QAAU,KAAK;CACxB,SAAS,WAAA,QAAU,MAAM;EACvB,OAAO,WAAA,QAAU,OAAO;EACxB,UAAU,WAAA,QAAU,OAAO;EAC5B,CAAC,CAAC;CACH,gBAAgB,WAAA,QAAU,MAAM;EAC9B,OAAO,WAAA,QAAU,OAAO;EACxB,UAAU,WAAA,QAAU,OAAO;EAC5B,CAAC,CAAC;CACJ"}
1
+ {"version":3,"file":"SecretKeysPopup.dEI2kM66.js","names":["objectToString","CREDENTIAL_TYPES_IDS"],"sources":["../../src/pages/services/components/SecretKeysPopup/WarningSecretKeysPopup/index.jsx","../../src/utils/downloadTxtAsFile.js","../../src/pages/services/hooks/useKeyDownload.js","../../src/pages/services/utils/formatSecrets.js","../../src/pages/services/utils/isAddButtonDisabled.js","../../src/pages/services/utils/getTitle.js","../../src/utils/invitations.js","../../src/pages/services/utils/buildPayload.js","../../src/pages/services/utils/buildServiceContent.js","../../src/pages/services/components/SecretKeysPopup/ServiceSecretKeys/index.jsx","../../src/pages/services/components/SecretKeysPopup/index.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 { Box, Typography, Button, useTheme } from '@mui/material';\nimport DownloadIcon from '@mui/icons-material/Download';\nimport InfoIcon from '@mui/icons-material/Info';\nimport PropTypes from 'prop-types';\n\nimport Popup from '@/components/common/Popup.jsx';\nimport Loading from '@/components/Loading.jsx';\n\nconst titleDefault =\n 'Wait! Before you close this window, please make sure you have saved a copy of your keys';\nconst subTitleDefault =\n // eslint-disable-next-line max-len\n 'Your organization’s unique keys are critical for managing your organization’s data on Velocity Network™. This information will not be available once you close this window.';\nconst buttonLabelDefault = 'Download keys';\n\nconst WarningSecretKeysPopup = ({\n isModalOpened,\n onClose,\n title = titleDefault,\n subTitle = subTitleDefault,\n buttonLabel = buttonLabelDefault,\n isLoading = false,\n onClick,\n}) => {\n const theme = useTheme();\n\n return (\n <Popup\n onClose={onClose}\n title=\"\"\n isOpen={isModalOpened}\n mainContainerStyles={styles.mainContainer}\n isBackBoxVisible\n backBoxColor={theme.palette.warning.main}\n disableCloseButton={isLoading}\n >\n <InfoIcon color=\"warning\" sx={styles.icon} />\n <Typography sx={styles.title}>{title}</Typography>\n <Typography textAlign=\"center\">{subTitle}</Typography>\n\n <Box sx={styles.buttonBlock}>\n <Button\n variant=\"outlined\"\n endIcon={\n isLoading ? <Loading color=\"error\" sx={styles.loader} size={26} /> : <DownloadIcon />\n }\n disabled={isLoading}\n sx={styles.button}\n onClick={onClick}\n >\n {buttonLabel}\n </Button>\n </Box>\n </Popup>\n );\n};\n\nconst styles = {\n mainContainer: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n pt: '19px',\n },\n title: {\n fontWeight: 600,\n fontSize: '32px',\n lineHeight: '39px',\n textAlign: 'center',\n mb: '32px',\n mt: '35px',\n },\n button: { px: 4, py: 1, fontSize: '16px' },\n buttonBlock: {\n marginTop: '52px',\n },\n icon: { width: '50px', height: '50px' },\n loader: { pl: '10px' },\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nWarningSecretKeysPopup.propTypes = {\n isModalOpened: PropTypes.bool,\n onClose: PropTypes.func,\n title: PropTypes.string,\n subTitle: PropTypes.string,\n buttonLabel: PropTypes.string,\n isLoading: PropTypes.bool,\n onClick: PropTypes.func,\n};\n\nexport default WarningSecretKeysPopup;\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 */\nconst download = (fileName, onLoading, onError, onClick, callback) => {\n const request = new XMLHttpRequest();\n request.responseType = 'blob';\n request.open('GET', fileName);\n\n request.addEventListener('load', () => {\n callback();\n });\n request.onloadstart = () => {\n onClick(true);\n onLoading(true);\n };\n request.onloadend = () => {\n onLoading(false);\n };\n request.onerror = () => {\n onError(true);\n };\n request.onabort = () => {\n onError(true);\n };\n\n request.send();\n};\n/* eslint-disable better-mutation/no-mutation */\nconst downloadTxtAsFile = (text, name) => {\n const a = document.createElement('a');\n const file = new Blob([text], { type: 'application/json' });\n\n a.href = URL.createObjectURL(file);\n a.download = name;\n a.click();\n a.remove();\n};\n\nexport default (fileName, text, onLoading, onError, onClick) => {\n download(fileName, onLoading, onError, onClick, () => {\n downloadTxtAsFile(text, fileName);\n });\n};\n","import { useState, useCallback } from 'react';\nimport downloadTxtAsFile from '@/utils/downloadTxtAsFile.js';\nimport { copyTextToClipboard, objectToString } from '@/utils/index.jsx';\n\nexport const useKeyDownload = () => {\n const [isDownloaded, setIsDownloaded] = useState(false);\n const [isLoadingKeys, setIsLoadingKeys] = useState(false);\n const [isLoadingKeysError, setIsLoadingKeysError] = useState(false);\n const [isCopied, setIsCopied] = useState(false);\n\n const onCopy = useCallback((secretKeys) => {\n copyTextToClipboard(objectToString(secretKeys), (error) => {\n setIsCopied(!error);\n });\n }, []);\n\n const onDownload = useCallback((secretKeys) => {\n setIsLoadingKeys(true);\n const keys = objectToString(secretKeys);\n downloadTxtAsFile(\n 'keys.json',\n keys,\n (isLoading) => setIsLoadingKeys(isLoading),\n (isError) => setIsLoadingKeysError(isError),\n (isClicked) => setIsDownloaded(isClicked),\n );\n }, []);\n\n return { isDownloaded, isLoadingKeys, isLoadingKeysError, isCopied, onDownload, onCopy };\n};\n\nexport default useKeyDownload;\n","export const formatSecrets = (secretKeys) => {\n return secretKeys\n ? [\n ...(secretKeys.keys\n ? secretKeys.keys.map((item) => ({\n ...item,\n id: item.didDocumentKey.id.replace('#', ''),\n }))\n : []),\n ...(secretKeys.authClients\n ? secretKeys.authClients.reduce(\n (acc, { clientId, clientSecret }) => [\n ...acc,\n { id: 'Client Id', key: clientId },\n { id: 'Client Secret', key: clientSecret },\n ],\n [],\n )\n : []),\n ]\n : [];\n};\n","const hasValue = (value) => {\n if (Array.isArray(value)) {\n return value.length > 0;\n }\n\n return Boolean(value);\n};\n\nconst hasRequiredFields = (fields, formData) => {\n if (!formData) {\n return false;\n }\n\n return fields.every((field) => hasValue(formData[field]));\n};\n\nconst requiredFieldsByServiceType = [\n {\n isActive: ({ isIssuingOrInspection }) => isIssuingOrInspection,\n requiredFields: ['serviceEndpoint', 'serviceCAO'],\n },\n {\n isActive: ({ isCAO }) => isCAO,\n requiredFields: ['serviceEndpoint'],\n },\n {\n isActive: ({ isWebWallet }) => isWebWallet,\n requiredFields: ['name', 'logo', 'serviceEndpoint', 'supportedExchangeProtocols'],\n },\n {\n isActive: ({ isHolderWallet }) => isHolderWallet,\n requiredFields: [\n 'name',\n 'logo',\n 'serviceEndpoint',\n 'supportedExchangeProtocols',\n 'playStoreUrl',\n 'googlePlayId',\n 'appleAppStoreUrl',\n 'appleAppId',\n ],\n },\n];\n\nexport const isAddButtonDisabled = (\n inProgress,\n isIssuingOrInspection,\n isCAO,\n isWebWallet,\n isHolderWallet,\n formData,\n) => {\n if (inProgress) {\n return true;\n }\n\n const serviceType = requiredFieldsByServiceType.find((item) =>\n item.isActive({ isIssuingOrInspection, isCAO, isWebWallet, isHolderWallet }),\n );\n\n if (!serviceType) {\n return true;\n }\n\n return !hasRequiredFields(serviceType.requiredFields, formData);\n};\n","export const getTitle = (step) => {\n switch (step) {\n case 2:\n return \"You're one step away from setting up your new service on Velocity Network™\";\n case 3:\n return 'Set a Secure Messages URL';\n case 4:\n return 'Congratulations!';\n default:\n return 'Select type of service to add';\n }\n};\n","export const getNewServiceIndex = (services, kebabType) => {\n // eslint-disable-next-line better-mutation/no-mutating-methods\n const servicesOfSameType = services\n .filter((item) => item.id.split('#')[1]?.startsWith(kebabType))\n .sort();\n\n return (\n // eslint-disable-next-line better-mutation/no-mutating-methods\n parseInt(servicesOfSameType[servicesOfSameType.length - 1]?.id.split('-').reverse()[0], 10) +\n 1 || 1\n );\n};\n","import { kebabCase } from 'lodash-es';\nimport { CREDENTIAL_TYPES_IDS } from '@/utils/serviceTypes.js';\nimport { getNewServiceIndex } from '@/utils/invitations.js';\n\nconst addProp = (name, value) => (value ? { [name]: value } : {});\n\nexport const buildPayload = (service, type, did, services) => {\n const kebabType = kebabCase(type);\n const { name, logo, supportedExchangeProtocols, serviceEndpoint } = service;\n\n const genericPayload = {\n ...(did &&\n services && { id: `${did}#${kebabType}-${getNewServiceIndex(services, kebabType)}` }),\n serviceEndpoint,\n type,\n };\n if (type === CREDENTIAL_TYPES_IDS.VLC_WEB_WALLET_PROVIDER) {\n return {\n ...genericPayload,\n ...addProp('logoUrl', logo),\n ...addProp('supportedExchangeProtocols', supportedExchangeProtocols),\n ...addProp('name', name),\n };\n }\n if (type === CREDENTIAL_TYPES_IDS.VLC_HOLDER_APP_PROVIDER) {\n const { playStoreUrl, googlePlayId, appleAppStoreUrl, appleAppId } = service;\n return {\n ...genericPayload,\n ...addProp('logoUrl', logo),\n ...addProp('supportedExchangeProtocols', supportedExchangeProtocols),\n ...addProp('name', name),\n ...addProp('playStoreUrl', playStoreUrl),\n ...addProp('googlePlayId', googlePlayId),\n ...addProp('appleAppStoreUrl', appleAppStoreUrl),\n ...addProp('appleAppId', appleAppId),\n };\n }\n return genericPayload;\n};\n","export const buildServiceContent = (item, title, isLink = false) => {\n if (!item) return [];\n\n const value = Array.isArray(item) ? item.join(', ') : item;\n return [{ name: title, value, isLink }];\n};\n","import { useMemo } from 'react';\nimport { Box, Button, Grid, Typography } from '@mui/material';\nimport InfoIcon from '@mui/icons-material/Info';\nimport DownloadIcon from '@mui/icons-material/Download';\nimport { Form } from 'react-admin';\nimport PropTypes from 'prop-types';\n\nimport { getTitle, formatSecrets } from '@/pages/services/utils/index.js';\n\nconst selectedStep = 4;\n\nexport const ServiceSecretKeys = ({\n secretKeys,\n subtitle,\n description,\n onDownload,\n onCopy,\n isCopied,\n}) => {\n const formattedKeys = useMemo(() => formatSecrets(secretKeys), [secretKeys]);\n\n return (\n <>\n <Typography sx={styles.title} mb={2}>\n {getTitle(selectedStep)}\n </Typography>\n <Typography sx={styles.subtitle}>{subtitle}</Typography>\n <Typography>{description}</Typography>\n <Form>\n {formattedKeys.map((item) => (\n <Grid container spacing={2} columns={14} key={item.id} sx={styles.keysBlock}>\n <Key label={item.id} />\n <Value value={item.key} />\n </Grid>\n ))}\n <Box sx={styles.doNotDisclosureBlock}>\n <InfoIcon />\n <Typography marginLeft=\"20px\">\n Do not disclose these keys to unauthorized persons or transmit via unsecured channels.\n </Typography>\n </Box>\n\n <Box sx={styles.buttonsBlock}>\n <Button\n variant=\"outlined\"\n color=\"secondary\"\n sx={[styles.button, { marginRight: '30px' }]}\n onClick={() => onCopy(secretKeys)}\n >\n {isCopied ? 'Copied' : 'Copy'}\n </Button>\n <Button\n variant=\"outlined\"\n endIcon={<DownloadIcon />}\n sx={styles.button}\n onClick={() => onDownload(secretKeys)}\n >\n Download\n </Button>\n </Box>\n </Form>\n </>\n );\n};\n\nconst Key = ({ label }) => (\n <Grid size={{ xs: 4 }} sx={styles.keyLabel}>\n <Typography>{label}</Typography>\n </Grid>\n);\n\nconst Value = ({ value }) => (\n <Grid size={{ xs: 10 }}>\n <Typography sx={styles.keyValue}>{value}</Typography>\n </Grid>\n);\n\nconst styles = {\n title: {\n fontSize: '32px',\n fontWeight: '600',\n lineHeight: '38px',\n },\n subtitle: {\n fontWeight: '600',\n fontSize: '16px',\n marginBottom: '24px',\n },\n doNotDisclosureBlock: {\n color: 'secondary.light',\n fontSize: '14px',\n display: 'flex',\n flexDirection: 'row',\n marginTop: '30px',\n },\n keysBlock: {\n marginTop: '30px',\n },\n keyLabel: {\n display: 'flex',\n alignItems: 'center',\n wordBreak: 'break-all',\n },\n keyValue: {\n width: '100%',\n borderColor: 'divider.main',\n borderWidth: '1px',\n borderStyle: 'solid',\n borderRadius: '6px',\n padding: '16px',\n boxSizing: 'border-box',\n wordBreak: 'break-word',\n },\n buttonsBlock: {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'center',\n marginTop: '40px',\n },\n button: { px: 4, py: 1, fontSize: '16px', width: '160px' },\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nServiceSecretKeys.propTypes = {\n // eslint-disable-next-line react/forbid-prop-types\n secretKeys: PropTypes.object,\n subtitle: PropTypes.string,\n description: PropTypes.string,\n onCopy: PropTypes.func,\n isCopied: PropTypes.bool,\n onDownload: PropTypes.func,\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nKey.propTypes = {\n label: PropTypes.string.isRequired,\n};\n// eslint-disable-next-line better-mutation/no-mutation\nValue.propTypes = {\n value: PropTypes.string.isRequired,\n};\n\nexport default ServiceSecretKeys;\n","import { useCallback, useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport Popup from '@/components/common/Popup.jsx';\nimport WarningSecretKeysPopup from './WarningSecretKeysPopup/index.jsx';\nimport { useKeyDownload } from '../../hooks/useKeyDownload.js';\nimport { ServiceSecretKeys } from './ServiceSecretKeys/index.jsx';\n\nexport const SecretKeysPopup = ({ isOpen, secretKeys, onClose, wording, warningWording }) => {\n const { onDownload, onCopy, isLoadingKeys, isLoadingKeysError, isDownloaded, isCopied } =\n useKeyDownload();\n\n const [isOpenWarningSecretPopup, setIsOpenWarningSecretPopup] = useState(false);\n\n const handleClose = useCallback(() => {\n if ((!isCopied && !isDownloaded) || isLoadingKeysError) {\n setIsOpenWarningSecretPopup(true);\n } else {\n onClose();\n }\n }, [isCopied, isDownloaded, isLoadingKeysError, onClose]);\n\n useEffect(() => {\n if (isOpenWarningSecretPopup && !isLoadingKeys && !isLoadingKeysError && isDownloaded) {\n onClose();\n }\n }, [isOpenWarningSecretPopup, isLoadingKeys, isLoadingKeysError, isDownloaded, onClose]);\n\n return (\n <Popup\n onClose={handleClose}\n title=\"\"\n isOpen={isOpen}\n mainContainerStyles={styles.mainContainer}\n disableCloseButton={isLoadingKeys}\n >\n <>\n <ServiceSecretKeys\n secretKeys={secretKeys}\n onDownload={onDownload}\n onCopy={onCopy}\n isCopied={isCopied}\n subtitle={wording.title}\n description={wording.subtitle}\n />\n <WarningSecretKeysPopup\n isModalOpened={isOpenWarningSecretPopup}\n onClose={onClose}\n title={warningWording.title}\n subtitle={warningWording.subtitle}\n onClick={() => onDownload(secretKeys)}\n isLoading={isLoadingKeys}\n />\n </>\n </Popup>\n );\n};\n\nconst styles = {\n mainContainer: { pt: 2 },\n};\n// eslint-disable-next-line better-mutation/no-mutation\nSecretKeysPopup.propTypes = {\n isOpen: PropTypes.bool.isRequired,\n // eslint-disable-next-line react/forbid-prop-types\n secretKeys: PropTypes.object.isRequired,\n onClose: PropTypes.func.isRequired,\n wording: PropTypes.shape({\n title: PropTypes.string.isRequired,\n subtitle: PropTypes.string.isRequired,\n }).isRequired,\n warningWording: PropTypes.shape({\n title: PropTypes.string.isRequired,\n subtitle: PropTypes.string.isRequired,\n }).isRequired,\n};\n\nexport default SecretKeysPopup;\n"],"mappings":";;;;;;;;;;;;;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d,MAAI,4BAA4B,CAAC,iBAAiB,CAAC,sBAAsB,aACvE,UAAS;IAEV;EAAC;EAA0B;EAAe;EAAoB;EAAc;EAAQ,CAAC;AAExF,QACE,iBAAA,GAAA,kBAAA,KAAC,cAAA,OAAD;EACE,SAAS;EACT,OAAM;EACE;EACR,qBAAqB,OAAO;EAC5B,oBAAoB;YAEpB,iBAAA,GAAA,kBAAA,MAAA,kBAAA,UAAA,EAAA,UAAA,CACE,iBAAA,GAAA,kBAAA,KAAC,mBAAD;GACc;GACA;GACJ;GACE;GACV,UAAU,QAAQ;GAClB,aAAa,QAAQ;GACrB,CAAA,EACF,iBAAA,GAAA,kBAAA,KAAC,wBAAD;GACE,eAAe;GACN;GACT,OAAO,eAAe;GACtB,UAAU,eAAe;GACzB,eAAe,WAAW,WAAW;GACrC,WAAW;GACX,CAAA,CACD,EAAA,CAAA;EACG,CAAA;;AAIZ,IAAM,SAAS,EACb,eAAe,EAAE,IAAI,GAAG,EACzB;AAED,gBAAgB,YAAY;CAC1B,QAAQ,WAAA,QAAU,KAAK;CAEvB,YAAY,WAAA,QAAU,OAAO;CAC7B,SAAS,WAAA,QAAU,KAAK;CACxB,SAAS,WAAA,QAAU,MAAM;EACvB,OAAO,WAAA,QAAU,OAAO;EACxB,UAAU,WAAA,QAAU,OAAO;EAC5B,CAAC,CAAC;CACH,gBAAgB,WAAA,QAAU,MAAM;EAC9B,OAAO,WAAA,QAAU,OAAO;EACxB,UAAU,WAAA,QAAU,OAAO;EAC5B,CAAC,CAAC;CACJ"}
@@ -6,7 +6,7 @@ const require_serviceTypes = require("./serviceTypes.DkHyHv7r.js");
6
6
  const require_CustomDropDown = require("./CustomDropDown.CLKrHWGm.js");
7
7
  const require_CreateOrganizationUtils = require("./CreateOrganizationUtils.IHpfMpyX.js");
8
8
  const require_HolderWalletSelection = require("./HolderWalletSelection.BBJmVA_8.js");
9
- const require_SecretKeysPopup = require("./SecretKeysPopup.C9L--WZW.js");
9
+ const require_SecretKeysPopup = require("./SecretKeysPopup.dEI2kM66.js");
10
10
  let react = require("react");
11
11
  let react_admin = require("react-admin");
12
12
  let prop_types = require("prop-types");
@@ -431,4 +431,4 @@ Object.defineProperty(exports, "ServiceTypeSelection", {
431
431
  }
432
432
  });
433
433
 
434
- //# sourceMappingURL=ServiceTypeSelection.0oZSS6yZ.js.map
434
+ //# sourceMappingURL=ServiceTypeSelection.DCwp_z1y.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ServiceTypeSelection.0oZSS6yZ.js","names":[],"sources":["../../src/components/common/Autocomplete.jsx","../../src/pages/services/components/ServiceEndpointSelection/components/IssuingOrInspectionSelection.jsx","../../src/pages/services/components/ServiceEndpointSelection/components/UserAgreement.jsx","../../src/pages/services/components/ServiceEndpointSelection/components/CAOSelection.jsx","../../src/pages/services/components/ServiceEndpointSelection/index.jsx","../../src/pages/services/components/ServiceTypeSelection/index.jsx"],"sourcesContent":["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,complexity\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, Stack, Tooltip } from '@mui/material';\nimport InfoIcon from '@mui/icons-material/Info';\nimport PropTypes from 'prop-types';\n\nimport CustomDropDown from '@/components/common/CustomDropDown.jsx';\nimport Autocomplete from '@/components/common/Autocomplete.jsx';\nimport OrganizationAvatar from '@/components/common/OrganizationAvatar.jsx';\n\nconst IssuingOrInspectionSelection = ({ credentialAgentOperators, inProgress }) => {\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 <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 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={inProgress}\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 || inProgress}\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};\n\nconst styles = {\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};\n\n// eslint-disable-next-line better-mutation/no-mutation\nIssuingOrInspectionSelection.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 inProgress: PropTypes.bool.isRequired,\n};\n\nexport default IssuingOrInspectionSelection;\n","import { Typography, Link } from '@mui/material';\nimport PropTypes from 'prop-types';\nimport { useConfig } from '@/utils/ConfigContext.js';\nimport { chainNames } from '@/utils/chainNames.js';\n\nexport const UserAgreement = ({ isWallet }) => {\n const config = useConfig();\n return (\n config.chainName !== chainNames.testnet && (\n <Typography variant=\"subtitle1\" sx={sx.userAgreement}>\n <span>By clicking Add, you agree to our </span>\n {isWallet ? (\n <Link\n target=\"_blank\"\n href=\"https://velocitynetwork.foundation/wp-content/uploads/2022/07/VNF-Wallet-Operator-Agreement-v1.1.pdf\"\n >\n Wallet Developer Agreement\n </Link>\n ) : (\n <Link\n target=\"_blank\"\n href=\"https://www.velocitynetwork.foundation/main2/participation-agreements\"\n >\n Participant Agreement\n </Link>\n )}\n </Typography>\n )\n );\n};\n\nconst sx = {\n userAgreement: {\n marginTop: '10px',\n },\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nUserAgreement.propTypes = {\n isWallet: PropTypes.bool.isRequired,\n};\n","import { TextInput, required } from 'react-admin';\nimport PropTypes from 'prop-types';\n\nimport { validateServiceEndpoint } from '@/components/organizations/CreateOrganizationUtils.js';\n\nconst CAOSelection = ({ inProgress }) => {\n return (\n <TextInput\n source=\"serviceEndpoint\"\n label=\"Service endpoint URL\"\n validate={[required('Service endpoint URL field is required'), ...validateServiceEndpoint]}\n parse={(value) => value?.trim() ?? ''}\n disabled={inProgress}\n />\n );\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nCAOSelection.propTypes = {\n inProgress: PropTypes.bool.isRequired,\n};\n\nexport default CAOSelection;\n","import { Form, FormDataConsumer, SaveButton } from 'react-admin';\nimport { Box, Button, Stack, Typography } from '@mui/material';\nimport KeyboardArrowLeftIcon from '@mui/icons-material/KeyboardArrowLeft';\n\nimport PropTypes from 'prop-types';\nimport { useIsIssuingInspection } from '../../hooks/useIsIssuingInspection.js';\nimport IssuingOrInspectionSelection from './components/IssuingOrInspectionSelection.jsx';\nimport WebWalletSelection from './components/WebWalletSelection.jsx';\nimport HolderWalletSelection from './components/HolderWalletSelection.jsx';\nimport { UserAgreement } from './components/UserAgreement.jsx';\nimport CAOSelection from './components/CAOSelection.jsx';\n\nimport { getTitle, isAddButtonDisabled } from '../../utils/index.js';\n\nconst selectedStep = 2;\n\nexport const ServiceEndpointSelection = ({\n credentialAgentOperators,\n selectedServiceType,\n inProgress,\n onCreate,\n handleBack,\n}) => {\n const { isIssuingOrInspection, isCAO, isWallet, isWebWallet, isHolderWallet } =\n useIsIssuingInspection(selectedServiceType);\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 {isIssuingOrInspection && (\n <IssuingOrInspectionSelection\n credentialAgentOperators={credentialAgentOperators}\n inProgress={inProgress}\n />\n )}\n\n {isWebWallet && <WebWalletSelection inProgress={inProgress} />}\n\n {isHolderWallet && <HolderWalletSelection inProgress={inProgress} />}\n\n {isCAO && <CAOSelection inProgress={inProgress} />}\n <UserAgreement isWallet={isWallet} />\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 isIssuingOrInspection,\n isCAO,\n isWebWallet,\n isHolderWallet,\n formData,\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 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 selectedServiceType: PropTypes.string.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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAKA,IAAM,gBAAA,GAAA,MAAA,YAA0B,SAAS,aACvC,EACE,OACA,OAAO,cACP,UACA,UACA,OACA,a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AU,KAAK;CAC3B,WAAW,WAAA,QAAU;CACrB,qBAAqB,WAAA,QAAU,UAAU;EAAC,WAAA,QAAU;EAAQ,WAAA,QAAU;EAAQ,WAAA,QAAU;EAAO,CAAC;CAChG,wBAAwB,WAAA,QAAU,KAAK;CACvC,WAAW,WAAA,QAAU;CACtB;AAGD,qBAAqB,eAAe;CAClC,WAAW;CACX,qBAAqB;CACrB,WAAW;CACZ"}
1
+ {"version":3,"file":"ServiceTypeSelection.DCwp_z1y.js","names":[],"sources":["../../src/components/common/Autocomplete.jsx","../../src/pages/services/components/ServiceEndpointSelection/components/IssuingOrInspectionSelection.jsx","../../src/pages/services/components/ServiceEndpointSelection/components/UserAgreement.jsx","../../src/pages/services/components/ServiceEndpointSelection/components/CAOSelection.jsx","../../src/pages/services/components/ServiceEndpointSelection/index.jsx","../../src/pages/services/components/ServiceTypeSelection/index.jsx"],"sourcesContent":["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,complexity\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, Stack, Tooltip } from '@mui/material';\nimport InfoIcon from '@mui/icons-material/Info';\nimport PropTypes from 'prop-types';\n\nimport CustomDropDown from '@/components/common/CustomDropDown.jsx';\nimport Autocomplete from '@/components/common/Autocomplete.jsx';\nimport OrganizationAvatar from '@/components/common/OrganizationAvatar.jsx';\n\nconst IssuingOrInspectionSelection = ({ credentialAgentOperators, inProgress }) => {\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 <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 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={inProgress}\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 || inProgress}\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};\n\nconst styles = {\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};\n\n// eslint-disable-next-line better-mutation/no-mutation\nIssuingOrInspectionSelection.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 inProgress: PropTypes.bool.isRequired,\n};\n\nexport default IssuingOrInspectionSelection;\n","import { Typography, Link } from '@mui/material';\nimport PropTypes from 'prop-types';\nimport { useConfig } from '@/utils/ConfigContext.js';\nimport { chainNames } from '@/utils/chainNames.js';\n\nexport const UserAgreement = ({ isWallet }) => {\n const config = useConfig();\n return (\n config.chainName !== chainNames.testnet && (\n <Typography variant=\"subtitle1\" sx={sx.userAgreement}>\n <span>By clicking Add, you agree to our </span>\n {isWallet ? (\n <Link\n target=\"_blank\"\n href=\"https://velocitynetwork.foundation/wp-content/uploads/2022/07/VNF-Wallet-Operator-Agreement-v1.1.pdf\"\n >\n Wallet Developer Agreement\n </Link>\n ) : (\n <Link\n target=\"_blank\"\n href=\"https://www.velocitynetwork.foundation/main2/participation-agreements\"\n >\n Participant Agreement\n </Link>\n )}\n </Typography>\n )\n );\n};\n\nconst sx = {\n userAgreement: {\n marginTop: '10px',\n },\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nUserAgreement.propTypes = {\n isWallet: PropTypes.bool.isRequired,\n};\n","import { TextInput, required } from 'react-admin';\nimport PropTypes from 'prop-types';\n\nimport { validateServiceEndpoint } from '@/components/organizations/CreateOrganizationUtils.js';\n\nconst CAOSelection = ({ inProgress }) => {\n return (\n <TextInput\n source=\"serviceEndpoint\"\n label=\"Service endpoint URL\"\n validate={[required('Service endpoint URL field is required'), ...validateServiceEndpoint]}\n parse={(value) => value?.trim() ?? ''}\n disabled={inProgress}\n />\n );\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nCAOSelection.propTypes = {\n inProgress: PropTypes.bool.isRequired,\n};\n\nexport default CAOSelection;\n","import { Form, FormDataConsumer, SaveButton } from 'react-admin';\nimport { Box, Button, Stack, Typography } from '@mui/material';\nimport KeyboardArrowLeftIcon from '@mui/icons-material/KeyboardArrowLeft';\n\nimport PropTypes from 'prop-types';\nimport { useIsIssuingInspection } from '../../hooks/useIsIssuingInspection.js';\nimport IssuingOrInspectionSelection from './components/IssuingOrInspectionSelection.jsx';\nimport WebWalletSelection from './components/WebWalletSelection.jsx';\nimport HolderWalletSelection from './components/HolderWalletSelection.jsx';\nimport { UserAgreement } from './components/UserAgreement.jsx';\nimport CAOSelection from './components/CAOSelection.jsx';\n\nimport { getTitle, isAddButtonDisabled } from '../../utils/index.js';\n\nconst selectedStep = 2;\n\nexport const ServiceEndpointSelection = ({\n credentialAgentOperators,\n selectedServiceType,\n inProgress,\n onCreate,\n handleBack,\n}) => {\n const { isIssuingOrInspection, isCAO, isWallet, isWebWallet, isHolderWallet } =\n useIsIssuingInspection(selectedServiceType);\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 {isIssuingOrInspection && (\n <IssuingOrInspectionSelection\n credentialAgentOperators={credentialAgentOperators}\n inProgress={inProgress}\n />\n )}\n\n {isWebWallet && <WebWalletSelection inProgress={inProgress} />}\n\n {isHolderWallet && <HolderWalletSelection inProgress={inProgress} />}\n\n {isCAO && <CAOSelection inProgress={inProgress} />}\n <UserAgreement isWallet={isWallet} />\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 isIssuingOrInspection,\n isCAO,\n isWebWallet,\n isHolderWallet,\n formData,\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 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 selectedServiceType: PropTypes.string.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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAKA,IAAM,gBAAA,GAAA,MAAA,YAA0B,SAAS,aACvC,EACE,OACA,OAAO,cACP,UACA,UACA,OACA,aAAa,QACb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;CAC3B,WAAW,WAAA,QAAU;CACrB,qBAAqB,WAAA,QAAU,UAAU;EAAC,WAAA,QAAU;EAAQ,WAAA,QAAU;EAAQ,WAAA,QAAU;EAAO,CAAC;CAChG,wBAAwB,WAAA,QAAU,KAAK;CACvC,WAAW,WAAA,QAAU;CACtB;AAGD,qBAAqB,eAAe;CAClC,WAAW;CACX,qBAAqB;CACrB,WAAW;CACZ"}
@@ -6,7 +6,7 @@ import { i as serviceTypes } from "./serviceTypes.DCgfBtsd.js";
6
6
  import { t as CustomDropDown } from "./CustomDropDown.B3x3Io5r.js";
7
7
  import { r as validateServiceEndpoint } from "./CreateOrganizationUtils.BAL1YBx4.js";
8
8
  import { n as WebWalletSelection, r as useIsIssuingInspection, t as HolderWalletSelection } from "./HolderWalletSelection.DYli1Fb4.js";
9
- import { a as getTitle, o as isAddButtonDisabled } from "./SecretKeysPopup.0XsoiVZ9.js";
9
+ import { a as getTitle, o as isAddButtonDisabled } from "./SecretKeysPopup.D_ws7IBv.js";
10
10
  import { forwardRef, useCallback, useEffect, useMemo, useState } from "react";
11
11
  import { AutocompleteInput, Form, FormDataConsumer, SaveButton, TextInput, required, useInput } from "react-admin";
12
12
  import PropTypes from "prop-types";
@@ -416,4 +416,4 @@ ServiceTypeSelection.defaultProps = {
416
416
  //#endregion
417
417
  export { ServiceEndpointSelection as n, ServiceTypeSelection as t };
418
418
 
419
- //# sourceMappingURL=ServiceTypeSelection.BS0kP3o8.js.map
419
+ //# sourceMappingURL=ServiceTypeSelection.DvgqE5zG.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ServiceTypeSelection.BS0kP3o8.js","names":[],"sources":["../../src/components/common/Autocomplete.jsx","../../src/pages/services/components/ServiceEndpointSelection/components/IssuingOrInspectionSelection.jsx","../../src/pages/services/components/ServiceEndpointSelection/components/UserAgreement.jsx","../../src/pages/services/components/ServiceEndpointSelection/components/CAOSelection.jsx","../../src/pages/services/components/ServiceEndpointSelection/index.jsx","../../src/pages/services/components/ServiceTypeSelection/index.jsx"],"sourcesContent":["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,complexity\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, Stack, Tooltip } from '@mui/material';\nimport InfoIcon from '@mui/icons-material/Info';\nimport PropTypes from 'prop-types';\n\nimport CustomDropDown from '@/components/common/CustomDropDown.jsx';\nimport Autocomplete from '@/components/common/Autocomplete.jsx';\nimport OrganizationAvatar from '@/components/common/OrganizationAvatar.jsx';\n\nconst IssuingOrInspectionSelection = ({ credentialAgentOperators, inProgress }) => {\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 <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 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={inProgress}\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 || inProgress}\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};\n\nconst styles = {\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};\n\n// eslint-disable-next-line better-mutation/no-mutation\nIssuingOrInspectionSelection.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 inProgress: PropTypes.bool.isRequired,\n};\n\nexport default IssuingOrInspectionSelection;\n","import { Typography, Link } from '@mui/material';\nimport PropTypes from 'prop-types';\nimport { useConfig } from '@/utils/ConfigContext.js';\nimport { chainNames } from '@/utils/chainNames.js';\n\nexport const UserAgreement = ({ isWallet }) => {\n const config = useConfig();\n return (\n config.chainName !== chainNames.testnet && (\n <Typography variant=\"subtitle1\" sx={sx.userAgreement}>\n <span>By clicking Add, you agree to our </span>\n {isWallet ? (\n <Link\n target=\"_blank\"\n href=\"https://velocitynetwork.foundation/wp-content/uploads/2022/07/VNF-Wallet-Operator-Agreement-v1.1.pdf\"\n >\n Wallet Developer Agreement\n </Link>\n ) : (\n <Link\n target=\"_blank\"\n href=\"https://www.velocitynetwork.foundation/main2/participation-agreements\"\n >\n Participant Agreement\n </Link>\n )}\n </Typography>\n )\n );\n};\n\nconst sx = {\n userAgreement: {\n marginTop: '10px',\n },\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nUserAgreement.propTypes = {\n isWallet: PropTypes.bool.isRequired,\n};\n","import { TextInput, required } from 'react-admin';\nimport PropTypes from 'prop-types';\n\nimport { validateServiceEndpoint } from '@/components/organizations/CreateOrganizationUtils.js';\n\nconst CAOSelection = ({ inProgress }) => {\n return (\n <TextInput\n source=\"serviceEndpoint\"\n label=\"Service endpoint URL\"\n validate={[required('Service endpoint URL field is required'), ...validateServiceEndpoint]}\n parse={(value) => value?.trim() ?? ''}\n disabled={inProgress}\n />\n );\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nCAOSelection.propTypes = {\n inProgress: PropTypes.bool.isRequired,\n};\n\nexport default CAOSelection;\n","import { Form, FormDataConsumer, SaveButton } from 'react-admin';\nimport { Box, Button, Stack, Typography } from '@mui/material';\nimport KeyboardArrowLeftIcon from '@mui/icons-material/KeyboardArrowLeft';\n\nimport PropTypes from 'prop-types';\nimport { useIsIssuingInspection } from '../../hooks/useIsIssuingInspection.js';\nimport IssuingOrInspectionSelection from './components/IssuingOrInspectionSelection.jsx';\nimport WebWalletSelection from './components/WebWalletSelection.jsx';\nimport HolderWalletSelection from './components/HolderWalletSelection.jsx';\nimport { UserAgreement } from './components/UserAgreement.jsx';\nimport CAOSelection from './components/CAOSelection.jsx';\n\nimport { getTitle, isAddButtonDisabled } from '../../utils/index.js';\n\nconst selectedStep = 2;\n\nexport const ServiceEndpointSelection = ({\n credentialAgentOperators,\n selectedServiceType,\n inProgress,\n onCreate,\n handleBack,\n}) => {\n const { isIssuingOrInspection, isCAO, isWallet, isWebWallet, isHolderWallet } =\n useIsIssuingInspection(selectedServiceType);\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 {isIssuingOrInspection && (\n <IssuingOrInspectionSelection\n credentialAgentOperators={credentialAgentOperators}\n inProgress={inProgress}\n />\n )}\n\n {isWebWallet && <WebWalletSelection inProgress={inProgress} />}\n\n {isHolderWallet && <HolderWalletSelection inProgress={inProgress} />}\n\n {isCAO && <CAOSelection inProgress={inProgress} />}\n <UserAgreement isWallet={isWallet} />\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 isIssuingOrInspection,\n isCAO,\n isWebWallet,\n isHolderWallet,\n formData,\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 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 selectedServiceType: PropTypes.string.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"],"mappings":";;;;;;;;;;;;;;;;;;AAKA,IAAM,iBAAe,WAAW,SAAS,aACvC,EACE,OACA,OAAO,cACP,UACA,UACA,OACA,aAAa,QACb,WACA,QACA,SAAS,IACT,SAAS,UAAU,SAErB,KACA;CACA,MAAM,EACJ,OACA,YAAY,EAAE,YACZ,SAAS;EAAE;EAAQ;EAAc;EAAU;EAAO,CAAC;CAEvD,MAAM,cAAc,cAAc;AAChC,SAAO,QACH,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM;AACxB,WAAQ,EAAE,QAAQ,IAAI,cAAc,EAAE,QAAQ,GAAG;IACjD,GACF,EAAE;IACL,CAAC,MAAM,CAAC;CAEX,MAAM,mBAAmB,aACtB,WAAW;EACV,MAAM,YAAY,OAAO,OAAO;AAChC,MAAI,OAAO,cAAc,SACvB,QAAO;AAET,SAAO,aAAa,UAAU,SAAS,UAAU,MAAM,WACnD,UAAU,MAAM,SAAS,UAAU,GACnC;IAEN,CAAC,OAAO,CACT;AAED,iBAAgB;AACd,MAAI,aAAa,WAAW,EAC1B,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eACV;KAEQ,CAAA,CACL;MACD;;EACN,EAAA,CAAA;;AAIP,IAAM,SAAS;CACb,aAAa;EACX,SAAS;EACT,WAAW;EACX,gBAAgB;EAChB,YAAY;EACZ,KAAK;EACN;CACD,aAAa,EACX,gBAAgB,YACjB;CACD,MAAM;EAAE,QAAQ,UAAU,MAAM,QAAQ,QAAQ;EAAM,IAAI;EAAQ,SAAS;EAAS;CACpF,QAAQ;EAAE,IAAI;EAAG,IAAI;EAAG,UAAU;EAAQ,OAAO;EAAS;CAC3D;AAED,qBAAqB,YAAY;CAC/B,YAAY,UAAU,KAAK;CAC3B,WAAW,UAAU;CACrB,qBAAqB,UAAU,UAAU;EAAC,UAAU;EAAQ,UAAU;EAAQ,UAAU;EAAO,CAAC;CAChG,wBAAwB,UAAU,KAAK;CACvC,WAAW,UAAU;CACtB;AAGD,qBAAqB,eAAe;CAClC,WAAW;CACX,qBAAqB;CACrB,WAAW;CACZ"}
1
+ {"version":3,"file":"ServiceTypeSelection.DvgqE5zG.js","names":[],"sources":["../../src/components/common/Autocomplete.jsx","../../src/pages/services/components/ServiceEndpointSelection/components/IssuingOrInspectionSelection.jsx","../../src/pages/services/components/ServiceEndpointSelection/components/UserAgreement.jsx","../../src/pages/services/components/ServiceEndpointSelection/components/CAOSelection.jsx","../../src/pages/services/components/ServiceEndpointSelection/index.jsx","../../src/pages/services/components/ServiceTypeSelection/index.jsx"],"sourcesContent":["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,complexity\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, Stack, Tooltip } from '@mui/material';\nimport InfoIcon from '@mui/icons-material/Info';\nimport PropTypes from 'prop-types';\n\nimport CustomDropDown from '@/components/common/CustomDropDown.jsx';\nimport Autocomplete from '@/components/common/Autocomplete.jsx';\nimport OrganizationAvatar from '@/components/common/OrganizationAvatar.jsx';\n\nconst IssuingOrInspectionSelection = ({ credentialAgentOperators, inProgress }) => {\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 <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 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={inProgress}\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 || inProgress}\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};\n\nconst styles = {\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};\n\n// eslint-disable-next-line better-mutation/no-mutation\nIssuingOrInspectionSelection.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 inProgress: PropTypes.bool.isRequired,\n};\n\nexport default IssuingOrInspectionSelection;\n","import { Typography, Link } from '@mui/material';\nimport PropTypes from 'prop-types';\nimport { useConfig } from '@/utils/ConfigContext.js';\nimport { chainNames } from '@/utils/chainNames.js';\n\nexport const UserAgreement = ({ isWallet }) => {\n const config = useConfig();\n return (\n config.chainName !== chainNames.testnet && (\n <Typography variant=\"subtitle1\" sx={sx.userAgreement}>\n <span>By clicking Add, you agree to our </span>\n {isWallet ? (\n <Link\n target=\"_blank\"\n href=\"https://velocitynetwork.foundation/wp-content/uploads/2022/07/VNF-Wallet-Operator-Agreement-v1.1.pdf\"\n >\n Wallet Developer Agreement\n </Link>\n ) : (\n <Link\n target=\"_blank\"\n href=\"https://www.velocitynetwork.foundation/main2/participation-agreements\"\n >\n Participant Agreement\n </Link>\n )}\n </Typography>\n )\n );\n};\n\nconst sx = {\n userAgreement: {\n marginTop: '10px',\n },\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nUserAgreement.propTypes = {\n isWallet: PropTypes.bool.isRequired,\n};\n","import { TextInput, required } from 'react-admin';\nimport PropTypes from 'prop-types';\n\nimport { validateServiceEndpoint } from '@/components/organizations/CreateOrganizationUtils.js';\n\nconst CAOSelection = ({ inProgress }) => {\n return (\n <TextInput\n source=\"serviceEndpoint\"\n label=\"Service endpoint URL\"\n validate={[required('Service endpoint URL field is required'), ...validateServiceEndpoint]}\n parse={(value) => value?.trim() ?? ''}\n disabled={inProgress}\n />\n );\n};\n\n// eslint-disable-next-line better-mutation/no-mutation\nCAOSelection.propTypes = {\n inProgress: PropTypes.bool.isRequired,\n};\n\nexport default CAOSelection;\n","import { Form, FormDataConsumer, SaveButton } from 'react-admin';\nimport { Box, Button, Stack, Typography } from '@mui/material';\nimport KeyboardArrowLeftIcon from '@mui/icons-material/KeyboardArrowLeft';\n\nimport PropTypes from 'prop-types';\nimport { useIsIssuingInspection } from '../../hooks/useIsIssuingInspection.js';\nimport IssuingOrInspectionSelection from './components/IssuingOrInspectionSelection.jsx';\nimport WebWalletSelection from './components/WebWalletSelection.jsx';\nimport HolderWalletSelection from './components/HolderWalletSelection.jsx';\nimport { UserAgreement } from './components/UserAgreement.jsx';\nimport CAOSelection from './components/CAOSelection.jsx';\n\nimport { getTitle, isAddButtonDisabled } from '../../utils/index.js';\n\nconst selectedStep = 2;\n\nexport const ServiceEndpointSelection = ({\n credentialAgentOperators,\n selectedServiceType,\n inProgress,\n onCreate,\n handleBack,\n}) => {\n const { isIssuingOrInspection, isCAO, isWallet, isWebWallet, isHolderWallet } =\n useIsIssuingInspection(selectedServiceType);\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 {isIssuingOrInspection && (\n <IssuingOrInspectionSelection\n credentialAgentOperators={credentialAgentOperators}\n inProgress={inProgress}\n />\n )}\n\n {isWebWallet && <WebWalletSelection inProgress={inProgress} />}\n\n {isHolderWallet && <HolderWalletSelection inProgress={inProgress} />}\n\n {isCAO && <CAOSelection inProgress={inProgress} />}\n <UserAgreement isWallet={isWallet} />\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 isIssuingOrInspection,\n isCAO,\n isWebWallet,\n isHolderWallet,\n formData,\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 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 selectedServiceType: PropTypes.string.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"],"mappings":";;;;;;;;;;;;;;;;;;AAKA,IAAM,iBAAe,WAAW,SAAS,aACvC,EACE,OACA,OAAO,cACP,UACA,UACA,OACA,aAAa,QACb,WACA,QACA,SAAS,IACT,SAAS,UAAU,SAErB,KACA;CACA,MAAM,EACJ,OACA,YAAY,EAAE,YACZ,SAAS;EAAE;EAAQ;EAAc;EAAU;EAAO,CAAC;CAEvD,MAAM,cAAc,cAAc;AAChC,SAAO,QACH,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM;AACxB,WAAQ,EAAE,QAAQ,IAAI,cAAc,EAAE,QAAQ,GAAG;IACjD,GACF,EAAE;IACL,CAAC,MAAM,CAAC;CAEX,MAAM,mBAAmB,aACtB,WAAW;EACV,MAAM,YAAY,OAAO,OAAO;AAChC,MAAI,OAAO,cAAc,SACvB,QAAO;AAET,SAAO,aAAa,UAAU,SAAS,UAAU,MAAM,WACnD,UAAU,MAAM,SAAS,UAAU,GACnC;IAEN,CAAC,OAAO,CACT;AAED,iBAAgB;AACd,MAAI,aAAa,WAAW,EAC1B,OAAM,SAAS,YAAY,GAAG;IAE/B,CAAC,aAAa,MAAM,CAAC;AAExB,QACE,oBAAC,mBAAD;EACE,GAAI;EACC;EACE;EACP,SAAS,eAAe,EAAE;EAC1B,YAAY;EACZ,WAAW,aAAa;EACxB,aAAY;EACZ,UAAU,YAAa,SAAS,MAAM,WAAW;EACjD,IAAI;EACJ,OAAO,CAAC,CAAC;EACT,YAAY,QAAQ,MAAM,UAAU;EACpC,WAAA;EACA,CAAA;EAEJ;AAGF,eAAa,YAAY;CACvB,OAAO,UAAU,OAAO;CAExB,OAAO,UAAU;CACjB,UAAU,UAAU;CAC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AAW,UAAU;CACrB,qBAAqB,UAAU,UAAU;EAAC,UAAU;EAAQ,UAAU;EAAQ,UAAU;EAAO,CAAC;CAChG,wBAAwB,UAAU,KAAK;CACvC,WAAW,UAAU;CACtB;AAGD,qBAAqB,eAAe;CAClC,WAAW;CACX,qBAAqB;CACrB,WAAW;CACZ"}
@@ -0,0 +1,31 @@
1
+ //#region src/utils/auth/refreshAccessTokens.js
2
+ var INTERACTION_REQUIRED_ERRORS = new Set([
3
+ "consent_required",
4
+ "interaction_required",
5
+ "login_required"
6
+ ]);
7
+ var isInteractionRequiredError = (error) => {
8
+ return [
9
+ error?.error,
10
+ error?.errorCode,
11
+ error?.code
12
+ ].some((code) => INTERACTION_REQUIRED_ERRORS.has(code));
13
+ };
14
+ var logNonInteractionRefreshError = (error) => {
15
+ console.error("Non-interaction access token refresh failure", error);
16
+ };
17
+ var refreshAccessToken = async ({ getAccessToken, getAccessTokenWithPopup, options = { cacheMode: "off" } }) => {
18
+ try {
19
+ return await getAccessToken(options);
20
+ } catch (error) {
21
+ if (!isInteractionRequiredError(error)) {
22
+ logNonInteractionRefreshError(error);
23
+ throw error;
24
+ }
25
+ return getAccessTokenWithPopup(options);
26
+ }
27
+ };
28
+ //#endregion
29
+ export { refreshAccessToken as t };
30
+
31
+ //# sourceMappingURL=refreshAccessTokens.C9boTp4h.js.map