Module data file

This topic covers the module data file in Microsoft Dynamics 365 Commerce.

Overview

A module data file contains the typings for data actions that the module uses to fetch data. The naming convention for module data files is MODULE_NAME.data.ts.

The software development kit (SDK) includes a set of core data actions that can get data from Dynamics 365 Commerce, ratings and reviews, or the recommendations service. You can find the list of data actions under the SDK's \node_modules\@msdyn365-commerce-modules\retail-actions\dist\lib directory.

Example

The following example shows a sample data file for a new module.

import { SimpleProduct } from '@msdyn365-commerce/commerce-entities';
import { AsyncResult } from '@msdyn365-commerce/retail-proxy';
import { IGetProductReviewsData } from '../../actions/getProductReviews';

export interface IProductFeatureData {
    products: AsyncResult<SimpleProduct>[];
    productReviews: AsyncResult<IGetProductReviewsData>;
}

Additional resources

Modules overview

Module definition file

Module React component file

Module view file

Module mock file

Module test file

Module props.autogenerated.ts file