@hachther/akilio-widget 0.7.0 → 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.
- package/README.md +281 -26
- package/dist/_headers +16 -0
- package/dist/akilio-widget.min.js +43 -43
- package/dist/assets/EmailIcon.d.ts +2 -0
- package/dist/assets/FormIcon.d.ts +2 -0
- package/dist/assets/PhoneIcon.d.ts +2 -0
- package/dist/components/BrandLogo.d.ts +7 -1
- package/dist/components/CartPanel.d.ts +13 -0
- package/dist/components/CommerceActions.d.ts +11 -0
- package/dist/components/Composer.d.ts +6 -1
- package/dist/components/ContactActions.d.ts +2 -2
- package/dist/components/EmptyState.d.ts +3 -7
- package/dist/components/Icons.d.ts +1 -0
- package/dist/components/InlineDecisionCard.d.ts +2 -0
- package/dist/components/Launcher.d.ts +6 -1
- package/dist/components/MessageBubble.d.ts +8 -2
- package/dist/components/MessageList.d.ts +1 -1
- package/dist/components/ProductCard.d.ts +4 -2
- package/dist/components/ProductCards.d.ts +6 -1
- package/dist/components/ProductDetail.d.ts +12 -0
- package/dist/components/SectionPrompt.d.ts +2 -0
- package/dist/components/TextSelectionPrompt.d.ts +2 -0
- package/dist/hooks/proactive-summary.d.ts +1 -0
- package/dist/hooks/storage.d.ts +2 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.min.js +9286 -7073
- package/dist/index.umd.min.cjs +36 -36
- package/dist/lib/client.d.ts +22 -2
- package/dist/lib/copy.d.ts +8 -2
- package/dist/loader.js +46 -0
- package/dist/locales/en.d.ts +127 -0
- package/dist/locales/fr.d.ts +127 -0
- package/dist/locales/index.d.ts +3 -0
- package/dist/releases/1.0.0/akilio-widget.min.js +45 -0
- package/dist/style.css +1744 -88
- package/dist/types.d.ts +451 -29
- package/dist/vanilla.d.ts +1 -0
- package/dist/widget-manifest.json +8 -0
- package/package.json +5 -3
package/dist/lib/client.d.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
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, 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;
|
|
@@ -15,11 +22,13 @@ export declare class AkilioClient {
|
|
|
15
22
|
private widgetTokenPromiseKey;
|
|
16
23
|
private mode;
|
|
17
24
|
private locale;
|
|
25
|
+
private integration?;
|
|
18
26
|
constructor(options: AkilioClientOptions);
|
|
19
27
|
private hasHostManagedToken;
|
|
20
28
|
private hostManagedToken;
|
|
21
29
|
private tokenIsUsable;
|
|
22
30
|
private clearWidgetToken;
|
|
31
|
+
private clearAnonymousIdentity;
|
|
23
32
|
private issueWidgetToken;
|
|
24
33
|
private ensureWidgetToken;
|
|
25
34
|
private baseHeaders;
|
|
@@ -28,7 +37,17 @@ export declare class AkilioClient {
|
|
|
28
37
|
private authenticatedRequest;
|
|
29
38
|
private authenticatedResponse;
|
|
30
39
|
getProjectConfig(projectKey: string): Promise<AkilioProjectConfig>;
|
|
31
|
-
prepareWidgetToken(projectKey: string
|
|
40
|
+
prepareWidgetToken(projectKey: string): Promise<void>;
|
|
41
|
+
forgetAnonymousIdentity(projectKey: string): void;
|
|
42
|
+
getCapabilities(projectKey: string, subject?: string): Promise<AkilioCapability[]>;
|
|
43
|
+
getCurrentCart(projectKey: string, subject?: string): Promise<AkilioCurrentCartResponse>;
|
|
44
|
+
createCapabilityConfirmation(projectKey: string, subject: string | undefined, capabilityId: string, payload: Record<string, unknown>, entryContext?: AkilioEntryContext | null): Promise<AkilioCapabilityConfirmation>;
|
|
45
|
+
confirmCapability(projectKey: string, subject: string | undefined, confirmationId: string): Promise<AkilioCapabilityConfirmation>;
|
|
46
|
+
executeCustomerServiceTool(projectKey: string, subject: string | undefined, toolId: string, payload: Record<string, unknown>, options?: {
|
|
47
|
+
confirmationId?: string;
|
|
48
|
+
entryContext?: AkilioEntryContext | null;
|
|
49
|
+
}): Promise<AkilioCustomerServiceToolResponse>;
|
|
50
|
+
sendWidgetEvent(projectKey: string, subject: string | undefined, event: AkilioWidgetAnalyticsEvent): Promise<void>;
|
|
32
51
|
sendMessage(projectKey: string, subject: string | undefined, request: AkilioChatRequest): Promise<AkilioChatResponse>;
|
|
33
52
|
sendMessageStream(projectKey: string, subject: string | undefined, request: AkilioChatRequest, handlers?: AkilioChatStreamHandlers, signal?: AbortSignal): Promise<AkilioChatResponse>;
|
|
34
53
|
getConversation(projectKey: string, subject: string | undefined, conversationId: string): Promise<AkilioConversationResponse>;
|
|
@@ -46,4 +65,5 @@ export declare class AkilioClient {
|
|
|
46
65
|
feedback_id: string;
|
|
47
66
|
}>;
|
|
48
67
|
sendContactRequest(projectKey: string, subject: string | undefined, request: AkilioContactRequest): Promise<AkilioContactRequestResponse>;
|
|
68
|
+
sendHumanHandoff(projectKey: string, subject: string | undefined, request: AkilioContactRequest): Promise<AkilioContactRequestResponse>;
|
|
49
69
|
}
|
package/dist/lib/copy.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import type { AkilioCopyOverrides, AkilioProjectConfig } from '../types';
|
|
2
|
-
export interface AkilioResolvedCopy extends Required<
|
|
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;
|
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.0.0/akilio-widget.min.js';
|
|
10
|
+
release.src = new URL(releasePath, loader.src).href;
|
|
11
|
+
release.async = true;
|
|
12
|
+
release.dataset.akilioRelease = '1.0.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.0.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.0.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,127 @@
|
|
|
1
|
+
export declare const en: {
|
|
2
|
+
direction: "ltr";
|
|
3
|
+
messages: {
|
|
4
|
+
launcher: string;
|
|
5
|
+
title: string;
|
|
6
|
+
description: string;
|
|
7
|
+
placeholder: string;
|
|
8
|
+
helper: string;
|
|
9
|
+
submit: string;
|
|
10
|
+
loading: string;
|
|
11
|
+
searching: string;
|
|
12
|
+
reviewingSources: string;
|
|
13
|
+
checkingAnswer: string;
|
|
14
|
+
preparingAnswer: string;
|
|
15
|
+
emptyState: string;
|
|
16
|
+
sources: string;
|
|
17
|
+
confidence: string;
|
|
18
|
+
clearHistory: string;
|
|
19
|
+
close: string;
|
|
20
|
+
online: string;
|
|
21
|
+
feedbackQuestion: string;
|
|
22
|
+
feedbackThanks: string;
|
|
23
|
+
feedbackSending: string;
|
|
24
|
+
contextualPlaceholder: string;
|
|
25
|
+
contextualDismiss: string;
|
|
26
|
+
contact: string;
|
|
27
|
+
contactName: string;
|
|
28
|
+
contactEmail: string;
|
|
29
|
+
contactPhone: string;
|
|
30
|
+
contactMethod: string;
|
|
31
|
+
contactMethodEmail: string;
|
|
32
|
+
contactMethodPhone: string;
|
|
33
|
+
contactMethodEither: string;
|
|
34
|
+
contactTime: string;
|
|
35
|
+
contactMessage: string;
|
|
36
|
+
contactConsent: string;
|
|
37
|
+
contactSubmit: string;
|
|
38
|
+
contactSending: string;
|
|
39
|
+
contactSuccess: string;
|
|
40
|
+
handoffQueued: string;
|
|
41
|
+
handoffDelivering: string;
|
|
42
|
+
handoffDelivered: string;
|
|
43
|
+
handoffFailed: string;
|
|
44
|
+
handoffCancelled: string;
|
|
45
|
+
contactFailed: string;
|
|
46
|
+
humanRequestTitle: string;
|
|
47
|
+
humanRequestDescription: string;
|
|
48
|
+
humanRequestConsequences: string;
|
|
49
|
+
humanRequestConfirm: string;
|
|
50
|
+
humanRequestCancel: string;
|
|
51
|
+
humanRequestSending: string;
|
|
52
|
+
humanRequestFailed: string;
|
|
53
|
+
humanRequestSuccess: string;
|
|
54
|
+
clarificationNeeded: string;
|
|
55
|
+
clarificationSubmit: string;
|
|
56
|
+
voteUp: string;
|
|
57
|
+
voteDown: string;
|
|
58
|
+
requestFailed: string;
|
|
59
|
+
configFailed: string;
|
|
60
|
+
newChat: string;
|
|
61
|
+
privacyTitle: string;
|
|
62
|
+
privacyAccept: string;
|
|
63
|
+
privacyAcceptAction: string;
|
|
64
|
+
privacyDecline: string;
|
|
65
|
+
privacyReview: string;
|
|
66
|
+
privacyRequired: string;
|
|
67
|
+
widgetUnavailable: string;
|
|
68
|
+
poweredBy: string;
|
|
69
|
+
aiContentWarning: string;
|
|
70
|
+
tourTitle: string;
|
|
71
|
+
tourMessage: string;
|
|
72
|
+
tourAction: string;
|
|
73
|
+
tourDismiss: string;
|
|
74
|
+
summarizePage: string;
|
|
75
|
+
summarizeConversation: string;
|
|
76
|
+
proactiveSummaryTitle: string;
|
|
77
|
+
proactiveSummaryMessage: string;
|
|
78
|
+
proactiveSummaryDismiss: string;
|
|
79
|
+
privacyDefaultNotice: string;
|
|
80
|
+
switchToLightMode: string;
|
|
81
|
+
switchToDarkMode: string;
|
|
82
|
+
products: string;
|
|
83
|
+
suggestedProducts: string;
|
|
84
|
+
matchedProducts: string;
|
|
85
|
+
productRecommendations: string;
|
|
86
|
+
productComparison: string;
|
|
87
|
+
compatibleProducts: string;
|
|
88
|
+
bundleProducts: string;
|
|
89
|
+
upgradeOptions: string;
|
|
90
|
+
complementaryProducts: string;
|
|
91
|
+
commerceActionConfirm: string;
|
|
92
|
+
commerceActionCancel: string;
|
|
93
|
+
commerceActionWorking: string;
|
|
94
|
+
commerceActionComplete: string;
|
|
95
|
+
commerceActionFailed: string;
|
|
96
|
+
addToCart: string;
|
|
97
|
+
compareProduct: string;
|
|
98
|
+
updateQuantity: string;
|
|
99
|
+
removeFromCart: string;
|
|
100
|
+
cart: string;
|
|
101
|
+
cartEmpty: string;
|
|
102
|
+
cartItems: string;
|
|
103
|
+
checkout: string;
|
|
104
|
+
cartUnavailable: string;
|
|
105
|
+
refreshCart: string;
|
|
106
|
+
viewProduct: string;
|
|
107
|
+
fromPrice: string;
|
|
108
|
+
unavailable: string;
|
|
109
|
+
inStock: string;
|
|
110
|
+
outOfStock: string;
|
|
111
|
+
rateLimited: string;
|
|
112
|
+
launcherAnswerReady: string;
|
|
113
|
+
launcherContact: string;
|
|
114
|
+
launcherPageHelp: string;
|
|
115
|
+
launcherProductHelp: string;
|
|
116
|
+
launcherPlanHelp: string;
|
|
117
|
+
productDetails: string;
|
|
118
|
+
productVariants: string;
|
|
119
|
+
productSpecifications: string;
|
|
120
|
+
suggestions: string[];
|
|
121
|
+
};
|
|
122
|
+
whiteLabel: {
|
|
123
|
+
launcher: string;
|
|
124
|
+
title: string;
|
|
125
|
+
configFailed: string;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
export declare const fr: {
|
|
2
|
+
direction: "ltr";
|
|
3
|
+
messages: {
|
|
4
|
+
launcher: string;
|
|
5
|
+
title: string;
|
|
6
|
+
description: string;
|
|
7
|
+
placeholder: string;
|
|
8
|
+
helper: string;
|
|
9
|
+
submit: string;
|
|
10
|
+
loading: string;
|
|
11
|
+
searching: string;
|
|
12
|
+
reviewingSources: string;
|
|
13
|
+
checkingAnswer: string;
|
|
14
|
+
preparingAnswer: string;
|
|
15
|
+
emptyState: string;
|
|
16
|
+
sources: string;
|
|
17
|
+
confidence: string;
|
|
18
|
+
clearHistory: string;
|
|
19
|
+
close: string;
|
|
20
|
+
online: string;
|
|
21
|
+
feedbackQuestion: string;
|
|
22
|
+
feedbackThanks: string;
|
|
23
|
+
feedbackSending: string;
|
|
24
|
+
contextualPlaceholder: string;
|
|
25
|
+
contextualDismiss: string;
|
|
26
|
+
contact: string;
|
|
27
|
+
contactName: string;
|
|
28
|
+
contactEmail: string;
|
|
29
|
+
contactPhone: string;
|
|
30
|
+
contactMethod: string;
|
|
31
|
+
contactMethodEmail: string;
|
|
32
|
+
contactMethodPhone: string;
|
|
33
|
+
contactMethodEither: string;
|
|
34
|
+
contactTime: string;
|
|
35
|
+
contactMessage: string;
|
|
36
|
+
contactConsent: string;
|
|
37
|
+
contactSubmit: string;
|
|
38
|
+
contactSending: string;
|
|
39
|
+
contactSuccess: string;
|
|
40
|
+
handoffQueued: string;
|
|
41
|
+
handoffDelivering: string;
|
|
42
|
+
handoffDelivered: string;
|
|
43
|
+
handoffFailed: string;
|
|
44
|
+
handoffCancelled: string;
|
|
45
|
+
contactFailed: string;
|
|
46
|
+
humanRequestTitle: string;
|
|
47
|
+
humanRequestDescription: string;
|
|
48
|
+
humanRequestConsequences: string;
|
|
49
|
+
humanRequestConfirm: string;
|
|
50
|
+
humanRequestCancel: string;
|
|
51
|
+
humanRequestSending: string;
|
|
52
|
+
humanRequestFailed: string;
|
|
53
|
+
humanRequestSuccess: string;
|
|
54
|
+
clarificationNeeded: string;
|
|
55
|
+
clarificationSubmit: string;
|
|
56
|
+
voteUp: string;
|
|
57
|
+
voteDown: string;
|
|
58
|
+
requestFailed: string;
|
|
59
|
+
configFailed: string;
|
|
60
|
+
newChat: string;
|
|
61
|
+
privacyTitle: string;
|
|
62
|
+
privacyAccept: string;
|
|
63
|
+
privacyAcceptAction: string;
|
|
64
|
+
privacyDecline: string;
|
|
65
|
+
privacyReview: string;
|
|
66
|
+
privacyRequired: string;
|
|
67
|
+
widgetUnavailable: string;
|
|
68
|
+
poweredBy: string;
|
|
69
|
+
aiContentWarning: string;
|
|
70
|
+
tourTitle: string;
|
|
71
|
+
tourMessage: string;
|
|
72
|
+
tourAction: string;
|
|
73
|
+
tourDismiss: string;
|
|
74
|
+
summarizePage: string;
|
|
75
|
+
summarizeConversation: string;
|
|
76
|
+
proactiveSummaryTitle: string;
|
|
77
|
+
proactiveSummaryMessage: string;
|
|
78
|
+
proactiveSummaryDismiss: string;
|
|
79
|
+
privacyDefaultNotice: string;
|
|
80
|
+
switchToLightMode: string;
|
|
81
|
+
switchToDarkMode: string;
|
|
82
|
+
products: string;
|
|
83
|
+
suggestedProducts: string;
|
|
84
|
+
matchedProducts: string;
|
|
85
|
+
productRecommendations: string;
|
|
86
|
+
productComparison: string;
|
|
87
|
+
compatibleProducts: string;
|
|
88
|
+
bundleProducts: string;
|
|
89
|
+
upgradeOptions: string;
|
|
90
|
+
complementaryProducts: string;
|
|
91
|
+
commerceActionConfirm: string;
|
|
92
|
+
commerceActionCancel: string;
|
|
93
|
+
commerceActionWorking: string;
|
|
94
|
+
commerceActionComplete: string;
|
|
95
|
+
commerceActionFailed: string;
|
|
96
|
+
addToCart: string;
|
|
97
|
+
compareProduct: string;
|
|
98
|
+
updateQuantity: string;
|
|
99
|
+
removeFromCart: string;
|
|
100
|
+
cart: string;
|
|
101
|
+
cartEmpty: string;
|
|
102
|
+
cartItems: string;
|
|
103
|
+
checkout: string;
|
|
104
|
+
cartUnavailable: string;
|
|
105
|
+
refreshCart: string;
|
|
106
|
+
viewProduct: string;
|
|
107
|
+
fromPrice: string;
|
|
108
|
+
unavailable: string;
|
|
109
|
+
inStock: string;
|
|
110
|
+
outOfStock: string;
|
|
111
|
+
rateLimited: string;
|
|
112
|
+
launcherAnswerReady: string;
|
|
113
|
+
launcherContact: string;
|
|
114
|
+
launcherPageHelp: string;
|
|
115
|
+
launcherProductHelp: string;
|
|
116
|
+
launcherPlanHelp: string;
|
|
117
|
+
productDetails: string;
|
|
118
|
+
productVariants: string;
|
|
119
|
+
productSpecifications: string;
|
|
120
|
+
suggestions: string[];
|
|
121
|
+
};
|
|
122
|
+
whiteLabel: {
|
|
123
|
+
launcher: string;
|
|
124
|
+
title: string;
|
|
125
|
+
configFailed: string;
|
|
126
|
+
};
|
|
127
|
+
};
|