@shoplix-ai/block-kit 1.2.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,16 +10,24 @@ written against this package and nothing else from the runtime. It holds:
10
10
  the buyer's language and text direction with the Shop's default language as
11
11
  fallback, `navigate` (the document's action, and the implicit taps: a
12
12
  product, a collection, search, the account), `cart` (how many items the
13
- cart holds, for a badge, never the cart itself), and a capability object
14
- holding only the capabilities the Block Type declared. A Block Type may also
15
- declare `rows` beside `render` and hand its items to the host instead of
16
- drawing them itself.
13
+ cart holds for a badge, and whether a change is on its way so every block
14
+ goes quiet together; never the cart itself, which a cart Binding resolves),
15
+ and a capability object holding only the capabilities the Block Type
16
+ declared. A Block Type may also declare `rows` beside `render` and hand its
17
+ items to the host instead of drawing them itself.
17
18
  - **The registry.** `createBlockRegistry()` keyed by Block Type, one owner per
18
19
  type. A second owner is refused; the same owner may register again. Packages
19
20
  outside the app register through it. `defineBlock()` is the typed authoring
20
21
  helper: settings and capabilities are inferred from the definition.
21
- - **The capability set.** `addToCart`, `openCart`, `beginCheckout`. Closed, and
22
- the same list the schema package lets a Block Definition declare.
22
+ - **The capability set.** `addToCart` (with optional line attributes),
23
+ `openCart`, `beginCheckout`, `setLineQuantity`, `removeLines` (one or many
24
+ line ids), `applyDiscountCode`, `removeDiscountCode`, `setCartNote`,
25
+ `setLineAttributes`. Closed, and the same list the schema package lets a
26
+ Block Definition declare. A cart capability resolves once Shopify accepted
27
+ and rejects with a `CapabilityRefusal`: the outcome (`refused`, `not_found`,
28
+ `failed`) and Shopify's messages; `isCapabilityRefusal` tells it apart from
29
+ any other rejection. Nothing repaints before Shopify's answer, and the block
30
+ decides how to show a refusal.
23
31
  - **The authoring shape of a Code Block.** `defineSettings()` and
24
32
  `defineBinding()` type a block's settings and binding files; `SettingsValues`
25
33
  derives the renderer's settings type from the settings file;
@@ -33,9 +41,11 @@ written against this package and nothing else from the runtime. It holds:
33
41
  major; the api's package registry records it at push, and taking a version
34
42
  refuses a major other than the runtime's before anything is built.
35
43
  - **Helpers.** `resolveToken` (follow an alias to its value), `formatMoney`
