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

@contentful/ecommerce-app-base

Package Overview
Dependencies
Maintainers
1
Versions
321
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contentful/ecommerce-app-base

Library to quickly build an app to integrate your e-commerce system of choice with Contentful

  • 4.0.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
43
decreased by-90.07%
Maintainers
1
Weekly downloads
 
Created
Source

CircleCI

ecommerce-app-base

@contentful/ecommerce-app-base is a library that helps you to quickly build an app to integrate your e-commerce system of choice with Contentful. Many e-commerce integrations are very similar, therefore this library provides the boilerplate for your app and you only need to add the code for your specific service.

This library creates an app which can be used in the entry field location to select stock keeping units (sku) from your e-commerce service. The library also provides a configuration screen for an easy customization.

Usage

import { setup } from '@contentful/ecommerce-app-base';

setup({
  makeCTA: () => 'Select products',
  name: 'My SKU App',
  logo: 'https://example.com/logo.svg',
  color: '#d7f0fa',
  description: 'My example SKU App',
  parameterDefinitions: [
    {
      "id": "category",
      "type": "Symbol",
      "name": "Catehory",
      "description": "Product category of our shop",
      "required": true
    }
  ],
  validateParameters: () => null,
  fetchProductPreviews: async (skus) => {
      const responess = await Promise.all(
          skus.map(sku => fetch(`https://example.com/products/${sku}`))
      );
      return responses.map(response => response.json());
  },
  renderDialog: (sdk) => {
    const config = sdk.parameters.invocation;

    const container = document.createElement('div');
    container.innerHTML = `<iframe src="https://example.com/products-search?category=${config.category}" />`;
    document.body.appendChild(container);
  },
  openDialog: async (sdk, currentValue, config) => {
    return await sdk.dialogs.openCurrentApp({
      parameters: { config, currentValue },
    });
  },
  isDisabled: () => false,
  productCardVersion: 'v2'  
});

Type Documentation

Components

Apps

These Contentful apps use @contentful/ecommerce-app-base. Look at their source code to learn how they utilize this library:

FAQs

Package last updated on 11 Jun 2024

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