From 59dfd602cf0750c6c5db45a112a4371a3aefb1a6 Mon Sep 17 00:00:00 2001 From: John Mizerek Date: Tue, 10 Mar 2026 13:14:11 -0700 Subject: [PATCH] Use production GraphQL query for DoorDash modifier extraction The minimal query was rejected by DoorDash's schema validation. Replaced with production-matching query including OptionListFragment, OptionFragment, and NestedExtrasFragment. Co-Authored-By: Claude Opus 4.6 --- playwright/doordash-modifiers.js | 86 +++++++++++++++++++++++++++++--- 1 file changed, 80 insertions(+), 6 deletions(-) diff --git a/playwright/doordash-modifiers.js b/playwright/doordash-modifiers.js index 5a17364..c534786 100644 --- a/playwright/doordash-modifiers.js +++ b/playwright/doordash-modifiers.js @@ -146,17 +146,91 @@ chromium.use(stealth()); } if (!queryTemplate) { - log("Could not capture query template, using hardcoded minimal query"); - // Minimal query that gets optionLists - queryTemplate = `query itemPage($storeId: ID!, $itemId: ID!, $consumerId: ID, $isMerchantPreview: Boolean, $isNested: Boolean!, $fulfillmentType: FulfillmentType, $shouldFetchPresetCarousels: Boolean!, $cursorContext: ItemPageCursorContextInput, $shouldFetchStoreLiteData: Boolean!) { - itemPage(storeId: $storeId, itemId: $itemId, consumerId: $consumerId, isMerchantPreview: $isMerchantPreview, fulfillmentType: $fulfillmentType, cursorContext: $cursorContext) { + log("Could not capture query template, using production query"); + // Full production query matching DoorDash's frontend schema + queryTemplate = `query itemPage($storeId: ID!, $itemId: ID!, $consumerId: ID, $isMerchantPreview: Boolean, $isNested: Boolean!, $fulfillmentType: FulfillmentType, $shouldFetchPresetCarousels: Boolean!, $cursorContext: ItemPageCursorContextInput, $shouldFetchStoreLiteData: Boolean!, $scheduledMinTimeUtc: String, $scheduledMaxTimeUtc: String) { + itemPage( + storeId: $storeId + itemId: $itemId + consumerId: $consumerId + isMerchantPreview: $isMerchantPreview + fulfillmentType: $fulfillmentType + cursorContext: $cursorContext + scheduledMinTimeUtc: $scheduledMinTimeUtc + scheduledMaxTimeUtc: $scheduledMaxTimeUtc + ) { + itemHeader @skip(if: $isNested) { + id + name + description + unitAmount + currency + decimalPlaces + __typename + } optionLists { - name minNumOptions maxNumOptions isOptional - options { name unitAmount currency decimalPlaces displayString __typename } + ...OptionListFragment __typename } __typename } +} + +fragment OptionListFragment on OptionList { + type + id + name + subtitle + minNumOptions + maxNumOptions + minAggregateOptionsQuantity + maxAggregateOptionsQuantity + minOptionChoiceQuantity + maxOptionChoiceQuantity + numFreeOptions + isOptional + options { + ...OptionFragment + nestedExtrasList { + ...NestedExtrasFragment + __typename + } + __typename + } + __typename +} + +fragment OptionFragment on FeedOption { + id + name + unitAmount + currency + displayString + decimalPlaces + nextCursor + defaultQuantity + imgUrl + __typename +} + +fragment NestedExtrasFragment on OptionList { + type + id + name + subtitle + minNumOptions + maxNumOptions + minAggregateOptionsQuantity + maxAggregateOptionsQuantity + minOptionChoiceQuantity + maxOptionChoiceQuantity + numFreeOptions + isOptional + options { + ...OptionFragment + __typename + } + __typename }`; } else { log("Captured query template (" + queryTemplate.length + " chars)");