@hachther/akilio-widget 0.6.6 → 1.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 (42) hide show
  1. package/README.md +359 -16
  2. package/dist/_headers +16 -0
  3. package/dist/akilio-widget.min.js +44 -44
  4. package/dist/assets/EmailIcon.d.ts +2 -0
  5. package/dist/assets/FormIcon.d.ts +2 -0
  6. package/dist/assets/PhoneIcon.d.ts +2 -0
  7. package/dist/components/BrandLogo.d.ts +7 -1
  8. package/dist/components/CartPanel.d.ts +13 -0
  9. package/dist/components/CommerceActions.d.ts +11 -0
  10. package/dist/components/Composer.d.ts +7 -1
  11. package/dist/components/ContactActions.d.ts +8 -0
  12. package/dist/components/ContextualPrompt.d.ts +7 -0
  13. package/dist/components/EmptyState.d.ts +3 -1
  14. package/dist/components/Icons.d.ts +1 -0
  15. package/dist/components/InlineDecisionCard.d.ts +2 -0
  16. package/dist/components/Launcher.d.ts +8 -1
  17. package/dist/components/MessageBubble.d.ts +10 -1
  18. package/dist/components/MessageList.d.ts +1 -1
  19. package/dist/components/ProductCard.d.ts +4 -2
  20. package/dist/components/ProductCards.d.ts +6 -1
  21. package/dist/components/ProductDetail.d.ts +12 -0
  22. package/dist/components/SectionPrompt.d.ts +2 -0
  23. package/dist/components/TextSelectionPrompt.d.ts +2 -0
  24. package/dist/hooks/page-end.d.ts +1 -0
  25. package/dist/hooks/proactive-summary.d.ts +1 -0
  26. package/dist/hooks/response-sound.d.ts +9 -0
  27. package/dist/hooks/storage.d.ts +2 -0
  28. package/dist/index.d.ts +5 -1
  29. package/dist/index.min.js +9343 -6663
  30. package/dist/index.umd.min.cjs +36 -36
  31. package/dist/lib/client.d.ts +23 -2
  32. package/dist/lib/copy.d.ts +8 -2
  33. package/dist/loader.js +46 -0
  34. package/dist/locales/en.d.ts +127 -0
  35. package/dist/locales/fr.d.ts +127 -0
  36. package/dist/locales/index.d.ts +3 -0
  37. package/dist/releases/1.0.0/akilio-widget.min.js +45 -0
  38. package/dist/style.css +2334 -151
  39. package/dist/types.d.ts +554 -20
  40. package/dist/vanilla.d.ts +1 -0
  41. package/dist/widget-manifest.json +8 -0
  42. package/package.json +5 -3
@@ -0,0 +1,2 @@
1
+ declare function EmailIcon(): import("react").JSX.Element;
2
+ export default EmailIcon;
@@ -0,0 +1,2 @@
1
+ declare function FormIcon(): import("react").JSX.Element;
2
+ export default FormIcon;
@@ -0,0 +1,2 @@
1
+ declare function PhoneIcon(): import("react").JSX.Element;
2
+ export default PhoneIcon;
@@ -1,10 +1,16 @@
1
1
  import React from 'react';
2
+ export declare const BrandingContext: React.Context<{
3
+ logoUrl?: string;
4
+ name?: string;
5
+ }>;
6
+ export declare function safeLogoUrl(value?: string): string | undefined;
2
7
  interface BrandLogoProps {
8
+ showAkilio?: boolean;
3
9
  variant?: 'mark' | 'wordmark';
4
10
  className?: string;
5
11
  style?: React.CSSProperties;
6
12
  primaryColor?: string;
7
13
  secondaryColor?: string;
8
14
  }
9
- export declare function BrandLogo({ variant, className, style, primaryColor, secondaryColor, }: BrandLogoProps): React.JSX.Element;
15
+ export declare function BrandLogo({ showAkilio, variant, className, style, primaryColor, secondaryColor, }: BrandLogoProps): React.JSX.Element;
10
16
  export {};
