Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/modules / ___dist / utils / formatOrderStatus.js
Size: Mime:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.formatOrderStatus = formatOrderStatus;
exports.default = void 0;

var _exotic = require("../exotic");

const ORDER_STATUS_LABEL = {
  'NONE': 'None',
  'ONHOLD': 'On hold',
  'SUBMITTED': 'Submitted',
  'READYTOEDIT': 'Ready to edit',
  'FREEZEEDIT': 'Freeze edit',
  'SUBMITTEDTOFULFILMENT': 'Submitted to fulfillment',
  'READYTOSHIP': 'Ready to ship',
  'SHIPPED': 'Shipped',
  'RETURNSUBMITTED': 'Return submitted',
  'UNABLETOSHIP': 'Unable to ship',
  // Cancelled in India/British english
  'CANCELED': 'Canceled',
  'DELIVERED': 'Delivered',
  'STANDARD_DELIVERY': 'Standard Delivery'
};

function formatOrderStatus(status) {
  /**
   * @todo @fixme @invalid
   * @note @ganesh
   * this is bad performance
   * obviously was copied from formatPrice which is @deprecated
   * this is not a reusable util, this is a domain specific data
   */
  if ((0, _exotic.isString)(status)) {
    return ORDER_STATUS_LABEL[status] || _exotic.EMPTY_STRING;
  } else {
    return 'N/A';
  } // try {
  //   return ORDER_STATUS_LABEL[status]
  // } catch (error) {
  //   return 'N/A'
  // }

}

var _default = formatOrderStatus;
exports.default = _default;