@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
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ChatBoxProps } from '../types';
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
triggerGokwikCustomCheckout?: () => void;
|
|
5
|
+
shiprocketCheckoutEvents?: {
|
|
6
|
+
buyCart?: () => void;
|
|
7
|
+
};
|
|
8
|
+
openRzpCheckout?: () => void;
|
|
9
|
+
Thinkific?: {
|
|
10
|
+
current_user?: {
|
|
11
|
+
full_name: string;
|
|
12
|
+
email: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export declare const ChatbotComponent: ({ botId }: ChatBoxProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AddBulkItemsButton: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const Button: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
2
|
+
export declare const GradientButton: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CheckoutButton: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, never>> & string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Message, UiData } from '../../types';
|
|
3
|
+
interface CollectionSliderProps {
|
|
4
|
+
message: Message;
|
|
5
|
+
botId: string;
|
|
6
|
+
uidata: UiData;
|
|
7
|
+
onSendMessage: (message: string) => Promise<void>;
|
|
8
|
+
loading: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const CollectionSlider: React.FC<CollectionSliderProps>;
|
|
11
|
+
export default CollectionSlider;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UiData } from '../../types';
|
|
2
|
+
interface DiscountModalProps {
|
|
3
|
+
discount: string;
|
|
4
|
+
uiData: UiData;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const DiscountModal: ({ discount, uiData, onClose, }: DiscountModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UiData } from '../../types';
|
|
2
|
+
interface DiscountPanelProps {
|
|
3
|
+
discount: string;
|
|
4
|
+
uiData: UiData;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const DiscountPanel: ({ discount, uiData, onClose, }: DiscountPanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { UiData } from '../../types';
|
|
3
|
+
interface AnimatedSuggestionProps {
|
|
4
|
+
messages: {
|
|
5
|
+
question: string;
|
|
6
|
+
isHighlighted: boolean;
|
|
7
|
+
}[];
|
|
8
|
+
botId?: string;
|
|
9
|
+
uiData?: UiData;
|
|
10
|
+
isHighlighted?: boolean;
|
|
11
|
+
onClick?: (message: string) => void;
|
|
12
|
+
onClose?: () => void;
|
|
13
|
+
}
|
|
14
|
+
declare const AnimatedSuggestion: React.FC<AnimatedSuggestionProps>;
|
|
15
|
+
export default AnimatedSuggestion;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React, InputHTMLAttributes } from 'react';
|
|
2
|
+
export interface FormError {
|
|
3
|
+
field: "name" | "email" | "phone";
|
|
4
|
+
message: string;
|
|
5
|
+
}
|
|
6
|
+
interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
7
|
+
label: string;
|
|
8
|
+
FieldError: FormError | null;
|
|
9
|
+
}
|
|
10
|
+
declare const Input: React.FC<InputProps>;
|
|
11
|
+
export default Input;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ShopifyStoreMeta } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes a price string based on whether it's running in a Shopify context
|
|
4
|
+
* @param price - The price string to normalize
|
|
5
|
+
* @param storeMetaData - The store meta data
|
|
6
|
+
* @returns Formatted price string in the appropriate currency format
|
|
7
|
+
*/
|
|
8
|
+
export declare const normalizePrice: (price: string, storeMetaData: ShopifyStoreMeta | null) => string;
|
|
9
|
+
export declare function formatSizeAndCurrency(sizeString: string, storeMetaData: ShopifyStoreMeta | null): string;
|
|
10
|
+
export declare const extractNumericPrice: (price: string) => number;
|
|
11
|
+
export declare const getMetaUrl: (storeUrl: string) => string;
|
|
12
|
+
export declare const getShopifyStoreMeta: (storeUrl: string) => Promise<ShopifyStoreMeta>;
|
|
13
|
+
export declare const formatPrice: (price: number, currency: string) => string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FormError } from './Input';
|
|
3
|
+
interface PhoneInputProps {
|
|
4
|
+
label: string;
|
|
5
|
+
name: string;
|
|
6
|
+
FieldError: FormError | null;
|
|
7
|
+
onChange?: (value: string) => void;
|
|
8
|
+
"data-cy"?: string;
|
|
9
|
+
countryCode?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const PhoneInput: React.FC<PhoneInputProps>;
|
|
12
|
+
export default PhoneInput;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { EcommercePlatform, Message, Product, ShopifyStoreMeta, UiData } from '../../types';
|
|
3
|
+
interface ProductSliderProps {
|
|
4
|
+
message: Message;
|
|
5
|
+
botId: string;
|
|
6
|
+
uidata: UiData;
|
|
7
|
+
onSendMessage: (message: string) => Promise<void>;
|
|
8
|
+
loading: boolean;
|
|
9
|
+
storeMetaData: ShopifyStoreMeta | null;
|
|
10
|
+
platform: EcommercePlatform;
|
|
11
|
+
setShowVariantModel: (show: boolean) => void;
|
|
12
|
+
setSelectedProduct: (product: Product) => void;
|
|
13
|
+
setCartVersion: React.Dispatch<React.SetStateAction<number>>;
|
|
14
|
+
}
|
|
15
|
+
declare const ProductSlider: React.FC<ProductSliderProps>;
|
|
16
|
+
export default ProductSlider;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
selectedLanguage: string;
|
|
4
|
+
setSelectedLanguage: React.Dispatch<React.SetStateAction<string>>;
|
|
5
|
+
}
|
|
6
|
+
declare const LanguageSelector: ({ selectedLanguage, setSelectedLanguage }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default LanguageSelector;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { UiData } from '../../types';
|
|
3
|
+
declare const SuggestionCard: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
4
|
+
isHighlighted: boolean;
|
|
5
|
+
$botId: string;
|
|
6
|
+
}>> & string;
|
|
7
|
+
declare const CloseSuggestion: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
8
|
+
interface Props {
|
|
9
|
+
value: string;
|
|
10
|
+
onClick: React.MouseEventHandler<HTMLDivElement>;
|
|
11
|
+
index: number;
|
|
12
|
+
isHighlighted: boolean;
|
|
13
|
+
uiData: UiData;
|
|
14
|
+
botId: string;
|
|
15
|
+
onClose?: () => void;
|
|
16
|
+
}
|
|
17
|
+
declare function Suggestion({ value, onClick, index, isHighlighted, uiData, botId, onClose, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export default Suggestion;
|
|
19
|
+
export { CloseSuggestion, SuggestionCard };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Product, SuggestedQuestionAnswer, UiData } from '../../types';
|
|
3
|
+
interface Props {
|
|
4
|
+
uidata: UiData;
|
|
5
|
+
botName?: string;
|
|
6
|
+
botId: string;
|
|
7
|
+
botNameColor: string | undefined;
|
|
8
|
+
showModel: boolean;
|
|
9
|
+
setShowModel: React.Dispatch<React.SetStateAction<boolean>>;
|
|
10
|
+
selectedSuggestedQuestionAnswer: SuggestedQuestionAnswer | null;
|
|
11
|
+
sendMessage: (message: string, answer?: string, products?: Product[]) => Promise<void>;
|
|
12
|
+
inChat?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const UserInfoModel: ({ uidata, botId, showModel, setShowModel, selectedSuggestedQuestionAnswer, sendMessage, botNameColor, inChat, }: Props) => import("react/jsx-runtime").JSX.Element | null;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Product, UiData } from '../../types';
|
|
3
|
+
interface Variant {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
options: string[];
|
|
7
|
+
available: boolean;
|
|
8
|
+
price: string;
|
|
9
|
+
}
|
|
10
|
+
interface Props {
|
|
11
|
+
uidata: UiData;
|
|
12
|
+
product: Product | null;
|
|
13
|
+
showModel: boolean;
|
|
14
|
+
setShowModel: React.Dispatch<React.SetStateAction<boolean>>;
|
|
15
|
+
onVariantSelect: (variant: Variant) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const VariantSelectionModel: ({ uidata, product, showModel, setShowModel, onVariantSelect, }: Props) => import("react/jsx-runtime").JSX.Element | null;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ShadowDOMRef } from '../../types';
|
|
3
|
+
interface ShadowDOMWrapperProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
globalStyles?: string;
|
|
6
|
+
containerStyles?: React.CSSProperties;
|
|
7
|
+
onReady?: (shadowRoot: ShadowRoot, container: HTMLElement) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const ShadowDOMWrapper: React.ForwardRefExoticComponent<ShadowDOMWrapperProps & React.RefAttributes<ShadowDOMRef>>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UiData } from '../../types';
|
|
2
|
+
export default function ChatInputBox({ uiData, onSendMessage, disabled, inputState, }: {
|
|
3
|
+
uiData: UiData;
|
|
4
|
+
onSendMessage: (message: string) => Promise<void>;
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
inputState: boolean;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { UiData } from '../../types';
|
|
3
|
+
export declare const LeftArrow: (props: React.SVGProps<SVGSVGElement> & {
|
|
4
|
+
uiData: UiData;
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const RightArrow: (props: React.SVGProps<SVGSVGElement> & {
|
|
7
|
+
uiData: UiData;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const CartIcon: (props: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const LinkIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const ActiveIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const SmileyIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const InfoIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const SupportIcon: (props: React.SVGProps<SVGSVGElement> & {
|
|
15
|
+
color?: string | undefined;
|
|
16
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare const CloseIcon: (props: React.SVGProps<SVGSVGElement> & {
|
|
18
|
+
botNameColor?: string | undefined;
|
|
19
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const DEBALES_TRACKING_EVENTS: {
|
|
2
|
+
readonly OPEN_STATE_CHANGE: "open_state_change";
|
|
3
|
+
readonly CHAT_BUTTON_CLICKED: "Chat button clicked";
|
|
4
|
+
readonly USER_FORM_FILLED: "User form filled";
|
|
5
|
+
readonly ADD_BULK_ITEM: "Add bulk item";
|
|
6
|
+
readonly USER_FORM_CLOSE: "user_form_close";
|
|
7
|
+
readonly CHECKOUT_CLICKED: "Checkout Clicked";
|
|
8
|
+
readonly ADD_TO_CART_CLICKED: "add to cart clicked";
|
|
9
|
+
readonly SUGGESTED_QUESTION_CLICKED: "Suggested Question Clicked";
|
|
10
|
+
readonly INITIAL_LEADING_QUERY_SUGGESTED_QUESTION_CLICKED: "Initial Leading Query Suggested Question Clicked";
|
|
11
|
+
readonly LEADING_QUERY_CLICKED: "Leading Query Clicked";
|
|
12
|
+
readonly COLLECTION_VIDEO_CLICKED: "Collection Video Clicked";
|
|
13
|
+
readonly COLLECTION_IMAGE_CLICKED: "Collection Image Clicked";
|
|
14
|
+
readonly VIEW_PRODUCT_CLICKED: "view product clicked";
|
|
15
|
+
readonly PRODUCT_VIDEO_CLICKED: "Product Video Clicked";
|
|
16
|
+
readonly PRODUCT_IMAGE_CLICKED: "Product Image Clicked";
|
|
17
|
+
readonly SHOW_SIMILAR_CLICKED: "show similar clicked";
|
|
18
|
+
readonly CHAT_MESSAGE_SENT: "chat_message_sent";
|
|
19
|
+
readonly CHAT_MESSAGE_TYPED: "chat_message_typed";
|
|
20
|
+
readonly CHAT_MESSAGE_ERROR: "chat_message_error";
|
|
21
|
+
readonly CHAT_MESSAGE_TYPING_STARTED: "chat_message_typing_started";
|
|
22
|
+
readonly CHAT_MESSAGE_TYPING_ENDED: "chat_message_typing_ended";
|
|
23
|
+
readonly DISCOUNT_VIEWED: "discount_viewed";
|
|
24
|
+
};
|
|
25
|
+
export declare const DEBALES_CUSTOM_EVENTS: {
|
|
26
|
+
readonly USER_FORM_SUBMITTED: "user_form_submitted";
|
|
27
|
+
readonly OPEN_STATE_CHANGE: "open_state_change";
|
|
28
|
+
readonly USER_FORM_CLOSE: "user_form_close";
|
|
29
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const isProduction = false;
|
|
2
|
+
declare const API_BASE_URL: string;
|
|
3
|
+
declare const ENABLE_MIXPANEL = true;
|
|
4
|
+
declare const MIXPANEL_TOKENS: Record<string, string>;
|
|
5
|
+
declare const POSTHOG_KEY: string;
|
|
6
|
+
export { API_BASE_URL, ENABLE_MIXPANEL, MIXPANEL_TOKENS, POSTHOG_KEY };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
interface AnalyticsConfig {
|
|
2
|
+
projectName: string;
|
|
3
|
+
localStorageKey?: string;
|
|
4
|
+
debug?: boolean;
|
|
5
|
+
testing?: () => boolean;
|
|
6
|
+
}
|
|
7
|
+
type TrackPayload = {
|
|
8
|
+
distinctId: string;
|
|
9
|
+
anonId: string;
|
|
10
|
+
projectName: string;
|
|
11
|
+
eventName: string;
|
|
12
|
+
operatingSystem?: string;
|
|
13
|
+
browser?: string;
|
|
14
|
+
browserVersion?: string;
|
|
15
|
+
osVersion?: string;
|
|
16
|
+
currentUrl: string;
|
|
17
|
+
chatId: string;
|
|
18
|
+
properties?: Record<string, any> | undefined;
|
|
19
|
+
};
|
|
20
|
+
type IdentifyPayload = {
|
|
21
|
+
distinctId: string;
|
|
22
|
+
anonId: string[];
|
|
23
|
+
projectName: string;
|
|
24
|
+
email: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
phone?: string;
|
|
27
|
+
properties?: Record<string, any> | undefined;
|
|
28
|
+
};
|
|
29
|
+
interface DebalesAnalyticsPublicAPI {
|
|
30
|
+
init(config: AnalyticsConfig): void;
|
|
31
|
+
identify(uniqueId: string, userProperties?: IdentifyPayload["properties"]): Promise<void>;
|
|
32
|
+
track(eventName: string, eventProperties?: TrackPayload["properties"]): void;
|
|
33
|
+
getDistinctId(): string;
|
|
34
|
+
getAnonId(): string;
|
|
35
|
+
}
|
|
36
|
+
declare const debalesAnalytic: DebalesAnalyticsPublicAPI;
|
|
37
|
+
export default debalesAnalytic;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface UTMParams {
|
|
2
|
+
source?: string;
|
|
3
|
+
medium?: string;
|
|
4
|
+
campaign?: string;
|
|
5
|
+
term?: string;
|
|
6
|
+
content?: string;
|
|
7
|
+
sessionId?: string;
|
|
8
|
+
messageId?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const addUtmParams: (url: string | URL, params?: UTMParams) => string;
|
|
11
|
+
export declare function parseURL(url: string): {
|
|
12
|
+
isValid: true;
|
|
13
|
+
url: URL;
|
|
14
|
+
} | {
|
|
15
|
+
isValid: false;
|
|
16
|
+
error: string;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { DefaultTheme } from 'styled-components';
|
|
2
|
+
import { Message, SuggestedQuestionAnswer, UiData } from '../types';
|
|
3
|
+
export declare const getTheme: (data: UiData) => DefaultTheme;
|
|
4
|
+
export declare function getSessionId(): string;
|
|
5
|
+
export declare function getMessageId(): string | null;
|
|
6
|
+
export declare function setSessionId(sessionId: string): void;
|
|
7
|
+
export declare function getIsFormClosedByUser(): boolean;
|
|
8
|
+
export declare function setIsFormClosedByUser(value: boolean): void;
|
|
9
|
+
export declare function getUserInfo(): {
|
|
10
|
+
name?: string;
|
|
11
|
+
email: string;
|
|
12
|
+
phone?: string;
|
|
13
|
+
} | null;
|
|
14
|
+
export declare function setUserInfo(userInfo: {
|
|
15
|
+
name?: string;
|
|
16
|
+
email?: string;
|
|
17
|
+
phone?: string;
|
|
18
|
+
}): void;
|
|
19
|
+
export declare function scrollToBottom(containerRef: React.RefObject<HTMLElement>): void;
|
|
20
|
+
export declare function getCurrentPath(): string;
|
|
21
|
+
export declare function isTestingUser(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Gets suggested questions for the current path from an array of SuggestedQuestionAnswer objects
|
|
24
|
+
*
|
|
25
|
+
* @param {SuggestedQuestionAnswer[]} questions - Array of all suggested questions
|
|
26
|
+
* @returns {SuggestedQuestionAnswer[]} - Filtered questions for the current path
|
|
27
|
+
*/
|
|
28
|
+
export declare function getQuestionsForCurrentPath(questions: SuggestedQuestionAnswer[]): SuggestedQuestionAnswer[];
|
|
29
|
+
export declare const asyncWait: (ms: number) => Promise<unknown>;
|
|
30
|
+
interface trackCheckoutOptions {
|
|
31
|
+
projectName: string;
|
|
32
|
+
/**
|
|
33
|
+
* conversationId should be combination of sessionId and projectName
|
|
34
|
+
* @example conversationId = sessionId + projectName
|
|
35
|
+
*/
|
|
36
|
+
conversationId: string;
|
|
37
|
+
cartValue: number;
|
|
38
|
+
/**
|
|
39
|
+
* createdAt should in a ISO format
|
|
40
|
+
*/
|
|
41
|
+
createdAt?: string;
|
|
42
|
+
/**
|
|
43
|
+
* updatedAt should in a ISO format
|
|
44
|
+
*/
|
|
45
|
+
updatedAt?: string;
|
|
46
|
+
userName?: string;
|
|
47
|
+
userPhone?: string;
|
|
48
|
+
userEmail?: string;
|
|
49
|
+
anonymousUserId?: string;
|
|
50
|
+
distinctId?: string;
|
|
51
|
+
}
|
|
52
|
+
export declare const trackCheckout: (options: trackCheckoutOptions) => Promise<boolean>;
|
|
53
|
+
export declare const initializeMixpanel: (projectName: string) => import('mixpanel-browser').OverridedMixpanel | null;
|
|
54
|
+
export declare const trackEventMixpanel: (eventName: string, data: Record<string, any>) => Promise<void>;
|
|
55
|
+
export declare const getMixpanelDistintId: (botId: string) => any;
|
|
56
|
+
export declare function restructureData(data: any): Message;
|
|
57
|
+
export declare const generateUniqueId: () => string | null;
|
|
58
|
+
export declare const clearanonymousUserId: () => void;
|
|
59
|
+
export declare function splitMessageIntoParagraphs(markdownText: string): string[];
|
|
60
|
+
export declare const isAthflex: (botId: string) => botId is "athflex" | "athflex-2";
|
|
61
|
+
export declare const isGaiabay: (botId: string) => boolean;
|
|
62
|
+
export declare const splitQuestionsIntoGroups: (questions: SuggestedQuestionAnswer[]) => (SuggestedQuestionAnswer | SuggestedQuestionAnswer[])[];
|
|
63
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { EcommercePlatform, Product } from '.';
|
|
2
|
+
export interface CartItem {
|
|
3
|
+
id: number;
|
|
4
|
+
quantity: number;
|
|
5
|
+
properties?: Record<string, string>;
|
|
6
|
+
title: string;
|
|
7
|
+
price: number;
|
|
8
|
+
variant_id: number;
|
|
9
|
+
}
|
|
10
|
+
export interface CartState {
|
|
11
|
+
items: CartItem[];
|
|
12
|
+
total: number;
|
|
13
|
+
itemCount: number;
|
|
14
|
+
currency: string;
|
|
15
|
+
token: string;
|
|
16
|
+
}
|
|
17
|
+
export interface CartPlatformAdapter {
|
|
18
|
+
readonly platform: EcommercePlatform;
|
|
19
|
+
isSupported(): boolean;
|
|
20
|
+
fetchCart(): Promise<CartOperationResult<CartState>>;
|
|
21
|
+
addToCart(variantId: string, quantity?: number, properties?: Record<string, string>): Promise<CartOperationResult<void>>;
|
|
22
|
+
removeFromCart(itemId: number): Promise<CartOperationResult<void>>;
|
|
23
|
+
updateQuantity(cartItem: CartItem): Promise<CartOperationResult<void>>;
|
|
24
|
+
clearCart(): Promise<CartOperationResult<void>>;
|
|
25
|
+
generateCartUrl(domain: string): string;
|
|
26
|
+
generateProductUrl(domain: string, product: Product): string;
|
|
27
|
+
addCartAttributes(attributes?: Record<string, string>): Promise<CartOperationResult<void>>;
|
|
28
|
+
}
|
|
29
|
+
export type CartOperationResult<T> = {
|
|
30
|
+
success: true;
|
|
31
|
+
data: T;
|
|
32
|
+
message?: string;
|
|
33
|
+
} | {
|
|
34
|
+
success: false;
|
|
35
|
+
error: string;
|
|
36
|
+
};
|
|
37
|
+
export interface CartContextValue {
|
|
38
|
+
isLoading: boolean;
|
|
39
|
+
error: string | null;
|
|
40
|
+
cart: CartState | null;
|
|
41
|
+
fetchCart: () => Promise<void>;
|
|
42
|
+
addToCart: (variantId: string, quantity?: number, properties?: Record<string, string>) => Promise<CartOperationResult<void>>;
|
|
43
|
+
removeFromCart: (itemId: number) => Promise<CartOperationResult<void>>;
|
|
44
|
+
updateQuantity: (cartItem: CartItem) => Promise<CartOperationResult<void>>;
|
|
45
|
+
clearCart: () => Promise<CartOperationResult<void>>;
|
|
46
|
+
generateCartUrl: (domain: string) => string;
|
|
47
|
+
generateProductUrl: (domain: string, product: Product) => string;
|
|
48
|
+
addCartAttributes: (attributes?: Record<string, string>) => Promise<CartOperationResult<void>>;
|
|
49
|
+
}
|