Mark POS .observe extension targets as @deprecated - #4146
Conversation
🚨🚨🚨 Docs migration in progress 🚨🚨🚨We are actively migrating UI extension reference docs to MDX in the
During this migration, please be aware of the following:
Doc comments in Examples that previously lived in this repo are being moved to the What should I do?
Thanks for your patience while we complete the migration! 🙏 |
df3502f to
83aff98
Compare
Add @deprecated and @Private JSDoc annotations to all 4 POS observe extension targets: - pos.transaction-complete.event.observe - pos.cash-tracking-session-start.event.observe - pos.cash-tracking-session-complete.event.observe - pos.cart-update.event.observe Each annotation includes the deprecation version (2026-04), migration path to pos.app.ready.data + shopify.addEventListener(), and a link to the new target's documentation. pos.cart-update.event.observe also references shopify.cart.current.subscribe() as an alternative for render targets. Resolves: shop/issues-retail#26066 Epic: shop/issues-retail#26019 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…_update event reference
83aff98 to
7386990
Compare
| /** | ||
| * Fires when a cash tracking session starts. | ||
| * | ||
| * @deprecated Deprecated as of `2026-04`. Use `pos.app.ready.data` target with |
There was a problem hiding this comment.
Shouldn't these all be deprecated as of 2025-10?
| * | ||
| * @deprecated Deprecated as of `2026-04`. Use `pos.app.ready.data` target with | ||
| * `window.addEventListener('cash_tracking_session_start', callback)` instead. | ||
| * See https://shopify.dev/docs/api/pos-ui-extensions/unstable/targets/pos-app-ready-data |
| * | ||
| * @deprecated Deprecated as of `2025-10`. Use `pos.app.ready.data` target with | ||
| * `window.addEventListener('transactioncomplete', callback)` instead. | ||
| * See https://shopify.dev/docs/api/pos-ui-extensions/latest/targets/pos-app-ready-data |
There was a problem hiding this comment.
Quick question: Is this a URL to a page that currently exists?
Let's embed the URL as part of the running text. So something like "Use the [pos.app.ready.app target](link). Also, let's use the version variable in URLs like this:
/docs/api/pos-ui-extensions/{API_VERSION}/targets/pos-app-ready-data
There was a problem hiding this comment.
Good call! The pos.app.ready.data target page doesn't exist yet — it'll go live with the 2026-04 API
I've updated all 4 deprecation blocks to:
- Add "the" before
pos.app.ready.data✅ - Inline the URL in the text as
[pos.app.ready.datatarget](link)instead of a separate "See" line ✅ - Use
{API_VERSION}variable in URLs ✅
Apply suggested changes
Apply suggested changes
Apply suggested changes
|
Hi @vctrchu ! Do you mind taking me off of this PR too? 🙏 |
…ailing newlines The deprecation annotations added in this PR cause two CI lint failures: 1. ESLint import/no-deprecated fires on the imports and usages of CashTrackingSessionStartData, CashTrackingSessionCompleteData, and CartUpdateEventData inside extension-targets.ts. These usages are intentional — extension-targets.ts is the file that defines the deprecated targets themselves, so the deprecated types must still be referenced here. Suppress the rule on each import and usage site. 2. Prettier flags three trailing blank lines at the end of CashTrackingSessionData.ts. Remove them.
4570355 to
edfba59
Compare
The deprecation annotations referenced `2025-10` — the API version when the replacement `pos.app.ready.data` target became available — but the existing convention in this repo (see `useTarget` in checkout/preact and `useDeliveryGroupTarget`) uses "Deprecated as of version <X>" to refer to the version that introduces the deprecation itself. This PR targets `2026-07-rc`, so that is the correct version. Also match the existing convention by including the word "version" and ending each annotation with "instead." for consistency.
Part of https://github.com/shop/issues-retail/issues/26066
What
Adds
@deprecatedand@privateJSDoc annotations to all 4 POS observe extension targets, pointing developers topos.app.ready.data+window.addEventListener()as the replacement.Targets deprecated
pos.transaction-complete.event.observewindow.addEventListener('transactioncomplete', cb)onpos.app.ready.datapos.cash-tracking-session-start.event.observewindow.addEventListener('cashtrackingsessionstart', cb)onpos.app.ready.datapos.cash-tracking-session-complete.event.observewindow.addEventListener('cashtrackingsessioncomplete', cb)onpos.app.ready.datapos.cart-update.event.observeapi.cart.current.subscribe()onpos.app.ready.dataWhy
The observe targets are fire-and-forget — they run once per event with no persistent state, no access to APIs, and no way to correlate events.
pos.app.ready.datais a persistent background target that runs for the entire session, receives events via the standardwindow.addEventListener()Web API, and has full access to non-UI APIs (cart, storage, session, locale, connectivity, device, product search).Notes
@privateexcludes these from generated shopify.dev documentationcart_updatehas no event equivalent inPosEventMap— cart state is continuous, not discrete, so the replacement is the subscribableapi.cart.current.subscribe()patternRelated PRs
Resolves: https://github.com/shop/issues-retail/issues/26066
Epic: https://github.com/shop/issues-retail/issues/26019
Test plan
yarn buildpasses