@hachther/akilio-widget 0.7.0 → 1.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 (45) hide show
  1. package/README.md +331 -26
  2. package/dist/_headers +16 -0
  3. package/dist/akilio-widget.min.js +45 -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 +2 -2
  12. package/dist/components/EmptyState.d.ts +3 -7
  13. package/dist/components/Icons.d.ts +3 -0
  14. package/dist/components/IdentityVerification.d.ts +14 -0
  15. package/dist/components/InlineDecisionCard.d.ts +2 -0
  16. package/dist/components/Launcher.d.ts +6 -1
  17. package/dist/components/MessageBubble.d.ts +9 -2
  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/ProductVariantSelector.d.ts +9 -0
  23. package/dist/components/SectionPrompt.d.ts +2 -0
  24. package/dist/components/TextSelectionPrompt.d.ts +2 -0
  25. package/dist/components/VoiceRecorder.d.ts +11 -0
  26. package/dist/hooks/current-cart.d.ts +14 -0
  27. package/dist/hooks/proactive-summary.d.ts +1 -0
  28. package/dist/hooks/storage.d.ts +2 -0
  29. package/dist/index.d.ts +5 -1
  30. package/dist/index.min.js +10412 -7169
  31. package/dist/index.umd.min.cjs +37 -36
  32. package/dist/lib/cart-capabilities.d.ts +4 -0
  33. package/dist/lib/client.d.ts +35 -2
  34. package/dist/lib/copy.d.ts +8 -2
  35. package/dist/lib/storefront-cart.d.ts +5 -0
  36. package/dist/loader.js +46 -0
  37. package/dist/locales/en.d.ts +161 -0
  38. package/dist/locales/fr.d.ts +161 -0
  39. package/dist/locales/index.d.ts +3 -0
  40. package/dist/releases/1.1.0/akilio-widget.min.js +46 -0
  41. package/dist/style.css +1842 -81
  42. package/dist/types.d.ts +569 -31
  43. package/dist/vanilla.d.ts +1 -0
  44. package/dist/widget-manifest.json +8 -0
  45. package/package.json +5 -3
@@ -0,0 +1,4 @@
1
+ import type { AkilioCapability, AkilioCommercePublicAction, AkilioProduct } from '../types';
2
+ /** Discovered backend capabilities control product-card cart visibility. */
3
+ export declare const CartCapabilitiesContext: import("react").Context<AkilioCapability[]>;
4
+ export declare function productCartActions(product: AkilioProduct, capabilities: AkilioCapability[]): AkilioCommercePublicAction[];
@@ -1,25 +1,35 @@
1
- import type { AkilioAuthConfig, AkilioChatRequest, AkilioChatResponse, AkilioChatStreamHandlers, AkilioCommerceEvent, AkilioContactRequest, AkilioContactRequestResponse, AkilioConversationResponse, AkilioFeedbackRating, AkilioMode, AkilioProjectConfig } from '../types';
1
+ import type { AkilioAuthConfig, AkilioCapability, AkilioCapabilityConfirmation, AkilioChatRequest, AkilioChatResponse, AkilioChatStreamHandlers, AkilioCommerceEvent, AkilioContactRequest, AkilioContactRequestResponse, AkilioConversationResponse, AkilioCurrentCartResponse, AkilioCustomerServiceToolResponse, AkilioEntryContext, AkilioFeedbackRating, AkilioIdentitySession, AkilioIdentityVerification, AkilioMode, AkilioProjectConfig, AkilioWidgetAnalyticsEvent, IntegrationType } from '../types';
2
2
  export interface AkilioClientOptions {
3
3
  apiBaseUrl: string;
4
4
  auth?: AkilioAuthConfig;
5
5
  fetchImpl?: typeof fetch;
6
6
  mode: AkilioMode;
7
7
  locale: string;
8
+ integration?: IntegrationType;
9
+ }
10
+ export declare class AkilioHttpError extends Error {
11
+ status: number;
12
+ payload: unknown;
13
+ retryAfterSeconds?: number;
14
+ constructor(message: string, status: number, payload: unknown, retryAfterSeconds?: number);
8
15
  }
