UNPKG

@chec/react-commercejs-hooks

Version:

ReactJS hooks for using Commerce.js with React projects

22 lines (21 loc) 721 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var useCheckout_1 = __importDefault(require("./useCheckout")); function useTotals() { var checkout = useCheckout_1.default(); if (!checkout) { return false; } var _a = checkout.live, subtotal = _a.subtotal, total = _a.total, totalDue = _a.total_due, totalWithTax = _a.total_with_tax, tax = _a.tax; return { subtotal: subtotal, total: total, totalWithTax: totalWithTax, totalDue: totalDue, tax: tax, }; } exports.default = useTotals;