@meltingspot/core 1.0.0 → 1.2.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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "MeltingSpot Core SDK",
4
4
  "homepage": "https://meltingspot.io",
5
5
  "license": "BSD-3-Clause",
6
- "version": "1.0.0",
6
+ "version": "1.2.0",
7
7
  "main": "./index.umd.js",
8
8
  "module": "./index.mjs",
9
9
  "typings": "./index.d.ts",
@@ -36,6 +36,7 @@ export interface AccessiblePlaybookIntentOutput {
36
36
  widgetId: string;
37
37
  location: PlaybookHotspotLocation;
38
38
  cssSelector: Nullable<string>;
39
+ highlighted: boolean;
39
40
  mode: PlaybookIntentWidgetMode;
40
41
  widgetMetadata: WidgetContentMetadata[];
41
42
  }
@@ -9,4 +9,10 @@ export declare class SpotMemberApiService {
9
9
  * Get the current user's SpotMember.
10
10
  */
11
11
  getSpotMemberForMe(): Promise<Result<SpotMemberOutput, Error>>;
12
+ /**
13
+ * Join and validate the current user on the spot from an SSO token.
14
+ * Authenticated call — the server re-validates the token and sources the
15
+ * signed claims. Returns the resulting SpotMember (created or existing).
16
+ */
17
+ joinFromSso(ssoToken: string): Promise<Result<SpotMemberOutput, Error>>;
12
18
  }
