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

@dotdev/locations

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dotdev/locations - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

99

lib/locations.js

@@ -1,9 +0,20 @@

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
'use strict';
import Q from '@dotdev/ajax-queue';
import Cookie from 'js-cookie';
Object.defineProperty(exports, "__esModule", {
value: true
});
const StoreLocations = function LocationAjaxWrapper(config) {
const settings = config || {};
const defaultSettings = {
var _ajaxQueue = require('@dotdev/ajax-queue');
var _ajaxQueue2 = _interopRequireDefault(_ajaxQueue);
var _jsCookie = require('js-cookie');
var _jsCookie2 = _interopRequireDefault(_jsCookie);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var StoreLocations = function LocationAjaxWrapper(config) {
var settings = config || {};
var defaultSettings = {
url: '/apps/connector',

@@ -13,5 +24,5 @@ params: ''

// Merge configs
};this.settings = _extends(defaultSettings, settings);
};this.settings = Object.assign(defaultSettings, settings);
this.queue = new Q({
this.queue = new _ajaxQueue2.default({
method: 'POST',

@@ -23,9 +34,9 @@ completedAllRequestsEvent: 'locations:requestsCompleted',

this.defaultSuccess = function locationSuccess(response) {
const locations = JSON.parse(response);
const foundEvent = new CustomEvent('locations:found', { detail: { response: locations } });
var locations = JSON.parse(response);
var foundEvent = new CustomEvent('locations:found', { detail: { response: locations } });
document.dispatchEvent(foundEvent);
};
this.defaultError = function locationError(response) {
const error = JSON.parse(response);
const errorEvent = new CustomEvent('locations:error', { detail: { response: error } });
var error = JSON.parse(response);
var errorEvent = new CustomEvent('locations:error', { detail: { response: error } });
document.dispatchEvent(errorEvent);

@@ -47,7 +58,7 @@ };

const options = config || {};
var options = config || {};
options.success = options.success || this.defaultSuccess;
options.error = options.error || this.defaultError;
const request = {
var request = {
url: this.settings.url + '/location-lookup' + this.settings.params,

@@ -65,3 +76,3 @@ data: options.data,

const options = config || {};
var options = config || {};
options.success = options.success || this.defaultSuccess;

@@ -75,3 +86,3 @@ options.error = options.error || this.defaultError;

}
const request = {
var request = {
url: this.settings.url + '/inventory-lookup/locations' + this.settings.params,

@@ -89,3 +100,3 @@ data: options.data,

const options = config || {};
var options = config || {};
options.success = options.success || this.defaultSuccess;

@@ -95,6 +106,6 @@ options.error = options.error || this.defaultError;

if (options.id !== {}) {
const attributes = {
var attributes = {
pick_up_store_id: options.id
};
const request = {
var request = {
url: '/cart/update.js',

@@ -115,10 +126,10 @@ success: options.success,

const options = config || {};
var options = config || {};
options.success = options.success || this.defaultSuccess;
options.error = options.error || this.defaultError;
const attributes = {
var attributes = {
pick_up_store_id: null
};
const request = {
var request = {
url: '/cart/update.js',

@@ -139,8 +150,8 @@ success: options.success,

const options = config || {};
const id = options.id;
var options = config || {};
var id = options.id;
options.success = options.success || this.defaultSuccess;
options.error = options.error || this.defaultError;
const request = {
var request = {
url: this.settings.url + '/locations/' + id + this.settings.params,

@@ -158,6 +169,8 @@ method: 'GET',

const options = config || {};
const { locationId, customerId } = options;
var options = config || {};
var locationId = options.locationId,
customerId = options.customerId;
const data = {
var data = {
location_id: locationId,

@@ -168,4 +181,4 @@ customer_id: customerId

options.success = options.success || function setHomeStore(response) {
const success = JSON.parse(response);
const successEvent = new CustomEvent('homestore:set', {
var success = JSON.parse(response);
var successEvent = new CustomEvent('homestore:set', {
detail: {

@@ -179,5 +192,5 @@ response: success

Cookie.set('HomeStore', data, { expires: 365 });
_jsCookie2.default.set('HomeStore', data, { expires: 365 });
const request = {
var request = {
url: this.settings.url + '/customers/default-location' + this.settings.params,

@@ -196,4 +209,4 @@ success: options.success,

const homeStore = Cookie.get('HomeStore') || '{}';
const json = JSON.parse(homeStore);
var homeStore = _jsCookie2.default.get('HomeStore') || '{}';
var json = JSON.parse(homeStore);
return json;

@@ -205,7 +218,7 @@ };

const options = config || {};
var options = config || {};
options.success = options.success || function returnSuccess(response) {
const success = JSON.parse(response);
const successEvent = new CustomEvent('return:success', {
var success = JSON.parse(response);
var successEvent = new CustomEvent('return:success', {
detail: {

@@ -218,4 +231,8 @@ response: success

options.error = options.error || this.defaultError;
const { id, lineItems, reasonId, customerId } = options;
const data = {
var id = options.id,
lineItems = options.lineItems,
reasonId = options.reasonId,
customerId = options.customerId;
var data = {
line_items: lineItems,

@@ -225,3 +242,3 @@ reason_id: reasonId,

};
const request = {
var request = {
url: this.settings.url + '/orders/' + id + '/return' + this.settings.params,

@@ -236,2 +253,2 @@ success: options.success,

export default StoreLocations;
exports.default = StoreLocations;
{
"name": "@dotdev/locations",
"version": "0.1.3",
"version": "0.1.4",
"description": "Front end store locator api wrapper",

@@ -12,14 +12,14 @@ "browser": "lib/locations.js",

"devDependencies": {
"@babel/core": "^7.1.2",
"@babel/plugin-transform-object-assign": "^7.0.0",
"@babel/plugin-transform-template-literals": "^7.0.0",
"babel-cli": "^6.26.0",
"babel-loader": "^8.0.4",
"babel-core": "^6.26.3",
"babel-plugin-transform-es2015-template-literals": "^6.22.0",
"babel-plugin-transform-object-assign": "^6.22.0",
"eslint": "^5.6.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.14.0",
"babel-preset-env": "^1.7.0",
"eslint": "^4.19.1",
"eslint-config-standard": "^11.0.0",
"eslint-plugin-import": "^2.13.0",
"eslint-plugin-node": "^7.0.1",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0"
"eslint-plugin-promise": "^3.8.0",
"eslint-plugin-standard": "^3.1.0"
},

@@ -31,3 +31,4 @@ "resolutions": {

"lint": "./node_modules/.bin/eslint locations.js",
"test": "npm run lint -- --fix",
"fix": "npm run lint -- --fix",
"test": "npm run lint",
"build": "./node_modules/.bin/babel locations.js -d lib"

@@ -34,0 +35,0 @@ },

Sorry, the diff of this file is not supported yet

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