9
16
  export declare class AkilioClient {
10
17
  private apiBaseUrl;
11
18
  private fetchImpl;
12
19
  private auth?;
13
20
  private widgetToken;
21
+ private voiceRequestIds;
14
22
  private widgetTokenPromise;
15
23
  private widgetTokenPromiseKey;
16
24
  private mode;
17
25
  private locale;
26
+ private integration?;
18
27
  constructor(options: AkilioClientOptions);
19
28
  private hasHostManagedToken;
20
29
  private hostManagedToken;
21
30
  private tokenIsUsable;
22
31
  private clearWidgetToken;
32
+ private clearAnonymousIdentity;
23
33
  private issueWidgetToken;
24
34
  private ensureWidgetToken;
25
35
  private baseHeaders;
@@ -28,7 +38,29 @@ export declare class AkilioClient {
28
38
  private authenticatedRequest;
29
39
  private authenticatedResponse;
30
40
  getProjectConfig(projectKey: string): Promise<AkilioProjectConfig>;
31
- prepareWidgetToken(projectKey: string, subject?: string): Promise<void>;
41
+ prepareWidgetToken(projectKey: string): Promise<void>;
42
+ forgetAnonymousIdentity(projectKey: string): void;
43
+ getCapabilities(projectKey: string, subject?: string): Promise<AkilioCapability[]>;
44
+ getCurrentCart(projectKey: string, subject?: string): Promise<AkilioCurrentCartResponse>;
45
+ createCapabilityConfirmation(projectKey: string, subject: string | undefined, capabilityId: string, payload: Record<string, unknown>, entryContext?: AkilioEntryContext | null): Promise<AkilioCapabilityConfirmation>;
46
+ confirmCapability(projectKey: string, subject: string | undefined, confirmationId: string): Promise<AkilioCapabilityConfirmation>;
47
+ executeCustomerServiceTool(projectKey: string, subject: string | undefined, toolId: string, payload: Record<string, unknown>, options?: {
48
+ confirmationId?: string;
49
+ entryContext?: AkilioEntryContext | null;
50
+ }): Promise<AkilioCustomerServiceToolResponse>;
51
+ sendWidgetEvent(projectKey: string, subject: string | undefined, event: AkilioWidgetAnalyticsEvent): Promise<void>;
52
+ transcribeVoice(projectKey: string, subject: string | undefined, audio: Blob, signal?: AbortSignal): Promise<{
53
+ transcript: string;
54
+ id: string;
55
+ }>;
56
+ requestIdentityVerification(projectKey: string, subject: string | undefined, conversationId: string, value: string, purpose?: 'identity' | 'step_up', signal?: AbortSignal, identifierType?: 'email' | 'phone'): Promise<AkilioIdentityVerification>;
57
+ confirmIdentityVerification(projectKey: string, subject: string | undefined, conversationId: string, verificationId: string, code: string, signal?: AbortSignal): Promise<{
58
+ verified: boolean;
59
+ assurance_level: string | null;
60
+ expires_at: string | null;
61
+ }>;
62
+ resendIdentityVerification(projectKey: string, subject: string | undefined, conversationId: string, verificationId: string, signal?: AbortSignal): Promise<AkilioIdentityVerification>;
63
+ getIdentitySession(projectKey: string, subject: string | undefined, conversationId: string, signal?: AbortSignal): Promise<AkilioIdentitySession>;
32
64
  sendMessage(projectKey: string, subject: string | undefined, request: AkilioChatRequest): Promise<AkilioChatResponse>;
33
65
  sendMessageStream(projectKey: string, subject: string | undefined, request: AkilioChatRequest, handlers?: AkilioChatStreamHandlers, signal?: AbortSignal): Promise<AkilioChatResponse>;
34
66
  getConversation(projectKey: string, subject: string | undefined, conversationId: string): Promise<AkilioConversationResponse>;
@@ -46,4 +78,5 @@ export declare class AkilioClient {
46
78
  feedback_id: string;
47
79
  }>;
48
80
  sendContactRequest(projectKey: string, subject: string | undefined, request: AkilioContactRequest): Promise<AkilioContactRequestResponse>;
81
+ sendHumanHandoff(projectKey: string, subject: string | undefined, request: AkilioContactRequest): Promise<AkilioContactRequestResponse>;
49
82
  }
@@ -1,9 +1,15 @@
1
- import type { AkilioCopyOverrides, AkilioProjectConfig } from '../types';
2
- export interface AkilioResolvedCopy extends Required<Omit<AkilioCopyOverrides, never>> {
1
+ import type { AkilioCopyOverrides, AkilioProjectConfig, AkilioTranslations } from '../types';
2
+ export interface AkilioResolvedCopy extends Required<AkilioCopyOverrides> {
3
3
  suggestions: string[];
4
4
  }
5
5
  export declare function resolveCopy(params: {
6
6
  locale?: string;
7
+ agentName?: string;
8
+ welcomeMessage?: string;
9
+ starterPrompts?: string[];
10
+ brandName?: string;
11
+ hideBranding?: boolean;
7
12
  projectConfig?: AkilioProjectConfig | null;
8
13
  overrides?: AkilioCopyOverrides;
14
+ translations?: AkilioTranslations;
9
15
  }): AkilioResolvedCopy;
@@ -0,0 +1,5 @@
1
+ import type { AkilioCommercePublicAction, AkilioProduct } from '../types';
2
+ /** Offer direct cart operations only for a supported, same-origin storefront. */
3
+ export declare function storefrontActions(product: AkilioProduct): AkilioCommercePublicAction[];
4
+ /** Shopify Ajax Cart uses the browser session, sharing the theme's actual cart. */
5
+ export declare function addToStorefrontCart(product: AkilioProduct, variantId: string): Promise<void>;
package/dist/loader.js ADDED
@@ -0,0 +1,46 @@
1
+ (function loadAkilioWidget(document) {
2
+ 'use strict';
3
+
4
+ var loader = document.currentScript;
5
+ if (!loader || loader.dataset.akilioLoaderStarted === 'true') return;
6
+ loader.dataset.akilioLoaderStarted = 'true';
7
+
8
+ var release = document.createElement('script');
9
+ var releasePath = 'releases/1.1.0/akilio-widget.min.js';
10
+ release.src = new URL(releasePath, loader.src).href;
11
+ release.async = true;
12
+ release.dataset.akilioRelease = '1.1.0';
13
+
14
+ for (var index = 0; index < loader.attributes.length; index += 1) {
15
+ var attribute = loader.attributes[index];
16
+ if (attribute.name.indexOf('data-') === 0) {
17
+ release.setAttribute(attribute.name, attribute.value);
18
+ }
19
+ }
20
+
21
+ release.removeAttribute('data-akilio-loader-started');
22
+ release.addEventListener('load', function () {
23
+ window.dispatchEvent(
24
+ new CustomEvent('akilio:loader-ready', {
25
+ detail: {
26
+ version: '1.1.0',
27
+ url: release.src,
28
+ },
29
+ })
30
+ );
31
+ });
32
+ release.addEventListener('error', function () {
33
+ delete loader.dataset.akilioLoaderStarted;
34
+ window.dispatchEvent(
35
+ new CustomEvent('akilio:loader-error', {
36
+ detail: {
37
+ version: '1.1.0',
38
+ url: release.src,
39
+ },
40
+ })
41
+ );
42
+ console.error('[Akilio] Unable to load widget release', release.src);
43
+ });
44
+
45
+ loader.parentNode.insertBefore(release, loader.nextSibling);
46
+ })(document);
@@ -0,0 +1,161 @@
1
+ export declare const en: {
2
+ direction: "ltr";
3
+ messages: {
4
+ identityGenericTitle: string;
5
+ identityPhone: string;
6
+ identityPhoneHint: string;
7
+ identityPhoneSent: string;
8
+ identityPhoneCodeTitle: string;
9
+ identityPhoneCodeHint: string;
10
+ identityPhoneVerified: string;
11
+ identityChangePhone: string;
12
+ identityCodeTitle: string;
13
+ identityDescription: string;
14
+ identityCodeHint: string;
15
+ identitySending: string;
16
+ identityTitle: string;
17
+ identityEmail: string;
18
+ identityCode: string;
19
+ identitySend: string;
20
+ identityConfirm: string;
21
+ identityResend: string;
22
+ identityCancel: string;
23
+ identitySent: string;
24
+ identityVerified: string;
25
+ identityInvalid: string;
26
+ identityExpired: string;
27
+ identityUnavailable: string;
28
+ identityLimited: string;
29
+ identityChangeEmail: string;
30
+ identityBusy: string;
31
+ recordVoice: string;
32
+ stopVoice: string;
33
+ sendVoice: string;
34
+ cancelVoice: string;
35
+ voiceTranscribing: string;
36
+ voiceFailure: string;
37
+ voicePermissionError: string;
38
+ launcher: string;
39
+ title: string;
40
+ description: string;
41
+ placeholder: string;
42
+ helper: string;
43
+ submit: string;
44
+ loading: string;
45
+ searching: string;
46
+ reviewingSources: string;
47
+ checkingAnswer: string;
48
+ preparingAnswer: string;
49
+ emptyState: string;
50
+ sources: string;
51
+ confidence: string;
52
+ clearHistory: string;
53
+ close: string;
54
+ online: string;
55
+ feedbackQuestion: string;
56
+ feedbackThanks: string;
57
+ feedbackSending: string;
58
+ contextualPlaceholder: string;
59
+ contextualDismiss: string;
60
+ contact: string;
61
+ contactName: string;
62
+ contactEmail: string;
63
+ contactPhone: string;
64
+ contactMethod: string;
65
+ contactMethodEmail: string;
66
+ contactMethodPhone: string;
67
+ contactMethodEither: string;
68
+ contactTime: string;
69
+ contactMessage: string;
70
+ contactConsent: string;
71
+ contactSubmit: string;
72
+ contactSending: string;
73
+ contactSuccess: string;
74
+ handoffQueued: string;
75
+ handoffDelivering: string;
76
+ handoffDelivered: string;
77
+ handoffFailed: string;
78
+ handoffCancelled: string;
79
+ contactFailed: string;
80
+ humanRequestTitle: string;
81
+ humanRequestDescription: string;
82
+ humanRequestConsequences: string;
83
+ humanRequestConfirm: string;
84
+ humanRequestCancel: string;
85
+ humanRequestSending: string;
86
+ humanRequestFailed: string;
87
+ humanRequestSuccess: string;
88
+ clarificationNeeded: string;
89
+ clarificationSubmit: string;
90
+ voteUp: string;
91
+ voteDown: string;
92
+ requestFailed: string;
93
+ configFailed: string;
94
+ newChat: string;
95
+ privacyTitle: string;
96
+ privacyAccept: string;
97
+ privacyAcceptAction: string;
98
+ privacyDecline: string;
99
+ privacyReview: string;
100
+ privacyRequired: string;
101
+ widgetUnavailable: string;
102
+ poweredBy: string;
103
+ aiContentWarning: string;
104
+ tourTitle: string;
105
+ tourMessage: string;
106
+ tourAction: string;
107
+ tourDismiss: string;
108
+ summarizePage: string;
109
+ summarizeConversation: string;
110
+ proactiveSummaryTitle: string;
111
+ proactiveSummaryMessage: string;
112
+ proactiveSummaryDismiss: string;
113
+ privacyDefaultNotice: string;
114
+ switchToLightMode: string;
115
+ switchToDarkMode: string;
116
+ products: string;
117
+ suggestedProducts: string;
118
+ matchedProducts: string;
119
+ productRecommendations: string;
120
+ productComparison: string;
121
+ compatibleProducts: string;
122
+ bundleProducts: string;
123
+ upgradeOptions: string;
124
+ complementaryProducts: string;
125
+ commerceActionConfirm: string;
126
+ commerceActionCancel: string;
127
+ commerceActionWorking: string;
128
+ commerceActionComplete: string;
129
+ commerceActionFailed: string;
130
+ addToCart: string;
131
+ compareProduct: string;
132
+ updateQuantity: string;
133
+ removeFromCart: string;
134
+ cart: string;
135
+ cartEmpty: string;
136
+ cartItems: string;
137
+ checkout: string;
138
+ cartUnavailable: string;
139
+ refreshCart: string;
140
+ viewProduct: string;
141
+ fromPrice: string;
142
+ unavailable: string;
143
+ inStock: string;
144
+ outOfStock: string;
145
+ rateLimited: string;
146
+ launcherAnswerReady: string;
147
+ launcherContact: string;
148
+ launcherPageHelp: string;
149
+ launcherProductHelp: string;
150
+ launcherPlanHelp: string;
151
+ productDetails: string;
152
+ productVariants: string;
153
+ productSpecifications: string;
154
+ suggestions: string[];
155
+ };
156
+ whiteLabel: {
157
+ launcher: string;
158
+ title: string;
159
+ configFailed: string;
160
+ };
161
+ };
@@ -0,0 +1,161 @@
1
+ export declare const fr: {
2
+ direction: "ltr";
3
+ messages: {
4
+ identityGenericTitle: string;
5
+ identityPhone: string;
6
+ identityPhoneHint: string;
7
+ identityPhoneSent: string;
8
+ identityPhoneCodeTitle: string;
9
+ identityPhoneCodeHint: string;
10
+ identityPhoneVerified: string;
11
+ identityChangePhone: string;
12
+ identityCodeTitle: string;
13
+ identityDescription: string;
14
+ identityCodeHint: string;
15
+ identitySending: string;
16
+ identityTitle: string;
17
+ identityEmail: string;
18
+ identityCode: string;
19
+ identitySend: string;
20
+ identityConfirm: string;
21
+ identityResend: string;
22
+ identityCancel: string;
23
+ identitySent: string;
24
+ identityVerified: string;
25
+ identityInvalid: string;
26
+ identityExpired: string;
27
+ identityUnavailable: string;
28
+ identityLimited: string;
29
+ identityChangeEmail: string;
30
+ identityBusy: string;
31
+ recordVoice: string;
32
+ stopVoice: string;
33
+ sendVoice: string;
34
+ cancelVoice: string;
35
+ voiceTranscribing: string;
36
+ voiceFailure: string;
37
+ voicePermissionError: string;
38
+ launcher: string;
39
+ title: string;
40
+ description: string;
41
+ placeholder: string;
42
+ helper: string;
43
+ submit: string;
44
+ loading: string;
45
+ searching: string;
46
+ reviewingSources: string;
47
+ checkingAnswer: string;
48
+ preparingAnswer: string;
49
+ emptyState: string;
50
+ sources: string;
51
+ confidence: string;
52
+ clearHistory: string;
53
+ close: string;
54
+ online: string;
55
+ feedbackQuestion: string;
56
+ feedbackThanks: string;
57
+ feedbackSending: string;
58
+ contextualPlaceholder: string;
59
+ contextualDismiss: string;
60
+ contact: string;
61
+ contactName: string;
62
+ contactEmail: string;
63
+ contactPhone: string;
64
+ contactMethod: string;
65
+ contactMethodEmail: string;
66
+ contactMethodPhone: string;
67
+ contactMethodEither: string;
68
+ contactTime: string;
69
+ contactMessage: string;
70
+ contactConsent: string;
71
+ contactSubmit: string;
72
+ contactSending: string;
73
+ contactSuccess: string;
74
+ handoffQueued: string;
75
+ handoffDelivering: string;
76
+ handoffDelivered: string;
77
+ handoffFailed: string;
78
+ handoffCancelled: string;
79
+ contactFailed: string;
80
+ humanRequestTitle: string;
81
+ humanRequestDescription: string;
82
+ humanRequestConsequences: string;
83
+ humanRequestConfirm: string;
84
+ humanRequestCancel: string;
85
+ humanRequestSending: string;
86
+ humanRequestFailed: string;
87
+ humanRequestSuccess: string;
88
+ clarificationNeeded: string;
89
+ clarificationSubmit: string;
90
+ voteUp: string;
91
+ voteDown: string;
92
+ requestFailed: string;
93
+ configFailed: string;
94
+ newChat: string;
95
+ privacyTitle: string;
96
+ privacyAccept: string;
97
+ privacyAcceptAction: string;
98
+ privacyDecline: string;
99
+ privacyReview: string;
100
+ privacyRequired: string;
101
+ widgetUnavailable: string;
102
+ poweredBy: string;
103
+ aiContentWarning: string;
104
+ tourTitle: string;
105
+ tourMessage: string;
106
+ tourAction: string;
107
+ tourDismiss: string;
108
+ summarizePage: string;
109
+ summarizeConversation: string;
110
+ proactiveSummaryTitle: string;
111
+ proactiveSummaryMessage: string;
112
+ proactiveSummaryDismiss: string;
113
+ privacyDefaultNotice: string;
114
+ switchToLightMode: string;
115
+ switchToDarkMode: string;
116
+ products: string;
117
+ suggestedProducts: string;
118
+ matchedProducts: string;
119
+ productRecommendations: string;
120
+ productComparison: string;
121
+ compatibleProducts: string;
122
+ bundleProducts: string;
123
+ upgradeOptions: string;
124
+ complementaryProducts: string;
125
+ commerceActionConfirm: string;
126
+ commerceActionCancel: string;
127
+ commerceActionWorking: string;
128
+ commerceActionComplete: string;
129
+ commerceActionFailed: string;
130
+ addToCart: string;
131
+ compareProduct: string;
132
+ updateQuantity: string;
133
+ removeFromCart: string;
134
+ cart: string;
135
+ cartEmpty: string;
136
+ cartItems: string;
137
+ checkout: string;
138
+ cartUnavailable: string;
139
+ refreshCart: string;
140
+ viewProduct: string;
141
+ fromPrice: string;
142
+ unavailable: string;
143
+ inStock: string;
144
+ outOfStock: string;
145
+ rateLimited: string;
146
+ launcherAnswerReady: string;
147
+ launcherContact: string;
148
+ launcherPageHelp: string;
149
+ launcherProductHelp: string;
150
+ launcherPlanHelp: string;
151
+ productDetails: string;
152
+ productVariants: string;
153
+ productSpecifications: string;
154
+ suggestions: string[];
155
+ };
156
+ whiteLabel: {
157
+ launcher: string;
158
+ title: string;
159
+ configFailed: string;
160
+ };
161
+ };
@@ -0,0 +1,3 @@
1
+ import type { AkilioLanguagePack, AkilioTranslations } from '../types';
2
+ export declare function normalizeLocale(locale?: string): string;
3
+ export declare function resolveLanguagePack(locale?: string, translations?: AkilioTranslations): AkilioLanguagePack;