@oondemand/oon-core-front 0.7.29 → 0.7.32

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.
@@ -4051,6 +4051,11 @@ function CoreUsersAccess() {
4051
4051
  const defaultRole = useMemo8(() => roles.find((role) => !role.admin)?.code || roles[0]?.code || "", [roles]);
4052
4052
  const selectedRole = roleCode || defaultRole;
4053
4053
  const pendingKeys = useRef4(/* @__PURE__ */ new Map());
4054
+ function deliveryMessage(data, issued) {
4055
+ if (data.delivery?.status === "sent") return `${issued} O convite foi enviado por e-mail; o link abaixo tamb\xE9m pode ser copiado.`;
4056
+ if (data.delivery?.status === "failed") return `${issued} O e-mail n\xE3o p\xF4de ser enviado${data.delivery.reasonCode ? ` (${data.delivery.reasonCode})` : ""}. Copie o link e envie manualmente ao usu\xE1rio.`;
4057
+ return `${issued} Copie o link e envie manualmente ao usu\xE1rio.`;
4058
+ }
4054
4059
  function operationKey(action) {
4055
4060
  if (!pendingKeys.current.has(action)) pendingKeys.current.set(action, crypto.randomUUID());
4056
4061
  return pendingKeys.current.get(action);
@@ -4064,7 +4069,7 @@ function CoreUsersAccess() {
4064
4069
  onSuccess: async (data) => {
4065
4070
  pendingKeys.current.clear();
4066
4071
  setInviteUrl(data.inviteUrl);
4067
- setMessage("Convite criado. Copie o link e envie manualmente ao usu\xE1rio.");
4072
+ setMessage(deliveryMessage(data, "Convite criado."));
4068
4073
  setEmail("");
4069
4074
  setName("");
4070
4075
  await queryClient.invalidateQueries({ queryKey: ["oon", "rbac", "users"] });
@@ -4090,7 +4095,7 @@ function CoreUsersAccess() {
4090
4095
  mutationFn: async (id) => (await http.post(`/core/users/invitations/${id}/regenerate`, { version: users.data?.find((user) => user.invitation?.id === id)?.invitation?.version }, { headers: { "idempotency-key": operationKey(`reissue:${id}:${users.data?.find((user) => user.invitation?.id === id)?.invitation?.version}`) } })).data,
4091
4096
  onSuccess: async (data) => {
4092
4097
  setInviteUrl(data.inviteUrl);
4093
- setMessage("Novo link gerado. O link anterior foi invalidado.");
4098
+ setMessage(deliveryMessage(data, "Novo link gerado e o anterior foi invalidado."));
4094
4099
  await queryClient.invalidateQueries({ queryKey: ["oon", "rbac", "users"] });
4095
4100
  }
4096
4101
  });
@@ -5739,4 +5744,4 @@ export {
5739
5744
  CoreOrganizationSwitcher,
5740
5745
  coreInitials
5741
5746
  };
5742
- //# sourceMappingURL=chunk-MRRN2HAU.js.map
5747
+ //# sourceMappingURL=chunk-GIDNQRK6.js.map