vsf-utilities
Advanced tools
Comparing version 1.0.0 to 1.0.1
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const lodash_custom_min_1 = require("../lodash/lodash.custom.min"); | ||
const replaceNumberToString = obj => { | ||
Object.keys(obj).forEach(key => { | ||
const get_1 = __importDefault(require("lodash/get")); | ||
const flow_1 = __importDefault(require("lodash/flow")); | ||
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep")); | ||
const replaceNumberToString = (obj) => { | ||
Object.keys(obj).forEach((key) => { | ||
if (obj[key] !== null && typeof obj[key] === 'object') { | ||
@@ -15,10 +20,5 @@ return replaceNumberToString(obj[key]); | ||
}; | ||
const transformToArray = value => Array.isArray(value) ? value : Object.values(value); | ||
const getProductOptions = (product, optionsName) => lodash_custom_min_1.flow([ | ||
lodash_custom_min_1.get, | ||
lodash_custom_min_1.cloneDeep, | ||
transformToArray, | ||
replaceNumberToString | ||
])(product, `product_option.extension_attributes.${optionsName}`, []); | ||
const transformToArray = (value) => Array.isArray(value) ? value : Object.values(value); | ||
const getProductOptions = (product, optionsName) => flow_1.default([get_1.default, cloneDeep_1.default, transformToArray, replaceNumberToString])(product, `product_option.extension_attributes.${optionsName}`, []); | ||
exports.default = getProductOptions; | ||
//# sourceMappingURL=getProductOptions.js.map |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.productsEquals = exports.productChecksum = void 0; | ||
const productChecksum_1 = require("./productChecksum"); | ||
const productChecksum_1 = __importDefault(require("./productChecksum")); | ||
exports.productChecksum = productChecksum_1.default; | ||
const productChecksum_2 = require("./productChecksum"); | ||
const productChecksum_2 = __importDefault(require("./productChecksum")); | ||
exports.productsEquals = productChecksum_2.default; | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const getProductOptions_1 = require("./getProductOptions"); | ||
const getProductOptions_1 = __importDefault(require("./getProductOptions")); | ||
const sha3_1 = require("sha3"); | ||
@@ -5,0 +8,0 @@ const getDataToHash = (product) => { |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const productChecksum_1 = require("./productChecksum"); | ||
const getProductOptions_1 = require("./getProductOptions"); | ||
const productChecksum_1 = __importDefault(require("./productChecksum")); | ||
const getProductOptions_1 = __importDefault(require("./getProductOptions")); | ||
// 'id' check | ||
@@ -6,0 +9,0 @@ const getServerItemId = (product) => product.server_item_id || product.item_id; |
@@ -6,3 +6,3 @@ import AssignPriceParams from './types/AssignPriceParams'; | ||
*/ | ||
declare function assignPrice({ product, target, price, tax, deprecatedPriceFieldsSupport }: AssignPriceParams): void; | ||
declare function assignPrice({ product, target, price, tax, deprecatedPriceFieldsSupport, }: AssignPriceParams): void; | ||
export default assignPrice; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const lodash_custom_min_1 = require("../lodash/lodash.custom.min"); | ||
const camelCase_1 = __importDefault(require("lodash/camelCase")); | ||
/** | ||
@@ -9,3 +12,3 @@ * change object keys to camelCase | ||
return Object.keys(obj).reduce((accObj, currKey) => { | ||
accObj[lodash_custom_min_1.camelCase(currKey)] = obj[currKey]; | ||
accObj[camelCase_1.default(currKey)] = obj[currKey]; | ||
return accObj; | ||
@@ -18,7 +21,7 @@ }, {}); | ||
*/ | ||
function assignPrice({ product, target, price, tax = 0, deprecatedPriceFieldsSupport = true }) { | ||
function assignPrice({ product, target, price, tax = 0, deprecatedPriceFieldsSupport = true, }) { | ||
let priceUpdate = { | ||
[target]: price, | ||
[`${target}_tax`]: tax, | ||
[`${target}_incl_tax`]: price + tax | ||
[`${target}_incl_tax`]: price + tax, | ||
}; | ||
@@ -25,0 +28,0 @@ if (deprecatedPriceFieldsSupport) { |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const updateProductPrices_1 = require("./updateProductPrices"); | ||
const updateProductPrices_1 = __importDefault(require("./updateProductPrices")); | ||
function calculateProductTax({ product, taxClasses, taxCountry = 'PL', taxRegion = '', sourcePriceInclTax = false, deprecatedPriceFieldsSupport = false, finalPriceInclTax = true, userGroupId = null, isTaxWithUserGroupIsActive }) { | ||
@@ -5,0 +8,0 @@ let rateFound = false; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getUserGroupIdToUse = exports.checkIfTaxWithUserGroupIsActive = exports.calculateProductTax = void 0; | ||
const calculateProductTax_1 = require("./calculateProductTax"); | ||
const calculateProductTax_1 = __importDefault(require("./calculateProductTax")); | ||
exports.calculateProductTax = calculateProductTax_1.default; | ||
const checkIfTaxWithUserGroupIsActive_1 = require("./checkIfTaxWithUserGroupIsActive"); | ||
const checkIfTaxWithUserGroupIsActive_1 = __importDefault(require("./checkIfTaxWithUserGroupIsActive")); | ||
exports.checkIfTaxWithUserGroupIsActive = checkIfTaxWithUserGroupIsActive_1.default; | ||
const getUserGroupIdToUse_1 = require("./getUserGroupIdToUse"); | ||
const getUserGroupIdToUse_1 = __importDefault(require("./getUserGroupIdToUse")); | ||
exports.getUserGroupIdToUse = getUserGroupIdToUse_1.default; | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const isSpecialPriceActive_1 = require("./isSpecialPriceActive"); | ||
const createSinglePrice_1 = require("./createSinglePrice"); | ||
const assignPrice_1 = require("./assignPrice"); | ||
const isSpecialPriceActive_1 = __importDefault(require("./isSpecialPriceActive")); | ||
const createSinglePrice_1 = __importDefault(require("./createSinglePrice")); | ||
const assignPrice_1 = __importDefault(require("./assignPrice")); | ||
function updateProductPrices({ product, rate, sourcePriceInclTax = false, deprecatedPriceFieldsSupport = false, finalPriceInclTax = true }) { | ||
@@ -7,0 +10,0 @@ const rate_factor = parseFloat(rate.rate) / 100; |
{ | ||
"name": "vsf-utilities", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Utilities functions shared between vsf projects", | ||
@@ -30,2 +30,3 @@ "keywords": [ | ||
"dependencies": { | ||
"lodash": "^4.17.19", | ||
"sha3": "^2.1.3" | ||
@@ -32,0 +33,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40635
506
2
+ Addedlodash@^4.17.19
+ Addedlodash@4.17.21(transitive)