@debales/ai 1.0.1-canary.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 +44 -0
- package/dist/browser/adapter/BaseCartAdapter.d.ts +17 -0
- package/dist/browser/adapter/CartAdapterFactory.d.ts +10 -0
- package/dist/browser/adapter/DefaultCartAdapter.d.ts +15 -0
- package/dist/browser/adapter/MagentoCartAdapter.d.ts +27 -0
- package/dist/browser/adapter/ShopifyCartAdapter.d.ts +20 -0
- package/dist/browser/ai-browser.js +2316 -0
- package/dist/browser/browser.d.ts +9 -0
- package/dist/browser/components/ChatbotComponent.d.ts +17 -0
- package/dist/browser/components/common/AddBulkItemsButton.d.ts +1 -0
- package/dist/browser/components/common/Button.d.ts +2 -0
- package/dist/browser/components/common/CheckoutButton.d.ts +1 -0
- package/dist/browser/components/common/CollectionSlider.d.ts +11 -0
- package/dist/browser/components/common/DiscountModel.d.ts +8 -0
- package/dist/browser/components/common/DiscountPanel.d.ts +8 -0
- package/dist/browser/components/common/DownArrow.d.ts +5 -0
- package/dist/browser/components/common/DynamicSuggestedQuestion.d.ts +15 -0
- package/dist/browser/components/common/ExitModal.d.ts +7 -0
- package/dist/browser/components/common/Input.d.ts +11 -0
- package/dist/browser/components/common/LoadingAnimation.d.ts +7 -0
- package/dist/browser/components/common/NormalizePrice.d.ts +13 -0
- package/dist/browser/components/common/PhoneInput.d.ts +12 -0
- package/dist/browser/components/common/ProductSlider.d.ts +16 -0
- package/dist/browser/components/common/SelectLanguage.d.ts +7 -0
- package/dist/browser/components/common/SuggestedQuestion.d.ts +19 -0
- package/dist/browser/components/common/UserInfoModel.d.ts +15 -0
- package/dist/browser/components/common/VariantSelectionModel.d.ts +18 -0
- package/dist/browser/components/common/loading-dots.d.ts +4 -0
- package/dist/browser/components/common/pop-up.d.ts +2 -0
- package/dist/browser/components/common/shadowWrapper.d.ts +10 -0
- package/dist/browser/components/footer/ChatInputBox.d.ts +7 -0
- package/dist/browser/components/icons/index.d.ts +19 -0
- package/dist/browser/constants/dom.d.ts +2 -0
- package/dist/browser/constants/events.d.ts +29 -0
- package/dist/browser/constants/index.d.ts +6 -0
- package/dist/browser/context/CartContext.d.ts +3 -0
- package/dist/browser/context/ShadowDomContext.d.ts +3 -0
- package/dist/browser/index.d.ts +3 -0
- package/dist/browser/lib/debalesAnalytics.d.ts +37 -0
- package/dist/browser/lib/debalesGlobalObject.d.ts +2 -0
- package/dist/browser/lib/platformDetection.d.ts +4 -0
- package/dist/browser/lib/platfromValidator.d.ts +2 -0
- package/dist/browser/lib/urlHelper.d.ts +18 -0
- package/dist/browser/lib/util.d.ts +63 -0
- package/dist/browser/main.d.ts +1 -0
- package/dist/browser/provider/CartProvider.d.ts +8 -0
- package/dist/browser/provider/index.d.ts +5 -0
- package/dist/browser/types/cart.d.ts +49 -0
- package/dist/browser/types/index.d.ts +141 -0
- package/dist/browser/types/magento.d.ts +37 -0
- package/dist/browser/types/shopify.d.ts +22 -0
- package/dist/module/adapter/BaseCartAdapter.d.ts +17 -0
- package/dist/module/adapter/CartAdapterFactory.d.ts +10 -0
- package/dist/module/adapter/DefaultCartAdapter.d.ts +15 -0
- package/dist/module/adapter/MagentoCartAdapter.d.ts +27 -0
- package/dist/module/adapter/ShopifyCartAdapter.d.ts +20 -0
- package/dist/module/ai.js +64865 -0
- package/dist/module/ai.umd.js +2543 -0
- package/dist/module/browser.d.ts +9 -0
- package/dist/module/components/ChatbotComponent.d.ts +17 -0
- package/dist/module/components/common/AddBulkItemsButton.d.ts +1 -0
- package/dist/module/components/common/Button.d.ts +2 -0
- package/dist/module/components/common/CheckoutButton.d.ts +1 -0
- package/dist/module/components/common/CollectionSlider.d.ts +11 -0
- package/dist/module/components/common/DiscountModel.d.ts +8 -0
- package/dist/module/components/common/DiscountPanel.d.ts +8 -0
- package/dist/module/components/common/DownArrow.d.ts +5 -0
- package/dist/module/components/common/DynamicSuggestedQuestion.d.ts +15 -0
- package/dist/module/components/common/ExitModal.d.ts +7 -0
- package/dist/module/components/common/Input.d.ts +11 -0
- package/dist/module/components/common/LoadingAnimation.d.ts +7 -0
- package/dist/module/components/common/NormalizePrice.d.ts +13 -0
- package/dist/module/components/common/PhoneInput.d.ts +12 -0
- package/dist/module/components/common/ProductSlider.d.ts +16 -0
- package/dist/module/components/common/SelectLanguage.d.ts +7 -0
- package/dist/module/components/common/SuggestedQuestion.d.ts +19 -0
- package/dist/module/components/common/UserInfoModel.d.ts +15 -0
- package/dist/module/components/common/VariantSelectionModel.d.ts +18 -0
- package/dist/module/components/common/loading-dots.d.ts +4 -0
- package/dist/module/components/common/pop-up.d.ts +2 -0
- package/dist/module/components/common/shadowWrapper.d.ts +10 -0
- package/dist/module/components/footer/ChatInputBox.d.ts +7 -0
- package/dist/module/components/icons/index.d.ts +19 -0
- package/dist/module/constants/dom.d.ts +2 -0
- package/dist/module/constants/events.d.ts +29 -0
- package/dist/module/constants/index.d.ts +6 -0
- package/dist/module/context/CartContext.d.ts +3 -0
- package/dist/module/context/ShadowDomContext.d.ts +3 -0
- package/dist/module/index.d.ts +3 -0
- package/dist/module/lib/debalesAnalytics.d.ts +37 -0
- package/dist/module/lib/debalesGlobalObject.d.ts +2 -0
- package/dist/module/lib/platformDetection.d.ts +4 -0
- package/dist/module/lib/platfromValidator.d.ts +2 -0
- package/dist/module/lib/urlHelper.d.ts +18 -0
- package/dist/module/lib/util.d.ts +63 -0
- package/dist/module/main.d.ts +1 -0
- package/dist/module/provider/CartProvider.d.ts +8 -0
- package/dist/module/provider/index.d.ts +5 -0
- package/dist/module/types/cart.d.ts +49 -0
- package/dist/module/types/index.d.ts +141 -0
- package/dist/module/types/magento.d.ts +37 -0
- package/dist/module/types/shopify.d.ts +22 -0
- package/package.json +73 -0
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# @debales/chatbot-core
|
|
2
|
+
|
|
3
|
+
A React component for integrating Debales.ai chatbots into your application.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- A Debales.ai account (Sign up at [debales.ai](https://debales.ai))
|
|
8
|
+
- React ^19.0.0
|
|
9
|
+
- React DOM ^19.0.0
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @debales/chatbot-core
|
|
15
|
+
# or
|
|
16
|
+
yarn add @debales/chatbot-core
|
|
17
|
+
# or
|
|
18
|
+
pnpm add @debales/chatbot-core
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import Chatbot from "@debales/chatbot-core";
|
|
25
|
+
|
|
26
|
+
function App() {
|
|
27
|
+
return (
|
|
28
|
+
<div>
|
|
29
|
+
<h1>My Application</h1>
|
|
30
|
+
<Chatbot botId="your-bot-id" />
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default App;
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Required Props
|
|
39
|
+
|
|
40
|
+
- `botId` (string): Your Debales.ai bot ID. You can find this in your Debales.ai dashboard.
|
|
41
|
+
|
|
42
|
+
## License
|
|
43
|
+
|
|
44
|
+
MIT
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Product } from '../types';
|
|
2
|
+
import { CartItem, CartOperationResult, CartPlatformAdapter, CartState } from '../types/cart';
|
|
3
|
+
import { EcommercePlatform } from '../types/index';
|
|
4
|
+
export declare abstract class BaseCartAdapter implements CartPlatformAdapter {
|
|
5
|
+
abstract readonly platform: EcommercePlatform;
|
|
6
|
+
isSupported(): boolean;
|
|
7
|
+
abstract fetchCart(): Promise<CartOperationResult<CartState>>;
|
|
8
|
+
abstract addToCart(variantId: string, quantity?: number, properties?: Record<string, string>): Promise<CartOperationResult<void>>;
|
|
9
|
+
abstract removeFromCart(itemId: number): Promise<CartOperationResult<void>>;
|
|
10
|
+
abstract updateQuantity(cartItem: CartItem): Promise<CartOperationResult<void>>;
|
|
11
|
+
abstract clearCart(): Promise<CartOperationResult<void>>;
|
|
12
|
+
abstract generateCartUrl(domain: string): string;
|
|
13
|
+
abstract generateProductUrl(domain: string, product: Product): string;
|
|
14
|
+
abstract addCartAttributes(attributes?: Record<string, string>): Promise<CartOperationResult<void>>;
|
|
15
|
+
protected createSuccessResult<T>(data: T, message?: string): CartOperationResult<T>;
|
|
16
|
+
protected createErrorResult<T>(error: string): CartOperationResult<T>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CartPlatformAdapter } from '../types/cart';
|
|
2
|
+
import { EcommercePlatform } from '../types/index';
|
|
3
|
+
export declare class CartAdapterFactory {
|
|
4
|
+
private static instance;
|
|
5
|
+
private adapterCache;
|
|
6
|
+
private constructor();
|
|
7
|
+
static getInstance(): CartAdapterFactory;
|
|
8
|
+
getAdapter(platform?: EcommercePlatform): CartPlatformAdapter;
|
|
9
|
+
clearCache(): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Product } from '../types';
|
|
2
|
+
import { CartItem, CartOperationResult, CartState } from '../types/cart';
|
|
3
|
+
import { EcommercePlatform } from '../types/index';
|
|
4
|
+
import { BaseCartAdapter } from './BaseCartAdapter';
|
|
5
|
+
export declare class DefaultCartAdapter extends BaseCartAdapter {
|
|
6
|
+
readonly platform = EcommercePlatform.DEFAULT;
|
|
7
|
+
fetchCart(): Promise<CartOperationResult<CartState>>;
|
|
8
|
+
addToCart(variantId: string, quantity?: number, properties?: Record<string, string>): Promise<CartOperationResult<void>>;
|
|
9
|
+
removeFromCart(itemId: number): Promise<CartOperationResult<void>>;
|
|
10
|
+
updateQuantity(cartItem: CartItem): Promise<CartOperationResult<void>>;
|
|
11
|
+
clearCart(): Promise<CartOperationResult<void>>;
|
|
12
|
+
generateCartUrl(domain: string): string;
|
|
13
|
+
generateProductUrl(domain: string, product: Product): string;
|
|
14
|
+
addCartAttributes(attributes?: Record<string, string>): Promise<CartOperationResult<void>>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Product } from '../types';
|
|
2
|
+
import { CartItem, CartOperationResult, CartState } from '../types/cart';
|
|
3
|
+
import { EcommercePlatform } from '../types/index';
|
|
4
|
+
import { BaseCartAdapter } from './BaseCartAdapter';
|
|
5
|
+
declare global {
|
|
6
|
+
interface Window {
|
|
7
|
+
checkout?: {
|
|
8
|
+
checkoutUrl?: string;
|
|
9
|
+
baseUrl?: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export declare class MagentoCartAdapter extends BaseCartAdapter {
|
|
14
|
+
readonly platform = EcommercePlatform.MAGENTO;
|
|
15
|
+
private readonly checkoutEndpoint;
|
|
16
|
+
private readonly baseUrl;
|
|
17
|
+
constructor();
|
|
18
|
+
private normalizeCartData;
|
|
19
|
+
fetchCart(): Promise<CartOperationResult<CartState>>;
|
|
20
|
+
addToCart(variantId: string, quantity?: number): Promise<CartOperationResult<void>>;
|
|
21
|
+
removeFromCart(itemId: number): Promise<CartOperationResult<void>>;
|
|
22
|
+
updateQuantity(cartItem: CartItem): Promise<CartOperationResult<void>>;
|
|
23
|
+
clearCart(): Promise<CartOperationResult<void>>;
|
|
24
|
+
generateCartUrl(domain: string): string;
|
|
25
|
+
generateProductUrl(domain: string, product: Product): string;
|
|
26
|
+
addCartAttributes(attributes?: Record<string, string>): Promise<CartOperationResult<void>>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Product } from '../types';
|
|
2
|
+
import { CartItem, CartOperationResult, CartState } from '../types/cart';
|
|
3
|
+
import { EcommercePlatform } from '../types/index';
|
|
4
|
+
import { BaseCartAdapter } from './BaseCartAdapter';
|
|
5
|
+
export declare class ShopifyCartAdapter extends BaseCartAdapter {
|
|
6
|
+
readonly platform = EcommercePlatform.SHOPIFY;
|
|
7
|
+
private readonly cartEndpoint;
|
|
8
|
+
private readonly localCartKey;
|
|
9
|
+
constructor();
|
|
10
|
+
private normalizeCartData;
|
|
11
|
+
generateProductUrl(domain: string, product: Product): string;
|
|
12
|
+
private updateTrackCart;
|
|
13
|
+
fetchCart(): Promise<CartOperationResult<CartState>>;
|
|
14
|
+
addToCart(variantId: string, quantity?: number, properties?: Record<string, string>): Promise<CartOperationResult<void>>;
|
|
15
|
+
removeFromCart(itemId: number): Promise<CartOperationResult<void>>;
|
|
16
|
+
updateQuantity(cartItem: CartItem): Promise<CartOperationResult<void>>;
|
|
17
|
+
clearCart(): Promise<CartOperationResult<void>>;
|
|
18
|
+
addCartAttributes(attributes?: Record<string, string>): Promise<CartOperationResult<void>>;
|
|
19
|
+
generateCartUrl(domain: string): string;
|
|
20
|
+
}
|