npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@scaleleap/amazon-marketplaces

v18.0.1

Published

A collection of Amazon Marketplace data objects.

Downloads

13,146

Readme

Amazon Marketplace Logo

@scaleleap/amazon-marketplaces

A collection of Amazon Marketplace data objects.

This package is written in TypeScript and is fully typed.


This package combines data about Amazon Marketplace (the consumer side of Amazon) into a structured class.

Available Marketplace Data

  • ID (e.g. A2EUQ1WTGCTBG2)
  • Country code (ISO 3166-1) (e.g. CA)
  • Amazon marketplace time zone (e.g. America/Los_Angeles)
  • Currency code (ISO 4217) (e.g. CAD)
  • Name (country name) (e.g. Canada)
  • URI (e.g. https://www.amazon.ca/)
  • Amazon Marketplace Web Service (Amazon MWS) endpoint URI
  • Amazon Advertising
    • API endpoint URI
    • Sponsored products
      • Minimum bid
      • Maximum bid
    • Sponsored Brands
      • Minimum bid
      • Maximum bid
    • Account time zone
  • Amazon Selling Partner API
    • Selling Partner Region
    • API endpoint URI
    • Seller Central endpoint URI (used for SP Auth)

Code Demo

Enum of Amazon Marketplace Data

import { amazonMarketplaces } from '@scaleleap/amazon-marketplaces'

const { CA } = amazonMarketplaces

console.log('Amazon Marketplace %s uses currency %s.', CA.name, CA.currency)

List of Amazon Marketplace Data

Sometimes it is more ergonomic to iterate over an array of marketplaces. And that is where amazonMarketplacesList may come handy.

import { amazonMarketplacesList } from '@scaleleap/amazon-marketplaces'

const marketplaceIds = amazonMarketplacesList.map(marketplace => marketplace.id)

Utility Functions

import {
  findAmazonMarketplace,
  findAmazonMarketplaceOrFail,
  AmazonMarketplaceCountryCode
} from '@scaleleap/amazon-marketplaces'

// Return value *can* be undefined
const CA = findAmazonMarketplace('countryCode', AmazonMarketplaceCountryCode.CA)

// Function will throw an error if marketplace is not found
// Thus return value is never undefined.
const US = findAmazonMarketplaceOrFail('countryCode', AmazonMarketplaceCountryCode.US)

// TypeScript assertion functions that ensure that the marketplace has advertising / selling partner enabled.
// Throws if not.
assertMarketplaceHasAdvertising(CA)
assertMarketplaceHasSellingPartner(CA)

// CA.advertising is now type guarded and can be safely accessed.
console.log(CA.advertising.countryCode)

Full Data Object Example

{
  "countryCode": "CA",
  "timeZone": "America/Los_Angeles",
  "currency": "CAD",
  "id": "A2EUQ1WTGCTBG2",
  "name": "Canada",
  "uri": "https://www.amazon.ca",
  "webServiceUri": "https://mws.amazonservices.ca",
  "advertising": {
    "countryCode": "CA",
    "timeZone": "America/Los_Angeles",
    "region": {
      "accessTokenUri": "https://api.amazon.com/auth/o2/token",
      "authorizationUri": "https://www.amazon.com/ap/oa",
      "code": "NA",
      "endpoint": "https://advertising-api.amazon.com",
      "name": "North America",
    },
    "bids": {
      "sponsoredBrands": {
        "min": 10,
        "max": 4900
      },
      "sponsoredProducts": {
        "min": 2,
        "max": 100000
      }
    },
  },
  "sellingPartner": {
    "region": {
      "awsRegion": "us-east-1",
      "code": "NA",
      "endpoint": "https://sellingpartnerapi-na.amazon.com",
      "name": "North America",
    },
    "sellerCentralAuthUri": "https://sellercentral.amazon.com"
  }
}

You may also view the Jest snapshot data for the fully rendered data object examples.

Download & Installation

$ npm i -s @scaleleap/amazon-marketplaces

Contributing

If you find any other data that can be added, please open an issue and let us know.

Note that this repository uses Conventional Commit style commit messages.

If a new marketplace is added, this should be marked as breaking change and increase the major version, because others may rely on iterating over the available marketplaces.

Original Data Sources

Authors or Acknowledgments

License

This project is licensed under the MIT License.

FOSSA Status

Badges

GitHub Workflow Status NPM License FOSSA Status