@@ -1,3 +1,21 @@
1
+ import { Result } from 'neverthrow';
2
+ /**
3
+ * Request passed to an injected stream transport (SSE endpoints).
4
+ * `endpoint` is the raw API path — the transport resolves the base URL and
5
+ * authentication itself (e.g. a browser-extension service worker).
6
+ */
7
+ export interface StreamTransportRequest {
8
+ endpoint: string;
9
+ body?: unknown;
10
+ signal?: AbortSignal;
11
+ }
12
+ /**
13
+ * Optional override for the SSE streaming transport. When set, `MeltingSpotApi.stream`
14
+ * delegates to it instead of a direct `fetch`, so an integrator can route the
15
+ * stream through its own channel (e.g. a service-worker Port) while the calling
16
+ * code keeps consuming a `ReadableStream` unchanged.
17
+ */
18
+ export type StreamTransport = (request: StreamTransportRequest) => Promise<Result<ReadableStream<Uint8Array>, Error>>;
1
19
  /**
2
20
  * Low-level SDK configuration. API URLs (msApiBaseUrl, msCommunityWebBaseUrl) are
3
21
  * infrastructure settings that must be set via Configuration.setConfiguration() before
@@ -8,7 +26,11 @@ export interface MeltingSpotConfiguration {
8
26
  msCommunityWebBaseUrl: string;
9
27
  ssoToken?: string;
10
28
  spotId: string;
29
+ domain?: string;
30
+ autoJoin?: boolean;
11
31
  rootDocument: Document;
32
+ iframelyApiKey?: string;
33
+ streamTransport?: StreamTransport;
12
34
  }
13
35
  export declare class ConfigurationService {
14
36
  private configuration;
@@ -12,6 +12,7 @@ export declare enum HttpMethods {
12
12
  export interface HttpInput {
13
13
  url: string;
14
14
  headers?: Record<string, string>;
15
+ signal?: AbortSignal;
15
16
  }
16
17
  export type QueryType = string | Record<string, string | number | boolean | string[] | number[] | boolean[]>;
17
18
  export interface HttpGetInput extends HttpInput {
@@ -1,9 +1,13 @@
1
+ import { MeltyHandoffReason } from './meltyHandoffReason';
1
2
  import { RenderableWidgetAction } from './renderableWidgetAction';
2
3
  export interface ConversationMessage {
3
4
  id: string;
4
5
  role: ConversationMessageRole;
5
6
  content: string[];
6
7
  widgetActions: RenderableWidgetAction[];
8
+ handoff?: {
9
+ reason: MeltyHandoffReason;
10
+ };
7
11
  createdAt: string;
8
12
  }
9
13
  export declare enum ConversationMessageRole {
@@ -1,9 +1,11 @@
1
+ import { MeltyHandoffReason } from './meltyHandoffReason';
1
2
  import { MeltyWidgetAction } from './meltyWidgetAction';
2
3
  export declare enum ConversationSseEventType {
3
4
  Metadata = "metadata",
4
5
  Token = "token",
5
6
  Action = "action",
6
7
  Bubble = "bubble",
8
+ Handoff = "handoff",
7
9
  Done = "done",
8
10
  Error = "error"
9
11
  }
@@ -28,6 +30,12 @@ export interface ConversationSseBubbleEvent {
28
30
  type: ConversationSseEventType.Bubble;
29
31
  data: Record<string, never>;
30
32
  }
33
+ export interface ConversationSseHandoffEvent {
34
+ type: ConversationSseEventType.Handoff;
35
+ data: {
36
+ reason: MeltyHandoffReason;
37
+ };
38
+ }
31
39
  export interface ConversationSseDoneEvent {
32
40
  type: ConversationSseEventType.Done;
33
41
  data: {
@@ -41,4 +49,4 @@ export interface ConversationSseErrorEvent {
41
49
  code: string;
42
50
  };
43
51
  }
44
- export type ConversationSseEvent = ConversationSseMetadataEvent | ConversationSseTokenEvent | ConversationSseActionEvent | ConversationSseBubbleEvent | ConversationSseDoneEvent | ConversationSseErrorEvent;
52
+ export type ConversationSseEvent = ConversationSseMetadataEvent | ConversationSseTokenEvent | ConversationSseActionEvent | ConversationSseBubbleEvent | ConversationSseHandoffEvent | ConversationSseDoneEvent | ConversationSseErrorEvent;
@@ -1,6 +1,7 @@
1
1
  import { Nullable } from '../nullable';
2
2
  import { ConversationStatus } from './conversation';
3
3
  import { ConversationMessageRole } from './conversationMessage';
4
+ import { MeltyHandoffReason } from './meltyHandoffReason';
4
5
  import { MeltyWidgetAction } from './meltyWidgetAction';
5
6
  /**
6
7
  * Raw payload of GET /melty/conversations/:id/messages. It differs from the SDK
@@ -14,6 +15,9 @@ export interface GetConversationMessageResponse {
14
15
  content: string[];
15
16
  metadata: Nullable<{
16
17
  actions?: MeltyWidgetAction[];
18
+ handoff?: {
19
+ reason: MeltyHandoffReason;
20
+ };
17
21
  }>;
18
22
  createdAt: string;
19
23
  }
@@ -5,6 +5,7 @@ export * from './conversationStreamResponse';
5
5
  export * from './createConversationResponse';
6
6
  export * from './getConversationMessagesResponse';
7
7
  export * from './listConversationsResponse';
8
+ export * from './meltyHandoffReason';
8
9
  export * from './meltyWidgetAction';
9
10
  export * from './renderableWidgetAction';
10
11
  export * from './proactiveCheckResponse';
@@ -0,0 +1,6 @@
1
+ export declare enum MeltyHandoffReason {
2
+ NoSource = "NoSource",// no retrieved RAG source relevant enough to answer
3
+ LowConfidence = "LowConfidence",// not confident in the answer
4
+ HumanRequest = "HumanRequest",// explicit human request from the user
5
+ OutOfScope = "OutOfScope"
6
+ }
@@ -34,6 +34,9 @@ export interface SimplifiedElementNode {
34
34
  value?: string;
35
35
  firstName?: string;
36
36
  lastName?: string;
37
+ options?: {
38
+ url?: string;
39
+ };
37
40
  }
38
41
  export type SimplifiedRichTextNode = SimplifiedElementNode | SimplifiedRichText;
39
42
  export type SimplifiedRichTextData = SimplifiedElementNode[];
@@ -2,6 +2,7 @@ export declare enum SpotWidgetContentType {
2
2
  Channel = "Channel",
3
3
  Collection = "Collection",
4
4
  Course = "Course",
5
+ Discussion = "Discussion",
5
6
  Forum = "Forum",
6
7
  Link = "Link",
7
8
  Live = "Live",
@@ -1,2 +1,10 @@
1
1
  import { PlaybookMatchingRulesData } from '../../types/widget/playbook/playbookMatchingRules';
2
2
  export declare const testUrlMatching: (url: string, matchingRules: PlaybookMatchingRulesData) => boolean;
3
+ /**
4
+ * Domain-scoped URL match: true when the URL's hostname equals `domain` or is a
5
+ * subdomain of it (`host === domain || host.endsWith('.' + domain)`). Mirrors
6
+ * the shared `util-widget` helper of the same name, duplicated here so the SDK
7
+ * bundle owns its playbook matching and stays self-contained. Returns false for
8
+ * non-parseable URLs.
9
+ */
10
+ export declare const matchesDomain: (url: string, domain: string) => boolean;