UNPKG

@woocommerce/data

Version:
31 lines (30 loc) 1.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getReportStatsError = exports.getReportStats = exports.getReportItems = exports.getReportItemsError = void 0; /** * Internal dependencies */ const utils_1 = require("../utils"); const EMPTY_OBJECT = {}; const getReportItemsError = (state, endpoint, query) => { const resourceName = (0, utils_1.getResourceName)(endpoint, query); return state.itemErrors[resourceName] || false; }; exports.getReportItemsError = getReportItemsError; const getReportItems = (state, endpoint, query) => { const resourceName = (0, utils_1.getResourceName)(endpoint, query); return (state.items[resourceName] || EMPTY_OBJECT); }; exports.getReportItems = getReportItems; const getReportStats = (state, endpoint, query) => { const resourceName = (0, utils_1.getResourceName)(endpoint, query); return (state.stats[resourceName] || EMPTY_OBJECT); }; exports.getReportStats = getReportStats; const getReportStatsError = (state, endpoint, query) => { const resourceName = (0, utils_1.getResourceName)(endpoint, query); return state.statErrors[resourceName] || false; }; exports.getReportStatsError = getReportStatsError;