best practices for e-commerce customization

20
Best practices for e-Commerce customization Sam Jarawan Principal Program Managers Dynamics 365 Commerce

Upload: others

Post on 19-Apr-2022

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Best practices for e-Commerce customization

Best practices for e-Commerce customization

Sam JarawanPrincipal Program ManagersDynamics 365 Commerce

Page 2: Best practices for e-Commerce customization

Agenda• Development environment

• Updating and Deploying

• Module and theme development customization options

• Performance

• Security

Page 3: Best practices for e-Commerce customization

Development environment

• Tools & SDKhttp://aka.ms/CommerceOnlineChannelExtensibility

• Configure environment against1. Cloud hosted e-Commerce site2. Cloud-hosted Retail Server

Page 4: Best practices for e-Commerce customization

Updating SDK/Module Library

• Check available/compatible versions in online docs• Commerce scale unit vs module library versions

• Update SDK/module library• Edit package.json file• Pull latest files ‘yarn’

• Build customization extension• ‘yarn msdyn365 pack’

• Upload and Deploy extension within LCS

Page 5: Best practices for e-Commerce customization

Module customization options

1. Code free changes2. Custom theme development3. Data action override4. Clone a module library module5. Create a custom module

Page 6: Best practices for e-Commerce customization

Code free changes

• Module configuration properties• Style presets• CSS overrides

Page 7: Best practices for e-Commerce customization

Custom theme development

• Modify module CSS• Module view overrides• Module definition overrides• Override module library component

• Create a new theme• yarn msdyn365 add-theme THEME_NAME

• Copy (clone) the fabrikam theme• yarn msdyn365 clone fabrikam THEME_NAME

Page 8: Best practices for e-Commerce customization

Data action override

• Module library modules use pre-existing data actions to fetch data

• Replace a provided data action with a custom data action

• Override the registered action by creating a new action with the same action ID

• Create a custom data action• yarn msdyn365 add-data-action custom-get-address

• Replace the default template code with your code

Page 9: Best practices for e-Commerce customization

Clone a module library module

• Cloning will create a new copy of module• Will NOT pick-up future release changes• Pages will need to be re-configured to use new module

• CLI commandyarn msdyn365 clone MODULE_LIBRARY_NAME NEW_NAME

Page 10: Best practices for e-Commerce customization

Custom modules

• Create a custom module using • yarn msdyn365 add-module MODULE_NAME

• Data Action Mocks• Page Mocks

Page 11: Best practices for e-Commerce customization

Performance

• Viewport configuration• Minimize HTML/CSS/JS file sizes• Caching• Browser hint meta tags• Perf analysis

Page 12: Best practices for e-Commerce customization

Viewport configurationTheme settings fi le: \ThemeName.theme.settings.json…

"content-block": {"properties": {

"full-width": {"friendlyName": "Hero","description": "Image on background with text overlay","type": "layout","properties": {

"image": {"friendlyName": "Hero Image Settings","description": "Image settings for the hero","type": "imageSizes","properties": {

"xs": {"width": 800,"height": 600

},"sm": {

"width": 1200,"height": 900

},"md": {

"width": 1600,"height": 900

},"lg": {

"width": 1600,"height": 700

},"xl": {

"width": 1600,"height": 700

}}

}}

},

Page 13: Best practices for e-Commerce customization

Minimize HTML/CSS/JS file sizes

• Reduce JavaScript by excluding unused modules

/src/settings/platform.settings.json

{

“dataActionTimeoutInMs”: 4000,

“minClientChunkSize”: 30000,

“excludeModules”: ["<EXCLUDED_MODULE_NAME1>","<EXCLUDED_MODULE_NAME2>" ],

“namespaceExtentions” : [ ],

“enableChunkByModulePackage”: false,

“chunkingGroupPreference”: [ ]

}

Page 14: Best practices for e-Commerce customization

Minimize HTML/CSS/JS file sizes

• JavaScript chunking (10.0.17)

/src/settings/platform.settings.json

{

“dataActionTimeoutInMs”: 4000,

“minClientChunkSize”: 30000,

“excludeModules”: [],

“namespaceExtentions” : [ ],

“enableChunkByModulePackage”: true,

“chunkingGroupPreference”: [

["module1", "module2”],

[ "module3", "module4"]

]

}

Page 15: Best practices for e-Commerce customization

Caching

• Data action caching ship with default values• Custom data actions -> ensure you add cache settings

/src/settings/cache.settings.json

Page 16: Best practices for e-Commerce customization

Browser hint meta tags VIA site builder

• DNS pre-fetch URLs• Tells the browser to perform DNS lookup on a page in the

background while the user is browsing• Once user clicks a link, the DNS lookup has taken place reducing

latency• Site builder – Site settings -> extensions

Page 17: Best practices for e-Commerce customization

Perf analysis

• Ensure you do some basic perf analysis on main pages of site• Home page• Category • Product Detail Page• …

• Many free/paid tools available• Basic testing: Browser F12 debugger tools to see requests

Page 18: Best practices for e-Commerce customization

Security

• Content security policy (CSP) support• Nonce support• Restrict e-com site form loading inside external website

Page 19: Best practices for e-Commerce customization

ADDITIONALINFORMATION

Page 20: Best practices for e-Commerce customization

ADDITIONAL RESOURCES

ARTICLESDynamics 365 Commerce architecture overview // aka.ms / CommerceArchitecture

Setup an online channel // aka.ms / CommerceSetupOnlineChannel

E-Commerce site overview // aka.ms / CommerceECommerceSiteOverview

Online channel extensibility // aka.ms / CommerceOnlineChannelExtensibility

Configure theme style presets // aka.ms / CommerceConfigureStylePresets

CONTACT Commerce Yammer Group // aka.ms / CommerceYammerGroup

Commerce Forums // aka.ms / CommerceForums

UPCOMING

TALKS

Dynamics 365 Commerce TechTalk Series // aka.ms / CommerceUpcomingTechTalkSeries

PAST

TALKS

Dynamics 365 Commerce Overview // aka.ms / CommerceTechTalkOverview

Dynamics 365 Commerce Architecture Overview // aka.ms / CommerceArchitectureOverviewTalk

Dynamics 365 E-Commerce Architecture Deep Dive // aka.ms / CommerceECommerceArchitectureDeepDive

Dynamics 365 Creating a new E-commerce Web Site // aka.ms / CommerceCreateECommerceWebSite

Dynamics 365 Set up a B2C Tenant for E-Commerce Site // aka.ms / CommerceSetupB2CTenant