Members
[richContentRenderers] : tapable.SyncHook
Provides access to the list of rendering strategies used by the RichContent component.
This target collects a list of RichContentRenderer modules. It builds an array of these renderers, which Venia's RichContent component uses to try and render a block of "rich" content, such as HTML.
Use this target if your backend system uses a customized content storage format instead of plain HTML in "rich content" fields such as product descriptions and CMS blocks.
[routes] : tapable.AsyncSeriesWaterfall
Provides access to Venia's routing table.
This target lets you add new routes to your storefronts. You can also modify Venia's existing client-side routes, such as cart or checkout URLs.
NOTE: This target does not include routes controlled by the Magento admin, such as CMS or catalog URLs.
[checkoutPagePaymentTypes] : tapable.SyncHook
Provides access to Venia's checkout page payment methods
This target lets you add new checkout page payment to your storefronts.
[savedPaymentTypes] : tapable.SyncHook
Provides access to Venia's saved payment methods
This target lets you add new saved payment method to your storefronts.
[editablePaymentTypes] : tapable.SyncHook
Provides access to Venia's editable payment methods
This target lets you add new editable payment method to your storefronts.
[summaryPagePaymentTypes] : tapable.SyncHook
Provides access to Venia's summary page for a payment method.
This target allows you to add custom payment summary rendering for the summary page in the checkout.
Typedefs
[rendererInterceptFunction] : function
Intercept function signature for the richContentRenderers target.
Interceptors of richContentRenderers should call .add on the provided renderer list.
[routesInterceptFunction] ⇒ [Array.<RouteDefinition>]
Intercept function signature for the routes target.
Interceptors of routes receive an array of RouteDefinition objects, which Venia will use to either generate a custom <AuthRoute /> component or a React Router <Route /> component in the final bundle based on the authed prop.
The AuthRoute will either return a React Router <Route /> component or a <Redirect /> component depending if the user is signed in and if the route needs authentication or not.
Interceptors must return an array of RouteDefinitions, either by mutating and then returning the array they received, or by returning a new array of RouteDefinitions.
[RouteDefinition] : Object
A route definition object that describes a route in your storefront.
[paymentInterceptFunction] : function
Intercept function signature for the checkoutPagePaymentTypes target.
Interceptors of checkoutPagePaymentTypes should call .add on the provided payment list.
[CheckoutPaymentDefinition] : Object
A payment definition object that describes a checkout page payment in your storefront.
[savedPaymentInterceptFunction] : function
Intercept function signature for the savedPaymentTypes target.
Interceptors of savedPaymentTypes should call .add on the provided payment list.
[SavedPaymentDefinition] : Object
A payment definition object that describes a saved payment in your storefront.
[editablePaymentInterceptFunction] : function
Intercept function signature for the editablePaymentTypes target.
Interceptors of editablePaymentTypes should call .add on the provided payment list.
[EditablePaymentDefinition] : Object
A payment definition object that describes a saved payment in your storefront.
[rootShimmerInterceptFunction] : function
Intercept function signature for the rootShimmerTypes target.
Interceptors of rootShimmerTypes should call .add on the provided shimmer list.
[RootShimmerTypesDefinition] : Object
A root component shimmer object that can be used during page transitions on your storefront
Interfaces
RichContentRenderer : Object
Rich content renderers for the RichContent component must implement this interface. Should be written as an ES Module—a module that exports functions with these names, rather than an object with these functions as properties.
Rich content renderers for the RichContent component must implement this interface. Should be written as an ES Module—a module that exports functions with these names, rather than an object with these functions as properties.
Properties
React.Componenthtml.functiontrue if the Component can understand and render that content.Example (A renderer that can render any content containing the string "honk")
import React from 'react';
import PlainHtmlRenderer from '@magento/venia-ui/components/richContent/plainHtmlRenderer';
function GooseRenderer(props) {
const html = props.html.replace(/honk/gim, '<strong>HONK!🦢</strong>');
return <PlainHtmlRenderer html={html} />;
}
export const Component = GooseRenderer;
export function canRender(content) {
return /honk/gim.test(content);
}
Provides access to the list of rendering strategies used by the RichContent component.
This target collects a list of RichContentRenderer modules. It builds an array of these renderers, which Venia's RichContent component uses to try and render a block of "rich" content, such as HTML.
Use this target if your backend system uses a customized content storage format instead of plain HTML in "rich content" fields such as product descriptions and CMS blocks.
See
- Intercept function signature
- RichContentRendererList
- RichContentRenderer
Example (Add a renderer)
targets.of('@magento/venia-ui').richContentRenderers.tap(
renderers => renderers.add({
componentName: 'AdobeXM',
importPath: '@adobe/xm-components/xm-renderer'
})
);
Provides access to Venia's routing table.
This target lets you add new routes to your storefronts. You can also modify Venia's existing client-side routes, such as cart or checkout URLs.
NOTE: This target does not include routes controlled by the Magento admin, such as CMS or catalog URLs.
See
- Intercept function signature
- Route definition object
Example (Add a custom route for a blog module)
const veniaTargets = targets.of('@magento/venia-ui')
const routes = veniaTargets.routes
routes.tap(
routesArray => {
routesArray.push({
name: 'Blog',
pattern: '/blog/:slug/:id',
path: '@partner/pwa-studio-blog'
});
return routesArray;
})
Provides access to Venia's checkout page payment methods
This target lets you add new checkout page payment to your storefronts.
See
- Intercept function signature
- CheckoutPaymentTypes
- CheckoutPayment definition object
Example (Add a payment)
targets.of('@magento/venia-ui').checkoutPagePaymentTypes.tap(
checkoutPagePaymentTypes => checkoutPagePaymentTypes.add({
paymentCode: 'braintree',
importPath: '@magento/braintree_payment'
})
);
Provides access to Venia's saved payment methods
This target lets you add new saved payment method to your storefronts.
See
- Intercept function signature
- SavedPaymentTypes
- SavedPayment definition object
Example (Add a payment)
targets.of('@magento/venia-ui').savedPaymentTypes.tap(
savedPaymentTypes => savedPaymentTypes.add({
paymentCode: 'braintree',
importPath: '@magento/braintree_payment'
})
);
Provides access to Venia's editable payment methods
This target lets you add new editable payment method to your storefronts.
See
- Intercept function signature
- EditablePaymentTypes
- EditablePayment definition object
Example (Add a payment)
targets.of('@magento/venia-ui').editablePaymentTypes.tap(
editablePaymentTypes => editablePaymentTypes.add({
paymentCode: 'braintree',
importPath: '@magento/braintree_payment'
})
);
Provides access to Venia's summary page for a payment method.
This target allows you to add custom payment summary rendering for the summary page in the checkout.
See
- Intercept function signature
- EditablePaymentTypes
- EditablePayment definition object
Example (Add a payment)
targets.of('@magento/venia-ui').editablePaymentTypes.tap(
editablePaymentTypes => editablePaymentTypes.add({
paymentCode: 'braintree',
importPath: '@magento/braintree_payment'
})
);
Intercept function signature for the richContentRenderers target.
Interceptors of richContentRenderers should call .add on the provided renderer list.
Parameters
RichContentRendererListIntercept function signature for the routes target.
Interceptors of routes receive an array of RouteDefinition objects, which Venia will use to either generate a custom <AuthRoute /> component or a React Router <Route /> component in the final bundle based on the authed prop.
The AuthRoute will either return a React Router <Route /> component or a <Redirect /> component depending if the user is signed in and if the route needs authentication or not.
Interceptors must return an array of RouteDefinitions, either by mutating and then returning the array they received, or by returning a new array of RouteDefinitions.
Returns: Array.<RouteDefinition> — Your function must return the modified array, or a new array you have constructed
Parameters
Array.<RouteDefinition>Example
const intercept = routesArray => {
return [
{ name: 'Backstop', pattern: '*', path: '@my-components/backstop' },
...routesArray
]
}
A route definition object that describes a route in your storefront.
Properties
stringstringstringpath prop for the <Route/> component.booleanbooleanstringExample (A custom route with a URL parameter)
const myCustomRoute = {
name: 'MyRoute',
pattern: '/my-route/:myRouteParam',
path: '@my-components/my-route-component'
}
Intercept function signature for the checkoutPagePaymentTypes target.
Interceptors of checkoutPagePaymentTypes should call .add on the provided payment list.
Parameters
CheckoutPaymentTypesDefinitionA payment definition object that describes a checkout page payment in your storefront.
Properties
stringstringExample (A custom payment method)
const myCustomPayment = {
paymentCode: 'cc',
importPath: '@partner/module/path_to_your_component'
}
Intercept function signature for the savedPaymentTypes target.
Interceptors of savedPaymentTypes should call .add on the provided payment list.
Parameters
SavedPaymentTypesDefinitionA payment definition object that describes a saved payment in your storefront.
Properties
stringstringExample (A custom payment method)
const myCustomPayment = {
paymentCode: 'cc',
importPath: '@partner/module/path_to_your_component'
}
Intercept function signature for the editablePaymentTypes target.
Interceptors of editablePaymentTypes should call .add on the provided payment list.
Parameters
EditablePaymentTypesDefinitionA payment definition object that describes a saved payment in your storefront.
Properties
stringstringExample (A custom payment method)
const myCustomPayment = {
paymentCode: 'cc',
importPath: '@partner/module/path_to_your_component'
}
Intercept function signature for the rootShimmerTypes target.
Interceptors of rootShimmerTypes should call .add on the provided shimmer list.
Parameters
RootShimmerTypesDefinitionA root component shimmer object that can be used during page transitions on your storefront
Properties
stringstringExample (A CMS Page Shimmer)
const cmsShimmer = {
shimmerType: 'CMS_PAGE_SHIMMER',
importPath: '@partner/module/path_to_your_component'
}
Source Code: pwa-studio/packages/venia-ui/lib/targets/venia-ui-declare.js