36
- (amount plus currency code, formatted in the buyer's language), `pickLocale`
37
- (the buyer's language from the Shop's languages with default fallback),
38
- `localize` (one string out of a locale object), `textDirection`,
44
+ (amount plus currency code, formatted in the buyer's language; the one way a
45
+ block formats a figure it derived from display money amounts, in one
46
+ currency, for display only: the total a buyer sees is always Shopify's),
47
+ `pickLocale` (the buyer's language from the Shop's languages with default
48
+ fallback), `localize` (one string out of a locale object), `textDirection`,
39
49
  `imageSourceFor` (the rendition to paint at a given display width).
40
50
 
41
51
  ## Rows: what the host lays out
@@ -84,8 +94,8 @@ React types only. Its export list, the runtime names and the type names alike,
84
94
  is pinned by a test; it is imported by code outside this repo, so growing it is
85
95
  a reviewed change. The package follows
86
96
  semver and is publishable: a change a Shop package would have to follow is a
87
- major bump, announced with a migration note, and the runtime moves to the new
88
- major before any Shop package may.
97
+ major bump, announced with a migration note in `CHANGELOG.md`, and the runtime
98
+ moves to the new major before any Shop package may.
89
99
 
90
100
  ```sh
91
101
  pnpm build
@@ -1,22 +1,64 @@
1
- import { type BlockCapabilityName } from '@shoplix-ai/sdui-schema';
1
+ import { type BlockCapabilityName, type CartAttribute } from '@shoplix-ai/sdui-schema';
2
2
  /**
3
3
  * The closed capability set. A renderer reaches commerce only through these
4
- * three; the Storefront token, the cart id and navigation never cross the
4
+ * nine; the Storefront token, the cart id and navigation never cross the
5
5
  * contract. The set is code, never document content, and it does not grow
6
6
  * without a new contract major. The schema package names the same list, so a
7
7
  * Block Definition can declare only what a renderer can be handed.
8
8
  */
9
- export declare const CAPABILITY_NAMES: readonly ["addToCart", "openCart", "beginCheckout"];
9
+ export declare const CAPABILITY_NAMES: readonly ["addToCart", "openCart", "beginCheckout", "setLineQuantity", "removeLines", "applyDiscountCode", "removeDiscountCode", "setCartNote", "setLineAttributes"];
10
10
  export type CapabilityName = BlockCapabilityName;
11
11
  export interface CartLineInput {
12
12
  readonly variantId: string;
13
13
  readonly quantity: number;
14
+ readonly attributes?: readonly CartAttribute[];
14
15
  }
16
+ export interface CartLineQuantityInput {
17
+ readonly lineId: string;
18
+ readonly quantity: number;
19
+ }
20
+ export interface CartLineAttributesInput {
21
+ readonly lineId: string;
22
+ readonly attributes: readonly CartAttribute[];
23
+ }
24
+ /**
25
+ * Every cart capability answers through the host's one serialized queue and
26
+ * resolves once Shopify accepted; it rejects with a CapabilityRefusal, and
27
+ * the held cart repaints only on Shopify's answer, never before.
28
+ */
15
29
  export interface Capabilities {
16
30
  readonly addToCart: (line: CartLineInput) => Promise<void>;
17
31
  readonly openCart: () => void;
18
32
  readonly beginCheckout: () => Promise<void>;
33
+ readonly setLineQuantity: (input: CartLineQuantityInput) => Promise<void>;
34
+ readonly removeLines: (lineIds: readonly string[]) => Promise<void>;
35
+ readonly applyDiscountCode: (code: string) => Promise<void>;
36
+ readonly removeDiscountCode: (code: string) => Promise<void>;
37
+ readonly setCartNote: (note: string) => Promise<void>;
38
+ readonly setLineAttributes: (input: CartLineAttributesInput) => Promise<void>;
19
39
  }
20
40
  /** What a renderer sees: exactly the capabilities its Block Type declared. */
21
41
  export type CapabilityObject<K extends CapabilityName = never> = Pick<Capabilities, K>;
42
+ /**
43
+ * Why a capability's promise rejected: Shopify refused the change (a quantity
44
+ * it will not sell, a code it does not honour), the cart is gone, or the call
45
+ * never got an answer.
46
+ */
47
+ export type CapabilityOutcome = 'refused' | 'not_found' | 'failed';
48
+ /**
49
+ * The typed refusal a cart capability rejects with: the outcome, and what
50
+ * Shopify said, in the buyer's language where Shopify gave it. A block
51
+ * decides how to show it; the host never shows it for the block.
52
+ */
53
+ export declare class CapabilityRefusal extends Error {
54
+ readonly outcome: CapabilityOutcome;
55
+ readonly messages: readonly string[];
56
+ readonly name = "CapabilityRefusal";
57
+ constructor(outcome: CapabilityOutcome, messages: readonly string[]);
58
+ }
59
+ /**
60
+ * Whether a rejection is a capability refusal, by its shape and never by
61
+ * its class: a Shop package and the app may each carry a copy of this module.
62
+ */
63
+ export declare function isCapabilityRefusal(error: unknown): error is CapabilityRefusal;
22
64
  //# sourceMappingURL=capabilities.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE3F;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,qDAAyB,CAAC;AAEvD,MAAM,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAEjD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C;AAED,8EAA8E;AAC9E,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,cAAc,GAAG,KAAK,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,aAAa,EACnB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,sKAAyB,CAAC;AAEvD,MAAM,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAEjD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAA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AS,cAAc,GAAG,KAAK,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;AAEvF;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;AAQnE;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAIxC,QAAQ,CAAC,OAAO,EAAE,iBAAiB;IACnC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE;IAJtC,SAAkB,IAAI,uBAAuB;gBAGlC,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE,SAAS,MAAM,EAAE;CAIvC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAU9E"}
@@ -1,10 +1,44 @@
1
- import { BLOCK_CAPABILITY_NAMES } from '@shoplix-ai/sdui-schema';
1
+ import { BLOCK_CAPABILITY_NAMES, } from '@shoplix-ai/sdui-schema';
2
2
  /**
3
3
  * The closed capability set. A renderer reaches commerce only through these
4
- * three; the Storefront token, the cart id and navigation never cross the
4
+ * nine; the Storefront token, the cart id and navigation never cross the
5
5
  * contract. The set is code, never document content, and it does not grow
6
6
  * without a new contract major. The schema package names the same list, so a
7
7
  * Block Definition can declare only what a renderer can be handed.
8
8
  */
9
9
  export const CAPABILITY_NAMES = BLOCK_CAPABILITY_NAMES;
10
+ const OUTCOMES = new Set([
11
+ 'refused',
12
+ 'not_found',
13
+ 'failed',
14
+ ]);
15
+ /**
16
+ * The typed refusal a cart capability rejects with: the outcome, and what
17
+ * Shopify said, in the buyer's language where Shopify gave it. A block
18
+ * decides how to show it; the host never shows it for the block.
19
+ */
20
+ export class CapabilityRefusal extends Error {
21
+ outcome;
22
+ messages;
23
+ name = 'CapabilityRefusal';
24
+ constructor(outcome, messages) {
25
+ super(messages.length > 0 ? messages.join(' ') : outcome);
26
+ this.outcome = outcome;
27
+ this.messages = messages;
28
+ }
29
+ }
30
+ /**
31
+ * Whether a rejection is a capability refusal, by its shape and never by
32
+ * its class: a Shop package and the app may each carry a copy of this module.
33
+ */
34
+ export function isCapabilityRefusal(error) {
35
+ if (typeof error !== 'object' || error === null)
36
+ return false;
37
+ const bag = error;
38
+ return (bag.name === 'CapabilityRefusal' &&
39
+ typeof bag.outcome === 'string' &&
40
+ OUTCOMES.has(bag.outcome) &&
41
+ Array.isArray(bag.messages) &&
42
+ bag.messages.every((message) => typeof message === 'string'));
43
+ }
10
44
  //# sourceMappingURL=capabilities.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAA4B,MAAM,yBAAyB,CAAC;AAE3F;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAAsB,CAAC"}
1
+ {"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,GAGvB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AA+CvD,MAAM,QAAQ,GAAwB,IAAI,GAAG,CAAoB;IAC/D,SAAS;IACT,WAAW;IACX,QAAQ;CACT,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAI/B;IACA;IAJO,IAAI,GAAG,mBAAmB,CAAC;IAE7C,YACW,OAA0B,EAC1B,QAA2B;QAEpC,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAHjD,YAAO,GAAP,OAAO,CAAmB;QAC1B,aAAQ,GAAR,QAAQ,CAAmB;IAGtC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,GAAG,GAAG,KAAkE,CAAC;IAC/E,OAAO,CACL,GAAG,CAAC,IAAI,KAAK,mBAAmB;QAChC,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ;QAC/B,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC;QACzB,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;QAC3B,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAC7D,CAAC;AACJ,CAAC"}
@@ -4,9 +4,14 @@ import type { CapabilityName, CapabilityObject } from './capabilities.js';
4
4
  import type { BlockNavigation } from './navigation.js';
5
5
  export type TextDirection = 'ltr' | 'rtl';
6
6
  export type BlockSettings = Readonly<Record<string, unknown>>;
7
- /** What a renderer may know of the cart without holding it: how many items it carries. */
7
+ /**
8
+ * What every renderer may know of the cart without holding it: how many
9
+ * items it carries, and whether a change is on its way. The host's serialized
10
+ * queue sets pending, so every block on the screen goes quiet together.
11
+ */
8
12
  export interface CartSummary {
9
13
  readonly totalQuantity: number;
14
+ readonly pending: boolean;
10
15
  }
11
16
  /**
12
17
  * Everything a renderer receives, and all it may know. Settings are the
@@ -15,8 +20,9 @@ export interface CartSummary {
15
20
  * display entries for the screen in hand, keyed by asset id; tokens and theme
16
21
  * are the Shop's; language and direction are the buyer's, with the Shop's default
17
22
  * language as the fallback every locale object resolves through; navigate is the
18
- * closed way to move the buyer; cart is the count a badge draws, never the
19
- * cart itself; capabilities hold only what the Block Type declared.
23
+ * closed way to move the buyer; cart is the count a badge draws and the pending
24
+ * flag, never the cart itself, which a cart Binding resolves; capabilities hold
25
+ * only what the Block Type declared.
20
26
  */
21
27
  export interface BlockRenderProps<TSettings extends BlockSettings = BlockSettings, K extends CapabilityName = never> {
22
28
  readonly blockId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,cAAc,EACd,UAAU,EACV,UAAU,EACV,WAAW,EACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,KAAK,CAAC;AAE1C,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAE9D,0FAA0F;AAC1F,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB,CAC/B,SAAS,SAAS,aAAa,GAAG,aAAa,EAC/C,CAAC,SAAS,cAAc,GAAG,KAAK;IAEhC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;IAC9B,QAAQ,CAAC,eAAe,EAAE,UAAU,CAAC;IACrC,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;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CAAC,YAAY,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC;IACrC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;IAC7C,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC;CACrD;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,SAAS,cAAc,EAAE,CAAC;IACjD,sGAAsG;IACtG,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,oGAAoG;IACpG,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACvC;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,SAAS,SAAS,aAAa,GAAG,aAAa,EAC/C,KAAK,CAAC,CAAC,SAAS,cAAc,GAAG,KAAK,EACtC,UAAU,EAAE,eAAe,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,iBAAiB,CAQ9D"}
@@ -1 +1 @@
1
- {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAsHA;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAGzB,UAAyC;IACzC,OAAO;QACL,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,EAAE;QAC3C,MAAM,EAAE,UAAU,CAAC,MAAkC;QACrD,IAAI,EAAE,UAAU,CAAC,IAAwC;KAC1D,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AA4HA;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAGzB,UAAyC;IACzC,OAAO;QACL,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,EAAE;QAC3C,MAAM,EAAE,UAAU,CAAC,MAAkC;QACrD,IAAI,EAAE,UAAU,CAAC,IAAwC;KAC1D,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { CAPABILITY_NAMES } from './capabilities.js';
2
- export type { Capabilities, CapabilityName, CapabilityObject, CartLineInput, } from './capabilities.js';
1
+ export { CAPABILITY_NAMES, CapabilityRefusal, isCapabilityRefusal } from './capabilities.js';
2
+ export type { Capabilities, CapabilityName, CapabilityObject, CapabilityOutcome, CartLineAttributesInput, CartLineInput, CartLineQuantityInput, } from './capabilities.js';
3
3
  export { defineBlock } from './contract.js';
4
4
  export type { BlockDefinition, BlockItemRenderProps, BlockOwner, BlockRegistration, BlockRenderProps, BlockRenderer, BlockRows, BlockSettings, CartSummary, TextDirection, } from './contract.js';
5
5
  export type { BlockNavigation } from './navigation.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,YAAY,EACV,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,aAAa,GACd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EACV,eAAe,EACf,oBAAoB,EACpB,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,aAAa,EACb,WAAW,EACX,aAAa,GACd,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAA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E,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC/D,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhF,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC9D,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElE,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAClE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { CAPABILITY_NAMES } from './capabilities.js';
1
+ export { CAPABILITY_NAMES, CapabilityRefusal, isCapabilityRefusal } from './capabilities.js';
2
2
  export { defineBlock } from './contract.js';
3
3
  export { createBlockRegistry } from './registry.js';
4
4
  export { defineBinding, defineSettings } from './authoring.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAQrD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAgB5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGpD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAG/D,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG9D,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAW7F,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAgB5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGpD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAG/D,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG9D,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
package/dist/version.d.ts CHANGED
@@ -4,6 +4,6 @@
4
4
  * The major is the compatibility line: a Shop package built against another
5
5
  * major never meets this runtime, and a major bump is an announced event.
6
6
  */
7
- export declare const CONTRACT_VERSION = "1.2.0";
8
- export declare const CONTRACT_MAJOR = 1;
7
+ export declare const CONTRACT_VERSION = "2.0.0";
8
+ export declare const CONTRACT_MAJOR = 2;
9
9
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -4,6 +4,6 @@
4
4
  * The major is the compatibility line: a Shop package built against another
5
5
  * major never meets this runtime, and a major bump is an announced event.
6
6
  */
7
- export const CONTRACT_VERSION = '1.2.0';
8
- export const CONTRACT_MAJOR = 1;
7
+ export const CONTRACT_VERSION = '2.0.0';
8
+ export const CONTRACT_MAJOR = 2;
9
9
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shoplix-ai/block-kit",
3
- "version": "1.2.0",
3
+ "version": "2.0.0",
4
4
  "description": "The renderer contract every Block Type renderer is written against: what a renderer receives, how a Block Type is registered with its owner, the closed capability set, and the small helpers renderers share. Contract only, no renderers.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -26,7 +26,7 @@
26
26
  "access": "public"
27
27
  },
28
28
  "dependencies": {
29
- "@shoplix-ai/sdui-schema": "1.3.0"
29
+ "@shoplix-ai/sdui-schema": "1.5.0"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "react": ">=19.0.0"