summaryrefslogtreecommitdiff
path: root/node_modules/@jet-app/app-store/tmp/src/common/developer/developer-request.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/developer/developer-request.js
init commit
Diffstat (limited to 'node_modules/@jet-app/app-store/tmp/src/common/developer/developer-request.js')
-rw-r--r--node_modules/@jet-app/app-store/tmp/src/common/developer/developer-request.js115
1 files changed, 115 insertions, 0 deletions
diff --git a/node_modules/@jet-app/app-store/tmp/src/common/developer/developer-request.js b/node_modules/@jet-app/app-store/tmp/src/common/developer/developer-request.js
new file mode 100644
index 0000000..88c7e74
--- /dev/null
+++ b/node_modules/@jet-app/app-store/tmp/src/common/developer/developer-request.js
@@ -0,0 +1,115 @@
+import { Request, defaultAdditionalPlatformsForClient } from "../../foundation/media/data-fetching";
+import { shouldFetchCustomAttributes } from "../product-page/product-page-variants";
+import { shouldUsePrerenderedIconArtwork } from "../content/content";
+/**
+ * Returns the attributes to use for a developer media API request.
+ */
+export function developerAttributes(objectGraph) {
+ const attributes = ["editorialArtwork", "editorialVideo", "requiredCapabilities", "minimumOSVersion"];
+ if (objectGraph.client.isMac) {
+ attributes.push("screenshotsByType");
+ }
+ else {
+ attributes.push("isAppleWatchSupported");
+ }
+ if (objectGraph.appleSilicon.isSupportEnabled) {
+ attributes.push("macRequiredCapabilities");
+ }
+ if (objectGraph.client.isMac) {
+ attributes.push("hasMacIPAPackage");
+ }
+ if (objectGraph.client.isVision) {
+ attributes.push("compatibilityControllerRequirement");
+ }
+ if (objectGraph.bag.enableUpdatedAgeRatings) {
+ attributes.push("ageRating");
+ }
+ if (shouldUsePrerenderedIconArtwork(objectGraph)) {
+ attributes.push("iconArtwork");
+ }
+ return attributes;
+}
+export const iosDeveloperRelationshipKeys = [
+ "latest-release-app",
+ "system-apps",
+ "arcade-apps",
+ "app-bundles",
+ "ios-apps",
+ "imessage-apps",
+ "watch-apps",
+ "atv-apps",
+];
+export const visionOSDeveloperRelationshipKeys = [
+ "latest-release-app",
+ "xros-apps",
+ "arcade-apps",
+ "ios-apps",
+];
+export const macosDeveloperRelationshipKeys = [
+ "latest-release-app",
+ "arcade-apps",
+ "app-bundles",
+ "mac-apps",
+];
+export const webDeveloperRelationshipKeys = [
+ "latest-release-app",
+ "system-apps",
+ "arcade-apps",
+ "app-bundles",
+ "ios-apps",
+ "imessage-apps",
+ "watch-apps",
+ "atv-apps",
+ "xros-apps",
+ "mac-apps",
+];
+export const watchosDeveloperRelationshipKey = "watch-apps";
+function developerRelationships(objectGraph) {
+ let relationships = [];
+ switch (objectGraph.client.deviceType) {
+ case "mac":
+ relationships = relationships.concat(macosDeveloperRelationshipKeys);
+ if (objectGraph.appleSilicon.isSupportEnabled) {
+ relationships.push("mac-os-compatible-ios-apps");
+ }
+ break;
+ case "watch":
+ relationships.push(watchosDeveloperRelationshipKey);
+ break;
+ case "vision":
+ relationships = relationships.concat(visionOSDeveloperRelationshipKeys);
+ break;
+ case "web":
+ relationships = relationships.concat(webDeveloperRelationshipKeys);
+ break;
+ default:
+ relationships = relationships.concat(iosDeveloperRelationshipKeys);
+ break;
+ }
+ return relationships;
+}
+/**
+ * Creates a {@linkcode Request} for a "developer" page with the given {@linkcode id}
+ */
+export function makeDeveloperRequest(objectGraph, id) {
+ const request = new Request(objectGraph).withIdOfType(id, "developers");
+ return addDeveloperRequestProperties(objectGraph, request);
+}
+/**
+ * Add the expected request attributes (relationships, platforms, etc) to a request
+ * for a "developer" resource
+ */
+export function addDeveloperRequestProperties(objectGraph, request) {
+ request
+ .includingAdditionalPlatforms(defaultAdditionalPlatformsForClient(objectGraph))
+ .includingRelationships(developerRelationships(objectGraph))
+ .includingAttributes(developerAttributes(objectGraph))
+ .includingMacOSCompatibleIOSAppsWhenSupported()
+ .usingCustomAttributes(shouldFetchCustomAttributes(objectGraph));
+ if (objectGraph.client.isWeb) {
+ // The "web" client needs to load *all* of the data for SEO purposes
+ request.addingQuery("sparseLimit[developers:ios-apps]", "40");
+ }
+ return request;
+}
+//# sourceMappingURL=developer-request.js.map \ No newline at end of file