node_modules ignore

This commit is contained in:
2025-05-08 23:43:47 +02:00
parent e19d52f172
commit 4574544c9f
65041 changed files with 10593536 additions and 0 deletions

View File

@@ -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

File diff suppressed because one or more lines are too long

View File

@@ -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

File diff suppressed because one or more lines are too long

View File

@@ -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

File diff suppressed because one or more lines are too long

View File

@@ -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

File diff suppressed because one or more lines are too long