"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const reactClient = require("@contember/react-client");
const react = require("react");
const variables = require("../../lib/variables.cjs");
const useSingleTenantMutation = require("../../lib/useSingleTenantMutation.cjs");
const LOGIN_MUTATION = `
		signIn(email: $email, password: $password, expiration: $expiration, otpToken: $otpToken) {
			ok
			error {
				code
				endUserMessage
			}
			result {
				token
				person {
					id
					email
				}
			}
		}
`;
const loginVariables = {
  email: variables.GQLVariable.Required(variables.GQLVariable.String),
  password: variables.GQLVariable.Required(variables.GQLVariable.String),
  expiration: variables.GQLVariable.Int,
  otpToken: variables.GQLVariable.String
};
const useSignIn = () => {
  const loginToken = reactClient.useLoginToken();
  return useSingleTenantMutation.useSingleTenantMutation(LOGIN_MUTATION, loginVariables, react.useMemo(() => ({
    apiTokenOverride: loginToken,
    headers: {
      "X-Contember-Token-Path": "data.result.result.token"
    }
  }), [loginToken]));
};
const useLogin = useSignIn;
exports.useLogin = useLogin;
exports.useSignIn = useSignIn;
//# sourceMappingURL=signIn.cjs.map
