0.1.0 • Published 2 years ago

@castletech/pwa-module-product-type v0.1.0

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

PWA Studio Product Type Extension

Preview

Create new product types in your pwa-studio using extensibility targetables api.

Compatibility: pwa-studio v11, v12

1. Installation

yarn add @castletech/pwa-module-product-type

2. Active module in your local-intercept

const {
  wrapProductTypeModule,
} = require("@castletech/pwa-module-product-type/targets");
wrapProductTypeModule({
  targets
});

3. Create new pwa-studio module

Create a new pwa-studio scaffolding module and connect the targetable productType api of the pwa-module-product-type module.

Exemple:

targets.of('@castletech/pwa-module-product-type').productType.tap(types =>
  types.add({
    condition: "product.__typename === 'BundleProduct'",
    componentName: 'ProductBundle',
    componentPath: '@castletech/pwa-module-product-bundle/lib/components/ProductBundle'
  })
);
propdescription
conditionIt can be a product attr, such as __typename
componentNameName of the component to be imported
componentPathPath of the component to be imported

4. Run project

yarn watch