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

@dotdev/locations

Package Overview
Dependencies
Maintainers
16
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dotdev/locations

Front end store locator api wrapper

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
16
Created
Source

Store location

import Locations from '@dotdev/locations'

const locationsJS = new Locations({options})
Options - optional - object

You are able to provide options to locations that will assist with testing. The options are not intended to be used for production.

Using the following settings will send all requests to the Alice mcCall dev environment.

const locationsJS = new StoreLocations({
  url: 'https://connector-dev.alicemccall.io/api/apps',
  params: '?shop=alice-mccall-stage.myshopify.com',
  storeKey: 'pickup_store_id',
  locationsUrl: '/location-lookup',
  inventoryUrl: '/inventory-lookup/locations'
})

The default url is '/apps/connector' and there are no default parameters

Methods

locationLookup({config})

Description

Find locations near to specified coordinates.

{config} - required - object
data - required - object

It is required that you send the location to the locationLookup

data: {
  coordinates: {
    latitude: lat,
    longitude: long
  }
}
success - optional - function

A callback function for once the stores have been located

success: function (response) {
  const json = JSON.parse(response)
}
error - optional - function

A callback function fired if the API returns an error

error: function (err) {
  console.error(err)
}
Example
const request = {
  data: {
    coordinates: {
      latitude: lat,
      longitude: long
    }
  },
  success: function (response) {
    const json = JSON.parse(response)
  }.bind(this)
}
locationsJS.locationLookup(request)

inventoryLocationsByIds({config})

Description

Find locations that stock a specified list of variants by id.

{config} - required - object
data - required - object

It is required that you send the location and an array of variant ids to the locationLookup

data: {
  coordinates: {
    latitude: lat,
    longitude: long
  },
  variants: [16326964609081, 12445435324234, 32452344534553]
}
success - optional - function

A callback function for once the stores have been located

success: function (response) {
  const json = JSON.parse(response)
}
error - optional - function

A callback function fired if the API returns an error

error: function (err) {
  console.error(err)
}
Example
const request = {
  data: {
    coordinates: {
      latitude: lat,
      longitude: long
    },
    variants: [16326964609081]
  },
  error: function locationError (response) {
    console.log(response)
  },
  success: function (response) {
    const json = JSON.parse(response)
  }.bind(this)
}
this.storeLocations.inventoryLocationsByIds(request)

setClickAndCollectStore({config})

{config} - required - object
id - required - integer

The id of the localtion that you wish to us for click and collect.

  id: 6
success - optional - function

A callback function for once the stores have been located

success: function (response) {
  const json = JSON.parse(response)
}
error - optional - function

A callback function fired if the API returns an error

error: function (err) {
  console.error(err)
}
Example
locationsJS.setClickAndCollectStore({ id: id });

FAQs

Package last updated on 02 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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