@stackable-labs/sdk-extension-contracts 1.64.0 → 1.65.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/dist/index.d.ts CHANGED
@@ -325,9 +325,26 @@ declare const ALLOWED_ICONS: readonly ["arrow-left", "calendar", "check-circle-2
325
325
  type AllowedIconName = (typeof ALLOWED_ICONS)[number];
326
326
 
327
327
  /**
328
- * Identity Contract
329
- * Types for the identity/auth event system.
328
+ * Messaging Contract
329
+ * Types for the messaging event system (postback buttons, etc.).
330
330
  */
331
+ /** Messaging event subscription types — 'postback' for all, 'postback:<actionName>' for specific */
332
+ type MessagingEventType = 'postback' | `postback:${string}`;
333
+ /** Normalized postback event payload */
334
+ interface MessagingPostbackEvent {
335
+ type: 'postback';
336
+ actionName: string;
337
+ conversationId: string;
338
+ timestamp: string;
339
+ }
340
+ /** Union of all messaging events (extensible for future event types) */
341
+ type MessagingEvent = MessagingPostbackEvent;
342
+
343
+ /**
344
+ * Identity & Event Contract
345
+ * Types for the identity/auth event system and cross-domain event declarations.
346
+ */
347
+
331
348
  type IdentityEventType = 'identity.login' | 'identity.logout' | 'identity.refresh' | 'identity.expired';
332
349
  interface UserIdentity {
333
350
  id: string;
@@ -347,6 +364,12 @@ interface IdentityEvent {
347
364
  state: IdentityState;
348
365
  timestamp: string;
349
366
  }
367
+ /**
368
+ * Union of all event types that can appear in the manifest events array.
369
+ * Grows as new event domains are added.
370
+ * Includes domain wildcards (e.g. 'identity' matches all identity.* events).
371
+ */
372
+ type EventType = IdentityEventType | 'identity' | MessagingEventType | 'messaging';
350
373
  /** Base claims sent to extend:identity handlers before JWT signing */
351
374
  interface IdentityBaseClaims {
352
375
  external_id: string;
@@ -469,7 +492,7 @@ interface InstanceOption {
469
492
  * Extensions declare required permissions in their manifest.
470
493
  * Host enforces: capability calls must be a subset of granted permissions.
471
494
  */
472
- declare const PERMISSIONS: readonly ["context:read", "data:query", "data:fetch", "actions:toast", "actions:invoke", "events:identity", "extend:identity"];
495
+ declare const PERMISSIONS: readonly ["context:read", "data:query", "data:fetch", "actions:toast", "actions:invoke", "events:identity", "events:messaging", "extend:identity"];
473
496
  type Permission = (typeof PERMISSIONS)[number];
474
497
  /**
475
498
  * Maps capability types to the permission required to use them.
@@ -496,7 +519,7 @@ interface ExtensionManifest {
496
519
  /** Permissions required by this extension */
497
520
  permissions: Permission[];
498
521
  /** Specific events this extension listens for (e.g. ["identity.login", "postback:add_to_cart"]) */
499
- events?: string[];
522
+ events?: EventType[];
500
523
  /**
501
524
  * Hostnames this extension is permitted to reach via data.fetch.
502
525
  * Example: ["api.myservice.com", "cdn.myservice.com"]
@@ -838,4 +861,4 @@ interface Order {
838
861
  display_status?: OrderStatus;
839
862
  }
840
863
 
841
- export { ALLOWED_ICONS, type ActionInvokePayload, type Address, type AllowedIconName, type ApiError, type ApiRequest, type ApiResponse, CAPABILITY_PERMISSION_MAP, type CapabilityCall, type CapabilityRequest, type CapabilityResponse, type CapabilityType, type ContextData, type Customer, type DataField, type DataFieldType, type EncryptedPayload, type ExtendIdentityRequest, type ExtendIdentityResponse, type ExtensionManifest, type ExtensionRegistryEntry, type FetchRequest, type FetchRequestInit, type FetchResponse, type HostToSandboxMessage, type IdentityBaseClaims, type IdentityEvent, type IdentityEventType, type IdentityState, type InstanceConfig, type InstanceOption, type InvokeAction, type MarketplaceExtension, type MessengerCommand, type NamedEntity, type Order, type OrderAction, type OrderItem, type OrderStatus, type OrderStatuses, PERMISSIONS, type Permission, type Price, type SandboxToHostMessage, type Shipment, type SurfaceContext, type SurfaceLifecycleMessage, type Target, type Theme, type ToastPayload, type UITag, type UITagCategory, UI_TAGS, UI_TAG_ATTRIBUTES, UI_TAG_ATTRIBUTE_VALUES, UI_TAG_CATEGORIES, UI_TAG_CHILDREN, UI_TAG_DEFINITIONS, type UserIdentity, type WidgetAction, tagToComponentName };
864
+ export { ALLOWED_ICONS, type ActionInvokePayload, type Address, type AllowedIconName, type ApiError, type ApiRequest, type ApiResponse, CAPABILITY_PERMISSION_MAP, type CapabilityCall, type CapabilityRequest, type CapabilityResponse, type CapabilityType, type ContextData, type Customer, type DataField, type DataFieldType, type EncryptedPayload, type EventType, type ExtendIdentityRequest, type ExtendIdentityResponse, type ExtensionManifest, type ExtensionRegistryEntry, type FetchRequest, type FetchRequestInit, type FetchResponse, type HostToSandboxMessage, type IdentityBaseClaims, type IdentityEvent, type IdentityEventType, type IdentityState, type InstanceConfig, type InstanceOption, type InvokeAction, type MarketplaceExtension, type MessagingEvent, type MessagingEventType, type MessagingPostbackEvent, type MessengerCommand, type NamedEntity, type Order, type OrderAction, type OrderItem, type OrderStatus, type OrderStatuses, PERMISSIONS, type Permission, type Price, type SandboxToHostMessage, type Shipment, type SurfaceContext, type SurfaceLifecycleMessage, type Target, type Theme, type ToastPayload, type UITag, type UITagCategory, UI_TAGS, UI_TAG_ATTRIBUTES, UI_TAG_ATTRIBUTE_VALUES, UI_TAG_CATEGORIES, UI_TAG_CHILDREN, UI_TAG_DEFINITIONS, type UserIdentity, type WidgetAction, tagToComponentName };
package/dist/index.js CHANGED
@@ -308,6 +308,7 @@ var PERMISSIONS = [
308
308
  "actions:toast",
309
309
  "actions:invoke",
310
310
  "events:identity",
311
+ "events:messaging",
311
312
  "extend:identity"
312
313
  ];
313
314
  var CAPABILITY_PERMISSION_MAP = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackable-labs/sdk-extension-contracts",
3
- "version": "1.64.0",
3
+ "version": "1.65.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",