@meltingspot/core 0.1.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.
Files changed (111) hide show
  1. package/LICENSE +28 -0
  2. package/README.md +42 -0
  3. package/api/meltingSpotApi.d.ts +57 -0
  4. package/index.d.ts +51 -0
  5. package/index.mjs +6134 -0
  6. package/index.umd.js +33 -0
  7. package/logger.d.ts +8 -0
  8. package/package.json +22 -0
  9. package/playbookEditor/index.d.ts +9 -0
  10. package/services/api/analytics/analytics.api.input.d.ts +6 -0
  11. package/services/api/analytics/analytics.api.service.d.ts +9 -0
  12. package/services/api/playbook/playbook.api.input.d.ts +68 -0
  13. package/services/api/playbook/playbook.api.output.d.ts +44 -0
  14. package/services/api/playbook/playbook.api.service.d.ts +22 -0
  15. package/services/api/spot/spot.api.output.d.ts +8 -0
  16. package/services/api/spot/spot.api.service.d.ts +11 -0
  17. package/services/api/spotMember/spotMember.api.output.d.ts +18 -0
  18. package/services/api/spotMember/spotMember.api.service.d.ts +12 -0
  19. package/services/api/spotMemberAuth/spotMemberAuth.api.output.d.ts +3 -0
  20. package/services/api/spotMemberAuth/spotMemberAuth.api.service.d.ts +11 -0
  21. package/services/auth.service.d.ts +49 -0
  22. package/services/configuration.service.d.ts +20 -0
  23. package/services/http.service.d.ts +33 -0
  24. package/services/routeChangeDetector.service.d.ts +29 -0
  25. package/services/sso.service.d.ts +8 -0
  26. package/services/storage.service.d.ts +11 -0
  27. package/types/authTokens.d.ts +4 -0
  28. package/types/conversation/conversation.d.ts +16 -0
  29. package/types/conversation/conversationMessage.d.ts +12 -0
  30. package/types/conversation/conversationSseEvent.d.ts +44 -0
  31. package/types/conversation/conversationStreamResponse.d.ts +9 -0
  32. package/types/conversation/createConversationResponse.d.ts +8 -0
  33. package/types/conversation/getConversationMessagesResponse.d.ts +25 -0
  34. package/types/conversation/index.d.ts +11 -0
  35. package/types/conversation/listConversationsResponse.d.ts +9 -0
  36. package/types/conversation/meltyWidgetAction.d.ts +12 -0
  37. package/types/conversation/proactiveCheckResponse.d.ts +12 -0
  38. package/types/conversation/renderableWidgetAction.d.ts +15 -0
  39. package/types/conversation/triggerType.d.ts +17 -0
  40. package/types/index.d.ts +12 -0
  41. package/types/injectable.d.ts +3 -0
  42. package/types/integrationSchema/beacon.d.ts +112 -0
  43. package/types/integrationSchema/index.d.ts +3 -0
  44. package/types/integrationSchema/integrationSchema.d.ts +19 -0
  45. package/types/integrationSchema/touchPoint.d.ts +89 -0
  46. package/types/learningPathContentType.d.ts +6 -0
  47. package/types/live/index.d.ts +2 -0
  48. package/types/live/liveBuiltInType.d.ts +4 -0
  49. package/types/live/liveStatus.d.ts +5 -0
  50. package/types/maybe.d.ts +2 -0
  51. package/types/meltyIntent/index.d.ts +3 -0
  52. package/types/meltyIntent/intentUserState.d.ts +7 -0
  53. package/types/meltyIntent/lastActionState.d.ts +5 -0
  54. package/types/meltyIntent/meltyIntentUserStateList.d.ts +11 -0
  55. package/types/nullable.d.ts +1 -0
  56. package/types/simplifiedRichText.d.ts +39 -0
  57. package/types/themeMode.d.ts +1 -0
  58. package/types/widget/index.d.ts +3 -0
  59. package/types/widget/metadata/abstractWidgetContentMetadata.d.ts +6 -0
  60. package/types/widget/metadata/channelWidgetContentMetadata.d.ts +11 -0
  61. package/types/widget/metadata/collectionWidgetContentMetadata.d.ts +12 -0
  62. package/types/widget/metadata/courseWidgetContentMetadata.d.ts +13 -0
  63. package/types/widget/metadata/documentLinkWidgetContentMetadata.d.ts +12 -0
  64. package/types/widget/metadata/documentPageWidgetContentMetadata.d.ts +12 -0
  65. package/types/widget/metadata/forumWidgetContentMetadata.d.ts +11 -0
  66. package/types/widget/metadata/index.d.ts +23 -0
  67. package/types/widget/metadata/learningPathWidgetContentMetadata.d.ts +16 -0
  68. package/types/widget/metadata/liveWidgetContentMetadata.d.ts +15 -0
  69. package/types/widget/metadata/richTextWidgetContentMetadata.d.ts +7 -0
  70. package/types/widget/metadata/topicWidgetContentMetadata.d.ts +14 -0
  71. package/types/widget/playbook/index.d.ts +8 -0
  72. package/types/widget/playbook/playbook.d.ts +8 -0
  73. package/types/widget/playbook/playbookHotspot.d.ts +12 -0
  74. package/types/widget/playbook/playbookHotspotLocation.d.ts +4 -0
  75. package/types/widget/playbook/playbookIntent.d.ts +12 -0
  76. package/types/widget/playbook/playbookIntentStatus.d.ts +5 -0
  77. package/types/widget/playbook/playbookIntentWidgetMode.d.ts +4 -0
  78. package/types/widget/playbook/playbookMatchingRules.d.ts +23 -0
  79. package/types/widget/playbook/playbookPage.d.ts +10 -0
  80. package/types/widget/spotWidgetContentType.d.ts +13 -0
  81. package/utils/date/date.d.ts +7 -0
  82. package/utils/date/formatDate.d.ts +16 -0
  83. package/utils/date/formatters/formatToDate.d.ts +2 -0
  84. package/utils/date/formatters/formatToDateTime.d.ts +2 -0
  85. package/utils/date/formatters/formatToExtraShortDate.d.ts +3 -0
  86. package/utils/date/formatters/formatToInlineExtraShortDate.d.ts +3 -0
  87. package/utils/date/formatters/formatToInlineShortDate.d.ts +3 -0
  88. package/utils/date/formatters/formatToLongDate.d.ts +3 -0
  89. package/utils/date/formatters/formatToLongDateTime.d.ts +3 -0
  90. package/utils/date/formatters/formatToShortDate.d.ts +2 -0
  91. package/utils/date/formatters/formatToShortTime.d.ts +3 -0
  92. package/utils/date/formatters/formatToSimpleDate.d.ts +2 -0
  93. package/utils/date/formatters/formatToSimpleDateTime.d.ts +2 -0
  94. package/utils/date/formatters/formatToTime.d.ts +2 -0
  95. package/utils/date/types.d.ts +3 -0
  96. package/utils/format.d.ts +6 -0
  97. package/utils/index.d.ts +16 -0
  98. package/utils/logger.d.ts +15 -0
  99. package/utils/playbook/testUrlMatching.d.ts +2 -0
  100. package/utils/playbookEditor/bridge.d.ts +22 -0
  101. package/utils/playbookEditor/lifecycle.d.ts +52 -0
  102. package/utils/string/sanitizeUrl.d.ts +1 -0
  103. package/utils/string/trim.d.ts +2 -0
  104. package/utils/ui/createDialog.d.ts +1 -0
  105. package/utils/ui/createIframe.d.ts +9 -0
  106. package/utils/ui/getHTMLElement.d.ts +5 -0
  107. package/utils/ui/isTouchDevice.d.ts +6 -0
  108. package/utm/flattenUtmParameters.d.ts +3 -0
  109. package/utm/index.d.ts +3 -0
  110. package/utm/parseUtmParameters.d.ts +2 -0
  111. package/utm/utmParameters.d.ts +7 -0
