import { OxPrompt } from '@operato/popup';
import { CustomAlert } from '@operato/shell';
export const showToast = (param) => {
    let message = '';
    let type = '';
    // 파라미터가 string이면 메세지만, object면 message 속성에서 꺼내기
    if (typeof param == 'string') {
        message = param;
    }
    else {
        message = param.message;
        type = param.type || '';
    }
    document.dispatchEvent(new CustomEvent('notify', {
        detail: {
            type,
            message
        }
    }));
};
export const showConfirm = async (param) => {
    let type;
    let title = '';
    let text = '';
    let confirmButton = { text: '확인' };
    let cancelButton = { text: '취소' };
    // 파라미터가 string이면 메세지만, object면 text 속성에서 꺼내기
    if (typeof param === 'string') {
        text = param;
        type = 'info';
    }
    else {
        type = param.type || type;
        title = param.title || title;
        text = param.text || text;
        confirmButton = param.confirmButton || confirmButton;
    }
    return await OxPrompt.open({
        type: type,
        title: title,
        text: text,
        confirmButton: confirmButton,
        cancelButton: cancelButton
    });
};
export const showAlert = (param) => {
    let type;
    let title = '';
    let text = '';
    let confirmButton = { text: '확인' };
    // 파라미터가 string이면 메세지만, object면 text 속성에서 꺼내기
    if (typeof param === 'string') {
        text = param;
    }
    else {
        type = param.type || type;
        title = param.title || title;
        text = param.text || text;
        confirmButton = param.confirmButton || confirmButton;
    }
    CustomAlert({
        type: type,
        title: title,
        text: text,
        confirmButton: confirmButton
    });
};
//# sourceMappingURL=alert.js.map