UNPKG

@woocommerce/data

Version:
36 lines (35 loc) 1.32 kB
"use strict"; /** * Internal dependencies */ Object.defineProperty(exports, "__esModule", { value: true }); exports.getImportError = exports.getImportTotals = exports.getImportStatus = exports.getFormSettings = exports.getImportStarted = void 0; const getImportStarted = (state) => { const { activeImport, lastImportStartTimestamp } = state; return { activeImport, lastImportStartTimestamp } || {}; }; exports.getImportStarted = getImportStarted; const getFormSettings = (state) => { const { period, skipPrevious } = state; return { period, skipPrevious } || {}; }; exports.getFormSettings = getFormSettings; const getImportStatus = (state, query) => { const stringifiedQuery = JSON.stringify(query); return state.importStatus[stringifiedQuery] || {}; }; exports.getImportStatus = getImportStatus; const getImportTotals = (state, query) => { const { importTotals, lastImportStartTimestamp } = state; const stringifiedQuery = JSON.stringify(query); return ({ ...importTotals[stringifiedQuery], lastImportStartTimestamp, } || {}); }; exports.getImportTotals = getImportTotals; const getImportError = (state, query) => { const stringifiedQuery = JSON.stringify(query); return state.errors[stringifiedQuery] || false; }; exports.getImportError = getImportError;