-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: table for mapping routes between ICM and PWA
- Loading branch information
Showing
11 changed files
with
148 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { environment } from '../environments/environment'; | ||
|
||
const ICM_CONFIG_MATCH = `^/${environment.icmServerWeb}/(?<channel>[\\w-]+)/(?<lang>\\w+)/(?<application>[\\w-]+)/\\w+`; | ||
const PWA_CONFIG_BUILD = ';channel=$<channel>;lang=$<lang>;application=$<application>;redirect=1'; | ||
|
||
export interface HybridMappingEntry { | ||
/** ID for grouping */ | ||
id: string; | ||
/** regex for detecting ICM URL */ | ||
icm: string; | ||
/** regex for building ICM URL (w/o web url) */ | ||
icmBuild: string; | ||
/** regex for detecting PWA URL */ | ||
pwa: string; | ||
/** regex for building PWA URL */ | ||
pwaBuild: string; | ||
/** handler */ | ||
handledBy: 'icm' | 'pwa'; | ||
} | ||
|
||
/** | ||
* Mapping table for running PWA and ICM in parallel | ||
*/ | ||
export const HYBRID_MAPPING_TABLE: HybridMappingEntry[] = [ | ||
{ | ||
id: 'Home', | ||
icm: `${ICM_CONFIG_MATCH}/(Default|ViewHomepage)-Start.*$`, | ||
icmBuild: `ViewHomepage-Start`, | ||
pwa: `^/home.*$`, | ||
pwaBuild: `home${PWA_CONFIG_BUILD}`, | ||
handledBy: 'pwa', | ||
}, | ||
{ | ||
id: 'PDP', | ||
icm: `${ICM_CONFIG_MATCH}/ViewProduct-Start.*(\\?|&)SKU=(?<sku>[\\w-]+).*$`, | ||
icmBuild: `ViewProduct-Start?SKU=$<sku>`, | ||
pwa: `^.*/product/(?<sku>[\\w-]+).*$`, | ||
pwaBuild: `product/$<sku>${PWA_CONFIG_BUILD}`, | ||
handledBy: 'pwa', | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters