@shoplix-ai/block-kit 1.2.0 → 3.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,30 @@ 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`, and `notificationInvitation`, the shopper's own
26
+ notification decision as one host state: whether the invitation is still
27
+ offered, the tap that opens the phone's prompt and the tap that hides it
28
+ until the next completed checkout. Closed, and the same list the schema
29
+ package lets a Block Definition declare. A cart capability resolves once Shopify accepted
30
+ the change it asked for and rejects with a `CapabilityRefusal`: the outcome
31
+ (`refused`, `not_found`, `failed`) and the messages that came with it,
32
+ Shopify's own or the host's where Shopify sent none — a quantity over the
33
+ stock is clamped by Shopify and not refused, and the host names what is left;
34
+ `isCapabilityRefusal` tells it apart from any other rejection. Nothing
35
+ repaints before Shopify's answer, and the block decides how to show a
36
+ refusal.
23
37
  - **The authoring shape of a Code Block.** `defineSettings()` and
24
38
  `defineBinding()` type a block's settings and binding files; `SettingsValues`
25
39
  derives the renderer's settings type from the settings file;
@@ -33,9 +47,11 @@ written against this package and nothing else from the runtime. It holds:
33
47
  major; the api's package registry records it at push, and taking a version
34
48
  refuses a major other than the runtime's before anything is built.
35
49
  - **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`,
50
+ (amount plus currency code, formatted in the buyer's language; the one way a
51
+ block formats a figure it derived from display money amounts, in one
52
+ currency, for display only: the total a buyer sees is always Shopify's),
53
+ `pickLocale` (the buyer's language from the Shop's languages with default
54
+ fallback), `localize` (one string out of a locale object), `textDirection`,
39
55
  `imageSourceFor` (the rendition to paint at a given display width).
40
56
 
41
57
  ## Rows: what the host lays out
@@ -84,8 +100,8 @@ React types only. Its export list, the runtime names and the type names alike,
84
100
  is pinned by a test; it is imported by code outside this repo, so growing it is
85
101
  a reviewed change. The package follows
86
102
  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.
103
+ major bump, announced with a migration note in `CHANGELOG.md`, and the runtime
104
+ moves to the new major before any Shop package may.
89
105
 
90
106
  ```sh
91
107
  pnpm build
@@ -1,22 +1,80 @@
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
5
- * contract. The set is code, never document content, and it does not grow
6
- * without a new contract major. The schema package names the same list, so a
7
- * Block Definition can declare only what a renderer can be handed.
4
+ * nine, and the shopper's notification decision only through the tenth; the
5
+ * Storefront token, the cart id and navigation never cross the contract. The
6
+ * set is code, never document content, and it does not grow without a new
7
+ * contract major. The schema package names the same list, so a Block
8
+ * Definition can declare only what a renderer can be handed.
8
9
  */
9
- export declare const CAPABILITY_NAMES: readonly ["addToCart", "openCart", "beginCheckout"];
10
+ export declare const CAPABILITY_NAMES: readonly ["addToCart", "openCart", "beginCheckout", "setLineQuantity", "removeLines", "applyDiscountCode", "removeDiscountCode", "setCartNote", "setLineAttributes", "notificationInvitation"];
10
11
  export type CapabilityName = BlockCapabilityName;
11
12
  export interface CartLineInput {
12
13
  readonly variantId: string;
13
14
  readonly quantity: number;
15
+ readonly attributes?: readonly CartAttribute[];
14
16
  }
17
+ export interface CartLineQuantityInput {
18
+ readonly lineId: string;
19
+ readonly quantity: number;
20
+ }
21
+ export interface CartLineAttributesInput {
22
+ readonly lineId: string;
23
+ readonly attributes: readonly CartAttribute[];
24
+ }
25
+ /**
26
+ * The Notification Invitation as a renderer sees it: whether there is still
27
+ * anything to ask, the tap that opens the phone's own prompt, and the tap
28
+ * that hides the invitation until the shopper's next completed checkout. One
29
+ * host state, so two blocks on one device never disagree.
30
+ */
31
+ export interface NotificationInvitation {
32
+ readonly offered: boolean;
33
+ readonly turnOn: () => void;
34
+ readonly dismiss: () => void;
35
+ }
36
+ /**
37
+ * Every cart capability answers through the host's one serialized queue and
38
+ * resolves once Shopify accepted the change it was asked for; it rejects with
39
+ * a CapabilityRefusal, and the held cart repaints only on Shopify's answer,
40
+ * never before.
41
+ */
15
42
  export interface Capabilities {
16
43
  readonly addToCart: (line: CartLineInput) => Promise<void>;
17
44
  readonly openCart: () => void;
18
45
  readonly beginCheckout: () => Promise<void>;
46
+ readonly setLineQuantity: (input: CartLineQuantityInput) => Promise<void>;
47
+ readonly removeLines: (lineIds: readonly string[]) => Promise<void>;
48
+ readonly applyDiscountCode: (code: string) => Promise<void>;
49
+ readonly removeDiscountCode: (code: string) => Promise<void>;
50
+ readonly setCartNote: (note: string) => Promise<void>;
51
+ readonly setLineAttributes: (input: CartLineAttributesInput) => Promise<void>;
52
+ readonly notificationInvitation: NotificationInvitation;
19
53
  }
20
54
  /** What a renderer sees: exactly the capabilities its Block Type declared. */
21
55
  export type CapabilityObject<K extends CapabilityName = never> = Pick<Capabilities, K>;
56
+ /**
57
+ * Why a capability's promise rejected: the change did not land (a quantity the
58
+ * shop will not sell, a code it does not honour), the cart is gone, or the
59
+ * call never got an answer.
60
+ */
61
+ export type CapabilityOutcome = 'refused' | 'not_found' | 'failed';
62
+ /**
63
+ * The typed refusal a cart capability rejects with: the outcome, and the words
64
+ * that came with it in the buyer's language — Shopify's own, or the host's
65
+ * where Shopify sent none, as it does for a quantity it silently clamps to the
66
+ * stock left. A block decides how to show it; the host never shows it for the
67
+ * block.
68
+ */
69
+ export declare class CapabilityRefusal extends Error {
70
+ readonly outcome: CapabilityOutcome;
71
+ readonly messages: readonly string[];
72
+ readonly name = "CapabilityRefusal";
73
+ constructor(outcome: CapabilityOutcome, messages: readonly string[]);
74
+ }
75
+ /**
76
+ * Whether a rejection is a capability refusal, by its shape and never by
77
+ * its class: a Shop package and the app may each carry a copy of this module.
78
+ */
79
+ export declare function isCapabilityRefusal(error: unknown): error is CapabilityRefusal;
22
80
  //# 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,OA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AC1B,QAAQ,EAAE,SAAS,MAAM,EAAE;CAIvC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAU9E"}
@@ -1,10 +1,47 @@
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
5
- * contract. The set is code, never document content, and it does not grow
6
- * without a new contract major. The schema package names the same list, so a
7
- * Block Definition can declare only what a renderer can be handed.
4
+ * nine, and the shopper's notification decision only through the tenth; the
5
+ * Storefront token, the cart id and navigation never cross the contract. The
6
+ * set is code, never document content, and it does not grow without a new
7
+ * contract major. The schema package names the same list, so a Block
8
+ * Definition can declare only what a renderer can be handed.
8
9
  */
9
10
  export const CAPABILITY_NAMES = BLOCK_CAPABILITY_NAMES;
11
+ const OUTCOMES = new Set([
12
+ 'refused',
13
+ 'not_found',
14
+ 'failed',
15
+ ]);
16
+ /**
17
+ * The typed refusal a cart capability rejects with: the outcome, and the words
18
+ * that came with it in the buyer's language — Shopify's own, or the host's
19
+ * where Shopify sent none, as it does for a quantity it silently clamps to the
20
+ * stock left. A block decides how to show it; the host never shows it for the
21
+ * block.
22
+ */
23
+ export class CapabilityRefusal extends Error {
24
+ outcome;
25
+ messages;
26
+ name = 'CapabilityRefusal';
27
+ constructor(outcome, messages) {
28
+ super(messages.length > 0 ? messages.join(' ') : outcome);
29
+ this.outcome = outcome;
30
+ this.messages = messages;
31
+ }
32
+ }
33
+ /**
34
+ * Whether a rejection is a capability refusal, by its shape and never by
35
+ * its class: a Shop package and the app may each carry a copy of this module.
36
+ */
37
+ export function isCapabilityRefusal(error) {
38
+ if (typeof error !== 'object' || error === null)
39
+ return false;
40
+ const bag = error;
41
+ return (bag.name === 'CapabilityRefusal' &&
42
+ typeof bag.outcome === 'string' &&
43
+ OUTCOMES.has(bag.outcome) &&
44
+ Array.isArray(bag.messages) &&
45
+ bag.messages.every((message) => typeof message === 'string'));
46
+ }
10
47
  //# 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;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AA6DvD,MAAM,QAAQ,GAAwB,IAAI,GAAG,CAAoB;IAC/D,SAAS;IACT,WAAW;IACX,QAAQ;CACT,CAAC,CAAC;AAEH;;;;;;GAMG;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,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AC,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, NotificationInvitation, } 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,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,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AAM,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;AAY7F,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 = "3.0.0";
8
+ export declare const CONTRACT_MAJOR = 3;
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 = '3.0.0';
8
+ export const CONTRACT_MAJOR = 3;
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": "3.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.9.0"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "react": ">=19.0.0"