@@ -0,0 +1,18 @@
1
+ import { Nullable } from '../../../types/nullable';
2
+ export interface SpotMemberOutput {
3
+ id: string;
4
+ spotId: string;
5
+ userId: Nullable<string>;
6
+ email: string;
7
+ title: Nullable<string>;
8
+ lang: string;
9
+ role: string;
10
+ customRoleId: Nullable<string>;
11
+ status: string;
12
+ firstname: string;
13
+ lastname: string;
14
+ warnings: number;
15
+ embedBaseUrls: Record<string, string>;
16
+ updatedAt: number;
17
+ lastActivityAt: Nullable<number>;
18
+ }
@@ -0,0 +1,12 @@
1
+ import { Result } from 'neverthrow';
2
+ import { SpotMemberOutput } from './spotMember.api.output';
3
+ export declare class SpotMemberApiService {
4
+ private readonly meltingSpotApi;
5
+ private static instance;
6
+ static getInstance(): SpotMemberApiService;
7
+ private constructor();
8
+ /**
9
+ * Get the current user's SpotMember.
10
+ */
11
+ getSpotMemberForMe(): Promise<Result<SpotMemberOutput, Error>>;
12
+ }
@@ -0,0 +1,3 @@
1
+ export interface SsoTokenApiOutput {
2
+ token: string;
3
+ }
@@ -0,0 +1,11 @@
1
+ import { Result } from 'neverthrow';
2
+ export declare class SpotMemberAuthApiService {
3
+ private readonly meltingSpotApi;
4
+ private static instance;
5
+ static getInstance(): SpotMemberAuthApiService;
6
+ private constructor();
7
+ /**
8
+ * Generate a new SSO token for the current user.
9
+ */
10
+ generateSsoToken(): Promise<Result<string, Error>>;
11
+ }
@@ -0,0 +1,49 @@
1
+ import { Result } from 'neverthrow';
2
+ import { AuthTokens } from '../types/authTokens';
3
+ import { Nullable } from '../types/nullable';
4
+ import { HttpError } from './http.service';
5
+ export declare enum AuthServiceEvents {
6
+ TokensUpdated = "auth:tokens-updated"
7
+ }
8
+ export interface AuthTokensUpdatedEventDetail {
9
+ accessToken: Nullable<string>;
10
+ refreshToken: Nullable<string>;
11
+ }
12
+ export declare class AuthService extends EventTarget {
13
+ private static instance;
14
+ private accessToken;
15
+ private refreshToken;
16
+ private constructor();
17
+ static getInstance(): AuthService;
18
+ /**
19
+ * Login with email and password.
20
+ */
21
+ loginWithPassword(email: string, password: string): Promise<Result<AuthTokens, HttpError>>;
22
+ /**
23
+ * Login with the SSO token from configuration.
24
+ */
25
+ loginWithSsoToken(ssoToken: string): Promise<Result<AuthTokens, HttpError>>;
26
+ /**
27
+ * Login with the access and refresh tokens.
28
+ */
29
+ loginWithAuthTokens(accessToken: string, refreshToken: string): AuthTokens;
30
+ resetPassword(email: string): Promise<Result<void, HttpError>>;
31
+ /**
32
+ * Refresh the access token using the stored refresh token.
33
+ */
34
+ refresh(): Promise<Result<AuthTokens, Error>>;
35
+ /**
36
+ * Remove auth tokens from memory.
37
+ */
38
+ logout(): Promise<void>;
39
+ /**
40
+ * Get the current access token.
41
+ */
42
+ getAccessToken(): Nullable<string>;
43
+ /**
44
+ * Get the current refresh token.
45
+ */
46
+ getRefreshToken(): Nullable<string>;
47
+ private setTokens;
48
+ private callApi;
49
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Low-level SDK configuration. API URLs (msApiBaseUrl, msCommunityWebBaseUrl) are
3
+ * infrastructure settings that must be set via Configuration.setConfiguration() before
4
+ * calling start(). They are not exposed as start() parameters.
5
+ */
6
+ export interface MeltingSpotConfiguration {
7
+ msApiBaseUrl: string;
8
+ msCommunityWebBaseUrl: string;
9
+ ssoToken?: string;
10
+ spotId: string;
11
+ rootDocument: Document;
12
+ }
13
+ export declare class ConfigurationService {
14
+ private configuration;
15
+ private static instance;
16
+ private constructor();
17
+ static getInstance(): ConfigurationService;
18
+ setConfiguration(config: Partial<MeltingSpotConfiguration>): void;
19
+ static getConfiguration(withOverride?: Partial<MeltingSpotConfiguration>): MeltingSpotConfiguration;
20
+ }
@@ -0,0 +1,33 @@
1
+ import { StatusCodes } from 'http-status-codes';
2
+ import { Result } from 'neverthrow';
3
+ export declare class HttpError extends Error {
4
+ readonly code: StatusCodes;
5
+ constructor(code: StatusCodes, message?: string);
6
+ }
7
+ export declare enum HttpMethods {
8
+ GET = "GET",
9
+ PATCH = "PATCH",
10
+ POST = "POST"
11
+ }
12
+ export interface HttpInput {
13
+ url: string;
14
+ headers?: Record<string, string>;
15
+ }
16
+ export type QueryType = string | Record<string, string | number | boolean | string[] | number[] | boolean[]>;
17
+ export interface HttpGetInput extends HttpInput {
18
+ query?: QueryType;
19
+ }
20
+ export interface HttpPatchInput extends HttpInput {
21
+ payload: string | object;
22
+ }
23
+ export interface HttpPostInput extends HttpInput {
24
+ payload: string | object;
25
+ }
26
+ export declare class HttpService {
27
+ private headers;
28
+ setHeaders(headers: Record<string, string>): void;
29
+ get<TResponse>(input: HttpGetInput): Promise<Result<TResponse, HttpError>>;
30
+ post<TResponse>(input: HttpPostInput): Promise<Result<TResponse, HttpError>>;
31
+ patch<TResponse>(input: HttpPatchInput): Promise<Result<TResponse, HttpError>>;
32
+ private serializeQuery;
33
+ }
@@ -0,0 +1,29 @@
1
+ export interface RouteChangeDetectorOptions {
2
+ onRouteChange: (url: string, context: string) => void | Promise<void>;
3
+ debounceMs?: number;
4
+ enableDeduplication?: boolean;
5
+ enableDomMutationDetection?: boolean;
6
+ enableHistoryChange?: boolean;
7
+ enablePopState?: boolean;
8
+ enableHashChange?: boolean;
9
+ enableLoad?: boolean;
10
+ rootDocument?: Document;
11
+ }
12
+ export declare class RouteChangeDetector {
13
+ private readonly options;
14
+ private active;
15
+ private lastObservedUrl;
16
+ private debounceTimer;
17
+ private originalPushState?;
18
+ private originalReplaceState?;
19
+ private popStateListener?;
20
+ private hashChangeListener?;
21
+ private loadListener?;
22
+ private mutationObserver?;
23
+ constructor(options: RouteChangeDetectorOptions);
24
+ start(): void;
25
+ stop(): void;
26
+ private handleNavigationEvent;
27
+ private patchHistoryListeners;
28
+ private restoreHistoryListeners;
29
+ }
@@ -0,0 +1,8 @@
1
+ import { Result } from 'neverthrow';
2
+ export declare class SsoService {
3
+ private static instance;
4
+ private readonly spotMemberAuthApiService;
5
+ static getInstance(): SsoService;
6
+ private constructor();
7
+ generateSsoToken(): Promise<Result<string, Error>>;
8
+ }
@@ -0,0 +1,11 @@
1
+ import { Nullable } from '../types/nullable';
2
+ export declare class StorageService {
3
+ private static instance;
4
+ private readonly storage;
5
+ private constructor();
6
+ static getInstance(): StorageService;
7
+ set<T>(key: string, value: T): Promise<void>;
8
+ get<T>(key: string): Promise<Nullable<T>>;
9
+ remove(key: string): Promise<void>;
10
+ exists(key: string): Promise<boolean>;
11
+ }
@@ -0,0 +1,4 @@
1
+ export interface AuthTokens {
2
+ accessToken: string;
3
+ refreshToken: string;
4
+ }
@@ -0,0 +1,16 @@
1
+ import { Nullable } from '../nullable';
2
+ import { ConversationMessage } from './conversationMessage';
3
+ import { TriggerType } from './triggerType';
4
+ export interface Conversation {
5
+ id: string;
6
+ status: ConversationStatus;
7
+ messages: ConversationMessage[];
8
+ createdAt: string;
9
+ triggerType: Nullable<TriggerType>;
10
+ triggerResourceId: Nullable<string>;
11
+ }
12
+ export declare enum ConversationStatus {
13
+ Active = "Active",
14
+ Closed = "Closed",
15
+ Expired = "Expired"
16
+ }
@@ -0,0 +1,12 @@
1
+ import { RenderableWidgetAction } from './renderableWidgetAction';
2
+ export interface ConversationMessage {
3
+ id: string;
4
+ role: ConversationMessageRole;
5
+ content: string[];
6
+ widgetActions: RenderableWidgetAction[];
7
+ createdAt: string;
8
+ }
9
+ export declare enum ConversationMessageRole {
10
+ User = "User",
11
+ Assistant = "Assistant"
12
+ }
@@ -0,0 +1,44 @@
1
+ import { MeltyWidgetAction } from './meltyWidgetAction';
2
+ export declare enum ConversationSseEventType {
3
+ Metadata = "metadata",
4
+ Token = "token",
5
+ Action = "action",
6
+ Bubble = "bubble",
7
+ Done = "done",
8
+ Error = "error"
9
+ }
10
+ export interface ConversationSseMetadataEvent {
11
+ type: ConversationSseEventType.Metadata;
12
+ data: {
13
+ conversationId: string;
14
+ messageId: string;
15
+ };
16
+ }
17
+ export interface ConversationSseTokenEvent {
18
+ type: ConversationSseEventType.Token;
19
+ data: {
20
+ content: string;
21
+ };
22
+ }
23
+ export interface ConversationSseActionEvent {
24
+ type: ConversationSseEventType.Action;
25
+ data: MeltyWidgetAction;
26
+ }
27
+ export interface ConversationSseBubbleEvent {
28
+ type: ConversationSseEventType.Bubble;
29
+ data: Record<string, never>;
30
+ }
31
+ export interface ConversationSseDoneEvent {
32
+ type: ConversationSseEventType.Done;
33
+ data: {
34
+ tokenCount: number;
35
+ };
36
+ }
37
+ export interface ConversationSseErrorEvent {
38
+ type: ConversationSseEventType.Error;
39
+ data: {
40
+ message: string;
41
+ code: string;
42
+ };
43
+ }
44
+ export type ConversationSseEvent = ConversationSseMetadataEvent | ConversationSseTokenEvent | ConversationSseActionEvent | ConversationSseBubbleEvent | ConversationSseDoneEvent | ConversationSseErrorEvent;
@@ -0,0 +1,9 @@
1
+ import { ConversationMessage } from './conversationMessage';
2
+ /**
3
+ * Response from a conversation streaming endpoint (create / sendMessage).
4
+ * The SSE stream is consumed internally and accumulated into this typed response.
5
+ */
6
+ export interface ConversationStreamResponse {
7
+ conversationId: string;
8
+ message: ConversationMessage;
9
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Response from POST /melty/conversations (JSON 201).
3
+ * Wire-pure create — returns the freshly created conversation id only.
4
+ * Caller chains streamSendMessage to deliver the first user message.
5
+ */
6
+ export interface CreateConversationResponse {
7
+ conversationId: string;
8
+ }
@@ -0,0 +1,25 @@
1
+ import { Nullable } from '../nullable';
2
+ import { ConversationStatus } from './conversation';
3
+ import { ConversationMessageRole } from './conversationMessage';
4
+ import { MeltyWidgetAction } from './meltyWidgetAction';
5
+ /**
6
+ * Raw payload of GET /melty/conversations/:id/messages. It differs from the SDK
7
+ * `Conversation`: the id is `conversationId`, and per-message widget actions are
8
+ * persisted under `metadata.actions` (not `widgetActions`). The service maps it
9
+ * onto `Conversation` so the rest of the SDK works with a single model.
10
+ */
11
+ export interface GetConversationMessageResponse {
12
+ id: string;
13
+ role: ConversationMessageRole;
14
+ content: string[];
15
+ metadata: Nullable<{
16
+ actions?: MeltyWidgetAction[];
17
+ }>;
18
+ createdAt: string;
19
+ }
20
+ export interface GetConversationMessagesResponse {
21
+ conversationId: string;
22
+ status: ConversationStatus;
23
+ createdAt: string;
24
+ messages: GetConversationMessageResponse[];
25
+ }
@@ -0,0 +1,11 @@
1
+ export * from './conversation';
2
+ export * from './conversationMessage';
3
+ export * from './conversationSseEvent';
4
+ export * from './conversationStreamResponse';
5
+ export * from './createConversationResponse';
6
+ export * from './getConversationMessagesResponse';
7
+ export * from './listConversationsResponse';
8
+ export * from './meltyWidgetAction';
9
+ export * from './renderableWidgetAction';
10
+ export * from './proactiveCheckResponse';
11
+ export * from './triggerType';
@@ -0,0 +1,9 @@
1
+ import { Conversation } from './conversation';
2
+ /**
3
+ * Response from GET /melty/conversations (lookup by intentId + status).
4
+ * Each item is a list projection of `Conversation` without `messages` — fetch
5
+ * messages via GET /:id/messages when needed.
6
+ */
7
+ export interface ListConversationsResponse {
8
+ conversations: Omit<Conversation, 'messages'>[];
9
+ }
@@ -0,0 +1,12 @@
1
+ import { WidgetContentMetadata } from '../widget/metadata';
2
+ import { SpotWidgetContentType } from '../widget/spotWidgetContentType';
3
+ /**
4
+ * Reference to a widget/content sent by the conversational agent.
5
+ * The SDK interprets this action and renders it as a content card
6
+ * (in conversation) or as a CTA button (in proactive beacon).
7
+ */
8
+ export interface MeltyWidgetAction {
9
+ widgetType: SpotWidgetContentType;
10
+ widgetId: string;
11
+ metadata: WidgetContentMetadata[];
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Nullable } from '../nullable';
2
+ import { ConversationMessage } from './conversationMessage';
3
+ /**
4
+ * Response from the proactive check endpoint (POST /api/melty/conversations~check).
5
+ * When `triggered` is true, the backend has determined a proactive message
6
+ * is relevant for the current user/page context.
7
+ */
8
+ export interface ProactiveCheckResponse {
9
+ triggered: boolean;
10
+ conversationId: Nullable<string>;
11
+ message: Nullable<ConversationMessage>;
12
+ }
@@ -0,0 +1,15 @@
1
+ import { PlaybookIntentWidgetMode } from '../widget/playbook/playbookIntentWidgetMode';
2
+ import { MeltyWidgetAction } from './meltyWidgetAction';
3
+ /**
4
+ * Widget action enriched with UI rendering hints — what conversation messages
5
+ * carry. Agent-sent actions arrive as plain `MeltyWidgetAction` (no hint,
6
+ * assignable as-is); widget-seeded actions (hotspot seed) add the hints.
7
+ */
8
+ export interface RenderableWidgetAction extends MeltyWidgetAction {
9
+ /**
10
+ * Rendering hint preserved from the originating widget (hotspot seed):
11
+ * List → grouped list-of-content card. Absent on agent-sent actions,
12
+ * which render as individual Beacon cards.
13
+ */
14
+ mode?: PlaybookIntentWidgetMode;
15
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Trigger that originated a conversation. Mirrors the backend `TriggerType`
3
+ * enum exposed via wire on `ConversationApiResponse.triggerType`.
4
+ *
5
+ * - `PlaybookIntent` — anchored on a conversational hotspot (resume key).
6
+ * - `UserInitiated` — explicit user-driven open (e.g. widget chat button).
7
+ * - `Welcome` / `Resume` / `Discover` / `Recommend` — server-driven proactive
8
+ * triggers produced by the `~check` flow.
9
+ */
10
+ export declare enum TriggerType {
11
+ PlaybookIntent = "PlaybookIntent",
12
+ UserInitiated = "UserInitiated",
13
+ Welcome = "Welcome",
14
+ Resume = "Resume",
15
+ Discover = "Discover",
16
+ Recommend = "Recommend"
17
+ }
@@ -0,0 +1,12 @@
1
+ export * from './authTokens';
2
+ export * from './conversation';
3
+ export * from './injectable';
4
+ export * from './integrationSchema';
5
+ export * from './learningPathContentType';
6
+ export * from './live';
7
+ export * from './maybe';
8
+ export * from './meltyIntent';
9
+ export * from './nullable';
10
+ export * from './simplifiedRichText';
11
+ export * from './themeMode';
12
+ export * from './widget';
@@ -0,0 +1,3 @@
1
+ export interface Injectable {
2
+ remove(): void;
3
+ }
@@ -0,0 +1,112 @@
1
+ import { WidgetContentMetadata } from '../widget/metadata';
2
+ export declare enum ButtonBeaconSize {
3
+ ExtraExtraSmall = "ExtraExtraSmall",
4
+ ExtraSmall = "ExtraSmall",
5
+ Small = "Small",
6
+ Medium = "Medium",
7
+ Large = "Large"
8
+ }
9
+ export declare enum BeaconIntegrationType {
10
+ Dropdown = "Dropdown",
11
+ Inline = "Inline",
12
+ Overlay = "Overlay"
13
+ }
14
+ export interface InlineBeaconIntegration {
15
+ type: BeaconIntegrationType.Inline;
16
+ }
17
+ export declare enum DropdownBeaconHorizontalPosition {
18
+ Left = "Left",
19
+ Right = "Right"
20
+ }
21
+ export declare enum DropdownBeaconVerticalPosition {
22
+ Top = "Top",
23
+ Bottom = "Bottom"
24
+ }
25
+ export interface DropdownBeaconIntegration {
26
+ type: BeaconIntegrationType.Dropdown;
27
+ horizontalPosition?: DropdownBeaconHorizontalPosition;
28
+ verticalPosition?: DropdownBeaconVerticalPosition;
29
+ buttonSize?: ButtonBeaconSize;
30
+ }
31
+ export declare enum OverlayBeaconPosition {
32
+ TopLeft = "TopLeft",
33
+ TopRight = "TopRight",
34
+ BottomLeft = "BottomLeft",
35
+ BottomRight = "BottomRight"
36
+ }
37
+ export interface OverlayBeaconMargin {
38
+ top?: string | number;
39
+ right?: string | number;
40
+ bottom?: string | number;
41
+ left?: string | number;
42
+ }
43
+ export interface OverlayBeaconIntegration {
44
+ type: BeaconIntegrationType.Overlay;
45
+ position?: OverlayBeaconPosition;
46
+ margin?: string | number | OverlayBeaconMargin;
47
+ }
48
+ export type BeaconIntegration = InlineBeaconIntegration | DropdownBeaconIntegration | OverlayBeaconIntegration;
49
+ export declare enum BeaconRenderType {
50
+ Button = "Button",
51
+ Card = "Card",
52
+ CardInline = "CardInline",
53
+ Carousel = "Carousel",
54
+ Helper = "Helper",
55
+ ListOfContent = "ListOfContent",
56
+ ListOfContentInline = "ListOfContentInline"
57
+ }
58
+ export interface CommonBeaconRender<TType extends BeaconRenderType> {
59
+ type: TType;
60
+ style?: Record<string, string | number>;
61
+ }
62
+ export interface ButtonBeaconRender extends CommonBeaconRender<BeaconRenderType.Button> {
63
+ size?: ButtonBeaconSize;
64
+ }
65
+ export type CarouselBeaconRender = CommonBeaconRender<BeaconRenderType.Carousel>;
66
+ export type CardBeaconRender = CommonBeaconRender<BeaconRenderType.Card>;
67
+ export type CardInlineBeaconRender = CommonBeaconRender<BeaconRenderType.CardInline>;
68
+ export type HelperBeaconRender = CommonBeaconRender<BeaconRenderType.Helper>;
69
+ export type ListOfContentBeaconRender = CommonBeaconRender<BeaconRenderType.ListOfContent>;
70
+ export type ListOfContentInlineBeaconRender = CommonBeaconRender<BeaconRenderType.ListOfContentInline>;
71
+ export type BeaconRender = ButtonBeaconRender | CarouselBeaconRender | CardBeaconRender | CardInlineBeaconRender | HelperBeaconRender | ListOfContentBeaconRender | ListOfContentInlineBeaconRender;
72
+ export declare enum WidgetInjectionType {
73
+ Inline = "Inline",
74
+ Modal = "Modal",
75
+ Drawer = "Drawer"
76
+ }
77
+ export declare enum WidgetInjectionTarget {
78
+ Self = "Self",
79
+ Parent = "Parent",
80
+ Top = "Top"
81
+ }
82
+ export interface CommonWidgetInjectionMode {
83
+ target?: WidgetInjectionTarget;
84
+ }
85
+ export interface InlineWidgetInjectionMode extends CommonWidgetInjectionMode {
86
+ type: WidgetInjectionType.Inline;
87
+ }
88
+ export interface ModalWidgetInjectionMode extends CommonWidgetInjectionMode {
89
+ type: WidgetInjectionType.Modal;
90
+ }
91
+ export declare enum DrawerWidgetPosition {
92
+ Left = "Left",
93
+ Right = "Right"
94
+ }
95
+ export interface DrawerWidgetInjectionMode extends CommonWidgetInjectionMode {
96
+ type: WidgetInjectionType.Drawer;
97
+ position: DrawerWidgetPosition;
98
+ }
99
+ export type WidgetInjection = InlineWidgetInjectionMode | ModalWidgetInjectionMode | DrawerWidgetInjectionMode;
100
+ export interface BeaconWidget {
101
+ widgetId: string;
102
+ injection: WidgetInjection;
103
+ }
104
+ export interface Beacon {
105
+ id: string;
106
+ integration?: BeaconIntegration;
107
+ render: BeaconRender;
108
+ widget: BeaconWidget;
109
+ }
110
+ export interface DisplayableBeacon extends Beacon {
111
+ widgetContentMetadata: WidgetContentMetadata | WidgetContentMetadata[];
112
+ }
@@ -0,0 +1,3 @@
1
+ export * from './beacon';
2
+ export * from './integrationSchema';
3
+ export * from './touchPoint';
@@ -0,0 +1,19 @@
1
+ import { ThemeMode } from '../themeMode';
2
+ import { DisplayableTouchPoint, TouchPoint } from './touchPoint';
3
+ export interface IntegrationSchema {
4
+ id: string;
5
+ integration: string;
6
+ baseUrls: string[];
7
+ touchPoints: TouchPoint[];
8
+ themeMode?: ThemeMode;
9
+ }
10
+ /**
11
+ * DisplayableIntegrationSchema is a subset of IntegrationSchema ready
12
+ * to be displayed in the UI. (Augmented with fetched widget metadata)
13
+ */
14
+ export interface DisplayableIntegrationSchema extends Pick<IntegrationSchema, 'id' | 'themeMode'> {
15
+ spotId: string;
16
+ touchPoints: DisplayableTouchPoint[];
17
+ }
18
+ export type IntegrationSchemas = IntegrationSchema[];
19
+ export type DisplayableIntegrationSchemas = DisplayableIntegrationSchema[];
@@ -0,0 +1,89 @@
1
+ import { Beacon, DisplayableBeacon } from './beacon';
2
+ export declare enum TouchPointAnchorType {
3
+ Body = "Body",
4
+ DOMSelector = "DOMSelector"
5
+ }
6
+ export declare enum TouchPointDOMInjectionPosition {
7
+ After = "After",
8
+ AppendChild = "AppendChild",
9
+ Before = "Before",
10
+ PrependChild = "PrependChild"
11
+ }
12
+ export declare enum TouchPointDOMSelectorPathStepType {
13
+ CSSSelector = "CSSSelector",
14
+ Slot = "Slot"
15
+ }
16
+ export declare enum TouchPointDOMSelectorCssStepMode {
17
+ Element = "Element",
18
+ WebComponent = "WebComponent"
19
+ }
20
+ export interface TouchPointDOMSelectorCssStep {
21
+ type: TouchPointDOMSelectorPathStepType.CSSSelector;
22
+ selector: string;
23
+ mode?: TouchPointDOMSelectorCssStepMode;
24
+ }
25
+ export interface TouchPointDOMSelectorSlotStep {
26
+ type: TouchPointDOMSelectorPathStepType.Slot;
27
+ index?: number;
28
+ selector?: string;
29
+ flatten?: boolean;
30
+ }
31
+ export type TouchPointDOMSelectorPathStep = TouchPointDOMSelectorCssStep | TouchPointDOMSelectorSlotStep;
32
+ export interface TouchPointDOMSelectorPath {
33
+ steps: TouchPointDOMSelectorPathStep[];
34
+ }
35
+ export type TouchPointDOMSelectorTarget = string | TouchPointDOMSelectorPath | TouchPointDOMSelectorPathStep[];
36
+ export interface TouchPointDOMSelectorAnchor {
37
+ type: TouchPointAnchorType.DOMSelector;
38
+ target: TouchPointDOMSelectorTarget;
39
+ position: TouchPointDOMInjectionPosition;
40
+ }
41
+ export interface TouchPointBodyAnchor {
42
+ type: TouchPointAnchorType.Body;
43
+ position?: TouchPointDOMInjectionPosition;
44
+ }
45
+ export type TouchPointAnchor = TouchPointBodyAnchor | TouchPointDOMSelectorAnchor;
46
+ export interface TouchPointRender {
47
+ wrapperElement?: string;
48
+ style?: Record<string, string | number>;
49
+ className?: string;
50
+ }
51
+ export declare enum TouchPointLayoutType {
52
+ Inline = "Inline",
53
+ Flex = "Flex"
54
+ }
55
+ export interface TouchPointInlineLayout {
56
+ type: TouchPointLayoutType.Inline;
57
+ }
58
+ export declare enum TouchPointFlexDirection {
59
+ Horizontal = "Horizontal",
60
+ Vertical = "Vertical"
61
+ }
62
+ export declare enum TouchPointFlexAlign {
63
+ Start = "Start",
64
+ Center = "Center",
65
+ End = "End",
66
+ Stretch = "Stretch",
67
+ Baseline = "Baseline"
68
+ }
69
+ export interface TouchPointFlexLayout {
70
+ type: TouchPointLayoutType.Flex;
71
+ direction?: TouchPointFlexDirection;
72
+ justifyContent?: TouchPointFlexAlign;
73
+ alignItems?: TouchPointFlexAlign;
74
+ gap?: string | number;
75
+ className?: string;
76
+ }
77
+ export type TouchPointLayout = TouchPointInlineLayout | TouchPointFlexLayout;
78
+ export interface TouchPoint {
79
+ id: string;
80
+ name: string;
81
+ urls: string[];
82
+ anchor: TouchPointAnchor;
83
+ render?: TouchPointRender;
84
+ layout?: TouchPointLayout;
85
+ beacons: Beacon[];
86
+ }
87
+ export interface DisplayableTouchPoint extends Pick<TouchPoint, 'id' | 'anchor' | 'render' | 'layout'> {
88
+ beacons: DisplayableBeacon[];
89
+ }