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.2 to 0.1.3

35

lib/locations.js

@@ -146,7 +146,34 @@ 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; };

StoreLocations.prototype.setHomeStore = function SetACookieOfTheUsersLocation(data) {
StoreLocations.prototype.setHomeStore = function SetACookieAndMetafieldOfTheUsersLocation(config) {
'use strict';
const string = JSON.stringify(data);
Cookie.set('HomeStore', string, { expires: 365 });
const options = config || {};
const { locationId, customerId } = options;
const data = {
location_id: locationId,
customer_id: customerId
};
options.success = options.success || function setHomeStore(response) {
const success = JSON.parse(response);
const successEvent = new CustomEvent('homestore:set', {
detail: {
response: success
}
});
document.dispatchEvent(successEvent);
};
options.error = options.error || this.defaultError;
Cookie.set('HomeStore', data, { expires: 365 });
const request = {
url: this.settings.url + '/customers/default-location' + this.settings.params,
success: options.success,
method: 'PUT',
error: options.error,
data: data
};
this.queue.add(request);
return this;

@@ -185,3 +212,3 @@ };

const request = {
url: this.settings.url + ('/orders/' + id + '/return') + this.settings.params,
url: this.settings.url + '/orders/' + id + '/return' + this.settings.params,
success: options.success,

@@ -188,0 +215,0 @@ method: 'POST',

@@ -140,6 +140,33 @@ import Q from '@dotdev/ajax-queue'

StoreLocations.prototype.setHomeStore = function SetACookieOfTheUsersLocation (data) {
StoreLocations.prototype.setHomeStore = function SetACookieAndMetafieldOfTheUsersLocation (config) {
'use strict'
const string = JSON.stringify(data)
Cookie.set('HomeStore', string, { expires: 365 })
const options = config || {}
const { locationId, customerId } = options
const data = {
location_id: locationId,
customer_id: customerId
}
options.success = options.success || function setHomeStore (response) {
const success = JSON.parse(response)
const successEvent = new CustomEvent('homestore:set', {
detail: {
response: success
}
})
document.dispatchEvent(successEvent)
}
options.error = options.error || this.defaultError
Cookie.set('HomeStore', data, { expires: 365 })
const request = {
url: `${this.settings.url}/customers/default-location${this.settings.params}`,
success: options.success,
method: 'PUT',
error: options.error,
data: data
}
this.queue.add(request)
return this

@@ -176,3 +203,3 @@ }

const request = {
url: this.settings.url + `/orders/${id}/return` + this.settings.params,
url: `${this.settings.url}/orders/${id}/return${this.settings.params}`,
success: options.success,

@@ -179,0 +206,0 @@ method: 'POST',

3

package.json
{
"name": "@dotdev/locations",
"version": "0.1.2",
"version": "0.1.3",
"description": "Front end store locator api wrapper",

@@ -17,2 +17,3 @@ "browser": "lib/locations.js",

"babel-plugin-transform-es2015-template-literals": "^6.22.0",
"babel-plugin-transform-object-assign": "^6.22.0",
"eslint": "^5.6.0",

@@ -19,0 +20,0 @@ "eslint-config-standard": "^12.0.0",

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