@@ -0,0 +1,13 @@
1
+ import type { AkilioResolvedCopy } from '../lib/copy';
2
+ import type { AkilioCart, AkilioCartAction, AkilioCartLine } from '../types';
3
+ interface CartPanelProps {
4
+ cart: AkilioCart | null;
5
+ loading?: boolean;
6
+ copy: AkilioResolvedCopy;
7
+ locale: string;
8
+ onClose: () => void;
9
+ onRefresh: () => void;
10
+ onAction: (line: AkilioCartLine, action: AkilioCartAction, quantity?: number) => Promise<void>;
11
+ }
12
+ export declare function CartPanel({ cart, loading, copy, locale, onClose, onRefresh, onAction, }: CartPanelProps): import("react").JSX.Element;
13
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { AkilioResolvedCopy } from '../lib/copy';
2
+ import type { AkilioCommercePublicAction, AkilioProduct } from '../types';
3
+ interface CommerceActionsProps {
4
+ actions: AkilioCommercePublicAction[];
5
+ products: AkilioProduct[];
6
+ copy: AkilioResolvedCopy;
7
+ onAction: (action: AkilioCommercePublicAction) => Promise<void>;
8
+ embedded?: boolean;
9
+ }
10
+ export declare function CommerceActions({ actions, products, copy, onAction, embedded, }: CommerceActionsProps): import("react").JSX.Element | null;
11
+ export {};
@@ -1,5 +1,5 @@
1
1
  import type { AkilioResolvedCopy } from '../lib/copy';
2
- import type { AkilioChatResponse } from '../types';
2
+ import type { AkilioChatIntent, AkilioChatResponse } from '../types';
3
3
  export interface ComposerHandle {
4
4
  getDraft(): string;
5
5
  setDraft(text: string, options?: {
@@ -19,6 +19,12 @@ interface ComposerProps {
19
19
  onDraftChange?: (draft: string, manual: boolean) => void;
20
20
  disabledMessage?: string;
21
21
  showPoweredBy?: boolean;
22
+ slug?: string;
23
+ intentActions?: Array<{
24
+ intent: AkilioChatIntent;
25
+ label: string;
26
+ }>;
27
+ onIntentAction?: (intent: AkilioChatIntent, label: string) => void;
22
28
  }
23
29
  declare const Composer: import("react").ForwardRefExoticComponent<ComposerProps & import("react").RefAttributes<ComposerHandle>>;
24
30
  export default Composer;
@@ -0,0 +1,8 @@
1
+ import type { AkilioResolvedCopy } from '../lib/copy';
2
+ import type { AkilioChatMessage, AkilioContactRequest, AkilioContactRequestCapability, AkilioContactRequestResponse, AkilioCustomerActionType } from '../types';
3
+ export declare function ContactActions({ message, capability, copy, onSubmit, }: {
4
+ message: AkilioChatMessage;
5
+ capability?: AkilioContactRequestCapability;
6
+ copy: AkilioResolvedCopy;
7
+ onSubmit?: (request: AkilioContactRequest, actionType: AkilioCustomerActionType) => Promise<AkilioContactRequestResponse>;
8
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,7 @@
1
+ export declare function ContextualPrompt({ placeholder, dismissLabel, dismissible, onDismiss, onSubmit, }: {
2
+ placeholder: string;
3
+ dismissLabel: string;
4
+ dismissible: boolean;
5
+ onDismiss: () => void;
6
+ onSubmit: (question: string) => Promise<void>;
7
+ }): import("react").JSX.Element;
@@ -1,9 +1,11 @@
1
1
  import type { AkilioResolvedCopy } from '../lib/copy';
2
- declare function EmptyState({ copy, onSuggestion, widgetAvailable, showBranding, primaryColor, }: {
2
+ declare function EmptyState({ copy, onSuggestion, widgetAvailable, showBranding, primaryColor, starterQuestions, }: {
3
3
  copy: AkilioResolvedCopy;
4
4
  onSuggestion: (suggestion: string) => void;
5
5
  widgetAvailable: boolean;
6
6
  showBranding: boolean;
7
7
  primaryColor?: string;
8
+ /** Resolved prompts from host configuration, public configuration, or locale defaults. */
9
+ starterQuestions?: string[];
8
10
  }): import("react").JSX.Element;
9
11
  export default EmptyState;
@@ -3,6 +3,7 @@ export declare function SparklesIcon(props: SVGProps<SVGSVGElement>): import("re
3
3
  export declare function SendIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
4
4
  export declare function CloseIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
5
5
  export declare function TrashIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
6
+ export declare function CartIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
6
7
  export declare function ThumbsUpIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
7
8
  export declare function ThumbsDownIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
8
9
  export declare function SunIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { AkilioInlineDecisionCardProps } from '../types';
2
+ export declare function InlineDecisionCard({ title, description, subject, page, primaryQuestion, followUpQuestions, onStartConversation, className, }: AkilioInlineDecisionCardProps): import("react").JSX.Element;
@@ -1,6 +1,13 @@
1
- export declare function Launcher({ label, onClick, showBranding, primaryColor, }: {
1
+ export declare function Launcher({ label, onClick, showBranding, primaryColor, open, controlsId, experience, expanded, answerReady, typing, accessibleLabel, }: {
2
2
  label: string;
3
3
  onClick: () => void;
4
4
  showBranding?: boolean;
5
5
  primaryColor?: string;
6
+ open?: boolean;
7
+ controlsId?: string;
8
+ experience?: 'adaptive' | 'static';
9
+ expanded?: boolean;
10
+ answerReady?: boolean;
11
+ typing?: boolean;
12
+ accessibleLabel?: string;
6
13
  }): import("react").JSX.Element;
@@ -1,13 +1,22 @@
1
1
  import type { AkilioResolvedCopy } from '../lib/copy';
2
- import type { AkilioChatMessage, AkilioFeedbackRating, AkilioProduct, AkilioProductVariant } from '../types';
2
+ import type { AkilioAgentTool, AkilioCart, AkilioChatMessage, AkilioCommercePublicAction, AkilioContactRequest, AkilioContactRequestCapability, AkilioContactRequestResponse, AkilioFeedbackRating, AkilioProactiveAction, AkilioProduct, AkilioProductVariant } from '../types';
3
3
  interface MessageBubbleProps {
4
4
  message: AkilioChatMessage;
5
5
  copy: AkilioResolvedCopy;
6
6
  locale: string;
7
7
  onFeedback?: (message: AkilioChatMessage, rating: AkilioFeedbackRating) => void;
8
8
  onSuggestion?: (suggestion: string) => void;
9
+ onProactiveAction?: (action: AkilioProactiveAction) => void;
9
10
  onProductClick?: (message: AkilioChatMessage, product: AkilioProduct, variant?: AkilioProductVariant) => void;
11
+ onCommerceAction?: (message: AkilioChatMessage, action: AkilioCommercePublicAction) => Promise<void>;
12
+ cart?: AkilioCart | null;
13
+ showBranding?: boolean;
10
14
  primaryColor?: string;
15
+ feedbackPending?: AkilioFeedbackRating;
16
+ contactRequestCapability?: AkilioContactRequestCapability;
17
+ onContactRequest?: (request: AkilioContactRequest, actionType: import('../types').AkilioCustomerActionType) => Promise<AkilioContactRequestResponse>;
18
+ onConfirmHumanRequest?: (message: AkilioChatMessage, tool: AkilioAgentTool, request: AkilioContactRequest) => Promise<void>;
19
+ onClarificationSubmit?: (message: AkilioChatMessage, values: Record<string, string>, submission: string) => Promise<void>;
11
20
  }
12
21
  export declare const MessageBubble: import("react").NamedExoticComponent<MessageBubbleProps>;
13
22
  export {};
@@ -1,3 +1,3 @@
1
1
  import { ChatPanelProps } from '../types';
2
- declare const MessageList: import("react").NamedExoticComponent<Pick<ChatPanelProps, "primaryColor" | "copy" | "onSuggestion" | "locale" | "onProductClick" | "onFeedback" | "messages">>;
2
+ declare const MessageList: import("react").NamedExoticComponent<Pick<ChatPanelProps, "primaryColor" | "copy" | "cart" | "locale" | "onSuggestion" | "showBranding" | "onProductClick" | "onCommerceAction" | "onFeedback" | "onProactiveAction" | "feedbackPending" | "contactRequestCapability" | "onContactRequest" | "onConfirmHumanRequest" | "onClarificationSubmit" | "messages">>;
3
3
  export default MessageList;
@@ -1,5 +1,5 @@
1
1
  import type { AkilioResolvedCopy } from '../lib/copy';
2
- import { AkilioProduct, type AkilioProductVariant } from '../types';
2
+ import type { AkilioCommercePublicAction, AkilioProduct, AkilioProductVariant } from '../types';
3
3
  export type ProductCardLayout = 'vertical' | 'horizontal';
4
4
  export interface ProductCardProps {
5
5
  product: AkilioProduct;
@@ -7,6 +7,8 @@ export interface ProductCardProps {
7
7
  locale: string;
8
8
  layout?: ProductCardLayout;
9
9
  onProductClick?: (product: AkilioProduct, variant?: AkilioProductVariant) => void;
10
+ actions?: AkilioCommercePublicAction[];
11
+ onCommerceAction?: (action: AkilioCommercePublicAction) => Promise<void>;
10
12
  }
11
- declare function ProductCard({ product, copy, locale, layout, onProductClick, }: ProductCardProps): import("react").JSX.Element;
13
+ declare function ProductCard({ product, copy, locale, layout, onProductClick, actions, onCommerceAction, }: ProductCardProps): import("react").JSX.Element;
12
14
  export default ProductCard;
@@ -1,10 +1,15 @@
1
1
  import type { AkilioResolvedCopy } from '../lib/copy';
2
- import type { AkilioCommerceCapability, AkilioProduct, AkilioProductVariant } from '../types';
2
+ import type { AkilioCart, AkilioCommerceCapability, AkilioCommercePublicAction, AkilioProduct, AkilioProductVariant } from '../types';
3
3
  interface ProductCardsProps {
4
4
  commerce: AkilioCommerceCapability;
5
5
  copy: AkilioResolvedCopy;
6
6
  locale: string;
7
+ products?: AkilioProduct[];
8
+ suggestedProducts?: AkilioProduct[];
9
+ heading?: string;
7
10
  onProductClick?: (product: AkilioProduct, variant?: AkilioProductVariant) => void;
11
+ onCommerceAction?: (action: AkilioCommercePublicAction) => Promise<void>;
12
+ cart?: AkilioCart | null;
8
13
  }
9
14
  export declare const ProductCards: import("react").NamedExoticComponent<ProductCardsProps>;
10
15
  export {};
@@ -0,0 +1,12 @@
1
+ import type { AkilioResolvedCopy } from '../lib/copy';
2
+ import type { AkilioCommercePublicAction, AkilioProduct, AkilioProductVariant } from '../types';
3
+ interface ProductDetailProps {
4
+ product: AkilioProduct;
5
+ copy: AkilioResolvedCopy;
6
+ locale: string;
7
+ onProductClick?: (product: AkilioProduct, variant?: AkilioProductVariant) => void;
8
+ actions?: AkilioCommercePublicAction[];
9
+ onCommerceAction?: (action: AkilioCommercePublicAction) => Promise<void>;
10
+ }
11
+ export default function ProductDetail({ product, copy, locale, onProductClick, actions, onCommerceAction, }: ProductDetailProps): import("react").JSX.Element;
12
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { AkilioSectionPromptProps } from '../types';
2
+ export declare function SectionPrompt({ sectionTitle, sectionId, question, page, onStartConversation, className, }: AkilioSectionPromptProps): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { AkilioTextSelectionPromptProps } from '../types';
2
+ export declare function TextSelectionPrompt({ container, sectionTitle, sectionId, minCharacters, question, onStartConversation, }: AkilioTextSelectionPromptProps): import("react").JSX.Element | null;
@@ -0,0 +1 @@
1
+ export declare function useNearPageEnd(enabled: boolean, threshold: number): boolean;
@@ -0,0 +1 @@
1
+ export declare function useProactiveSummaryScore(enabled: boolean): number;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Generates a short notification chime without downloading an audio asset.
3
+ * prepare() should run during the user's send gesture so browser autoplay
4
+ * policies allow play() to run when the asynchronous response finishes.
5
+ */
6
+ export declare function useResponseSound(enabled: boolean, volume: number): {
7
+ prepare: () => void;
8
+ play: () => void;
9
+ };
@@ -1,6 +1,8 @@
1
1
  import type { Dispatch, SetStateAction } from 'react';
2
2
  import type { AkilioChatMessage } from '../types';
3
3
  export declare const MAX_AKILIO_HISTORY_MESSAGES = 60;
4
+ export declare function readLocalValue(key: string): string | null;
5
+ export declare function writeLocalValue(key: string, value: string | null): void;
4
6
  export declare function safeJsonParse<T>(raw: string | null, fallback: T): T;
5
7
  export declare function useLocalMessages(options: {
6
8
  enabled: boolean;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,7 @@
1
- export { AkilioWidget, AkilioWidget as EjibuWidget } from './AkilioWidget';
1
+ export { AkilioWidget } from './AkilioWidget';
2
+ export { InlineDecisionCard } from './components/InlineDecisionCard';
3
+ export { SectionPrompt } from './components/SectionPrompt';
4
+ export { TextSelectionPrompt } from './components/TextSelectionPrompt';
2
5
  export { AkilioClient } from './lib/client';
3
6
  export type * from './types';
7
+ export { resolveLanguagePack } from './locales';