@meltingspot/core 1.18.0 → 1.19.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.18.0",
6
+ "version": "1.19.0",
7
7
  "main": "./index.umd.js",
8
8
  "module": "./index.mjs",
9
9
  "typings": "./index.d.ts",
@@ -67,6 +67,9 @@ export interface CreatePlaybookIntentInput {
67
67
  widgetId?: string;
68
68
  order?: number;
69
69
  }
70
+ export interface GenerateIntentStandaloneTitleInput {
71
+ prompt: string;
72
+ }
70
73
  export interface UpdatePlaybookIntentInput {
71
74
  description?: string;
72
75
  hotspotId?: string;
@@ -8,6 +8,9 @@ import { PlaybookIntent } from '../../../types/widget/playbook/playbookIntent';
8
8
  import { PlaybookIntentActionSummary } from '../../../types/widget/playbook/playbookIntentActionSummary';
9
9
  import { PlaybookIntentWidgetMode } from '../../../types/widget/playbook/playbookIntentWidgetMode';
10
10
  import { PlaybookPage } from '../../../types/widget/playbook/playbookPage';
11
+ export interface GenerateIntentStandaloneTitleOutput {
12
+ title: string;
13
+ }
11
14
  export interface ListPlaybooksOutput {
12
15
  items: Playbook[];
13
16
  total: number;
@@ -2,8 +2,8 @@ import { Result } from 'neverthrow';
2
2
  import { PlaybookHotspot } from '../../../types/widget/playbook/playbookHotspot';
3
3
  import { PlaybookIntent } from '../../../types/widget/playbook/playbookIntent';
4
4
  import { PlaybookPage } from '../../../types/widget/playbook/playbookPage';
5
- import { CreatePlaybookHotspotInput, CreatePlaybookIntentInput, CreatePlaybookPageInput, ListAccessiblePlaybookIntentsQuery, ListPlaybookHotspotsQuery, ListPlaybookIntentsQuery, ListPlaybookPagesQuery, ListPlaybooksQuery, PlaybookHotspotParams, PlaybookIntentParams, PlaybookPageParams, PlaybookParams, UpdatePlaybookHotspotInput, UpdatePlaybookIntentInput } from './playbook.api.input';
6
- import { ListAccessiblePlaybookIntentsOutput, ListPlaybookHotspotsOutput, ListPlaybookIntentsOutput, ListPlaybookPagesOutput, ListPlaybooksOutput } from './playbook.api.output';
5
+ import { CreatePlaybookHotspotInput, CreatePlaybookIntentInput, CreatePlaybookPageInput, GenerateIntentStandaloneTitleInput, ListAccessiblePlaybookIntentsQuery, ListPlaybookHotspotsQuery, ListPlaybookIntentsQuery, ListPlaybookPagesQuery, ListPlaybooksQuery, PlaybookHotspotParams, PlaybookIntentParams, PlaybookPageParams, PlaybookParams, UpdatePlaybookHotspotInput, UpdatePlaybookIntentInput } from './playbook.api.input';
6
+ import { GenerateIntentStandaloneTitleOutput, ListAccessiblePlaybookIntentsOutput, ListPlaybookHotspotsOutput, ListPlaybookIntentsOutput, ListPlaybookPagesOutput, ListPlaybooksOutput } from './playbook.api.output';
7
7
  export declare class PlaybookApiService {
8
8
  private readonly meltingSpotApi;
9
9
  private static instance;
@@ -18,5 +18,6 @@ export declare class PlaybookApiService {
18
18
  updatePlaybookHotspot(query: PlaybookHotspotParams, body: UpdatePlaybookHotspotInput): Promise<Result<PlaybookHotspot, Error>>;
19
19
  listPlaybookIntents(query: ListPlaybookIntentsQuery): Promise<Result<ListPlaybookIntentsOutput, Error>>;
20
20
  createPlaybookIntent(query: PlaybookHotspotParams, body: CreatePlaybookIntentInput): Promise<Result<PlaybookIntent, Error>>;
21
+ generateIntentStandaloneTitle(body: GenerateIntentStandaloneTitleInput): Promise<Result<GenerateIntentStandaloneTitleOutput, Error>>;
21
22
  updatePlaybookIntent(query: PlaybookIntentParams, body: UpdatePlaybookIntentInput): Promise<Result<PlaybookIntent, Error>>;
22
23
  }
@@ -1,18 +1,24 @@
1
+ import { StatusCodes } from 'http-status-codes';
1
2
  import { Result } from 'neverthrow';
2
3
  import { AuthTokens } from '../types/authTokens';
3
4
  import { Nullable } from '../types/nullable';
4
5
  import { HttpError } from './http.service';
5
6
  export declare enum AuthServiceEvents {
6
- TokensUpdated = "auth:tokens-updated"
7
+ TokensUpdated = "auth:tokens-updated",
8
+ RefreshRejected = "auth:refresh-rejected"
7
9
  }
8
10
  export interface AuthTokensUpdatedEventDetail {
9
11
  accessToken: Nullable<string>;
10
12
  refreshToken: Nullable<string>;
11
13
  }
14
+ export interface AuthRefreshRejectedEventDetail {
15
+ status: StatusCodes;
16
+ }
12
17
  export declare class AuthService extends EventTarget {
13
18
  private static instance;
14
19
  private accessToken;
15
20
  private refreshToken;
21
+ private refreshInFlight;
16
22
  private constructor();
17
23
  static getInstance(): AuthService;
18
24
  /**
@@ -30,8 +36,20 @@ export declare class AuthService extends EventTarget {
30
36
  resetPassword(email: string): Promise<Result<void, HttpError>>;
31
37
  /**
32
38
  * Refresh the access token using the stored refresh token.
39
+ *
40
+ * Concurrent calls share a single request and receive the same `Result`.
41
+ * The error carries the HTTP status: 401 when the server refuses the refresh
42
+ * token (also signalled by `AuthServiceEvents.RefreshRejected`), 5xx on an
43
+ * outage or a network error.
44
+ *
45
+ * A refresh superseded by a logout or a new login while in flight writes
46
+ * nothing and signals nothing: it never overwrites nor logs out the session
47
+ * that replaced the one it was refreshing.
33
48
  */
34
- refresh(): Promise<Result<AuthTokens, Error>>;
49
+ refresh(): Promise<Result<AuthTokens, HttpError>>;
50
+ private doRefresh;
51
+ private currentSessionResult;
52
+ private emitRefreshRejected;
35
53
  /**
36
54
  * Remove auth tokens from memory.
37
55
  */
@@ -18,6 +18,8 @@ export interface ConversationMessage {
18
18
  };
19
19
  feedbackEligible?: boolean;
20
20
  intentAction?: MessageIntentAction;
21
+ wizardStepKey?: string;
22
+ wizardClosing?: boolean;
21
23
  createdAt: string;
22
24
  }
23
25
  export declare enum ConversationMessageRole {
@@ -22,6 +22,8 @@ export interface GetConversationMessageResponse {
22
22
  reason: MeltyHandoffReason;
23
23
  };
24
24
  intentAction?: MessageIntentAction;
25
+ wizardStepKey?: string;
26
+ wizardClosing?: boolean;
25
27
  }>;
26
28
  feedback?: {
27
29
  signal: MeltyMessageFeedbackSignal;
@@ -8,8 +8,10 @@ export * from './listConversationsResponse';
8
8
  export * from './meltyHandoffReason';
9
9
  export * from './meltyMessageFeedbackReason';
10
10
  export * from './meltyMessageFeedbackSignal';
11
+ export * from './meltyOnboardingAction';
11
12
  export * from './meltyWidgetAction';
12
13
  export * from './messageIntentAction';
14
+ export * from './onboardingConversation';
13
15
  export * from './renderableWidgetAction';
14
16
  export * from './proactiveCheckResponse';
15
17
  export * from './triggerType';
@@ -0,0 +1,3 @@
1
+ export declare enum MeltyOnboardingAction {
2
+ ContinueOnboarding = "ContinueOnboarding"
3
+ }
@@ -7,4 +7,5 @@ export interface MessageIntentAction {
7
7
  url?: string;
8
8
  openInNewTab?: boolean;
9
9
  clickedAt?: string;
10
+ unavailable?: boolean;
10
11
  }
@@ -0,0 +1,81 @@
1
+ import { Nullable } from '../nullable';
2
+ import { ConversationStatus } from './conversation';
3
+ /**
4
+ * Status of the onboarding wizard of a client spot (story 2.1). Mirrors the
5
+ * backend `OnboardingWizardStatus`: `Completed` once the last answer saved the
6
+ * context and persona of the spot, `InProgress` before.
7
+ */
8
+ export declare enum OnboardingWizardStatus {
9
+ InProgress = "InProgress",
10
+ Completed = "Completed"
11
+ }
12
+ /**
13
+ * The 8 steps of the onboarding checklist of a client spot (story 3.1), in the
14
+ * order of the checklist. Mirrors the shared `OnboardingStep` enum (same
15
+ * values): the SDK core shares no package with it, the `util-types` barrel
16
+ * would drag `zod` and `dayjs` into the published bundle.
17
+ */
18
+ export declare enum OnboardingStep {
19
+ CompanyContext = "CompanyContext",
20
+ CoachPersona = "CoachPersona",
21
+ ContextDocuments = "ContextDocuments",
22
+ TestAiCoach = "TestAiCoach",
23
+ Playbook = "Playbook",
24
+ Extension = "Extension",
25
+ IntentTooltip = "IntentTooltip",
26
+ PreviewAsMember = "PreviewAsMember"
27
+ }
28
+ /**
29
+ * Persisted status of an onboarding step. Mirrors the shared
30
+ * `OnboardingStepStatus` enum. "To do" is not a value: it is a null status.
31
+ */
32
+ export declare enum OnboardingStepStatus {
33
+ Completed = "Completed",
34
+ Skipped = "Skipped"
35
+ }
36
+ /** One step of the onboarding checklist and its status (null = to do). */
37
+ export interface CoachOnboardingChecklistStep {
38
+ step: OnboardingStep;
39
+ status: Nullable<OnboardingStepStatus>;
40
+ }
41
+ /**
42
+ * The onboarding checklist of the client spot, pushed by the host to the
43
+ * coach (`Coach.setOnboardingChecklist`, story 3.1): the coach reads nothing
44
+ * of it from the server.
45
+ */
46
+ export interface CoachOnboardingChecklist {
47
+ steps: CoachOnboardingChecklistStep[];
48
+ completedCount: number;
49
+ totalCount: number;
50
+ nextStep: Nullable<OnboardingStep>;
51
+ latestPlaybookName: Nullable<string>;
52
+ testCoachDisabledReason?: Nullable<string>;
53
+ }
54
+ /**
55
+ * State of the onboarding wizard, as the server computes it from the messages
56
+ * of the onboarding conversation. Keys are the wizard step keys (shared
57
+ * `WizardStepKey` values) — typed as strings here, the SDK core shares no
58
+ * package with the wizard definition.
59
+ */
60
+ export interface OnboardingWizardState {
61
+ status: OnboardingWizardStatus;
62
+ currentStepKey: Nullable<string>;
63
+ answers: Partial<Record<string, string[]>>;
64
+ }
65
+ /** The onboarding conversation of a client spot, in the Academy spot. */
66
+ export interface OnboardingConversation {
67
+ id: string;
68
+ title: Nullable<string>;
69
+ status: ConversationStatus;
70
+ onboardingSpotId: string;
71
+ createdAt: string;
72
+ }
73
+ /** Response of POST /melty/conversations~onboarding. */
74
+ export interface GetOrCreateOnboardingConversationResponse {
75
+ conversation: OnboardingConversation;
76
+ wizard: OnboardingWizardState;
77
+ }
78
+ /** Response of POST /melty/conversations/:id/onboardingWizard~answer. */
79
+ export interface AnswerOnboardingWizardStepResponse {
80
+ wizard: OnboardingWizardState;
81
+ }