'use strict';

const watchers = require('./watchers-203d7acd.js');

/**
 * Clear the current checkout.
 */
const clearCheckout = () => watchers.clearCheckout(watchers.state.formId, watchers.state.mode);
/**
 * Lock the checkout (disables input and submission)
 * Pass a lock name to prevent conflicts and allow multiple locks.
 */
const lockCheckout = lockName => (watchers.state.locks = [...watchers.state.locks, lockName]);
/**
 * Unlock the checkout.
 * Pass an optional lock name to only unlock a specific lock
 */
const unLockCheckout = (lockName = '') => (watchers.state.locks = !!lockName ? watchers.state.locks.filter(name => name !== lockName) : []);

exports.clearCheckout = clearCheckout;
exports.lockCheckout = lockCheckout;
exports.unLockCheckout = unLockCheckout;
