@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.
Files changed (103) hide show
  1. package/README.md +44 -0
  2. package/dist/browser/adapter/BaseCartAdapter.d.ts +17 -0
  3. package/dist/browser/adapter/CartAdapterFactory.d.ts +10 -0
  4. package/dist/browser/adapter/DefaultCartAdapter.d.ts +15 -0
  5. package/dist/browser/adapter/MagentoCartAdapter.d.ts +27 -0
  6. package/dist/browser/adapter/ShopifyCartAdapter.d.ts +20 -0
  7. package/dist/browser/ai-browser.js +2316 -0
  8. package/dist/browser/browser.d.ts +9 -0
  9. package/dist/browser/components/ChatbotComponent.d.ts +17 -0
  10. package/dist/browser/components/common/AddBulkItemsButton.d.ts +1 -0
  11. package/dist/browser/components/common/Button.d.ts +2 -0
  12. package/dist/browser/components/common/CheckoutButton.d.ts +1 -0
  13. package/dist/browser/components/common/CollectionSlider.d.ts +11 -0
  14. package/dist/browser/components/common/DiscountModel.d.ts +8 -0
  15. package/dist/browser/components/common/DiscountPanel.d.ts +8 -0
  16. package/dist/browser/components/common/DownArrow.d.ts +5 -0
  17. package/dist/browser/components/common/DynamicSuggestedQuestion.d.ts +15 -0
  18. package/dist/browser/components/common/ExitModal.d.ts +7 -0
  19. package/dist/browser/components/common/Input.d.ts +11 -0
  20. package/dist/browser/components/common/LoadingAnimation.d.ts +7 -0
  21. package/dist/browser/components/common/NormalizePrice.d.ts +13 -0
  22. package/dist/browser/components/common/PhoneInput.d.ts +12 -0
  23. package/dist/browser/components/common/ProductSlider.d.ts +16 -0
  24. package/dist/browser/components/common/SelectLanguage.d.ts +7 -0
  25. package/dist/browser/components/common/SuggestedQuestion.d.ts +19 -0
  26. package/dist/browser/components/common/UserInfoModel.d.ts +15 -0
  27. package/dist/browser/components/common/VariantSelectionModel.d.ts +18 -0
  28. package/dist/browser/components/common/loading-dots.d.ts +4 -0
  29. package/dist/browser/components/common/pop-up.d.ts +2 -0
  30. package/dist/browser/components/common/shadowWrapper.d.ts +10 -0
  31. package/dist/browser/components/footer/ChatInputBox.d.ts +7 -0
  32. package/dist/browser/components/icons/index.d.ts +19 -0
  33. package/dist/browser/constants/dom.d.ts +2 -0
  34. package/dist/browser/constants/events.d.ts +29 -0
  35. package/dist/browser/constants/index.d.ts +6 -0
  36. package/dist/browser/context/CartContext.d.ts +3 -0
  37. package/dist/browser/context/ShadowDomContext.d.ts +3 -0
  38. package/dist/browser/index.d.ts +3 -0
  39. package/dist/browser/lib/debalesAnalytics.d.ts +37 -0
  40. package/dist/browser/lib/debalesGlobalObject.d.ts +2 -0
  41. package/dist/browser/lib/platformDetection.d.ts +4 -0
  42. package/dist/browser/lib/platfromValidator.d.ts +2 -0
  43. package/dist/browser/lib/urlHelper.d.ts +18 -0
  44. package/dist/browser/lib/util.d.ts +63 -0
  45. package/dist/browser/main.d.ts +1 -0
  46. package/dist/browser/provider/CartProvider.d.ts +8 -0
  47. package/dist/browser/provider/index.d.ts +5 -0
  48. package/dist/browser/types/cart.d.ts +49 -0
  49. package/dist/browser/types/index.d.ts +141 -0
  50. package/dist/browser/types/magento.d.ts +37 -0
  51. package/dist/browser/types/shopify.d.ts +22 -0
  52. package/dist/module/adapter/BaseCartAdapter.d.ts +17 -0
  53. package/dist/module/adapter/CartAdapterFactory.d.ts +10 -0
  54. package/dist/module/adapter/DefaultCartAdapter.d.ts +15 -0
  55. package/dist/module/adapter/MagentoCartAdapter.d.ts +27 -0
  56. package/dist/module/adapter/ShopifyCartAdapter.d.ts +20 -0
  57. package/dist/module/ai.js +64865 -0
  58. package/dist/module/ai.umd.js +2543 -0
  59. package/dist/module/browser.d.ts +9 -0
  60. package/dist/module/components/ChatbotComponent.d.ts +17 -0
  61. package/dist/module/components/common/AddBulkItemsButton.d.ts +1 -0
  62. package/dist/module/components/common/Button.d.ts +2 -0
  63. package/dist/module/components/common/CheckoutButton.d.ts +1 -0
  64. package/dist/module/components/common/CollectionSlider.d.ts +11 -0
  65. package/dist/module/components/common/DiscountModel.d.ts +8 -0
  66. package/dist/module/components/common/DiscountPanel.d.ts +8 -0
  67. package/dist/module/components/common/DownArrow.d.ts +5 -0
  68. package/dist/module/components/common/DynamicSuggestedQuestion.d.ts +15 -0
  69. package/dist/module/components/common/ExitModal.d.ts +7 -0
  70. package/dist/module/components/common/Input.d.ts +11 -0
  71. package/dist/module/components/common/LoadingAnimation.d.ts +7 -0
  72. package/dist/module/components/common/NormalizePrice.d.ts +13 -0
  73. package/dist/module/components/common/PhoneInput.d.ts +12 -0
  74. package/dist/module/components/common/ProductSlider.d.ts +16 -0
  75. package/dist/module/components/common/SelectLanguage.d.ts +7 -0
  76. package/dist/module/components/common/SuggestedQuestion.d.ts +19 -0
  77. package/dist/module/components/common/UserInfoModel.d.ts +15 -0
  78. package/dist/module/components/common/VariantSelectionModel.d.ts +18 -0
  79. package/dist/module/components/common/loading-dots.d.ts +4 -0
  80. package/dist/module/components/common/pop-up.d.ts +2 -0
  81. package/dist/module/components/common/shadowWrapper.d.ts +10 -0
  82. package/dist/module/components/footer/ChatInputBox.d.ts +7 -0
  83. package/dist/module/components/icons/index.d.ts +19 -0
  84. package/dist/module/constants/dom.d.ts +2 -0
  85. package/dist/module/constants/events.d.ts +29 -0
  86. package/dist/module/constants/index.d.ts +6 -0
  87. package/dist/module/context/CartContext.d.ts +3 -0
  88. package/dist/module/context/ShadowDomContext.d.ts +3 -0
  89. package/dist/module/index.d.ts +3 -0
  90. package/dist/module/lib/debalesAnalytics.d.ts +37 -0
  91. package/dist/module/lib/debalesGlobalObject.d.ts +2 -0
  92. package/dist/module/lib/platformDetection.d.ts +4 -0
  93. package/dist/module/lib/platfromValidator.d.ts +2 -0
  94. package/dist/module/lib/urlHelper.d.ts +18 -0
  95. package/dist/module/lib/util.d.ts +63 -0
  96. package/dist/module/main.d.ts +1 -0
  97. package/dist/module/provider/CartProvider.d.ts +8 -0
  98. package/dist/module/provider/index.d.ts +5 -0
  99. package/dist/module/types/cart.d.ts +49 -0
  100. package/dist/module/types/index.d.ts +141 -0
  101. package/dist/module/types/magento.d.ts +37 -0
  102. package/dist/module/types/shopify.d.ts +22 -0
  103. 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
+ }