@stackable-labs/sdk-extension-contracts 1.75.0 → 1.76.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 -6
- package/dist/index.js +33 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -330,8 +330,15 @@ type AllowedIconName = (typeof ALLOWED_ICONS)[number];
|
|
|
330
330
|
* Types for the identity/auth event system.
|
|
331
331
|
*/
|
|
332
332
|
|
|
333
|
-
/**
|
|
334
|
-
|
|
333
|
+
/** Well-known identity event names. Hooks accept these directly (e.g., useIdentityEvent('login', ...)). */
|
|
334
|
+
declare const IDENTITY_EVENTS: {
|
|
335
|
+
readonly LOGIN: "login";
|
|
336
|
+
readonly LOGOUT: "logout";
|
|
337
|
+
readonly REFRESH: "refresh";
|
|
338
|
+
readonly EXPIRED: "expired";
|
|
339
|
+
};
|
|
340
|
+
/** Domain-stripped identity event names — derived from IDENTITY_EVENTS. */
|
|
341
|
+
type IdentityEventType = typeof IDENTITY_EVENTS[keyof typeof IDENTITY_EVENTS];
|
|
335
342
|
interface UserIdentity {
|
|
336
343
|
id: string;
|
|
337
344
|
email?: string;
|
|
@@ -422,7 +429,12 @@ interface ConversationField {
|
|
|
422
429
|
value: string | number | boolean;
|
|
423
430
|
}
|
|
424
431
|
/** Known actions for actions.invoke capability */
|
|
425
|
-
|
|
432
|
+
declare const INVOKE_ACTIONS: {
|
|
433
|
+
readonly NEW_CONVERSATION: "newConversation";
|
|
434
|
+
readonly SET_CONVERSATION_TAGS: "setConversationTags";
|
|
435
|
+
readonly SET_CONVERSATION_FIELDS: "setConversationFields";
|
|
436
|
+
};
|
|
437
|
+
type InvokeAction = typeof INVOKE_ACTIONS[keyof typeof INVOKE_ACTIONS] | MessengerCommand | WidgetAction;
|
|
426
438
|
/** Typed payload for newConversation action */
|
|
427
439
|
interface NewConversationPayload {
|
|
428
440
|
metadata?: Record<string, unknown>;
|
|
@@ -513,7 +525,16 @@ type MessagingEventHandler = (event: MessagingEvent) => void;
|
|
|
513
525
|
* Types for the activity event system (host-to-extension push events).
|
|
514
526
|
*/
|
|
515
527
|
/** Well-known activity event names (aligned with GA conventions). Hosts can emit any custom string. */
|
|
516
|
-
|
|
528
|
+
declare const ACTIVITY_EVENTS: {
|
|
529
|
+
readonly CLICK: "click";
|
|
530
|
+
readonly PAGE_VIEW: "page_view";
|
|
531
|
+
readonly FORM_SUBMIT: "form_submit";
|
|
532
|
+
readonly PRODUCT_VIEW: "product_view";
|
|
533
|
+
readonly ADD_TO_CART: "add_to_cart";
|
|
534
|
+
readonly PURCHASE: "purchase";
|
|
535
|
+
readonly SEARCH: "search";
|
|
536
|
+
};
|
|
537
|
+
type WellKnownActivityEvent = typeof ACTIVITY_EVENTS[keyof typeof ACTIVITY_EVENTS];
|
|
517
538
|
/** Domain-stripped activity event names. Hooks accept these directly (e.g., useActivityEvent('product_view', ...)). */
|
|
518
539
|
type ActivityEventType = WellKnownActivityEvent | string;
|
|
519
540
|
/** Normalized activity event payload */
|
|
@@ -596,6 +617,14 @@ type Capability = keyof typeof CAPABILITY_PERMISSION_MAP;
|
|
|
596
617
|
* Apps define which targets they expose; this is not a fixed list.
|
|
597
618
|
*/
|
|
598
619
|
type Target = string;
|
|
620
|
+
/** Well-known surface target slots provided by the Stackable platform. */
|
|
621
|
+
declare const SURFACE_TARGETS: {
|
|
622
|
+
readonly HEADER: "slot.header";
|
|
623
|
+
readonly CONTENT: "slot.content";
|
|
624
|
+
readonly FOOTER: "slot.footer";
|
|
625
|
+
readonly FOOTER_LINKS: "slot.footer-links";
|
|
626
|
+
};
|
|
627
|
+
type SurfaceTarget = typeof SURFACE_TARGETS[keyof typeof SURFACE_TARGETS];
|
|
599
628
|
interface ExtensionManifest {
|
|
600
629
|
/** Human-readable extension name */
|
|
601
630
|
name: string;
|
|
@@ -605,7 +634,7 @@ interface ExtensionManifest {
|
|
|
605
634
|
targets: string[];
|
|
606
635
|
/** Permissions required by this extension */
|
|
607
636
|
permissions: Permission[];
|
|
608
|
-
/** Specific events this extension listens for (e.g. ["identity:login", "messaging:postback:
|
|
637
|
+
/** Specific events this extension listens for (e.g. ["identity:login", "messaging:postback:Buy Now"]) */
|
|
609
638
|
events?: EventType[];
|
|
610
639
|
/**
|
|
611
640
|
* Hostnames this extension is permitted to reach via data.fetch.
|
|
@@ -957,4 +986,4 @@ interface Order {
|
|
|
957
986
|
display_status?: OrderStatus;
|
|
958
987
|
}
|
|
959
988
|
|
|
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 };
|
|
989
|
+
export { ACTIVITY_EVENTS, 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, IDENTITY_EVENTS, INVOKE_ACTIONS, 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, SURFACE_TARGETS, type SandboxToHostMessage, type Shipment, type SurfaceContext, type SurfaceLifecycleMessage, type SurfaceTarget, 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 };
|
package/dist/index.js
CHANGED
|
@@ -334,8 +334,32 @@ var ALLOWED_ICONS = [
|
|
|
334
334
|
];
|
|
335
335
|
|
|
336
336
|
// src/capabilities.ts
|
|
337
|
+
var INVOKE_ACTIONS = {
|
|
338
|
+
NEW_CONVERSATION: "newConversation",
|
|
339
|
+
SET_CONVERSATION_TAGS: "setConversationTags",
|
|
340
|
+
SET_CONVERSATION_FIELDS: "setConversationFields"
|
|
341
|
+
};
|
|
337
342
|
var RESERVED_CONTEXT_KEYS = ["identity", "messaging"];
|
|
338
343
|
|
|
344
|
+
// src/identity.ts
|
|
345
|
+
var IDENTITY_EVENTS = {
|
|
346
|
+
LOGIN: "login",
|
|
347
|
+
LOGOUT: "logout",
|
|
348
|
+
REFRESH: "refresh",
|
|
349
|
+
EXPIRED: "expired"
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
// src/activity.ts
|
|
353
|
+
var ACTIVITY_EVENTS = {
|
|
354
|
+
CLICK: "click",
|
|
355
|
+
PAGE_VIEW: "page_view",
|
|
356
|
+
FORM_SUBMIT: "form_submit",
|
|
357
|
+
PRODUCT_VIEW: "product_view",
|
|
358
|
+
ADD_TO_CART: "add_to_cart",
|
|
359
|
+
PURCHASE: "purchase",
|
|
360
|
+
SEARCH: "search"
|
|
361
|
+
};
|
|
362
|
+
|
|
339
363
|
// src/permissions.ts
|
|
340
364
|
var PERMISSIONS = [
|
|
341
365
|
"context:read",
|
|
@@ -357,4 +381,12 @@ var CAPABILITY_PERMISSION_MAP = {
|
|
|
357
381
|
"extend.identity": "extend:identity"
|
|
358
382
|
};
|
|
359
383
|
|
|
360
|
-
|
|
384
|
+
// src/manifest.ts
|
|
385
|
+
var SURFACE_TARGETS = {
|
|
386
|
+
HEADER: "slot.header",
|
|
387
|
+
CONTENT: "slot.content",
|
|
388
|
+
FOOTER: "slot.footer",
|
|
389
|
+
FOOTER_LINKS: "slot.footer-links"
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
export { ACTIVITY_EVENTS, ALLOWED_ICONS, CAPABILITY_PERMISSION_MAP, EXTENSION_CATEGORIES, EXTENSION_VISIBILITIES, IDENTITY_EVENTS, INVOKE_ACTIONS, PERMISSIONS, RESERVED_CONTEXT_KEYS, SURFACE_TARGETS, UI_TAGS, UI_TAG_ATTRIBUTES, UI_TAG_ATTRIBUTE_VALUES, UI_TAG_CATEGORIES, UI_TAG_CHILDREN, UI_TAG_DEFINITIONS, asClerkOrgId, asClerkUserId, asISOTimestamp, tagToComponentName };
|