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

strapi-plugin-vtex

v1.0.1

Published

A strapi plugin that implements a complete purchase flow using the VTEX API.

Downloads

5

Readme

strapi-plugin-vtex

🚀   Overview

This plugin implements a complete purchase flow using the VTEX API, just install it and configure the environment variables to make the resources available for your front-end consume.


⏳   Installation

With npm:

npm install strapi-plugin-vtex

With yarn:

yarn add strapi-plugin-vtex

📦 Configuration

This plugin needs some environment variables to work, its variables is decribed on .env.example file but i going to describe it below too.

In particular, I prefer to configure and use plugin variables directly from the procces.env command instead of configuring them in the config/plugins.js file of the strapi project. I do not find it interesting to configure plugins outside the context of the plugin.

So the only thing you need to do is describe this environment variables on your .env file for development environment and setup the same variables on your server for production environment.

VTEX_API_PREFIX=true
VTEX_SCOPE=<yours-vtex-store-scope>
VTEX_API_KEY=<yours-vtex-api-key>
VTEX_API_SECRET=<yours-vtex-api-secret>
VTEX_TRADE_POLICY=<yours-vtex-trade-policy>
FACEBOOK_APP_KEY=<yours-facebook-app-key>
FACEBOOK_APP_SECRET=<yours-facebook-app-secret>
GOOGLE_APP_KEY=<yours-google-app-key>
GOOGLE_APP_SECRET=<yours-google-app-secret>

Describing each variable:

VTEX_API_PREFIX: (true) by default. With this flag, the plugin forces /vtex prefix to url api on all plugin routes, but you can disable it turning it to false, so your resources can look like (GET /vtex/me) or (GET /me) avoiding broken your other strapi implementations.

VTEX_SCOPE: Is your vtex subdomain commerce scope, it is used to identify your store on VTEX API PLATFORM.

VTEX_API_KEY: Is the generated API KEY used to get access to VTEX API PLATFORM. (See this link tutorial to generate your access keys)

VTEX_API_SECRET: Is the generated API SECRET used to get access to VTEX API PLATFORM. (See this link tutorial to generate your access keys)

VTEX_TRADE_POLICY: Is the configured trade policy in your VTEX PANEL to access your products and trade policies trought this plugin integration.

FACEBOOK_APP_KEY: Is the generated facebook app key configured in yours VTEX PANEL to able social login with facebook.

FACEBOOK_APP_SECRET: Is the generated facebook app secret configured in yours VTEX PANEL to able social login with facebook.

GOOGLE_APP_KEY: Is the generated google app key configured in yours VTEX PANEL to able social login with google.

GOOGLE_APP_SECRET: Is the generated google app secret configured in yours VTEX PANEL to able social login with google.


✨   API Resources

POST /auth/register Create a customer account on VTEX PLATFORM [public]

{
	"email": "[email protected]",
	"firstName": "John",
	"lastName": "Doe",
	"document": "11111111191",
	"phone": "+551199999999",
	"isNewsletterOptIn": true|false
}

POST /auth/request_reset Request a reset password to desired vtex account email [public]

{
    "email": "[email protected]"
}

POST /auth/reset Reset password for desired vtex account email [public]

{
    "email": "[email protected]",
    "authenticationToken": "F2D9E877E061A7C2AF70990B54EEC408829B523F9E094C8B4BB1018CB9C0AA38",
    "newPassword": "super-secret-password",
    "accessKey": "123456"
}

POST /auth/login Execute the classic login (username & password) for VTEX customer account [public]

{
    "email": "[email protected]",
    "password": "super-secret-password"
}

POST /me Update authenticated VTEX customer account [protected by jwt token]

{
    "email": "[email protected]",
    "password": "super-secret-password"
}

GET /me Get authenticated VTEX customer account data [protected by jwt token]

GET /me/addresses Get authenticated VTEX customer address data [protected by jwt token]

GET /me/addresses/:id Fin one authenticated VTEX customer address [protected by jwt token]

