Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

commercelayer

Package Overview
Dependencies
Maintainers
1
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

commercelayer - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

2

package.json
{
"name": "commercelayer",
"version": "1.1.1",
"version": "1.1.2",
"description": "The official Commerce Layer JS library",

@@ -5,0 +5,0 @@ "main": "./src/main.js",

@@ -5,39 +5,40 @@ const axios = require('axios')

exports.getOrderToken = function getOrderToken() {
var orderToken = utils.getCookie('order_token_' + config.getCountryCode())
if (orderToken != '') {
return orderToken
} else {
return null
}
function getAccessToken() {
return axios
.post('/oauth/token', {
grant_type: "client_credentials",
client_id: config.clientId(),
scope: "market:" + config.marketId()
})
.then(function (response) {
utils.setCookie('access_token_' + config.marketId(), response.data.access_token, response.data.expires_in)
return response.data.access_token
})
}
exports.setOrderToken = function setOrderToken(token) {
utils.setCookie('order_token_' + config.getCountryCode(), token, 30*60*60*24)
}
// axios defaults
axios.defaults.baseURL = config.baseUrl()
axios.defaults.headers.common['Accept'] = 'application/vnd.api+json'
axios.defaults.headers.common['Content-Type'] = 'application/vnd.api+json'
exports.getAccessToken = function getAccessToken() {
// axios interceptors
axios.interceptors.request.use(function (requestConfig) {
requestConfig.headers.Authorization = 'Bearer ' + utils.getCookie('access_token_' + config.marketId())
return requestConfig
}, function (error) {
return Promise.reject(error)
})
var accessTokenFromCookie = utils.getCookie('access_token')
if (accessTokenFromCookie) {
return new Promise(function(resolve, reject){
resolve(accessTokenFromCookie)
})
} else {
var clientId = config.getClientId()
var marketId = config.getMarketId()
return axios
.post('/oauth/token', {
grant_type: "client_credentials",
client_id: clientId,
scope: "market:" + marketId
axios.interceptors.response.use(function (response) {
return response
}, function (error) {
if (error.response.status === 401) {
if (error.response.data.errors[0].code == "INVALID_TOKEN") {
return getAccessToken().then(function(accessToken) {
error.config.headers.Authorization = 'Bearer ' + accessToken
return axios.request(error.config)
})
.then(function (response) {
utils.setCookie('access_token', response.data.access_token, response.data.expires_in - 60)
return response.data.access_token
})
}
}
}
return Promise.reject(error)
})

@@ -1,80 +0,56 @@

exports.getBaseUrl = function getBaseUrl() {
var $baseUrl = document.querySelector('#commercelayer[data-base-url]')
if ($baseUrl) {
return $baseUrl.dataset.baseUrl
} else {
console.log('[Commerce Layer] Missing config: #commercelayer[data-client-id]');
module.exports = {
baseUrl: function() {
var $baseUrl = document.querySelector('#commercelayer[data-base-url]')
if ($baseUrl) {
return $baseUrl.dataset.baseUrl
}
},
clientId: function() {
var $cliendId = document.querySelector('#commercelayer[data-client-id]')
if ($cliendId) {
return $cliendId.dataset.clientId
}
},
marketId: function() {
var $market = document.querySelector('#commercelayer[data-market-id]')
if ($market) {
return $market.dataset.marketId
}
},
countryCode: function() {
var $country = document.querySelector('#commercelayer[data-country-code]')
if ($country) {
return $country.dataset.countryCode
}
},
languageCode: function() {
var $language = document.querySelector('#commercelayer[data-language-code]')
if ($language) {
return $language.dataset.languageCode.split("-")[0]
}
},
cartUrl: function() {
var $cartUrl = document.querySelector('#commercelayer[data-cart-url]')
if ($cartUrl) {
return $cartUrl.dataset.cartUrl
}
},
returnUrl: function() {
var $returnUrl = document.querySelector('#commercelayer[data-return-url]')
if ($returnUrl) {
return $returnUrl.dataset.cartUrl
}
},
privacyUrl: function() {
var $privacyUrl = document.querySelector('#commercelayer[data-privacy-url]')
if ($privacyUrl) {
return $privacyUrl.dataset.privacyUrl
}
},
termsUrl: function() {
var $termsUrl = document.querySelector('#commercelayer[data-terms-url]')
if ($termsUrl) {
return $termsUrl.dataset.termsUrl
}
}
}
exports.getClientId = function getClientId() {
var $cliendId = document.querySelector('#commercelayer[data-client-id]')
if ($cliendId) {
return $cliendId.dataset.clientId
} else {
console.log('[Commerce Layer] Missing config: #commercelayer[data-client-id]');
}
}
exports.getMarketId = function getMarketId() {
var $market = document.querySelector('#commercelayer[data-market-id]')
if ($market) {
return $market.dataset.marketId
} else {
console.log('[Commerce Layer] Missing config: #commercelayer[data-market-id]');
}
}
exports.getCountryCode = function getCountryCode() {
var $country = document.querySelector('#commercelayer[data-country-code]')
if ($country) {
return $country.dataset.countryCode
} else {
console.log('[Commerce Layer] Missing config: #commercelayer[data-country-code]');
}
}
exports.getLanguageCode = function getLanguageCode() {
var $language = document.querySelector('#commercelayer[data-language-code]')
if ($language) {
return $language.dataset.languageCode.split("-")[0]
} else {
console.log('[Commerce Layer] Missing config: #commercelayer[data-language-code]');
}
}
exports.getCartUrl = function getCartUrl() {
var $cartUrl = document.querySelector('#commercelayer[data-cart-url]')
if ($cartUrl) {
return $cartUrl.dataset.cartUrl
} else {
console.log('[Commerce Layer] Missing config: #commercelayer[data-cart-url]');
}
}
exports.getReturnUrl = function getReturnUrl() {
var $returnUrl = document.querySelector('#commercelayer[data-return-url]')
if ($returnUrl) {
return $returnUrl.dataset.cartUrl
} else {
console.log('[Commerce Layer] Missing config: #commercelayer[data-return-url]');
}
}
exports.getPrivacyUrl = function getPrivacyUrl() {
var $privacyUrl = document.querySelector('#commercelayer[data-privacy-url]')
if ($privacyUrl) {
return $privacyUrl.dataset.privacyUrl
} else {
console.log('[Commerce Layer] Missing config: #commercelayer[data-privacy-url]');
}
}
exports.getTermsUrl = function getTermsUrl() {
var $termsUrl = document.querySelector('#commercelayer[data-terms-url]')
if ($termsUrl) {
return $termsUrl.dataset.termsUrl
} else {
console.log('[Commerce Layer] Missing config: #commercelayer[data-terms-url]');
}
}

@@ -8,35 +8,2 @@ const axios = require('axios')

axios.defaults.baseURL = config.getBaseUrl()
axios.defaults.headers.common['Accept'] = 'application/vnd.api+json'
function getOrder() {
return auth.getAccessToken().then(function(accessToken){
return axios
.get('/api/orders?include=line_items&filter[token]=' + auth.getOrderToken(), {
headers: { 'Authorization': 'Bearer ' + accessToken }
})
.then(function(response) {
if (response.data.data.length > 0) {
ui.hideShoppingBagUnavailableMessage()
updateShoppingBagPreview(response.data.data[0])
updateShoppingBagTable(response.data)
updateShoppingBagCheckoutLink(response.data)
return response.data.data[0]
}
})
})
}
function refreshOrder() {
var orderToken = auth.getOrderToken()
if (orderToken) {
getOrder().then(function(order) {
if (order.attributes.status == 'placed') {
createOrder()
getOrder()
}
})
}
}
function getPrices() {

@@ -54,32 +21,59 @@

auth.getAccessToken().then(function(accessToken){
var skus = []
var skusEndpoint = '/api/skus?filter[codes]=' + skuCodes.join(',') +'&include=prices&page[size]=25'
var skuAttributes = [
'id',
'code',
'prices.formatted_amount',
'prices.formatted_compare_at_amount',
]
axios
.get('/api/skus?filter[codes]=' + skuCodes.join(',') +'&include=prices', {
headers: { 'Authorization': 'Bearer ' + accessToken }
})
.then(function(response) {
var skus = normalize(response.data).get([
'id',
'code',
'prices.formatted_amount',
'prices.formatted_compare_at_amount',
])
axios
.get(skusEndpoint)
.then(function(response) {
for (var i = 0; i < skus.length; i++) {
ui.updatePrices(normalize(response.data).get(skuAttributes))
var priceAmount = document.querySelector('[data-sku-code=' + skus[i].code + '] > .amount')
if (priceAmount) {
priceAmount.innerHTML = skus[i].prices[0].formatted_amount
}
var pageCount = response.data.meta.page_count
var priceCompareAmount = document.querySelector('[data-sku-code=' + skus[i].code + '] > .compare-at-amount')
if (priceCompareAmount) {
priceCompareAmount.innerHTML = skus[i].prices[0].formatted_compare_at_amount
}
if (pageCount > 1) {
for (var p=2; p<=pageCount; p++ ) {
var skusEndpointWithPage = skusEndpoint + '&page[number]=' + p
axios
.get(skusEndpointWithPage)
.then(function(response) {
ui.updatePrices(normalize(response.data).get(skuAttributes))
})
}
})
}
})
}
}
function getOrder() {
return axios
.get('/api/orders?include=line_items&filter[token]=' + utils.getOrderToken())
.then(function(response) {
if (response.data.data.length > 0) {
ui.hideShoppingBagUnavailableMessage()
updateShoppingBagPreview(response.data.data[0])
updateShoppingBagTable(response.data)
updateShoppingBagCheckoutLink(response.data)
return response.data.data[0]
}
})
}
function refreshOrder() {
var orderToken = utils.getOrderToken()
if (orderToken) {
getOrder().then(function(order) {
if (order && order.attributes.status == 'placed') {
createOrder()
getOrder()
}
})
}

@@ -100,24 +94,21 @@ }

auth.getAccessToken().then(function(accessToken){
axios
.get('/api/skus?filter[codes]=' + skuCodes.join(','), {
headers: { 'Authorization': 'Bearer ' + accessToken }
})
.then(function(response) {
var skus = normalize(response.data).get([
'id',
'code'
])
axios
.get('/api/skus?filter[codes]=' + skuCodes.join(','))
.then(function(response) {
var skus = normalize(response.data).get([
'id',
'code'
])
for (var i = 0; i < skus.length; i++) {
for (var i = 0; i < skus.length; i++) {
var variant = document.querySelector('.variant[data-sku-code=' + skus[i].code + ']')
if (variant) {
variant.value = skus[i].id
variant.removeAttribute('disabled')
}
var variant = document.querySelector('.variant[data-sku-code=' + skus[i].code + ']')
if (variant) {
variant.value = skus[i].id
variant.removeAttribute('disabled')
}
}
})
})
}
})
}

@@ -137,19 +128,15 @@ }

auth.getAccessToken().then(function(accessToken){
axios
.get('/api/skus/' + skuId , {
headers: { 'Authorization': 'Bearer ' + accessToken }
})
.then(function(response) {
var sku = normalize(response.data).get([
'id',
'inventory'
])
axios
.get('/api/skus/' + skuId)
.then(function(response) {
var sku = normalize(response.data).get([
'id',
'inventory'
])
if (sku.inventory.available) {
ui.updateAddToBagLink(skuId, skuOptionText)
ui.displayAvailableMessage(sku.inventory)
}
})
})
if (sku.inventory.available) {
ui.updateAddToBagLink(skuId, skuOptionText)
ui.displayAvailableMessage(sku.inventory)
}
})

@@ -177,73 +164,52 @@ })

function createOrder() {
return auth.getAccessToken().then(function(accessToken){
return axios
.post('/api/orders', {
data: {
type: 'orders',
attributes: {
shipping_country_code_lock: config.getCountryCode(),
language_code: config.getLanguageCode(),
cart_url: config.getCartUrl(),
return_url: config.getReturnUrl(),
privacy_url: config.getPrivacyUrl(),
terms_url: config.getTermsUrl()
}
return axios
.post('/api/orders', {
data: {
type: 'orders',
attributes: {
shipping_country_code_lock: config.countryCode(),
language_code: config.languageCode(),
cart_url: config.cartUrl(),
return_url: config.returnUrl(),
privacy_url: config.privacyUrl(),
terms_url: config.getTermsUrl()
}
},
{
headers: {
'Authorization': 'Bearer ' + accessToken,
'Content-Type': 'application/vnd.api+json'
}
}
).then(function(response) {
auth.setOrderToken(response.data.data.attributes.token)
return(response.data.data)
})
}
).then(function(response) {
utils.setOrderToken(response.data.data.attributes.token)
return(response.data.data)
})
}
function createLineItem(orderId, skuId, skuName, skuImageUrl) {
return auth.getAccessToken().then(function(accessToken){
return axios
.post('/api/line_items', {
data: {
type: 'line_items',
attributes: {
quantity: 1,
name: skuName,
image_url: skuImageUrl,
_update_quantity: 1
return axios
.post('/api/line_items', {
data: {
type: 'line_items',
attributes: {
quantity: 1,
name: skuName,
image_url: skuImageUrl,
_update_quantity: 1
},
relationships: {
order: {
data: {
type: 'orders',
id: orderId
}
},
relationships: {
order: {
data: {
type: 'orders',
id: orderId
}
},
item: {
data: {
type: 'skus',
id: skuId
}
item: {
data: {
type: 'skus',
id: skuId
}
}
}
},
{
headers: {
'Authorization': 'Bearer ' + accessToken,
'Content-Type': 'application/vnd.api+json'
}
}
)
.then(function(response) {
return(response.data)
})
}
)
.then(function(response) {
return(response.data)
})

@@ -254,45 +220,22 @@

function deleteLineItem(lineItemId) {
return auth.getAccessToken().then(function(accessToken){
return axios
.delete('/api/line_items/' + lineItemId,
{
headers: {
'Authorization': 'Bearer ' + accessToken,
'Content-Type': 'application/vnd.api+json'
}
}
)
return axios
.delete('/api/line_items/' + lineItemId)
.then(function(response) {
return true
})
})
}
function updateLineItem(lineItemId, attributes) {
return auth.getAccessToken().then(function(accessToken){
return axios
.patch('/api/line_items/' + lineItemId, {
data: {
type: 'line_items',
id: lineItemId,
attributes: attributes
}
},
{
headers: {
'Authorization': 'Bearer ' + accessToken,
'Content-Type': 'application/vnd.api+json'
}
return axios
.patch('/api/line_items/' + lineItemId, {
data: {
type: 'line_items',
id: lineItemId,
attributes: attributes
}
)
.then(function(response) {
return(response.data)
})
}
)
.then(function(response) {
return(response.data)
})
}

@@ -374,5 +317,5 @@

utils.addTableColImage(tableRow, line_item.image_url, 'shopping-bag-col-image')
ui.addTableColImage(tableRow, line_item.image_url, 'shopping-bag-col-image')
utils.addTableColText(tableRow, line_item.name, 'shopping-bag-col-name')
ui.addTableColText(tableRow, line_item.name, 'shopping-bag-col-name')

@@ -397,6 +340,6 @@ var quantitySelect = document.createElement('select')

utils.addTableColElement(tableRow, quantitySelect, 'shopping-bag-col-qty')
ui.addTableColElement(tableRow, quantitySelect, 'shopping-bag-col-qty')
utils.addTableColText(tableRow, line_item.formatted_total_amount, 'shopping-bag-col-total')
ui.addTableColText(tableRow, line_item.formatted_total_amount, 'shopping-bag-col-total')

@@ -414,3 +357,3 @@ // remove

})
utils.addTableColElement(tableRow, removeLink, 'shopping-bag-col-remove')
ui.addTableColElement(tableRow, removeLink, 'shopping-bag-col-remove')

@@ -448,3 +391,3 @@

if (auth.getOrderToken()) {
if (utils.getOrderToken()) {
orderPromise = getOrder()

@@ -495,10 +438,11 @@ } else {

exports.init = function() {
refreshOrder()
getPrices()
getVariants()
getInventory()
setupAddToShoppingBag()
setupShoppingBagToggle()
setupShoppingBagOpen()
setupShoppingBagClose()
// refreshOrder()
// getVariants()
// getInventory()
// setupAddToShoppingBag()
// setupShoppingBagToggle()
// setupShoppingBagOpen()
// setupShoppingBagClose()
}

@@ -1,86 +0,118 @@

exports.toggleShoppingBag = function toggleShoppingBag() {
document.querySelector('#shopping-bag').classList.toggle("open");
document.querySelector('#main').classList.toggle("open");
}
module.exports = {
exports.openShoppingBag = function openShoppingBag() {
document.querySelector('#shopping-bag').classList.add("open");
document.querySelector('#main').classList.add("open");
}
updatePrices: function(skus) {
for (var k = 0; k < skus.length; k++) {
var priceAmount = document.querySelector('[data-sku-code=' + skus[k].code + '] > .amount')
if (priceAmount) {
priceAmount.innerHTML = skus[k].prices[0].formatted_amount
}
var priceCompareAmount = document.querySelector('[data-sku-code=' + skus[k].code + '] > .compare-at-amount')
if (priceCompareAmount) {
priceCompareAmount.innerHTML = skus[k].prices[0].formatted_compare_at_amount
}
}
},
toggleShoppingBag: function() {
document.querySelector('#shopping-bag').classList.toggle("open");
document.querySelector('#main').classList.toggle("open");
},
openShoppingBag: function() {
document.querySelector('#shopping-bag').classList.add("open");
document.querySelector('#main').classList.add("open");
},
closeShoppingBag: function() {
document.querySelector('#shopping-bag').classList.remove("open");
document.querySelector('#main').classList.remove("open");
},
displayAvailableMessage: function(inventory) {
var $availableMessage = document.querySelector('.available-message')
exports.closeShoppingBag = function closeShoppingBag() {
document.querySelector('#shopping-bag').classList.remove("open");
document.querySelector('#main').classList.remove("open");
}
if ($availableMessage) {
exports.displayAvailableMessage = function displayAvailableMessage(inventory) {
var $availableMessage = document.querySelector('.available-message')
first_level = inventory.levels[0]
if ($availableMessage) {
if (first_level.quantity == 0) {
for(var k=1; k < inventory.levels.length; k++) {
level = inventory.levels[k]
if (level.quantity > 0) {
first_level = level
break
}
}
}
first_level = inventory.levels[0]
if (first_level.quantity > 0) {
first_delivery_lead_time = first_level.delivery_lead_times[0]
if (first_level.quantity == 0) {
for(var k=1; k < inventory.levels.length; k++) {
level = inventory.levels[k]
if (level.quantity > 0) {
first_level = level
break
var $availableMessageQty = document.querySelector('.available-message-qty')
if ($availableMessageQty) {
$availableMessageQty.innerHTML = first_level.quantity
}
}
}
if (first_level.quantity > 0) {
first_delivery_lead_time = first_level.delivery_lead_times[0]
var $availableMessageMinDays = document.querySelector('.available-message-min-days')
if ($availableMessageMinDays) {
$availableMessageMinDays.innerHTML = first_delivery_lead_time.min.days
}
var $availableMessageQty = document.querySelector('.available-message-qty')
if ($availableMessageQty) {
$availableMessageQty.innerHTML = first_level.quantity
}
var $availableMessageMaxDays = document.querySelector('.available-message-max-days')
if ($availableMessageMaxDays) {
$availableMessageMaxDays.innerHTML = first_delivery_lead_time.max.days
}
var $availableMessageMinDays = document.querySelector('.available-message-min-days')
if ($availableMessageMinDays) {
$availableMessageMinDays.innerHTML = first_delivery_lead_time.min.days
}
var $availableMessageShippingPrice = document.querySelector('.available-message-shipping-price')
if ($availableMessageShippingPrice) {
$availableMessageShippingPrice.innerHTML = first_delivery_lead_time.shipping_method.formatted_price_amount
}
var $availableMessageMaxDays = document.querySelector('.available-message-max-days')
if ($availableMessageMaxDays) {
$availableMessageMaxDays.innerHTML = first_delivery_lead_time.max.days
}
$availableMessage.style.display = 'block'
var $availableMessageShippingPrice = document.querySelector('.available-message-shipping-price')
if ($availableMessageShippingPrice) {
$availableMessageShippingPrice.innerHTML = first_delivery_lead_time.shipping_method.formatted_price_amount
}
$availableMessage.style.display = 'block'
}
}
document.querySelector('.unavailable-message').style.display = 'none'
},
displayUnavailableMessage: function() {
document.querySelector('.available-message').style.display = 'none'
document.querySelector('.unavailable-message').style.display = 'block'
},
displayShoppingBagUnavailableMessage: function() {
document.querySelector('.shopping-bag-unavailable-message').style.display = 'block'
},
hideShoppingBagUnavailableMessage: function() {
document.querySelector('.shopping-bag-unavailable-message').style.display = 'none'
},
updateAddToBagLink: function(skuId, skuOptionText) {
var $addToBag = document.querySelector(".add-to-bag")
document.querySelector('.unavailable-message').style.display = 'none'
}
exports.displayUnavailableMessage = function displayUnavailableMessage() {
document.querySelector('.available-message').style.display = 'none'
document.querySelector('.unavailable-message').style.display = 'block'
}
exports.displayShoppingBagUnavailableMessage = function displayShoppingBagUnavailableMessage() {
document.querySelector('.shopping-bag-unavailable-message').style.display = 'block'
}
exports.hideShoppingBagUnavailableMessage = function hideShoppingBagUnavailableMessage() {
document.querySelector('.shopping-bag-unavailable-message').style.display = 'none'
}
exports.updateAddToBagLink = function updateAddToBagLink(skuId, skuOptionText) {
var $addToBag = document.querySelector(".add-to-bag")
if ($addToBag) {
$addToBag.dataset.skuId = skuId
$addToBag.dataset.skuName = $addToBag.dataset.productName + ' (' + skuOptionText + ')'
$addToBag.removeAttribute('disabled')
if ($addToBag) {
$addToBag.dataset.skuId = skuId
$addToBag.dataset.skuName = $addToBag.dataset.productName + ' (' + skuOptionText + ')'
$addToBag.removeAttribute('disabled')
}
},
addTableColText: function(tableRow, text, className) {
var tableCol = document.createElement('td')
tableCol.classList.add('shopping-bag-col')
tableCol.classList.add(className)
var tableColText = document.createTextNode(text)
tableCol.appendChild(tableColText)
tableRow.appendChild(tableCol)
},
addTableColImage: function(tableRow, imageUrl, className) {
var tableCol = document.createElement('td')
tableCol.classList.add('shopping-bag-col')
tableCol.classList.add(className)
var tableColImg = document.createElement('img')
tableColImg.src = imageUrl
tableCol.appendChild(tableColImg)
tableRow.appendChild(tableCol)
},
addTableColElement: function(tableRow, element, className) {
var tableCol = document.createElement('td')
tableCol.classList.add('shopping-bag-col')
tableCol.classList.add(className)
tableCol.appendChild(element)
tableRow.appendChild(tableCol)
}
}

@@ -1,49 +0,36 @@

exports.setCookie = function setCookie(cname, cvalue, exsecs) {
var d = new Date();
d.setTime(d.getTime() + (exsecs*1000));
var expires = "expires="+ d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
const config = require('./config')
exports.getCookie = function getCookie(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
module.exports = {
setCookie: function(cname, cvalue, exsecs) {
var d = new Date();
d.setTime(d.getTime() + (exsecs*1000));
var expires = "expires="+ d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
},
getCookie: function(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
},
getOrderToken: function() {
var orderToken = this.getCookie('order_token_' + config.countryCode())
if (orderToken != '') {
return orderToken
} else {
return null
}
return "";
},
setOrderToken: function(token) {
this.setCookie('order_token_' + config.countryCode(), token, 30*60*60*24)
}
}
exports.addTableColText = function addTableColText(tableRow, text, className) {
var tableCol = document.createElement('td')
tableCol.classList.add('shopping-bag-col')
tableCol.classList.add(className)
var tableColText = document.createTextNode(text)
tableCol.appendChild(tableColText)
tableRow.appendChild(tableCol)
}
exports.addTableColImage = function addTableColImage(tableRow, imageUrl, className) {
var tableCol = document.createElement('td')
tableCol.classList.add('shopping-bag-col')
tableCol.classList.add(className)
var tableColImg = document.createElement('img')
tableColImg.src = imageUrl
tableCol.appendChild(tableColImg)
tableRow.appendChild(tableCol)
}
exports.addTableColElement = function addTableColElement(tableRow, element, className) {
var tableCol = document.createElement('td')
tableCol.classList.add('shopping-bag-col')
tableCol.classList.add(className)
tableCol.appendChild(element)
tableRow.appendChild(tableCol)
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc