[Prototype] POS UI extension intercept declaration (capabilities.intercepts)#8057
Draft
henryStelle wants to merge 6 commits into
Draft
[Prototype] POS UI extension intercept declaration (capabilities.intercepts)#8057henryStelle wants to merge 6 commits into
henryStelle wants to merge 6 commits into
Conversation
POS UI extensions can now declare, in shopify.extension.toml, which host-mediated intercept events they participate in and whether they intend to block progress on each. This is the event-scoped POS analogue of checkout's single `capabilities.block_progress` capability. TOML shape (top-level array of tables): [[intercepts]] event = "beforecheckout" block_progress = true - event: required, validated against POS_INTERCEPT_EVENTS (beforecheckout, beforepayment) — extensible const - block_progress: optional boolean, defaults to false - duplicate events are rejected - declarations flow through deployConfig for later backend wiring Prototype: schema + parsing + validation + tests (Area B, step 1). Assisted-By: devx/a246d980-dba0-4a06-b4d4-27c89d8ca9bf
Per design confirmation, replace the [[intercepts]] array-of-tables with a single POS-specific capability: a string array of blockable events. [capabilities] intercepts = ["beforecheckout", "beforepayment"] Membership in the array = the extension may block that event (collapses "intercepts at all" vs "can block" into one blockable set, intended for the prototype). - Export shared CapabilitiesSchema; POS extends it with an optional `intercepts` array of POS_INTERCEPT_EVENTS enums. Shared block_progress boolean is untouched (checkout depends on it); intercepts is POS-only. - Unknown events rejected with a clear message; duplicates rejected via a uniqueness superRefine on the array. - deployConfig emits capabilities (incl. intercepts); mapping kept thin for the pending cross-repo field rename. - Tests updated: valid/empty parse, coexists-with-shared-capabilities, unknown-event + duplicate rejection, deployConfig includes/omits. Assisted-By: devx/a246d980-dba0-4a06-b4d4-27c89d8ca9bf
Drop the newly-added pos_ui_extension.test.ts. This is a prototype and the tests should not gate it. All source/schema changes are kept. Note: with the test gone, knip flags POS_INTERCEPT_EVENTS as an unused export (the test was its only external consumer). The const is still used internally by the schema; left as-is intentionally. Assisted-By: devx/a246d980-dba0-4a06-b4d4-27c89d8ca9bf
The const is still used internally by the intercept schema, but has no external consumer now that the prototype tests are gone. Keep it local to satisfy knip; re-add `export` when real consumers land. Assisted-By: devx/a246d980-dba0-4a06-b4d4-27c89d8ca9bf
Intercept events are functionally equivalent to extension targets, which are free-form strings validated server-side (the CLI never hardcodes the valid target list). Match that precedent so the intercept event set stays forward-compatible: new events can ship without a CLI release and won't be rejected by older CLI installs. - intercepts: array(enum(POS_INTERCEPT_EVENTS)) -> array(string) with a light lowercase-identifier format check (structural only, not a value allowlist). Server remains the source of truth for valid event names. - Keep the duplicate-rejection superRefine (structural, forward-compatible). - Delete the POS_INTERCEPT_EVENTS const entirely. Assisted-By: devx/a246d980-dba0-4a06-b4d4-27c89d8ca9bf
Per design: intercept event names are lowercase a-z only, no digits. Change the format check from /^[a-z][a-z0-9]*$/ to /^[a-z]+$/. Everything else (array(string), dedupe refine) unchanged. Assisted-By: devx/a246d980-dba0-4a06-b4d4-27c89d8ca9bf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
TOML schema support for a POS UI extension to declare which intercept events it may block:
Changes
models/extensions/specifications/pos_ui_extension.ts—POS_INTERCEPT_EVENTSconst;PosCapabilitiesSchemaextends the sharedCapabilitiesSchemawith an optionalinterceptsarray of known event enums + a uniquenesssuperRefine; POS spec overridescapabilities;deployConfigpassesinterceptsthrough.models/extensions/schemas.ts— only addedexportto the sharedCapabilitiesSchema. The sharedblock_progressboolean is untouched (checkout unaffected).Prototype scope notes
block_progress.config.intercepts).