summaryrefslogtreecommitdiff
path: root/node_modules/@jet-app/app-store/tmp/src/common/web-navigation/inject-web-navigation.js
diff options
context:
space:
mode:
authorrxliuli <rxliuli@gmail.com>2025-11-04 05:03:50 +0800
committerrxliuli <rxliuli@gmail.com>2025-11-04 05:03:50 +0800
commitbce557cc2dc767628bed6aac87301a1be7c5431b (patch)
treeb51a051228d01fe3306cd7626d4a96768aadb944 /node_modules/@jet-app/app-store/tmp/src/common/web-navigation/inject-web-navigation.js
init commit
Diffstat (limited to 'node_modules/@jet-app/app-store/tmp/src/common/web-navigation/inject-web-navigation.js')
-rw-r--r--node_modules/@jet-app/app-store/tmp/src/common/web-navigation/inject-web-navigation.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/node_modules/@jet-app/app-store/tmp/src/common/web-navigation/inject-web-navigation.js b/node_modules/@jet-app/app-store/tmp/src/common/web-navigation/inject-web-navigation.js
new file mode 100644
index 0000000..b882c17
--- /dev/null
+++ b/node_modules/@jet-app/app-store/tmp/src/common/web-navigation/inject-web-navigation.js
@@ -0,0 +1,32 @@
+import { createWebNavigation, setActivePlatform } from "./web-navigation";
+/**
+ * The "default" {@linkcode PreviewPlatform} that should be used for the navigation state in cases
+ * where an explicit value is not provided
+ */
+const FALLBACK_PREVIEW_PLATFORM = "iphone";
+/**
+ * Inject the `WebNavigation` into a page model
+ *
+ * @param objectGraph
+ * @param page the page to inject the navigation into
+ * @param platform the `PreviewPlatform` to render navigation links for
+ * @returns the web navigation shelf, in case further mutation is required
+ */
+export function injectWebNavigation(objectGraph, page, platform) {
+ const webNavigation = createWebNavigation(objectGraph, platform !== null && platform !== void 0 ? platform : FALLBACK_PREVIEW_PLATFORM);
+ if (page.title) {
+ webNavigation.title = page.title;
+ }
+ page.webNavigation = webNavigation;
+ return webNavigation;
+}
+/**
+ * Sets the `WebNavigation` contained by {@linkcode page} to reflect {@linkcode platform}
+ * as the active platform. Landing pages links will also be made active based on {@linkcode intent}
+ */
+export function updateWebNavigation(objectGraph, page, platform, intent) {
+ if (page.webNavigation) {
+ setActivePlatform(objectGraph, page.webNavigation, platform, intent);
+ }
+}
+//# sourceMappingURL=inject-web-navigation.js.map \ No newline at end of file