POST /me/addresses Create authenticated VTEX customer address [protected by jwt token]

{
    "addressName": "home",
    "addressType": "residential",
    "receiverName": "JOHN DOE",
    "postalCode": "943062700",
    "street": "Solana Dr",
    "number": "404",
    "complement": "B",
    "neighborhood": "Barron Park",
    "city": "Palo Alto",
    "state": "CA",
    "country": "USA",
    "geoCoordinate": [0, 0],
    "reference": null
}

PUT /me/addresses/:id Update authenticated VTEX customer address [protected by jwt token]

{
    "addressName": "newhome",
    "addressType": "residential",
    "receiverName": "JOHN DOE",
    "postalCode": "943062700",
    "street": "Solana Dr",
    "number": "404",
    "complement": "B",
    "neighborhood": "Barron Park",
    "city": "Palo Alto",
    "state": "CA",
    "country": "USA",
    "geoCoordinate": [0, 0],
    "reference": null,
    "reference": "close to school"
}

DELETE /me/addresses/:id Delete an authenticated VTEX customer address [protected by jwt token]

GET /categories/level/:level Retrieve all categories from VTEX PLATFORM with cascade levels [public]

GET /stores Retrieve all registeres physic stores from VTEX PLATFORM [public]

GET /collections Retrieve all collections from VTEX PLATFORM [public]

GET /collections/:id/products Retrieve products from VTEX PLATFORM for a specific collection [public]

GET /products/autocomplete?searchTerm=Cellphone Retrieve product suggestions from VTEX PLATFORM for input searchTerm [public]

GET /products Retrieve a list of products from VTEX PLATFORM [public]

GET /orders Retrieve a list of orders from VTEX PLATFORM authenticated customer [protected by jwt token]

GET /orders/:id Retrieve a specific order from VTEX PLATFORM authenticated customer [protected by jwt token]

POST /orders/simulation Simulate an order on VTEX PLATFORM to preview available subtotal, taxes, payment conditions and shipping methods [public]

{
	"items":[{
		"id":"12345",
		"quantity": 1,
		"seller": "1"
	}],
	"postalCode": "943062700",
	"country": "USA"
}

POST /orders Generate an order on VTEX PLATFORM to specified clientProfileData.email, if user does not has an account yet, it will be generated for specified email, than you will be able to reset the password over the POST /auth/request_reset resource. [public]

{
	"items":[{
		"id":"12345",
		"quantity": 1,
		"seller": "1"
	}],
	"paymentSystem": 6,
	"installments": 1,
	"shippingMethod": "Fedex",
	"clientProfileData": {
		"email": "[email protected]",
        "firstName": "John",
        "lastName": "Doe",
        "document": "11111111191",
        "phone": "+551199999999",
        "isNewsletterOptIn": true|false
	},
	"cc": {
		"holderName": "JOHN DOE",
        "cardNumber": "4111111111111111",
		"dueDate": "09/24",
		"validationCode": "123"
	},
	"address":{
		"addressName": "home",
        "addressType": "residential",
        "receiverName": "JOHN DOE",
        "postalCode": "943062700",
        "street": "Solana Dr",
        "number": "404",
        "complement": "B",
        "neighborhood": "Barron Park",
        "city": "Palo Alto",
        "state": "CA",
        "country": "USA",
        "geoCoordinate": [0, 0],
        "reference": null
	}
}

GET /locations/cep/:cep Retrieve address suggestion for specified zipcode [brazil only] [public]

GET /locations/estados Retrieve a list of states in brazil [brazil only] [public]

GET /locations/estados/:uf/municipios Retrieve a list of cities for specified state in brazil [brazil only] [public]

GET /locations/municipios/:city/bairros Retrieve a list of neighborhoos for specified city in brazil [brazil only] [public]


🎉   Congradulations, You're done.

With this plugin you will be able to expose all vtex purchase flow to your front-end applications and create new great features for them with strapi, of corse.


📜   License

This project is under the MIT license. See the LICENSE for details.

💻   Developed by André Ciornavei - Get in touch!