@askly/widget 2.10.0 → 3.0.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 (47) hide show
  1. package/MIGRATION-3.0.md +58 -0
  2. package/README.md +136 -5
  3. package/dist/app/HelpTab-jjw4cF1_.js +1 -0
  4. package/dist/app/VoiceRecorder-CMc1Bz14.js +1 -0
  5. package/dist/app/askly-app.js +1 -0
  6. package/dist/app/shared-C0Z29aNi.js +1 -0
  7. package/dist/app/speech-8iAgRQFA.js +1 -0
  8. package/dist/index.esm.js +1 -1
  9. package/dist/index.umd.js +1 -1
  10. package/dist/loader.js +1 -0
  11. package/dist/types/app.d.ts +3 -0
  12. package/dist/types/core/api.d.ts +30 -0
  13. package/dist/types/core/config.d.ts +44 -0
  14. package/dist/{core → types/core}/events.d.ts +19 -0
  15. package/dist/types/core/html.d.ts +2 -0
  16. package/dist/types/core/speech.d.ts +38 -0
  17. package/dist/{core → types/core}/types.d.ts +4 -0
  18. package/dist/types/core/voice.d.ts +7 -0
  19. package/dist/{icons.d.ts → types/icons.d.ts} +0 -3
  20. package/dist/types/index.d.ts +7 -0
  21. package/dist/types/loader/attrs.d.ts +4 -0
  22. package/dist/types/loader/core.d.ts +26 -0
  23. package/dist/{ui → types/ui}/Composer.d.ts +11 -9
  24. package/dist/types/ui/VoiceRecorder.d.ts +17 -0
  25. package/dist/types/widget-entry.d.ts +1 -0
  26. package/dist/types/widget.d.ts +3 -0
  27. package/dist/widget.js +1 -10
  28. package/package.json +32 -21
  29. package/dist/index.d.ts +0 -117
  30. package/dist/widget.d.ts +0 -4
  31. /package/dist/{core → types/core}/format.d.ts +0 -0
  32. /package/dist/{core → types/core}/greeting.d.ts +0 -0
  33. /package/dist/{core → types/core}/session.d.ts +0 -0
  34. /package/dist/{core → types/core}/storage.d.ts +0 -0
  35. /package/dist/{identity.d.ts → types/identity.d.ts} +0 -0
  36. /package/dist/{markdown.d.ts → types/markdown.d.ts} +0 -0
  37. /package/dist/{pathRules.d.ts → types/pathRules.d.ts} +0 -0
  38. /package/dist/{realtime.d.ts → types/realtime.d.ts} +0 -0
  39. /package/dist/{ui → types/ui}/ChatTerms.d.ts +0 -0
  40. /package/dist/{ui → types/ui}/ConversationList.d.ts +0 -0
  41. /package/dist/{ui → types/ui}/ExploreTab.d.ts +0 -0
  42. /package/dist/{ui → types/ui}/GreetingBubble.d.ts +0 -0
  43. /package/dist/{ui → types/ui}/HelpTab.d.ts +0 -0
  44. /package/dist/{ui → types/ui}/Launcher.d.ts +0 -0
  45. /package/dist/{ui → types/ui}/MessageList.d.ts +0 -0
  46. /package/dist/{ui → types/ui}/NavTabs.d.ts +0 -0
  47. /package/dist/{ui → types/ui}/PanelHeader.d.ts +0 -0
@@ -0,0 +1,7 @@
1
+ import type { AsklyApi } from "./core/api";
2
+ declare const Askly: AsklyApi;
3
+ export default Askly;
4
+ export type { AsklyApi } from "./core/api";
5
+ export type { AsklyConfig } from "./core/config";
6
+ export type { AsklyIdentity } from "./identity";
7
+ export type { AsklyEventMap, AsklyEventName, AsklyEventHandler, AsklySpace } from "./core/events";
@@ -0,0 +1,4 @@
1
+ /** `data-*` attributes on the script tag, as init() options. */
2
+ import type { AsklyConfig } from "../core/config";
3
+ export declare function appIdFromScript(script: Element | null): string | undefined;
4
+ export declare function configFromScript(currentScript: Element, autoAppId: string): AsklyConfig;
@@ -0,0 +1,26 @@
1
+ export declare const ASKLY_API_BASE = "https://api.askly.co.in";
2
+ export declare const APP_FILE = "app/askly-app.js";
3
+ export interface LoaderOptions {
4
+ /** URL of the app module (`app/askly-app.js`). */
5
+ appUrl: string;
6
+ /** Tried when `appUrl` cannot be fetched (the versioned CDN copy). */
7
+ fallbackUrl?: string;
8
+ }
9
+ /** The queue the app replays. `v` lets a future app recognise an older stub. */
10
+ export interface AsklyStub {
11
+ q: Array<[string, any[]]> | null;
12
+ v: number;
13
+ _r: Array<() => void>;
14
+ _t: number;
15
+ _unpaint?: () => void;
16
+ [method: string]: any;
17
+ }
18
+ export declare function createLoader(initial: LoaderOptions): AsklyStub;
19
+ /**
20
+ * Where the loader's script came from, as the place to fetch the app from. A floating CDN
21
+ * tag (`@3`, `@latest`, none) is pinned to this exact version so the app and its chunks
22
+ * always come from one immutable path.
23
+ */
24
+ export declare function appUrlFromScript(src: string | null | undefined, version: string, fallback: string): string;
25
+ /** The <script> that loaded this file: `document.currentScript`, else the tag that names it. */
26
+ export declare function findLoaderScript(): HTMLScriptElement | null;
@@ -1,28 +1,30 @@
1
1
  import React from "react";
