Giter Site home page Giter Site logo

scaleleap / amazon-marketplaces Goto Github PK

View Code? Open in Web Editor NEW
12.0 4.0 11.0 2.71 MB

A collection of Amazon Marketplace data objects.

Home Page: https://npm.im/@scaleleap/amazon-marketplaces

License: MIT License

JavaScript 10.38% TypeScript 89.62%
amazon marketplace amazon-marketplace amazon-advertising amazon-advertising-api api

amazon-marketplaces's Introduction

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

amazon-marketplaces's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar fossabot avatar moltar avatar nazarvovk avatar nguyentoanit avatar nishealj avatar renovate-bot avatar renovate[bot] avatar repo-ranger[bot] avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

amazon-marketplaces's Issues

How to add custom time zones to AmazonMarketplaceAdvertisingTimeZone

I am connecting to amazon api through ScaleLeap/amazon-advertising-api-sdk. While using the profile api i am getting error :
Invalid value "Europe/Amsterdam" supplied to Array. Later I debugged the code, then i found that the particular time zone is not available in time zone list. Could please add it by your self or give the sample code for how to add extra time zones to that list.
If i added these lines
EUROPE_AMSTERDAM = "Europe/Amsterdam"
AmazonMarketplaceAdvertisingTimeZone["EUROPE_AMSTERDAM"] = "Europe/Amsterdam";
in amazon-marketplace.d.ts, amazon-marketplace.js then profile api returning the profiles list.

Can you add new marketplace country codes PL and SE.

I am trying to get the list of profiles from my amazon account. the list of profiles contains country codes PL and SE and timezones for that countries. but those are not available in the API. can you please update those lists. i need
country code: SE,PL.
timezone: "Europe/Stockholm", "Europe/Warsaw".
currency code: SEK,PLN.
API having the below details in static list.
export declare enum AmazonMarketplaceAdvertisingCountryCode {
AE = "AE",
AU = "AU",
BR = "BR",
CA = "CA",
DE = "DE",
ES = "ES",
FR = "FR",
IN = "IN",
IT = "IT",
JP = "JP",
MX = "MX",
NL = "NL",
SG = "SG",
UK = "UK",
US = "US"
}
export declare enum AmazonMarketplaceAdvertisingTimeZone {
AMERICA_LOS_ANGELES = "America/Los_Angeles",
AMERICA_SAO_PAULO = "America/Sao_Paulo",
ASIA_DUBAI = "Asia/Dubai",
ASIA_INDIA = "Asia/Kolkata",
ASIA_SINGAPORE = "Asia/Singapore",
ASIA_TOKYO = "Asia/Tokyo",
AUSTRALIA_SYDNEY = "Australia/Sydney",
EUROPE_AMSTERDAM = "Europe/Amsterdam",
EUROPE_LONDON = "Europe/London",
EUROPE_PARIS = "Europe/Paris"
}.
Please add it as soon as possible. my application was dependent on it.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Using npm packages for Renovate presets is now deprecated. Please migrate to repository-based presets instead.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • chore(deps): update dependency @types/node to v20.12.12
  • chore(deps): update dependency ts-jest to v29.1.3

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/danger.yml
  • actions/checkout v4
  • actions/cache v4
  • actions/setup-node v4
  • danger/danger-js 12.3.0
.github/workflows/release.yml
  • actions/checkout v4
  • actions/cache v4
  • actions/setup-node v4
.github/workflows/test.yml
  • actions/checkout v4
  • actions/cache v4
  • actions/setup-node v4
npm
package.json
  • @lavadrop/ensure 1.0.0
  • @jest/globals 29.7.0
  • @scaleleap/semantic-release-config 1.1.41
  • @types/jest 29.5.12
  • @types/node 20.12.10
  • @typescript-eslint/eslint-plugin 7.10.0
  • @typescript-eslint/parser 7.10.0
  • danger 12.3.0
  • eslint-config-airbnb-base 15.0.0
  • eslint-config-prettier 9.1.0
  • eslint-import-resolver-typescript 3.6.1
  • eslint-plugin-eslint-comments 3.2.0
  • eslint-plugin-jest 28.5.0
  • eslint-plugin-jest-formatting 3.1.0
  • eslint-plugin-prettier 5.1.3
  • eslint-plugin-simple-import-sort 12.1.0
  • eslint-plugin-sonarjs 1.0.3
  • eslint-plugin-unicorn 53.0.0
  • jest 29.7.0
  • rimraf 5.0.7
  • ts-jest 29.1.2
  • tsconfigs 4.0.2
  • typedoc 0.25.13
  • typescript 5.4.5

  • Check this box to trigger a request for Renovate to run again on this repository

Add marketplace launch date

Would be good to know when the marketplace had launched (announced).

I've asked ChatGPT for this, and here's the result. But need to validate it.


Amazon Marketplace Country Name Amazon Marketplace ID Date when the marketplace launched
United States US July 1995
United Kingdom UK October 1998
Germany DE October 1998
France FR August 2000
Japan JP November 2000
Canada CA June 2002
China CN September 2004
Italy IT November 2010
Spain ES September 2011
India IN June 2013
Mexico MX June 2013
Australia AU April 2018
Brazil BR January 2019
United Arab Emirates AE May 2019
Singapore SG October 2019
Saudi Arabia SA June 2020
Netherlands NL March 2020
Sweden SE October 2020
Poland PL

Migration from 17.3.0 to 18.0.0 - Cannot find module '@scaleleap/amazon-marketplaces' or its corresponding type declarations

Hello,

Thanks for this repository!

I'm trying to migrate this dependency from 17.3.0 to 18.0.0 but typescript shows me an error:
image.

I digged a bit hoping this might help: the difference I see in the node_modules between 17.3.0 and 18.0.0 is that now, the lib files are not directly in the lib folder but in a src subfolder. So the types property in the package.json seems wrong as it's pointing to a non-existing file (it should be lib/src/index.d.ts instead of lib/index.d.ts)

Version 17.3.0

image

Version 18.0.0

image

Tell me if you need more information ๐Ÿ™‚

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.