Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
const fs = require('fs');
const path = require('path');
const _ = require('lodash');
const request = require('request-promise-native');
const MoltinGateway = require('@moltin/sdk').gateway;
const Moltin = MoltinGateway({
client_id: process.env.MOLTIN_CLIENT_ID,
client_secret: process.env.MOLTIN_CLIENT_SECRET
});
if (!Moltin.Files) {
// Moltin JS SDK does not support files operation in 3.3.0
Moltin.Files = Object.setPrototypeOf(
Object.assign({}, Moltin.Products),
Moltin.Products
);
Moltin.Files.endpoint = 'files';
}
(async function() {
// There are only 42 images in the AW catalog and the default pagination limit in Moltin API is 100
const images = (await Moltin.Files.All()).data;
import { gateway as MoltinGateway } from '@moltin/sdk'
const Moltin = MoltinGateway({
client_id: 'EdP3Gi1agyUF3yFS7Ngm8iyodLgbSR3wY4ceoJl0d2'
})
export default {
getHomepageProducts () {
return Moltin.Products.Filter({}).With('main_image').Limit(8).All()
},
findBySlug (slug) {
return Moltin.Products.Filter({
eq: {
slug: slug
}
}).With(['main_image', 'brands']).Limit(1).All()
},
const MoltinGateway = require('@moltin/sdk').gateway;
let client_id = 'j6hSilXRQfxKohTndUuVrErLcSJWP15P347L6Im0M4';
if (process.env.REACT_APP_MOLTIN_CLIENT_ID) {
client_id = process.env.REACT_APP_MOLTIN_CLIENT_ID;
}
const Moltin = MoltinGateway({
client_id,
application: 'react-demo-store'
});
export const GetProducts = () =>
Moltin.Products.With('files, main_images, collections').All();
export const GetProduct = ID => Moltin.Products.Get(ID);
export const GetCategories = () => Moltin.Categories.With('products').All();
export const GetCategory = ID => Moltin.Categories.Get(ID);
export const GetCollections = () => Moltin.Collections.With('products').All();
export const GetBrands = () => Moltin.Brands.All();
const MoltinGateway = require('@moltin/sdk').gateway;
let client_id = 'j6hSilXRQfxKohTndUuVrErLcSJWP15P347L6Im0M4';
if (process.env.REACT_APP_MOLTIN_CLIENT_ID) {
client_id = process.env.REACT_APP_MOLTIN_CLIENT_ID;
}
var exports = module.exports = {};
const Moltin = MoltinGateway({
client_id,
application: 'react-demo-store'
});
exports.GetProducts = function() {
return Moltin.Products.With('files, main_images, collections').All()
};
exports.GetProduct = function(ID) {
return Moltin.Products.Get(ID)
}
exports.GetCategories = function() {
return Moltin.Categories.With('products').All()
}
import { gateway as MoltinGateway } from '@moltin/sdk'
const Moltin = MoltinGateway({
client_id:
process.env.MOLTIN_CLIENT_ID || 'EdP3Gi1agyUF3yFS7Ngm8iyodLgbSR3wY4ceoJl0d2'
})
export const getProducts = () => Moltin.Products.With('main_image').All()
export const getProductById = id => Moltin.Products.With('main_image').Get(id)
export const addToCart = (cartId, productId, quantity) =>
Moltin.Cart(cartId).AddProduct(productId, quantity)
export const getCartItems = id => Moltin.Cart(id).Items()
export const removeFromCart = (productId, cartId) =>
Moltin.Cart(cartId).RemoveItem(productId)
const MoltinGateway = require('@moltin/sdk').gateway;
let client_id = 'j6hSilXRQfxKohTndUuVrErLcSJWP15P347L6Im0M4';
if (process.env.REACT_APP_MOLTIN_CLIENT_ID) {
client_id = process.env.REACT_APP_MOLTIN_CLIENT_ID;
}
var exports = (module.exports = {});
const Moltin = MoltinGateway({
client_id,
application: 'react-demo-store'
});
exports.GetProducts = function(resources) {
return Moltin.Products.With(resources).All();
};
exports.GetProduct = function(ID) {
return Moltin.Products.Get(ID);
};
exports.GetCategories = function(resources) {
return Moltin.Categories.With(resources).All();
};