420 lines
13 KiB
JavaScript
420 lines
13 KiB
JavaScript
import "./chunk-AOWI4JYR.js";
|
|
import "./chunk-KGPWUC7Q.js";
|
|
import "./chunk-FVEHK4NK.js";
|
|
import "./chunk-C4NW23D7.js";
|
|
import "./chunk-E3IW2VDN.js";
|
|
import "./chunk-MN3D3XJI.js";
|
|
import "./chunk-C7H2BX76.js";
|
|
import "./chunk-U66AL5Y5.js";
|
|
import "./chunk-7KYK3FTC.js";
|
|
import "./chunk-JF4AI5LV.js";
|
|
import "./chunk-ALMC553V.js";
|
|
import "./chunk-PDGPTUUZ.js";
|
|
import "./chunk-XH2B3RAH.js";
|
|
import "./chunk-MLTBQQQV.js";
|
|
import "./chunk-GXKJFURG.js";
|
|
import "./chunk-7FUKGPNR.js";
|
|
import "./chunk-NAZM6EA4.js";
|
|
import "./chunk-UATNJIHQ.js";
|
|
import "./chunk-P4VL3IHZ.js";
|
|
import "./chunk-HIZVCZYI.js";
|
|
import "./chunk-7HX4OIS5.js";
|
|
import "./chunk-6LY4MOO2.js";
|
|
import "./chunk-SQLDXQZE.js";
|
|
import "./chunk-QF6GPHA4.js";
|
|
import "./chunk-SYWYLB7I.js";
|
|
import "./chunk-S3HPKOXW.js";
|
|
import "./chunk-JRLAXHTE.js";
|
|
import "./chunk-E4IFZ6ZT.js";
|
|
import "./chunk-XNACAI67.js";
|
|
import {
|
|
useMutation,
|
|
useQuery,
|
|
useQueryClient
|
|
} from "./chunk-QLEKUQKW.js";
|
|
import "./chunk-4J3VOWQV.js";
|
|
import "./chunk-PFI4R5WA.js";
|
|
import "./chunk-G2UWKDMB.js";
|
|
import "./chunk-B3BGMYGX.js";
|
|
import "./chunk-W6ICJ5TB.js";
|
|
import "./chunk-IHYIPMY2.js";
|
|
import "./chunk-UWHSN2C7.js";
|
|
import "./chunk-ERK7O2GM.js";
|
|
import {
|
|
useFetchClient
|
|
} from "./chunk-FCIM6RNO.js";
|
|
import "./chunk-J33IXKN4.js";
|
|
import "./chunk-NP53ZCXD.js";
|
|
import "./chunk-KFLQQE5L.js";
|
|
import "./chunk-ED4XR3VQ.js";
|
|
import "./chunk-MBK4V2X7.js";
|
|
import {
|
|
require_isEmpty
|
|
} from "./chunk-YJEURQPS.js";
|
|
import "./chunk-5ESYXDTN.js";
|
|
import "./chunk-GGK2TLCV.js";
|
|
import "./chunk-K65KIEAL.js";
|
|
import "./chunk-B7ZLODDO.js";
|
|
import "./chunk-PW7XKCYO.js";
|
|
import "./chunk-RMBEU7DO.js";
|
|
import "./chunk-RI2W2UZ6.js";
|
|
import "./chunk-IY256CNP.js";
|
|
import {
|
|
errorsTrads
|
|
} from "./chunk-IFOFBKTA.js";
|
|
import {
|
|
create2 as create,
|
|
create4 as create2,
|
|
create6 as create3
|
|
} from "./chunk-XLSIZGJF.js";
|
|
import "./chunk-EGNP2T5O.js";
|
|
import "./chunk-GSN7U3BK.js";
|
|
import "./chunk-T3B5F2LV.js";
|
|
import "./chunk-YXDCVYVT.js";
|
|
import "./chunk-QIJGNK42.js";
|
|
import "./chunk-7PUJSL55.js";
|
|
import "./chunk-C2ZJTFO7.js";
|
|
import "./chunk-C75BZXCZ.js";
|
|
import "./chunk-APGTER6B.js";
|
|
import "./chunk-ZM6TT53G.js";
|
|
import {
|
|
MemoizedInputRenderer
|
|
} from "./chunk-6AXVGFVQ.js";
|
|
import {
|
|
Form
|
|
} from "./chunk-BFLP6DBI.js";
|
|
import {
|
|
useRBAC
|
|
} from "./chunk-CMLQV3Z2.js";
|
|
import "./chunk-D4WYVNVM.js";
|
|
import "./chunk-MMOBCIZG.js";
|
|
import "./chunk-IGCTEXRF.js";
|
|
import {
|
|
Layouts
|
|
} from "./chunk-TIVRAWTC.js";
|
|
import "./chunk-PQINNV4N.js";
|
|
import "./chunk-VYSYYPOB.js";
|
|
import {
|
|
Page,
|
|
useAPIErrorHandler
|
|
} from "./chunk-5CAWUBTQ.js";
|
|
import "./chunk-W2TBR6J3.js";
|
|
import "./chunk-QEGMJR7H.js";
|
|
import "./chunk-LCL5TIBZ.js";
|
|
import "./chunk-WOQNBAGN.js";
|
|
import "./chunk-BHLYCXQ7.js";
|
|
import "./chunk-76QM3EFM.js";
|
|
import "./chunk-CE4VABH2.js";
|
|
import "./chunk-5VODLFKF.js";
|
|
import {
|
|
useNotification
|
|
} from "./chunk-N55RVBRV.js";
|
|
import {
|
|
Box,
|
|
Button,
|
|
Flex,
|
|
Grid,
|
|
Typography,
|
|
useIntl,
|
|
useNotifyAT
|
|
} from "./chunk-7XB6XSWQ.js";
|
|
import "./chunk-5ZC4PE57.js";
|
|
import "./chunk-TUXTO2Z5.js";
|
|
import "./chunk-FOD4ENRR.js";
|
|
import {
|
|
ForwardRef$4F
|
|
} from "./chunk-WRD5KPDH.js";
|
|
import {
|
|
require_jsx_runtime
|
|
} from "./chunk-NIAJZ5MX.js";
|
|
import "./chunk-ACIMPXWY.js";
|
|
import {
|
|
require_react
|
|
} from "./chunk-MADUDGYZ.js";
|
|
import {
|
|
PERMISSIONS,
|
|
getTrad
|
|
} from "./chunk-DJJSG3NG.js";
|
|
import {
|
|
__toESM
|
|
} from "./chunk-PLDDJCW6.js";
|
|
|
|
// node_modules/@strapi/plugin-users-permissions/dist/admin/pages/AdvancedSettings/index.mjs
|
|
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
|
|
var import_react = __toESM(require_react(), 1);
|
|
var import_isEmpty2 = __toESM(require_isEmpty(), 1);
|
|
|
|
// node_modules/@strapi/plugin-users-permissions/dist/admin/pages/AdvancedSettings/utils/layout.mjs
|
|
var import_isEmpty = __toESM(require_isEmpty(), 1);
|
|
var layout = [
|
|
{
|
|
label: {
|
|
id: getTrad("EditForm.inputToggle.label.email"),
|
|
defaultMessage: "One account per email address"
|
|
},
|
|
hint: {
|
|
id: getTrad("EditForm.inputToggle.description.email"),
|
|
defaultMessage: "Disallow the user to create multiple accounts using the same email address with different authentication providers."
|
|
},
|
|
name: "unique_email",
|
|
type: "boolean",
|
|
size: 12
|
|
},
|
|
{
|
|
label: {
|
|
id: getTrad("EditForm.inputToggle.label.sign-up"),
|
|
defaultMessage: "Enable sign-ups"
|
|
},
|
|
hint: {
|
|
id: getTrad("EditForm.inputToggle.description.sign-up"),
|
|
defaultMessage: "When disabled (OFF), the registration process is forbidden. No one can subscribe anymore no matter the used provider."
|
|
},
|
|
name: "allow_register",
|
|
type: "boolean",
|
|
size: 12
|
|
},
|
|
{
|
|
label: {
|
|
id: getTrad("EditForm.inputToggle.label.email-reset-password"),
|
|
defaultMessage: "Reset password page"
|
|
},
|
|
hint: {
|
|
id: getTrad("EditForm.inputToggle.description.email-reset-password"),
|
|
defaultMessage: "URL of your application's reset password page."
|
|
},
|
|
placeholder: {
|
|
id: getTrad("EditForm.inputToggle.placeholder.email-reset-password"),
|
|
defaultMessage: "ex: https://youtfrontend.com/reset-password"
|
|
},
|
|
name: "email_reset_password",
|
|
type: "string",
|
|
size: 12
|
|
},
|
|
{
|
|
label: {
|
|
id: getTrad("EditForm.inputToggle.label.email-confirmation"),
|
|
defaultMessage: "Enable email confirmation"
|
|
},
|
|
hint: {
|
|
id: getTrad("EditForm.inputToggle.description.email-confirmation"),
|
|
defaultMessage: "When enabled (ON), new registered users receive a confirmation email."
|
|
},
|
|
name: "email_confirmation",
|
|
type: "boolean",
|
|
size: 12
|
|
},
|
|
{
|
|
label: {
|
|
id: getTrad("EditForm.inputToggle.label.email-confirmation-redirection"),
|
|
defaultMessage: "Redirection url"
|
|
},
|
|
hint: {
|
|
id: getTrad("EditForm.inputToggle.description.email-confirmation-redirection"),
|
|
defaultMessage: "After you confirmed your email, choose where you will be redirected."
|
|
},
|
|
placeholder: {
|
|
id: getTrad("EditForm.inputToggle.placeholder.email-confirmation-redirection"),
|
|
defaultMessage: "ex: https://youtfrontend.com/email-confirmation"
|
|
},
|
|
name: "email_confirmation_redirection",
|
|
type: "string",
|
|
size: 12
|
|
}
|
|
];
|
|
|
|
// node_modules/@strapi/plugin-users-permissions/dist/admin/pages/AdvancedSettings/utils/schema.mjs
|
|
var URL_REGEX = new RegExp("(^$)|((.+:\\/\\/.*)(d*)\\/?(.*))");
|
|
var schema = create3().shape({
|
|
email_confirmation_redirection: create().when("email_confirmation", {
|
|
is: true,
|
|
then: create2().matches(URL_REGEX).required(),
|
|
otherwise: create2().nullable()
|
|
}),
|
|
email_reset_password: create2(errorsTrads.string).matches(URL_REGEX, {
|
|
id: errorsTrads.regex.id,
|
|
defaultMessage: "This is not a valid URL"
|
|
}).nullable()
|
|
});
|
|
|
|
// node_modules/@strapi/plugin-users-permissions/dist/admin/pages/AdvancedSettings/index.mjs
|
|
var ProtectedAdvancedSettingsPage = () => (0, import_jsx_runtime.jsx)(Page.Protect, {
|
|
permissions: PERMISSIONS.readAdvancedSettings,
|
|
children: (0, import_jsx_runtime.jsx)(AdvancedSettingsPage, {})
|
|
});
|
|
var AdvancedSettingsPage = () => {
|
|
const { formatMessage } = useIntl();
|
|
const { toggleNotification } = useNotification();
|
|
const { notifyStatus } = useNotifyAT();
|
|
const queryClient = useQueryClient();
|
|
const { get, put } = useFetchClient();
|
|
const { formatAPIError } = useAPIErrorHandler();
|
|
const { isLoading: isLoadingForPermissions, allowedActions: { canUpdate } } = useRBAC({
|
|
update: PERMISSIONS.updateAdvancedSettings
|
|
});
|
|
const { isLoading: isLoadingData, data } = useQuery([
|
|
"users-permissions",
|
|
"advanced"
|
|
], async () => {
|
|
const { data: data2 } = await get("/users-permissions/advanced");
|
|
return data2;
|
|
}, {
|
|
onSuccess() {
|
|
notifyStatus(formatMessage({
|
|
id: getTrad("Form.advancedSettings.data.loaded"),
|
|
defaultMessage: "Advanced settings data has been loaded"
|
|
}));
|
|
},
|
|
onError() {
|
|
toggleNotification({
|
|
type: "danger",
|
|
message: formatMessage({
|
|
id: getTrad("notification.error"),
|
|
defaultMessage: "An error occured"
|
|
})
|
|
});
|
|
}
|
|
});
|
|
const isLoading = isLoadingForPermissions || isLoadingData;
|
|
const submitMutation = useMutation((body) => put("/users-permissions/advanced", body), {
|
|
async onSuccess() {
|
|
await queryClient.invalidateQueries([
|
|
"users-permissions",
|
|
"advanced"
|
|
]);
|
|
toggleNotification({
|
|
type: "success",
|
|
message: formatMessage({
|
|
id: getTrad("notification.success.saved"),
|
|
defaultMessage: "Saved"
|
|
})
|
|
});
|
|
},
|
|
onError(error) {
|
|
toggleNotification({
|
|
type: "danger",
|
|
message: formatAPIError(error)
|
|
});
|
|
},
|
|
refetchActive: true
|
|
});
|
|
const { isLoading: isSubmittingForm } = submitMutation;
|
|
const handleSubmit = async (body) => {
|
|
submitMutation.mutate({
|
|
...body,
|
|
email_confirmation_redirection: body.email_confirmation ? body.email_confirmation_redirection : ""
|
|
});
|
|
};
|
|
if (isLoading) {
|
|
return (0, import_jsx_runtime.jsx)(Page.Loading, {});
|
|
}
|
|
return (0, import_jsx_runtime.jsxs)(Page.Main, {
|
|
"aria-busy": isSubmittingForm,
|
|
children: [
|
|
(0, import_jsx_runtime.jsx)(Page.Title, {
|
|
children: formatMessage({
|
|
id: "Settings.PageTitle",
|
|
defaultMessage: "Settings - {name}"
|
|
}, {
|
|
name: formatMessage({
|
|
id: getTrad("HeaderNav.link.advancedSettings"),
|
|
defaultMessage: "Advanced Settings"
|
|
})
|
|
})
|
|
}),
|
|
(0, import_jsx_runtime.jsx)(Form, {
|
|
onSubmit: handleSubmit,
|
|
initialValues: data.settings,
|
|
validationSchema: schema,
|
|
children: ({ values, isSubmitting, modified }) => {
|
|
return (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
children: [
|
|
(0, import_jsx_runtime.jsx)(Layouts.Header, {
|
|
title: formatMessage({
|
|
id: getTrad("HeaderNav.link.advancedSettings"),
|
|
defaultMessage: "Advanced Settings"
|
|
}),
|
|
primaryAction: (0, import_jsx_runtime.jsx)(Button, {
|
|
loading: isSubmitting,
|
|
type: "submit",
|
|
disabled: !modified || !canUpdate,
|
|
startIcon: (0, import_jsx_runtime.jsx)(ForwardRef$4F, {}),
|
|
size: "S",
|
|
children: formatMessage({
|
|
id: "global.save",
|
|
defaultMessage: "Save"
|
|
})
|
|
})
|
|
}),
|
|
(0, import_jsx_runtime.jsx)(Layouts.Content, {
|
|
children: (0, import_jsx_runtime.jsx)(Box, {
|
|
background: "neutral0",
|
|
hasRadius: true,
|
|
shadow: "filterShadow",
|
|
paddingTop: 6,
|
|
paddingBottom: 6,
|
|
paddingLeft: 7,
|
|
paddingRight: 7,
|
|
children: (0, import_jsx_runtime.jsxs)(Flex, {
|
|
direction: "column",
|
|
alignItems: "stretch",
|
|
gap: 4,
|
|
children: [
|
|
(0, import_jsx_runtime.jsx)(Typography, {
|
|
variant: "delta",
|
|
tag: "h2",
|
|
children: formatMessage({
|
|
id: "global.settings",
|
|
defaultMessage: "Settings"
|
|
})
|
|
}),
|
|
(0, import_jsx_runtime.jsx)(Grid.Root, {
|
|
gap: 6,
|
|
children: [
|
|
{
|
|
label: {
|
|
id: getTrad("EditForm.inputSelect.label.role"),
|
|
defaultMessage: "Default role for authenticated users"
|
|
},
|
|
hint: {
|
|
id: getTrad("EditForm.inputSelect.description.role"),
|
|
defaultMessage: "It will attach the new authenticated user to the selected role."
|
|
},
|
|
options: data.roles.map((role) => ({
|
|
label: role.name,
|
|
value: role.type
|
|
})),
|
|
name: "default_role",
|
|
size: 6,
|
|
type: "enumeration"
|
|
},
|
|
...layout
|
|
].map(({ size, ...field }) => (0, import_jsx_runtime.jsx)(Grid.Item, {
|
|
col: size,
|
|
direction: "column",
|
|
alignItems: "stretch",
|
|
children: (0, import_jsx_runtime.jsx)(MemoizedInputRenderer, {
|
|
...field,
|
|
disabled: field.name === "email_confirmation_redirection" && values.email_confirmation === false,
|
|
label: formatMessage(field.label),
|
|
hint: field.hint ? formatMessage(field.hint) : void 0,
|
|
placeholder: field.placeholder ? formatMessage(field.placeholder) : void 0
|
|
})
|
|
}, field.name))
|
|
})
|
|
]
|
|
})
|
|
})
|
|
})
|
|
]
|
|
});
|
|
}
|
|
})
|
|
]
|
|
});
|
|
};
|
|
export {
|
|
AdvancedSettingsPage,
|
|
ProtectedAdvancedSettingsPage
|
|
};
|
|
//# sourceMappingURL=AdvancedSettings-XGUBZOWK.js.map
|