@stackable-labs/sdk-extension-contracts 1.42.1 → 1.44.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
@@ -404,9 +404,40 @@ type CapabilityCall = {
404
404
  payload: ActionInvokePayload;
405
405
  } | {
406
406
  type: 'context.read';
407
+ } | {
408
+ type: 'identity.read';
409
+ } | {
410
+ type: 'identity.extend';
411
+ payload: {
412
+ claims: Record<string, unknown>;
413
+ };
407
414
  };
408
415
  type CapabilityType = CapabilityCall['type'];
409
416
 
417
+ /**
418
+ * Identity Contract
419
+ * Types for the identity/auth event system.
420
+ */
421
+ type AuthEventType = 'identity.login' | 'identity.logout' | 'identity.refresh' | 'identity.expired';
422
+ interface UserIdentity {
423
+ id: string;
424
+ email?: string;
425
+ name?: string;
426
+ avatarUrl?: string;
427
+ provider: string;
428
+ metadata?: Record<string, unknown>;
429
+ }
430
+ interface AuthState {
431
+ authenticated: boolean;
432
+ user: UserIdentity | null;
433
+ expiresAt?: string;
434
+ }
435
+ interface AuthEvent {
436
+ type: AuthEventType;
437
+ state: AuthState;
438
+ timestamp: string;
439
+ }
440
+
410
441
  /**
411
442
  * Instance Contract
412
443
  * Shared types for extension instances used by both host and admin.
@@ -415,8 +446,12 @@ type Theme = 'light' | 'dark';
415
446
  interface InstanceConfig {
416
447
  settings?: {
417
448
  theme?: Theme;
449
+ identityId?: string;
450
+ identityProvider?: string;
451
+ } & Record<string, unknown>;
452
+ secrets?: {
453
+ identityKey?: string;
418
454
  } & Record<string, unknown>;
419
- secrets?: Record<string, unknown>;
420
455
  }
421
456
  interface InstanceOption {
422
457
  id: string;
@@ -429,7 +464,7 @@ interface InstanceOption {
429
464
  * Extensions declare required permissions in their manifest.
430
465
  * Host enforces: capability calls must be a subset of granted permissions.
431
466
  */
432
- declare const PERMISSIONS: readonly ["context:read", "data:query", "data:fetch", "actions:toast", "actions:invoke"];
467
+ declare const PERMISSIONS: readonly ["context:read", "data:query", "data:fetch", "actions:toast", "actions:invoke", "identity:read", "identity:subscribe", "identity:extend"];
433
468
  type Permission = (typeof PERMISSIONS)[number];
434
469
  /**
435
470
  * Maps capability types to the permission required to use them.
@@ -536,6 +571,10 @@ type HostToSandboxMessage = {
536
571
  } | {
537
572
  type: 'extension-encryption-key';
538
573
  encryptionKey: string;
574
+ } | {
575
+ type: 'extension-event';
576
+ eventType: string;
577
+ payload: EncryptedPayload | unknown;
539
578
  };
540
579
  type SandboxToHostMessage = CapabilityRequest | {
541
580
  type: 'surface-ready';
@@ -782,4 +821,4 @@ interface Order {
782
821
  display_status?: OrderStatus;
783
822
  }
784
823
 
785
- 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 ExtensionManifest, type ExtensionRegistryEntry, type FetchRequest, type FetchRequestInit, type FetchResponse, type HostToSandboxMessage, 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 WidgetAction, tagToComponentName };
824
+ export { ALLOWED_ICONS, type ActionInvokePayload, type Address, type AllowedIconName, type ApiError, type ApiRequest, type ApiResponse, type AuthEvent, type AuthEventType, type AuthState, CAPABILITY_PERMISSION_MAP, type CapabilityCall, type CapabilityRequest, type CapabilityResponse, type CapabilityType, type ContextData, type Customer, type DataField, type DataFieldType, type EncryptedPayload, type ExtensionManifest, type ExtensionRegistryEntry, type FetchRequest, type FetchRequestInit, type FetchResponse, type HostToSandboxMessage, 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 };
package/dist/index.js CHANGED
@@ -306,14 +306,19 @@ var PERMISSIONS = [
306
306
  "data:query",
307
307
  "data:fetch",
308
308
  "actions:toast",
309
- "actions:invoke"
309
+ "actions:invoke",
310
+ "identity:read",
311
+ "identity:subscribe",
312
+ "identity:extend"
310
313
  ];
311
314
  var CAPABILITY_PERMISSION_MAP = {
312
315
  "context.read": "context:read",
313
316
  "data.query": "data:query",
314
317
  "data.fetch": "data:fetch",
315
318
  "actions.toast": "actions:toast",
316
- "actions.invoke": "actions:invoke"
319
+ "actions.invoke": "actions:invoke",
320
+ "identity.read": "identity:read",
321
+ "identity.extend": "identity:extend"
317
322
  };
318
323
 
319
324
  // ../../../lib/contracts/src/permissions.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackable-labs/sdk-extension-contracts",
3
- "version": "1.42.1",
3
+ "version": "1.44.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",