diff options
| author | rxliuli <rxliuli@gmail.com> | 2025-11-04 05:03:50 +0800 |
|---|---|---|
| committer | rxliuli <rxliuli@gmail.com> | 2025-11-04 05:03:50 +0800 |
| commit | bce557cc2dc767628bed6aac87301a1be7c5431b (patch) | |
| tree | b51a051228d01fe3306cd7626d4a96768aadb944 /node_modules/@jet-app/app-store/tmp/src/common/account | |
init commit
Diffstat (limited to 'node_modules/@jet-app/app-store/tmp/src/common/account')
| -rw-r--r-- | node_modules/@jet-app/app-store/tmp/src/common/account/account-links-regex-parser.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/node_modules/@jet-app/app-store/tmp/src/common/account/account-links-regex-parser.js b/node_modules/@jet-app/app-store/tmp/src/common/account/account-links-regex-parser.js new file mode 100644 index 0000000..b6d2ad2 --- /dev/null +++ b/node_modules/@jet-app/app-store/tmp/src/common/account/account-links-regex-parser.js @@ -0,0 +1,35 @@ +import { DynamicUIRequestInfo, FlowAction } from "../../api/models"; +/** + * Run a given URL through all the different web view regexes we have in the bag and return a + * flow action with the correct page type for this url. This is essentially what AMSURLParser + * is doing, however that does not work for App Store the way we route URLs. + * + * @param objectGraph The App Store object graph. + * @param urlString The string to create the appropriate FlowAction for. + * @returns A FlowAction appropriate for the provided URL. + */ +export function flowActionForAccountURL(objectGraph, urlString) { + // Dynamic UI + const dynamicUIRegexPatterns = objectGraph.bag.dynamicUIRegexStrings; + for (const pattern of dynamicUIRegexPatterns) { + const regexPattern = pattern.replace(/\//g, "\\/"); + const dynamicUIPattern = new RegExp(regexPattern); + if (dynamicUIPattern.test(urlString)) { + const action = new FlowAction("dynamicUI", urlString); + action.pageData = new DynamicUIRequestInfo(objectGraph.bag.metricsTopic); + return action; + } + } + // Web UI regex check + const webViewRegexPatterns = objectGraph.bag.webViewRegexStrings; + for (const pattern of webViewRegexPatterns) { + const regexPattern = pattern.replace(/\//g, "\\/"); + const webViewPattern = new RegExp(regexPattern); + if (webViewPattern.test(urlString)) { + return new FlowAction("webView", urlString); + } + } + /// Last of all try to allow the finance view controller to handle this url + return new FlowAction("finance", urlString); +} +//# sourceMappingURL=account-links-regex-parser.js.map
\ No newline at end of file |
