"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.pushUrl = exports.goForward = exports.goBack = exports.goHome = void 0;
var error_1 = require("../api/error");
var actions_1 = require("../constants/actions");
/**
 * Go back to the initial task URL
 *
 * @export
 * @returns {ReduxThunkedAction}
 */
function goHome() {
    return function (dispatch, getState) {
        var initUrl = getState().taskpane.initialUrl;
        if (initUrl != null) {
            dispatch({
                type: actions_1.ActionType.TASK_PANE_HOME
            });
        }
        else {
            throw new error_1.MgError("Case not handled yet: Home action when no initial task URL set");
        }
    };
}
exports.goHome = goHome;
/**
 * Go back one entry in the task pane navigation history
 *
 * @export
 * @returns
 */
function goBack() {
    return {
        type: actions_1.ActionType.TASK_PANE_BACK
    };
}
exports.goBack = goBack;
/**
 * Go forward one entry in the task pane navigation history
 *
 * @export
 * @returns
 */
function goForward() {
    return {
        type: actions_1.ActionType.TASK_PANE_FORWARD
    };
}
exports.goForward = goForward;
/**
 * Pushes the given URL to the task pane navigation history stack
 *
 * @export
 * @param {string} url
 * @param {boolean} [silent]
 * @returns
 */
function pushUrl(url, silent) {
    return {
        type: actions_1.ActionType.TASK_PANE_PUSH_URL,
        payload: {
            url: url,
            silent: silent
        }
    };
}
exports.pushUrl = pushUrl;
//# sourceMappingURL=taskpane.js.map