<commit_before>// ==LICENSE-BEGIN==
// Copyright 2017 European Digital Reading Lab. All rights reserved.
// Licensed to the Readium Foundation under one or more contributor license agreements.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file exposed on Github (readium) in the project repository.
// ==LICENSE-END==

import { Action } from "readium-desktop/common/models/redux";
import { PublicationDocument } from "readium-desktop/main/db/document/publication";

export enum ActionType {
    UserKeyCheckRequest = "LCP_USER_KEY_CHECK_REQUEST",
    UserKeyCheckError = "LCP_USER_KEY_CHECK_ERROR",
    UserKeyCheckSuccess = "LCP_USER_KEY_CHECK_SUCCESS",

    PassphraseSubmitRequest = "LCP_PASSPHRASE_SUBMIT_REQUEST",
    PassphraseSubmitSuccess = "LCP_PASSPHRASE_SUBMIT_SUCCESS",
    PassphraseSubmitError = "LCP_PASSPHRASE_SUBMIT_ERROR",

    ReturnRequest = "LCP_RETURN_REQUEST",
    ReturnSuccess = "LCP_RETURN_SUCCESS",
    ReturnError = "LCP_RETURN_ERROR",

    RenewRequest = "LCP_RENEW_REQUEST",
    RenewSuccess = "LCP_RENEW_SUCCESS",
    RenewError = "LCP_RENEW_ERROR",

    StatusUpdateRequest = "LCP_STATUS_UPDATE_REQUEST",
    StatusUpdateSuccess = "LCP_STATUS_UPDATE_SUCCESS",
    StatusUpdateError = "LCP_STATUS_UPDATE_ERROR",
}

export function checkUserKey(publication: PublicationDocument, hint: string): Action {
    return {
        type: ActionType.UserKeyCheckRequest,
        payload: {
            publication,
            hint,
        },
    };
}

export function sendPassphrase(publication: PublicationDocument, passphrase: string): Action {
    return {
        type: ActionType.PassphraseSubmitRequest,
        payload: {
            publication,
            passphrase,
        },
    };
}

export function lsdRenew(publication: PublicationDocument): Action {
    return {
        type: ActionType.RenewRequest,
        payload: {
            publication,
        },
    };
}

export function lsdReturn(publication: PublicationDocument): Action {
    return {
        type: ActionType.ReturnRequest,
        payload: {
            publication,
        },
    };
}<commit_msg>fix bad PublicationDocument use<commit_after>// ==LICENSE-BEGIN==
// Copyright 2017 European Digital Reading Lab. All rights reserved.
// Licensed to the Readium Foundation under one or more contributor license agreements.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file exposed on Github (readium) in the project repository.
// ==LICENSE-END==

import { Action } from "readium-desktop/common/models/redux";
import { PublicationView } from "readium-desktop/common/views/publication";

export enum ActionType {
    UserKeyCheckRequest = "LCP_USER_KEY_CHECK_REQUEST",
    UserKeyCheckError = "LCP_USER_KEY_CHECK_ERROR",
    UserKeyCheckSuccess = "LCP_USER_KEY_CHECK_SUCCESS",

    PassphraseSubmitRequest = "LCP_PASSPHRASE_SUBMIT_REQUEST",
    PassphraseSubmitSuccess = "LCP_PASSPHRASE_SUBMIT_SUCCESS",
    PassphraseSubmitError = "LCP_PASSPHRASE_SUBMIT_ERROR",

    ReturnRequest = "LCP_RETURN_REQUEST",
    ReturnSuccess = "LCP_RETURN_SUCCESS",
    ReturnError = "LCP_RETURN_ERROR",

    RenewRequest = "LCP_RENEW_REQUEST",
    RenewSuccess = "LCP_RENEW_SUCCESS",
    RenewError = "LCP_RENEW_ERROR",

    StatusUpdateRequest = "LCP_STATUS_UPDATE_REQUEST",
    StatusUpdateSuccess = "LCP_STATUS_UPDATE_SUCCESS",
    StatusUpdateError = "LCP_STATUS_UPDATE_ERROR",
}

export function checkUserKey(publication: PublicationView, hint: string): Action {
    return {
        type: ActionType.UserKeyCheckRequest,
        payload: {
            publication,
            hint,
        },
    };
}

export function sendPassphrase(publication: PublicationView, passphrase: string): Action {
    return {
        type: ActionType.PassphraseSubmitRequest,
        payload: {
            publication,
            passphrase,
        },
    };
}

export function lsdRenew(publication: PublicationView): Action {
    return {
        type: ActionType.RenewRequest,
        payload: {
            publication,
        },
    };
}

export function lsdReturn(publication: PublicationView): Action {
    return {
        type: ActionType.ReturnRequest,
        payload: {
            publication,
        },
    };
}
{'fraction_non_alphanumeric': 0.08654292343387471, 'fraction_numerical': 0.0018561484918793504, 'mean_word_length': 3.3944954128440368, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5193638', 'n_tokens_mistral': 1252, 'n_tokens_neox': 1233, 'n_words': 279}