Skip to content

fix(pos): include Event Listeners API in targets.json reverse mapping#4568

Closed
henryStelle wants to merge 1 commit into
2026-07-rcfrom
fix-pos-targets-json-event-listeners-api
Closed

fix(pos): include Event Listeners API in targets.json reverse mapping#4568
henryStelle wants to merge 1 commit into
2026-07-rcfrom
fix-pos-targets-json-event-listeners-api

Conversation

@henryStelle

Copy link
Copy Markdown
Contributor

Problem

BackgroundShopifyGlobal (which provides addEventListener/removeEventListener on the shopify global) was not being picked up by build-docs-targets-json.mjs. The script discovers APIs by parsing type signatures and recursively resolving nested *Api names via getNestedApis(), but BackgroundShopifyGlobal is a global interface — not a type parameter in DataTargetApi's intersection — so it was never discovered.

This caused EventListenersApi to be missing from the generated targets.json reverse mapping, which broke the <ExtensionSupports entityName="Event Listeners API" /> component on the shopify-dev docs page.

Fix

Following the existing *Api pattern used by SessionApi, StorageApi, etc.:

  1. Created EventListenersApi + EventListenersApiContent types in src/surfaces/point-of-sale/api/event-listeners-api/
  2. Added EventListenersApi to DataTargetApi's type intersection in data-target-api.ts
  3. Exported EventListenersApi from api.ts
  4. Registered the file path in build-docs-targets-json.mjs's apiFilePaths map

Now getNestedApis('DataTargetApi') naturally discovers EventListenersApi, which flows into the reverse mapping as EventListenersApi -> [pos.app.ready.data] — no special-case hacks needed.

Regenerated

  • 2026-07-rc/generated_docs_data_v2.json
  • 2026-07-rc/targets.json

@henryStelle henryStelle requested a review from vctrchu July 6, 2026 23:37
…ping

BackgroundShopifyGlobal (addEventListener/removeEventListener on the shopify
global) was not being picked up by build-docs-targets-json.mjs. The script
discovers APIs by parsing type signatures and recursively resolving nested
*Api names via getNestedApis(), but BackgroundShopifyGlobal is a global
interface that doesn't match the (\w+Api) extraction pattern.

Fix: reference BackgroundShopifyGlobal from DataTargetApi's type intersection
(it is the shopify global for data targets), add it to the build script's
apiFilePaths map, and widen the getNestedApis extraction regex to also match
*Global types. Now getNestedApis('DataTargetApi') naturally discovers
BackgroundShopifyGlobal, which flows into the reverse mapping as
BackgroundShopifyGlobal -> [pos.app.ready.data].

Regenerated 2026-07-rc docs data.
@henryStelle henryStelle force-pushed the fix-pos-targets-json-event-listeners-api branch from 9d0f224 to fb28c6b Compare July 6, 2026 23:49
@henryStelle

Copy link
Copy Markdown
Contributor Author

Superseded by #4569

@henryStelle henryStelle closed this Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant