@stackable-labs/sdk-extension-contracts 1.72.0 → 1.74.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 +35 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -414,8 +414,28 @@ interface ToastPayload {
|
|
|
414
414
|
type MessengerCommand = 'open' | 'close' | 'show' | 'hide';
|
|
415
415
|
/** Widget-only actions handled by WidgetComponent (not forwarded to Zendesk) */
|
|
416
416
|
type WidgetAction = 'toggle';
|
|
417
|
+
/** Conversation tags — array of string labels */
|
|
418
|
+
type ConversationTags = string[];
|
|
419
|
+
/** Conversation field — Zendesk custom field ID + value */
|
|
420
|
+
interface ConversationField {
|
|
421
|
+
id: string;
|
|
422
|
+
value: string | number | boolean;
|
|
423
|
+
}
|
|
417
424
|
/** Known actions for actions.invoke capability */
|
|
418
|
-
type InvokeAction = 'newConversation' | MessengerCommand | WidgetAction;
|
|
425
|
+
type InvokeAction = 'newConversation' | 'setConversationTags' | 'setConversationFields' | MessengerCommand | WidgetAction;
|
|
426
|
+
/** Typed payload for newConversation action */
|
|
427
|
+
interface NewConversationPayload {
|
|
428
|
+
metadata?: Record<string, unknown>;
|
|
429
|
+
tags?: ConversationTags;
|
|
430
|
+
fields?: ConversationField[];
|
|
431
|
+
[key: string]: unknown;
|
|
432
|
+
}
|
|
433
|
+
/** Maps known action names to their typed payloads */
|
|
434
|
+
interface ActionPayloadMap {
|
|
435
|
+
newConversation: NewConversationPayload;
|
|
436
|
+
setConversationTags: ConversationTags;
|
|
437
|
+
setConversationFields: ConversationField[];
|
|
438
|
+
}
|
|
419
439
|
/** Payload for actions.invoke capability */
|
|
420
440
|
interface ActionInvokePayload {
|
|
421
441
|
action: InvokeAction;
|
|
@@ -493,7 +513,7 @@ type MessagingEventHandler = (event: MessagingEvent) => void;
|
|
|
493
513
|
* Types for the activity event system (host-to-extension push events).
|
|
494
514
|
*/
|
|
495
515
|
/** Well-known activity event names (aligned with GA conventions). Hosts can emit any custom string. */
|
|
496
|
-
type WellKnownActivityEvent = 'page_view' | '
|
|
516
|
+
type WellKnownActivityEvent = 'click' | 'page_view' | 'form_submit' | 'product_view' | 'add_to_cart' | 'purchase' | 'search';
|
|
497
517
|
/** Domain-stripped activity event names. Hooks accept these directly (e.g., useActivityEvent('product_view', ...)). */
|
|
498
518
|
type ActivityEventType = WellKnownActivityEvent | string;
|
|
499
519
|
/** Normalized activity event payload */
|
|
@@ -552,9 +572,19 @@ interface InstanceOption {
|
|
|
552
572
|
declare const PERMISSIONS: readonly ["context:read", "data:query", "data:fetch", "actions:toast", "actions:invoke", "events:identity", "events:messaging", "events:activity", "extend:identity"];
|
|
553
573
|
type Permission = (typeof PERMISSIONS)[number];
|
|
554
574
|
/**
|
|
555
|
-
* Maps capability types
|
|
575
|
+
* Maps capability types (dot notation, used in code) to the permission
|
|
576
|
+
* required to use them (colon notation, used in manifest).
|
|
556
577
|
*/
|
|
557
|
-
declare const CAPABILITY_PERMISSION_MAP:
|
|
578
|
+
declare const CAPABILITY_PERMISSION_MAP: {
|
|
579
|
+
readonly 'context.read': "context:read";
|
|
580
|
+
readonly 'data.query': "data:query";
|
|
581
|
+
readonly 'data.fetch': "data:fetch";
|
|
582
|
+
readonly 'actions.toast': "actions:toast";
|
|
583
|
+
readonly 'actions.invoke': "actions:invoke";
|
|
584
|
+
readonly 'extend.identity': "extend:identity";
|
|
585
|
+
};
|
|
586
|
+
/** Capability key type — dot-notation API names (e.g., 'data.query', 'actions.toast') */
|
|
587
|
+
type Capability = keyof typeof CAPABILITY_PERMISSION_MAP;
|
|
558
588
|
|
|
559
589
|
/**
|
|
560
590
|
* Extension Manifest Schema
|
|
@@ -927,4 +957,4 @@ interface Order {
|
|
|
927
957
|
display_status?: OrderStatus;
|
|
928
958
|
}
|
|
929
959
|
|
|
930
|
-
export { ALLOWED_ICONS, type ActionInvokePayload, type ActivityEvent, type ActivityEventHandler, type ActivityEventType, 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 EventDomain, type EventType, type ExtendIdentityHandler, 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 MessagingContext, type MessagingEvent, type MessagingEventHandler, type MessagingEventType, type MessagingPostbackEvent, type MessengerCommand, type NamedEntity, type Order, type OrderAction, type OrderItem, type OrderStatus, type OrderStatuses, PERMISSIONS, type Permission, type Price, RESERVED_CONTEXT_KEYS, type ReservedContextKey, 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 WellKnownActivityEvent, type WidgetAction, tagToComponentName };
|
|
960
|
+
export { ALLOWED_ICONS, type ActionInvokePayload, type ActionPayloadMap, type ActivityEvent, type ActivityEventHandler, type ActivityEventType, type Address, type AllowedIconName, type ApiError, type ApiRequest, type ApiResponse, CAPABILITY_PERMISSION_MAP, type Capability, type CapabilityCall, type CapabilityRequest, type CapabilityResponse, type CapabilityType, type ContextData, type ConversationField, type ConversationTags, type Customer, type DataField, type DataFieldType, type EncryptedPayload, type EventDomain, type EventType, type ExtendIdentityHandler, 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 MessagingContext, type MessagingEvent, type MessagingEventHandler, type MessagingEventType, type MessagingPostbackEvent, type MessengerCommand, type NamedEntity, type NewConversationPayload, type Order, type OrderAction, type OrderItem, type OrderStatus, type OrderStatuses, PERMISSIONS, type Permission, type Price, RESERVED_CONTEXT_KEYS, type ReservedContextKey, 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 WellKnownActivityEvent, type WidgetAction, tagToComponentName };
|