node_modules ignore

This commit is contained in:
oier committed 2025-05-08 23:43:47 +02:00
1 parent e19d52f172
commit 4574544c9f
65041 files changed
+10593536

No files matched your search

@@ -0,0 +1,278 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var jsxRuntime = require('react/jsx-runtime');
var React = require('react');
var strapiAdmin = require('@strapi/admin/strapi-admin');
var designSystem = require('@strapi/design-system');
var icons = require('@strapi/icons');
var admin = require('@strapi/strapi/admin');
var upperFirst = require('lodash/upperFirst');
var reactIntl = require('react-intl');
var reactQuery = require('react-query');
var index = require('../../components/FormModal/index.js');
var constants = require('../../constants.js');
require('lodash/isEmpty');
var getTrad = require('../../utils/getTrad.js');
var forms = require('./utils/forms.js');
function _interopNamespaceDefault(e) {
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n.default = e;
return Object.freeze(n);
}
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
const ProvidersPage = ()=>{
const { formatMessage, locale } = reactIntl.useIntl();
const queryClient = reactQuery.useQueryClient();
const { trackUsage } = strapiAdmin.useTracking();
const [isOpen, setIsOpen] = React__namespace.useState(false);
const [providerToEditName, setProviderToEditName] = React__namespace.useState(null);
const { toggleNotification } = admin.useNotification();
const { get, put } = admin.useFetchClient();
const { formatAPIError } = admin.useAPIErrorHandler();
const formatter = designSystem.useCollator(locale, {
sensitivity: 'base'
});
const { isLoading: isLoadingPermissions, allowedActions: { canUpdate } } = admin.useRBAC({
update: constants.PERMISSIONS.updateProviders
});
const { isLoading: isLoadingData, data } = reactQuery.useQuery([
'users-permissions',
'get-providers'
], async ()=>{
const { data } = await get('/users-permissions/providers');
return data;
}, {
initialData: {}
});
const submitMutation = reactQuery.useMutation((body)=>put('/users-permissions/providers', body), {
async onSuccess () {
await queryClient.invalidateQueries([
'users-permissions',
'get-providers'
]);
toggleNotification({
type: 'success',
message: formatMessage({
id: getTrad('notification.success.submit')
})
});
trackUsage('didEditAuthenticationProvider');
handleToggleModal();
},
onError (error) {
toggleNotification({
type: 'danger',
message: formatAPIError(error)
});
},
refetchActive: false
});
const providers = Object.entries(data).reduce((acc, [name, provider])=>{
const { icon, enabled, subdomain } = provider;
acc.push({
name,
icon: icon === 'envelope' ? [
'fas',
'envelope'
] : [
'fab',
icon
],
enabled,
subdomain
});
return acc;
}, []).sort((a, b)=>formatter.compare(a.name, b.name));
const isLoading = isLoadingData || isLoadingPermissions;
const isProviderWithSubdomain = React__namespace.useMemo(()=>{
if (!providerToEditName) {
return false;
}
const providerToEdit = providers.find((obj)=>obj.name === providerToEditName);
return !!providerToEdit?.subdomain;
}, [
providers,
providerToEditName
]);
const layoutToRender = React__namespace.useMemo(()=>{
if (providerToEditName === 'email') {
return forms.email;
}
if (isProviderWithSubdomain) {
return forms.providersWithSubdomain;
}
return forms.providers;
}, [
providerToEditName,
isProviderWithSubdomain
]);
const handleToggleModal = ()=>{
setIsOpen((prev)=>!prev);
};
const handleClickEdit = (provider)=>{
if (canUpdate) {
setProviderToEditName(provider.name);
handleToggleModal();
}
};
const handleSubmit = async (values)=>{
trackUsage('willEditAuthenticationProvider');
submitMutation.mutate({
providers: {
...data,
[providerToEditName]: values
}
});
};
if (isLoading) {
return /*#__PURE__*/ jsxRuntime.jsx(admin.Page.Loading, {});
}
return /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Layouts.Root, {
children: [
/*#__PURE__*/ jsxRuntime.jsx(admin.Page.Title, {
children: formatMessage({
id: 'Settings.PageTitle',
defaultMessage: 'Settings - {name}'
}, {
name: formatMessage({
id: getTrad('HeaderNav.link.providers'),
defaultMessage: 'Providers'
})
})
}),
/*#__PURE__*/ jsxRuntime.jsxs(admin.Page.Main, {
children: [
/*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Layouts.Header, {
title: formatMessage({
id: getTrad('HeaderNav.link.providers'),
defaultMessage: 'Providers'
})
}),
/*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Layouts.Content, {
children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Table, {
colCount: 3,
rowCount: providers.length + 1,
children: [
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Thead, {
children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Tr, {
children: [
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Th, {
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
variant: "sigma",
textColor: "neutral600",
children: formatMessage({
id: 'global.name',
defaultMessage: 'Name'
})
})
}),
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Th, {
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
variant: "sigma",
textColor: "neutral600",
children: formatMessage({
id: getTrad('Providers.status'),
defaultMessage: 'Status'
})
})
}),
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Th, {
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
variant: "sigma",
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.VisuallyHidden, {
children: formatMessage({
id: 'global.settings',
defaultMessage: 'Settings'
})
})
})
})
]
})
}),
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Tbody, {
children: providers.map((provider)=>/*#__PURE__*/ jsxRuntime.jsxs(designSystem.Tr, {
onClick: ()=>canUpdate ? handleClickEdit(provider) : undefined,
children: [
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
width: "45%",
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
fontWeight: "semiBold",
textColor: "neutral800",
children: provider.name
})
}),
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
width: "65%",
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
textColor: provider.enabled ? 'success600' : 'danger600',
"data-testid": `enable-${provider.name}`,
children: provider.enabled ? formatMessage({
id: 'global.enabled',
defaultMessage: 'Enabled'
}) : formatMessage({
id: 'global.disabled',
defaultMessage: 'Disabled'
})
})
}),
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
onClick: (e)=>e.stopPropagation(),
children: canUpdate && /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
onClick: ()=>handleClickEdit(provider),
variant: "ghost",
label: "Edit",
children: /*#__PURE__*/ jsxRuntime.jsx(icons.Pencil, {})
})
})
]
}, provider.name))
})
]
})
})
]
}),
/*#__PURE__*/ jsxRuntime.jsx(index, {
initialData: data[providerToEditName],
isOpen: isOpen,
isSubmiting: submitMutation.isLoading,
layout: layoutToRender,
headerBreadcrumbs: [
formatMessage({
id: getTrad('PopUpForm.header.edit.providers'),
defaultMessage: 'Edit Provider'
}),
upperFirst(providerToEditName)
],
onToggle: handleToggleModal,
onSubmit: handleSubmit,
providerToEditName: providerToEditName
})
]
});
};
const ProtectedProvidersPage = ()=>/*#__PURE__*/ jsxRuntime.jsx(admin.Page.Protect, {
permissions: constants.PERMISSIONS.readProviders,
children: /*#__PURE__*/ jsxRuntime.jsx(ProvidersPage, {})
});
exports.ProvidersPage = ProvidersPage;
exports.default = ProtectedProvidersPage;
//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../admin/src/pages/Providers/index.jsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useTracking, Layouts } from '@strapi/admin/strapi-admin';\nimport {\n IconButton,\n Table,\n Tbody,\n Td,\n Th,\n Thead,\n Tr,\n Typography,\n VisuallyHidden,\n useCollator,\n} from '@strapi/design-system';\nimport { Pencil } from '@strapi/icons';\nimport {\n Page,\n useAPIErrorHandler,\n useNotification,\n useFetchClient,\n useRBAC,\n} from '@strapi/strapi/admin';\nimport upperFirst from 'lodash/upperFirst';\nimport { useIntl } from 'react-intl';\nimport { useMutation, useQuery, useQueryClient } from 'react-query';\n\nimport FormModal from '../../components/FormModal';\nimport { PERMISSIONS } from '../../constants';\nimport { getTrad } from '../../utils';\n\nimport forms from './utils/forms';\n\nexport const ProvidersPage = () => {\n const { formatMessage, locale } = useIntl();\n const queryClient = useQueryClient();\n const { trackUsage } = useTracking();\n const [isOpen, setIsOpen] = React.useState(false);\n const [providerToEditName, setProviderToEditName] = React.useState(null);\n const { toggleNotification } = useNotification();\n const { get, put } = useFetchClient();\n const { formatAPIError } = useAPIErrorHandler();\n const formatter = useCollator(locale, {\n sensitivity: 'base',\n });\n\n const {\n isLoading: isLoadingPermissions,\n allowedActions: { canUpdate },\n } = useRBAC({ update: PERMISSIONS.updateProviders });\n\n const { isLoading: isLoadingData, data } = useQuery(\n ['users-permissions', 'get-providers'],\n async () => {\n const { data } = await get('/users-permissions/providers');\n\n return data;\n },\n {\n initialData: {},\n }\n );\n\n const submitMutation = useMutation((body) => put('/users-permissions/providers', body), {\n async onSuccess() {\n await queryClient.invalidateQueries(['users-permissions', 'get-providers']);\n\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: getTrad('notification.success.submit') }),\n });\n\n trackUsage('didEditAuthenticationProvider');\n\n handleToggleModal();\n },\n onError(error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n },\n refetchActive: false,\n });\n\n const providers = Object.entries(data)\n .reduce((acc, [name, provider]) => {\n const { icon, enabled, subdomain } = provider;\n\n acc.push({\n name,\n icon: icon === 'envelope' ? ['fas', 'envelope'] : ['fab', icon],\n enabled,\n subdomain,\n });\n\n return acc;\n }, [])\n .sort((a, b) => formatter.compare(a.name, b.name));\n\n const isLoading = isLoadingData || isLoadingPermissions;\n\n const isProviderWithSubdomain = React.useMemo(() => {\n if (!providerToEditName) {\n return false;\n }\n\n const providerToEdit = providers.find((obj) => obj.name === providerToEditName);\n\n return !!providerToEdit?.subdomain;\n }, [providers, providerToEditName]);\n\n const layoutToRender = React.useMemo(() => {\n if (providerToEditName === 'email') {\n return forms.email;\n }\n\n if (isProviderWithSubdomain) {\n return forms.providersWithSubdomain;\n }\n\n return forms.providers;\n }, [providerToEditName, isProviderWithSubdomain]);\n\n const handleToggleModal = () => {\n setIsOpen((prev) => !prev);\n };\n\n const handleClickEdit = (provider) => {\n if (canUpdate) {\n setProviderToEditName(provider.name);\n handleToggleModal();\n }\n };\n\n const handleSubmit = async (values) => {\n trackUsage('willEditAuthenticationProvider');\n\n submitMutation.mutate({ providers: { ...data, [providerToEditName]: values } });\n };\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n return (\n <Layouts.Root>\n <Page.Title>\n {formatMessage(\n { id: 'Settings.PageTitle', defaultMessage: 'Settings - {name}' },\n {\n name: formatMessage({\n id: getTrad('HeaderNav.link.providers'),\n defaultMessage: 'Providers',\n }),\n }\n )}\n </Page.Title>\n <Page.Main>\n <Layouts.Header\n title={formatMessage({\n id: getTrad('HeaderNav.link.providers'),\n defaultMessage: 'Providers',\n })}\n />\n <Layouts.Content>\n <Table colCount={3} rowCount={providers.length + 1}>\n <Thead>\n <Tr>\n <Th>\n <Typography variant=\"sigma\" textColor=\"neutral600\">\n {formatMessage({ id: 'global.name', defaultMessage: 'Name' })}\n </Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\" textColor=\"neutral600\">\n {formLine truncated
@@ -0,0 +1,254 @@
import { jsx, jsxs } from 'react/jsx-runtime';
import * as React from 'react';
import { useTracking, Layouts } from '@strapi/admin/strapi-admin';
import { useCollator, Table, Thead, Tr, Th, Typography, VisuallyHidden, Tbody, Td, IconButton } from '@strapi/design-system';
import { Pencil } from '@strapi/icons';
import { useNotification, useFetchClient, useAPIErrorHandler, useRBAC, Page } from '@strapi/strapi/admin';
import upperFirst from 'lodash/upperFirst';
import { useIntl } from 'react-intl';
import { useQueryClient, useQuery, useMutation } from 'react-query';
import FormModal from '../../components/FormModal/index.mjs';
import { PERMISSIONS } from '../../constants.mjs';
import 'lodash/isEmpty';
import getTrad from '../../utils/getTrad.mjs';
import forms from './utils/forms.mjs';
const ProvidersPage = ()=>{
const { formatMessage, locale } = useIntl();
const queryClient = useQueryClient();
const { trackUsage } = useTracking();
const [isOpen, setIsOpen] = React.useState(false);
const [providerToEditName, setProviderToEditName] = React.useState(null);
const { toggleNotification } = useNotification();
const { get, put } = useFetchClient();
const { formatAPIError } = useAPIErrorHandler();
const formatter = useCollator(locale, {
sensitivity: 'base'
});
const { isLoading: isLoadingPermissions, allowedActions: { canUpdate } } = useRBAC({
update: PERMISSIONS.updateProviders
});
const { isLoading: isLoadingData, data } = useQuery([
'users-permissions',
'get-providers'
], async ()=>{
const { data } = await get('/users-permissions/providers');
return data;
}, {
initialData: {}
});
const submitMutation = useMutation((body)=>put('/users-permissions/providers', body), {
async onSuccess () {
await queryClient.invalidateQueries([
'users-permissions',
'get-providers'
]);
toggleNotification({
type: 'success',
message: formatMessage({
id: getTrad('notification.success.submit')
})
});
trackUsage('didEditAuthenticationProvider');
handleToggleModal();
},
onError (error) {
toggleNotification({
type: 'danger',
message: formatAPIError(error)
});
},
refetchActive: false
});
const providers = Object.entries(data).reduce((acc, [name, provider])=>{
const { icon, enabled, subdomain } = provider;
acc.push({
name,
icon: icon === 'envelope' ? [
'fas',
'envelope'
] : [
'fab',
icon
],
enabled,
subdomain
});
return acc;
}, []).sort((a, b)=>formatter.compare(a.name, b.name));
const isLoading = isLoadingData || isLoadingPermissions;
const isProviderWithSubdomain = React.useMemo(()=>{
if (!providerToEditName) {
return false;
}
const providerToEdit = providers.find((obj)=>obj.name === providerToEditName);
return !!providerToEdit?.subdomain;
}, [
providers,
providerToEditName
]);
const layoutToRender = React.useMemo(()=>{
if (providerToEditName === 'email') {
return forms.email;
}
if (isProviderWithSubdomain) {
return forms.providersWithSubdomain;
}
return forms.providers;
}, [
providerToEditName,
isProviderWithSubdomain
]);
const handleToggleModal = ()=>{
setIsOpen((prev)=>!prev);
};
const handleClickEdit = (provider)=>{
if (canUpdate) {
setProviderToEditName(provider.name);
handleToggleModal();
}
};
const handleSubmit = async (values)=>{
trackUsage('willEditAuthenticationProvider');
submitMutation.mutate({
providers: {
...data,
[providerToEditName]: values
}
});
};
if (isLoading) {
return /*#__PURE__*/ jsx(Page.Loading, {});
}
return /*#__PURE__*/ jsxs(Layouts.Root, {
children: [
/*#__PURE__*/ jsx(Page.Title, {
children: formatMessage({
id: 'Settings.PageTitle',
defaultMessage: 'Settings - {name}'
}, {
name: formatMessage({
id: getTrad('HeaderNav.link.providers'),
defaultMessage: 'Providers'
})
})
}),
/*#__PURE__*/ jsxs(Page.Main, {
children: [
/*#__PURE__*/ jsx(Layouts.Header, {
title: formatMessage({
id: getTrad('HeaderNav.link.providers'),
defaultMessage: 'Providers'
})
}),
/*#__PURE__*/ jsx(Layouts.Content, {
children: /*#__PURE__*/ jsxs(Table, {
colCount: 3,
rowCount: providers.length + 1,
children: [
/*#__PURE__*/ jsx(Thead, {
children: /*#__PURE__*/ jsxs(Tr, {
children: [
/*#__PURE__*/ jsx(Th, {
children: /*#__PURE__*/ jsx(Typography, {
variant: "sigma",
textColor: "neutral600",
children: formatMessage({
id: 'global.name',
defaultMessage: 'Name'
})
})
}),
/*#__PURE__*/ jsx(Th, {
children: /*#__PURE__*/ jsx(Typography, {
variant: "sigma",
textColor: "neutral600",
children: formatMessage({
id: getTrad('Providers.status'),
defaultMessage: 'Status'
})
})
}),
/*#__PURE__*/ jsx(Th, {
children: /*#__PURE__*/ jsx(Typography, {
variant: "sigma",
children: /*#__PURE__*/ jsx(VisuallyHidden, {
children: formatMessage({
id: 'global.settings',
defaultMessage: 'Settings'
})
})
})
})
]
})
}),
/*#__PURE__*/ jsx(Tbody, {
children: providers.map((provider)=>/*#__PURE__*/ jsxs(Tr, {
onClick: ()=>canUpdate ? handleClickEdit(provider) : undefined,
children: [
/*#__PURE__*/ jsx(Td, {
width: "45%",
children: /*#__PURE__*/ jsx(Typography, {
fontWeight: "semiBold",
textColor: "neutral800",
children: provider.name
})
}),
/*#__PURE__*/ jsx(Td, {
width: "65%",
children: /*#__PURE__*/ jsx(Typography, {
textColor: provider.enabled ? 'success600' : 'danger600',
"data-testid": `enable-${provider.name}`,
children: provider.enabled ? formatMessage({
id: 'global.enabled',
defaultMessage: 'Enabled'
}) : formatMessage({
id: 'global.disabled',
defaultMessage: 'Disabled'
})
})
}),
/*#__PURE__*/ jsx(Td, {
onClick: (e)=>e.stopPropagation(),
children: canUpdate && /*#__PURE__*/ jsx(IconButton, {
onClick: ()=>handleClickEdit(provider),
variant: "ghost",
label: "Edit",
children: /*#__PURE__*/ jsx(Pencil, {})
})
})
]
}, provider.name))
})
]
})
})
]
}),
/*#__PURE__*/ jsx(FormModal, {
initialData: data[providerToEditName],
isOpen: isOpen,
isSubmiting: submitMutation.isLoading,
layout: layoutToRender,
headerBreadcrumbs: [
formatMessage({
id: getTrad('PopUpForm.header.edit.providers'),
defaultMessage: 'Edit Provider'
}),
upperFirst(providerToEditName)
],
onToggle: handleToggleModal,
onSubmit: handleSubmit,
providerToEditName: providerToEditName
})
]
});
};
const ProtectedProvidersPage = ()=>/*#__PURE__*/ jsx(Page.Protect, {
permissions: PERMISSIONS.readProviders,
children: /*#__PURE__*/ jsx(ProvidersPage, {})
});
export { ProvidersPage, ProtectedProvidersPage as default };
//# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":["../../../../admin/src/pages/Providers/index.jsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useTracking, Layouts } from '@strapi/admin/strapi-admin';\nimport {\n IconButton,\n Table,\n Tbody,\n Td,\n Th,\n Thead,\n Tr,\n Typography,\n VisuallyHidden,\n useCollator,\n} from '@strapi/design-system';\nimport { Pencil } from '@strapi/icons';\nimport {\n Page,\n useAPIErrorHandler,\n useNotification,\n useFetchClient,\n useRBAC,\n} from '@strapi/strapi/admin';\nimport upperFirst from 'lodash/upperFirst';\nimport { useIntl } from 'react-intl';\nimport { useMutation, useQuery, useQueryClient } from 'react-query';\n\nimport FormModal from '../../components/FormModal';\nimport { PERMISSIONS } from '../../constants';\nimport { getTrad } from '../../utils';\n\nimport forms from './utils/forms';\n\nexport const ProvidersPage = () => {\n const { formatMessage, locale } = useIntl();\n const queryClient = useQueryClient();\n const { trackUsage } = useTracking();\n const [isOpen, setIsOpen] = React.useState(false);\n const [providerToEditName, setProviderToEditName] = React.useState(null);\n const { toggleNotification } = useNotification();\n const { get, put } = useFetchClient();\n const { formatAPIError } = useAPIErrorHandler();\n const formatter = useCollator(locale, {\n sensitivity: 'base',\n });\n\n const {\n isLoading: isLoadingPermissions,\n allowedActions: { canUpdate },\n } = useRBAC({ update: PERMISSIONS.updateProviders });\n\n const { isLoading: isLoadingData, data } = useQuery(\n ['users-permissions', 'get-providers'],\n async () => {\n const { data } = await get('/users-permissions/providers');\n\n return data;\n },\n {\n initialData: {},\n }\n );\n\n const submitMutation = useMutation((body) => put('/users-permissions/providers', body), {\n async onSuccess() {\n await queryClient.invalidateQueries(['users-permissions', 'get-providers']);\n\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: getTrad('notification.success.submit') }),\n });\n\n trackUsage('didEditAuthenticationProvider');\n\n handleToggleModal();\n },\n onError(error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n },\n refetchActive: false,\n });\n\n const providers = Object.entries(data)\n .reduce((acc, [name, provider]) => {\n const { icon, enabled, subdomain } = provider;\n\n acc.push({\n name,\n icon: icon === 'envelope' ? ['fas', 'envelope'] : ['fab', icon],\n enabled,\n subdomain,\n });\n\n return acc;\n }, [])\n .sort((a, b) => formatter.compare(a.name, b.name));\n\n const isLoading = isLoadingData || isLoadingPermissions;\n\n const isProviderWithSubdomain = React.useMemo(() => {\n if (!providerToEditName) {\n return false;\n }\n\n const providerToEdit = providers.find((obj) => obj.name === providerToEditName);\n\n return !!providerToEdit?.subdomain;\n }, [providers, providerToEditName]);\n\n const layoutToRender = React.useMemo(() => {\n if (providerToEditName === 'email') {\n return forms.email;\n }\n\n if (isProviderWithSubdomain) {\n return forms.providersWithSubdomain;\n }\n\n return forms.providers;\n }, [providerToEditName, isProviderWithSubdomain]);\n\n const handleToggleModal = () => {\n setIsOpen((prev) => !prev);\n };\n\n const handleClickEdit = (provider) => {\n if (canUpdate) {\n setProviderToEditName(provider.name);\n handleToggleModal();\n }\n };\n\n const handleSubmit = async (values) => {\n trackUsage('willEditAuthenticationProvider');\n\n submitMutation.mutate({ providers: { ...data, [providerToEditName]: values } });\n };\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n return (\n <Layouts.Root>\n <Page.Title>\n {formatMessage(\n { id: 'Settings.PageTitle', defaultMessage: 'Settings - {name}' },\n {\n name: formatMessage({\n id: getTrad('HeaderNav.link.providers'),\n defaultMessage: 'Providers',\n }),\n }\n )}\n </Page.Title>\n <Page.Main>\n <Layouts.Header\n title={formatMessage({\n id: getTrad('HeaderNav.link.providers'),\n defaultMessage: 'Providers',\n })}\n />\n <Layouts.Content>\n <Table colCount={3} rowCount={providers.length + 1}>\n <Thead>\n <Tr>\n <Th>\n <Typography variant=\"sigma\" textColor=\"neutral600\">\n {formatMessage({ id: 'global.name', defaultMessage: 'Name' })}\n </Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\" textColor=\"neutral600\">\n {forLine truncated
@@ -0,0 +1,281 @@
'use strict';
var admin = require('@strapi/strapi/admin');
var yup = require('yup');
require('lodash/isEmpty');
var getTrad = require('../../../utils/getTrad.js');
function _interopNamespaceDefault(e) {
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n.default = e;
return Object.freeze(n);
}
var yup__namespace = /*#__PURE__*/_interopNamespaceDefault(yup);
const callbackLabel = {
id: getTrad('PopUpForm.Providers.redirectURL.front-end.label'),
defaultMessage: 'The redirect URL to your front-end app'
};
const callbackPlaceholder = {
id: 'http://www.client-app.com',
defaultMessage: 'http://www.client-app.com'
};
const enabledDescription = {
id: getTrad('PopUpForm.Providers.enabled.description'),
defaultMessage: "If disabled, users won't be able to use this provider."
};
const enabledLabel = {
id: getTrad('PopUpForm.Providers.enabled.label'),
defaultMessage: 'Enable'
};
const keyLabel = {
id: getTrad('PopUpForm.Providers.key.label'),
defaultMessage: 'Client ID'
};
const hintLabel = {
id: getTrad('PopUpForm.Providers.redirectURL.label'),
defaultMessage: 'The redirect URL to add in your {provider} application configurations'
};
const textPlaceholder = {
id: getTrad('PopUpForm.Providers.key.placeholder'),
defaultMessage: 'TEXT'
};
const secretLabel = {
id: getTrad('PopUpForm.Providers.secret.label'),
defaultMessage: 'Client Secret'
};
const CALLBACK_REGEX = /^$|^[a-z][a-z0-9+.-]*:\/\/[^\s/$.?#](?:[^\s]*[^\s/$.?#])?$/i;
const SUBDOMAIN_REGEX = /^(([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+)(:\d+)?(\/\S*)?$/i;
const forms = {
email: {
form: [
[
{
intlLabel: enabledLabel,
name: 'enabled',
type: 'bool',
description: enabledDescription,
size: 6
}
]
],
schema: yup__namespace.object().shape({
enabled: yup__namespace.bool().required(admin.translatedErrors.required.id)
})
},
providers: {
form: [
[
{
intlLabel: enabledLabel,
name: 'enabled',
type: 'bool',
description: enabledDescription,
size: 6,
validations: {
required: true
}
}
],
[
{
intlLabel: keyLabel,
name: 'key',
type: 'text',
placeholder: textPlaceholder,
size: 12,
validations: {
required: true
}
}
],
[
{
intlLabel: secretLabel,
name: 'secret',
type: 'text',
placeholder: textPlaceholder,
size: 12,
validations: {
required: true
}
}
],
[
{
intlLabel: callbackLabel,
placeholder: callbackPlaceholder,
name: 'callback',
type: 'text',
size: 12,
validations: {
required: true
}
}
],
[
{
intlLabel: hintLabel,
name: 'noName',
type: 'text',
validations: {},
size: 12,
disabled: true
}
]
],
schema: yup__namespace.object().shape({
enabled: yup__namespace.bool().required(admin.translatedErrors.required.id),
key: yup__namespace.string().when('enabled', {
is: true,
then: yup__namespace.string().required(admin.translatedErrors.required.id),
otherwise: yup__namespace.string()
}),
secret: yup__namespace.string().when('enabled', {
is: true,
then: yup__namespace.string().required(admin.translatedErrors.required.id),
otherwise: yup__namespace.string()
}),
callback: yup__namespace.string().when('enabled', {
is: true,
then: yup__namespace.string().matches(CALLBACK_REGEX, admin.translatedErrors.regex.id).required(admin.translatedErrors.required.id),
otherwise: yup__namespace.string()
})
})
},
providersWithSubdomain: {
form: [
[
{
intlLabel: enabledLabel,
name: 'enabled',
type: 'bool',
description: enabledDescription,
size: 6,
validations: {
required: true
}
}
],
[
{
intlLabel: keyLabel,
name: 'key',
type: 'text',
placeholder: textPlaceholder,
size: 12,
validations: {
required: true
}
}
],
[
{
intlLabel: secretLabel,
name: 'secret',
type: 'text',
placeholder: textPlaceholder,
size: 12,
validations: {
required: true
}
}
],
[
{
intlLabel: {
id: getTrad({
id: 'PopUpForm.Providers.jwksurl.label'
}),
defaultMessage: 'JWKS URL'
},
name: 'jwksurl',
type: 'text',
placeholder: textPlaceholder,
size: 12,
validations: {
required: false
}
}
],
[
{
intlLabel: {
id: getTrad('PopUpForm.Providers.subdomain.label'),
defaultMessage: 'Host URI (Subdomain)'
},
name: 'subdomain',
type: 'text',
placeholder: {
id: getTrad('PopUpForm.Providers.subdomain.placeholder'),
defaultMessage: 'my.subdomain.com'
},
size: 12,
validations: {
required: true
}
}
],
[
{
intlLabel: callbackLabel,
placeholder: callbackPlaceholder,
name: 'callback',
type: 'text',
size: 12,
validations: {
required: true
}
}
],
[
{
intlLabel: hintLabel,
name: 'noName',
type: 'text',
validations: {},
size: 12,
disabled: true
}
]
],
schema: yup__namespace.object().shape({
enabled: yup__namespace.bool().required(admin.translatedErrors.required.id),
key: yup__namespace.string().when('enabled', {
is: true,
then: yup__namespace.string().required(admin.translatedErrors.required.id),
otherwise: yup__namespace.string()
}),
secret: yup__namespace.string().when('enabled', {
is: true,
then: yup__namespace.string().required(admin.translatedErrors.required.id),
otherwise: yup__namespace.string()
}),
subdomain: yup__namespace.string().when('enabled', {
is: true,
then: yup__namespace.string().matches(SUBDOMAIN_REGEX, admin.translatedErrors.regex.id).required(admin.translatedErrors.required.id),
otherwise: yup__namespace.string()
}),
callback: yup__namespace.string().when('enabled', {
is: true,
then: yup__namespace.string().matches(CALLBACK_REGEX, admin.translatedErrors.regex.id).required(admin.translatedErrors.required.id),
otherwise: yup__namespace.string()
})
})
}
};
module.exports = forms;
//# sourceMappingURL=forms.js.map
@@ -0,0 +1 @@
{"version":3,"file":"forms.js","sources":["../../../../../admin/src/pages/Providers/utils/forms.js"],"sourcesContent":["import { translatedErrors } from '@strapi/strapi/admin';\nimport * as yup from 'yup';\n\nimport { getTrad } from '../../../utils';\n\nconst callbackLabel = {\n id: getTrad('PopUpForm.Providers.redirectURL.front-end.label'),\n defaultMessage: 'The redirect URL to your front-end app',\n};\nconst callbackPlaceholder = {\n id: 'http://www.client-app.com',\n defaultMessage: 'http://www.client-app.com',\n};\nconst enabledDescription = {\n id: getTrad('PopUpForm.Providers.enabled.description'),\n defaultMessage: \"If disabled, users won't be able to use this provider.\",\n};\nconst enabledLabel = {\n id: getTrad('PopUpForm.Providers.enabled.label'),\n defaultMessage: 'Enable',\n};\nconst keyLabel = { id: getTrad('PopUpForm.Providers.key.label'), defaultMessage: 'Client ID' };\nconst hintLabel = {\n id: getTrad('PopUpForm.Providers.redirectURL.label'),\n defaultMessage: 'The redirect URL to add in your {provider} application configurations',\n};\nconst textPlaceholder = {\n id: getTrad('PopUpForm.Providers.key.placeholder'),\n defaultMessage: 'TEXT',\n};\n\nconst secretLabel = {\n id: getTrad('PopUpForm.Providers.secret.label'),\n defaultMessage: 'Client Secret',\n};\n\nconst CALLBACK_REGEX = /^$|^[a-z][a-z0-9+.-]*:\\/\\/[^\\s/$.?#](?:[^\\s]*[^\\s/$.?#])?$/i;\nconst SUBDOMAIN_REGEX = /^(([a-zA-Z0-9-]+\\.)*[a-zA-Z0-9-]+)(:\\d+)?(\\/\\S*)?$/i;\n\nconst forms = {\n email: {\n form: [\n [\n {\n intlLabel: enabledLabel,\n name: 'enabled',\n type: 'bool',\n description: enabledDescription,\n size: 6,\n // TODO check if still needed\n // validations: {\n // required: true,\n // },\n },\n ],\n ],\n schema: yup.object().shape({\n enabled: yup.bool().required(translatedErrors.required.id),\n }),\n },\n providers: {\n form: [\n [\n {\n intlLabel: enabledLabel,\n name: 'enabled',\n type: 'bool',\n description: enabledDescription,\n size: 6,\n validations: {\n required: true,\n },\n },\n ],\n [\n {\n intlLabel: keyLabel,\n name: 'key',\n type: 'text',\n placeholder: textPlaceholder,\n size: 12,\n validations: {\n required: true,\n },\n },\n ],\n [\n {\n intlLabel: secretLabel,\n name: 'secret',\n type: 'text',\n placeholder: textPlaceholder,\n size: 12,\n validations: {\n required: true,\n },\n },\n ],\n [\n {\n intlLabel: callbackLabel,\n placeholder: callbackPlaceholder,\n name: 'callback',\n type: 'text',\n size: 12,\n validations: {\n required: true,\n },\n },\n ],\n [\n {\n intlLabel: hintLabel,\n name: 'noName',\n type: 'text',\n validations: {},\n size: 12,\n disabled: true,\n },\n ],\n ],\n schema: yup.object().shape({\n enabled: yup.bool().required(translatedErrors.required.id),\n key: yup.string().when('enabled', {\n is: true,\n then: yup.string().required(translatedErrors.required.id),\n otherwise: yup.string(),\n }),\n secret: yup.string().when('enabled', {\n is: true,\n then: yup.string().required(translatedErrors.required.id),\n otherwise: yup.string(),\n }),\n callback: yup.string().when('enabled', {\n is: true,\n then: yup\n .string()\n .matches(CALLBACK_REGEX, translatedErrors.regex.id)\n .required(translatedErrors.required.id),\n otherwise: yup.string(),\n }),\n }),\n },\n providersWithSubdomain: {\n form: [\n [\n {\n intlLabel: enabledLabel,\n name: 'enabled',\n type: 'bool',\n description: enabledDescription,\n size: 6,\n validations: {\n required: true,\n },\n },\n ],\n [\n {\n intlLabel: keyLabel,\n name: 'key',\n type: 'text',\n placeholder: textPlaceholder,\n size: 12,\n validations: {\n required: true,\n },\n },\n ],\n [\n {\n intlLabel: secretLabel,\n name: 'secret',\n type: 'text',\n placeholder: textPlaceholder,\n size: 12,\n validations: {\n required: true,\n },\n },\n ],\n [\n {\n intlLabel: {\n id: getTrad({ id: 'PopUpForm.Providers.jwksurl.label' }),\n defaultMessage: 'JWKS URL',\n },\n nameLine truncated
@@ -0,0 +1,260 @@
import { translatedErrors } from '@strapi/strapi/admin';
import * as yup from 'yup';
import 'lodash/isEmpty';
import getTrad from '../../../utils/getTrad.mjs';
const callbackLabel = {
id: getTrad('PopUpForm.Providers.redirectURL.front-end.label'),
defaultMessage: 'The redirect URL to your front-end app'
};
const callbackPlaceholder = {
id: 'http://www.client-app.com',
defaultMessage: 'http://www.client-app.com'
};
const enabledDescription = {
id: getTrad('PopUpForm.Providers.enabled.description'),
defaultMessage: "If disabled, users won't be able to use this provider."
};
const enabledLabel = {
id: getTrad('PopUpForm.Providers.enabled.label'),
defaultMessage: 'Enable'
};
const keyLabel = {
id: getTrad('PopUpForm.Providers.key.label'),
defaultMessage: 'Client ID'
};
const hintLabel = {
id: getTrad('PopUpForm.Providers.redirectURL.label'),
defaultMessage: 'The redirect URL to add in your {provider} application configurations'
};
const textPlaceholder = {
id: getTrad('PopUpForm.Providers.key.placeholder'),
defaultMessage: 'TEXT'
};
const secretLabel = {
id: getTrad('PopUpForm.Providers.secret.label'),
defaultMessage: 'Client Secret'
};
const CALLBACK_REGEX = /^$|^[a-z][a-z0-9+.-]*:\/\/[^\s/$.?#](?:[^\s]*[^\s/$.?#])?$/i;
const SUBDOMAIN_REGEX = /^(([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+)(:\d+)?(\/\S*)?$/i;
const forms = {
email: {
form: [
[
{
intlLabel: enabledLabel,
name: 'enabled',
type: 'bool',
description: enabledDescription,
size: 6
}
]
],
schema: yup.object().shape({
enabled: yup.bool().required(translatedErrors.required.id)
})
},
providers: {
form: [
[
{
intlLabel: enabledLabel,
name: 'enabled',
type: 'bool',
description: enabledDescription,
size: 6,
validations: {
required: true
}
}
],
[
{
intlLabel: keyLabel,
name: 'key',
type: 'text',
placeholder: textPlaceholder,
size: 12,
validations: {
required: true
}
}
],
[
{
intlLabel: secretLabel,
name: 'secret',
type: 'text',
placeholder: textPlaceholder,
size: 12,
validations: {
required: true
}
}
],
[
{
intlLabel: callbackLabel,
placeholder: callbackPlaceholder,
name: 'callback',
type: 'text',
size: 12,
validations: {
required: true
}
}
],
[
{
intlLabel: hintLabel,
name: 'noName',
type: 'text',
validations: {},
size: 12,
disabled: true
}
]
],
schema: yup.object().shape({
enabled: yup.bool().required(translatedErrors.required.id),
key: yup.string().when('enabled', {
is: true,
then: yup.string().required(translatedErrors.required.id),
otherwise: yup.string()
}),
secret: yup.string().when('enabled', {
is: true,
then: yup.string().required(translatedErrors.required.id),
otherwise: yup.string()
}),
callback: yup.string().when('enabled', {
is: true,
then: yup.string().matches(CALLBACK_REGEX, translatedErrors.regex.id).required(translatedErrors.required.id),
otherwise: yup.string()
})
})
},
providersWithSubdomain: {
form: [
[
{
intlLabel: enabledLabel,
name: 'enabled',
type: 'bool',
description: enabledDescription,
size: 6,
validations: {
required: true
}
}
],
[
{
intlLabel: keyLabel,
name: 'key',
type: 'text',
placeholder: textPlaceholder,
size: 12,
validations: {
required: true
}
}
],
[
{
intlLabel: secretLabel,
name: 'secret',
type: 'text',
placeholder: textPlaceholder,
size: 12,
validations: {
required: true
}
}
],
[
{
intlLabel: {
id: getTrad({
id: 'PopUpForm.Providers.jwksurl.label'
}),
defaultMessage: 'JWKS URL'
},
name: 'jwksurl',
type: 'text',
placeholder: textPlaceholder,
size: 12,
validations: {
required: false
}
}
],
[
{
intlLabel: {
id: getTrad('PopUpForm.Providers.subdomain.label'),
defaultMessage: 'Host URI (Subdomain)'
},
name: 'subdomain',
type: 'text',
placeholder: {
id: getTrad('PopUpForm.Providers.subdomain.placeholder'),
defaultMessage: 'my.subdomain.com'
},
size: 12,
validations: {
required: true
}
}
],
[
{
intlLabel: callbackLabel,
placeholder: callbackPlaceholder,
name: 'callback',
type: 'text',
size: 12,
validations: {
required: true
}
}
],
[
{
intlLabel: hintLabel,
name: 'noName',
type: 'text',
validations: {},
size: 12,
disabled: true
}
]
],
schema: yup.object().shape({
enabled: yup.bool().required(translatedErrors.required.id),
key: yup.string().when('enabled', {
is: true,
then: yup.string().required(translatedErrors.required.id),
otherwise: yup.string()
}),
secret: yup.string().when('enabled', {
is: true,
then: yup.string().required(translatedErrors.required.id),
otherwise: yup.string()
}),
subdomain: yup.string().when('enabled', {
is: true,
then: yup.string().matches(SUBDOMAIN_REGEX, translatedErrors.regex.id).required(translatedErrors.required.id),
otherwise: yup.string()
}),
callback: yup.string().when('enabled', {
is: true,
then: yup.string().matches(CALLBACK_REGEX, translatedErrors.regex.id).required(translatedErrors.required.id),
otherwise: yup.string()
})
})
}
};
export { forms as default };
//# sourceMappingURL=forms.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"forms.mjs","sources":["../../../../../admin/src/pages/Providers/utils/forms.js"],"sourcesContent":["import { translatedErrors } from '@strapi/strapi/admin';\nimport * as yup from 'yup';\n\nimport { getTrad } from '../../../utils';\n\nconst callbackLabel = {\n id: getTrad('PopUpForm.Providers.redirectURL.front-end.label'),\n defaultMessage: 'The redirect URL to your front-end app',\n};\nconst callbackPlaceholder = {\n id: 'http://www.client-app.com',\n defaultMessage: 'http://www.client-app.com',\n};\nconst enabledDescription = {\n id: getTrad('PopUpForm.Providers.enabled.description'),\n defaultMessage: \"If disabled, users won't be able to use this provider.\",\n};\nconst enabledLabel = {\n id: getTrad('PopUpForm.Providers.enabled.label'),\n defaultMessage: 'Enable',\n};\nconst keyLabel = { id: getTrad('PopUpForm.Providers.key.label'), defaultMessage: 'Client ID' };\nconst hintLabel = {\n id: getTrad('PopUpForm.Providers.redirectURL.label'),\n defaultMessage: 'The redirect URL to add in your {provider} application configurations',\n};\nconst textPlaceholder = {\n id: getTrad('PopUpForm.Providers.key.placeholder'),\n defaultMessage: 'TEXT',\n};\n\nconst secretLabel = {\n id: getTrad('PopUpForm.Providers.secret.label'),\n defaultMessage: 'Client Secret',\n};\n\nconst CALLBACK_REGEX = /^$|^[a-z][a-z0-9+.-]*:\\/\\/[^\\s/$.?#](?:[^\\s]*[^\\s/$.?#])?$/i;\nconst SUBDOMAIN_REGEX = /^(([a-zA-Z0-9-]+\\.)*[a-zA-Z0-9-]+)(:\\d+)?(\\/\\S*)?$/i;\n\nconst forms = {\n email: {\n form: [\n [\n {\n intlLabel: enabledLabel,\n name: 'enabled',\n type: 'bool',\n description: enabledDescription,\n size: 6,\n // TODO check if still needed\n // validations: {\n // required: true,\n // },\n },\n ],\n ],\n schema: yup.object().shape({\n enabled: yup.bool().required(translatedErrors.required.id),\n }),\n },\n providers: {\n form: [\n [\n {\n intlLabel: enabledLabel,\n name: 'enabled',\n type: 'bool',\n description: enabledDescription,\n size: 6,\n validations: {\n required: true,\n },\n },\n ],\n [\n {\n intlLabel: keyLabel,\n name: 'key',\n type: 'text',\n placeholder: textPlaceholder,\n size: 12,\n validations: {\n required: true,\n },\n },\n ],\n [\n {\n intlLabel: secretLabel,\n name: 'secret',\n type: 'text',\n placeholder: textPlaceholder,\n size: 12,\n validations: {\n required: true,\n },\n },\n ],\n [\n {\n intlLabel: callbackLabel,\n placeholder: callbackPlaceholder,\n name: 'callback',\n type: 'text',\n size: 12,\n validations: {\n required: true,\n },\n },\n ],\n [\n {\n intlLabel: hintLabel,\n name: 'noName',\n type: 'text',\n validations: {},\n size: 12,\n disabled: true,\n },\n ],\n ],\n schema: yup.object().shape({\n enabled: yup.bool().required(translatedErrors.required.id),\n key: yup.string().when('enabled', {\n is: true,\n then: yup.string().required(translatedErrors.required.id),\n otherwise: yup.string(),\n }),\n secret: yup.string().when('enabled', {\n is: true,\n then: yup.string().required(translatedErrors.required.id),\n otherwise: yup.string(),\n }),\n callback: yup.string().when('enabled', {\n is: true,\n then: yup\n .string()\n .matches(CALLBACK_REGEX, translatedErrors.regex.id)\n .required(translatedErrors.required.id),\n otherwise: yup.string(),\n }),\n }),\n },\n providersWithSubdomain: {\n form: [\n [\n {\n intlLabel: enabledLabel,\n name: 'enabled',\n type: 'bool',\n description: enabledDescription,\n size: 6,\n validations: {\n required: true,\n },\n },\n ],\n [\n {\n intlLabel: keyLabel,\n name: 'key',\n type: 'text',\n placeholder: textPlaceholder,\n size: 12,\n validations: {\n required: true,\n },\n },\n ],\n [\n {\n intlLabel: secretLabel,\n name: 'secret',\n type: 'text',\n placeholder: textPlaceholder,\n size: 12,\n validations: {\n required: true,\n },\n },\n ],\n [\n {\n intlLabel: {\n id: getTrad({ id: 'PopUpForm.Providers.jwksurl.label' }),\n defaultMessage: 'JWKS URL',\n },\n namLine truncated