2
2
  export interface ComposerProps {
3
- enableVoiceChat: boolean;
4
3
  fileInputRef: React.RefObject<HTMLInputElement>;
5
4
  handleEmojiClick: (emoji: string) => void;
6
5
  handleFileChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
7
6
  handleFileUploadClick: () => void;
8
7
  input: string;
9
8
  inputRef: React.RefObject<HTMLTextAreaElement>;
10
- isListening: boolean;
11
9
  isTyping: boolean;
12
10
  leadRequired: boolean;
13
11
  placeholderText: string;
14
- readAloud: boolean;
15
12
  sendMessage: (text?: string) => void | Promise<void>;
16
13
  setInput: React.Dispatch<React.SetStateAction<string>>;
17
14
  setShowEmojiPicker: (show: boolean) => void;
18
- setTtsMuted: (muted: boolean) => void;
19
15
  showEmojiPicker: boolean;
20
- stopSpeaking: () => void;
21
- toggleVoiceInput: () => void;
22
- ttsMuted: boolean;
23
- ttsMutedRef: React.MutableRefObject<boolean>;
16
+ startVoiceInput: () => void;
17
+ stopVoiceInput: () => void;
18
+ cancelVoiceInput: () => void;
24
19
  turnstileBlocked: boolean;
25
20
  uploadingFile: boolean;
21
+ voiceInputEnabled: boolean;
22
+ voiceMaxMs: number;
23
+ voiceMeterRef: React.MutableRefObject<{
24
+ level: number;
25
+ elapsedMs: number;
26
+ }>;
27
+ voicePhase: "idle" | "starting" | "recording" | "transcribing";
26
28
  }
27
- /** The message box and its actions: attach, emoji, voice input, read-aloud and send. */
29
+ /** The message box and its actions: attach, emoji, voice input and send. */
28
30
  export declare function Composer(props: ComposerProps): React.JSX.Element;
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ export interface VoiceRecorderProps {
3
+ phase: "starting" | "recording" | "transcribing";
4
+ /** Written by the recorder about ten times a second; read here so only this strip re-renders. */
5
+ meterRef: React.MutableRefObject<{
6
+ level: number;
7
+ elapsedMs: number;
8
+ }>;
9
+ maxMs: number;
10
+ onStop: () => void;
11
+ onCancel: () => void;
12
+ }
13
+ /**
14
+ * Replaces the whole message box while a clip is being recorded or transcribed: cancel on
15
+ * the left, a waveform that scrolls in from the right, and stop on the right.
16
+ */
17
+ export declare function VoiceRecorder({ phase, meterRef, maxMs, onStop, onCancel }: VoiceRecorderProps): React.JSX.Element;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import type { ChatWidgetProps } from "./core/types";
3
+ export declare const ChatWidget: ({ orgId, organizationName: initialOrganizationName, themeColor: initialThemeColor, theme: initialTheme, position, orgServerRoute, enableVoiceChat: initialEnableVoiceChat, voiceInput: initialVoiceInput, welcomeMessage: initialWelcomeMessage, placeholderText, organizationLogo: initialOrganizationLogo, buttonIcon, buttonShape: initialButtonShape, autoOpen, greeting, showTimestamp, soundEnabled, soundVolume, poweredBy, userId, timestamp, signature, turnstileSiteKey, excludePaths, includePaths, configOverride, resetGeneration: initResetGeneration, greetingStartedAt, onMessageSent, onMessageReceived, onChatOpened, onChatClosed, onEscalation, }: ChatWidgetProps) => React.JSX.Element | null;