@robylon/whatsapp-react-sdk 1.0.0-staging.1 → 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.
Files changed (30) hide show
  1. package/README.md +11 -11
  2. package/dist/cjs/index.js +2 -2
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/types/components/ChatbotIframe.d.ts +16 -0
  5. package/dist/cjs/types/constants/fontStyles.d.ts +0 -2
  6. package/dist/cjs/types/core/api.d.ts +0 -2
  7. package/dist/cjs/types/types.d.ts +0 -8
  8. package/dist/cjs/types/vanilla/components/ChatbotIframe.d.ts +92 -0
  9. package/dist/esm/index.js +2 -2
  10. package/dist/esm/index.js.map +1 -1
  11. package/dist/esm/types/components/ChatbotIframe.d.ts +16 -0
  12. package/dist/esm/types/constants/fontStyles.d.ts +0 -2
  13. package/dist/esm/types/core/api.d.ts +0 -2
  14. package/dist/esm/types/types.d.ts +0 -8
  15. package/dist/esm/types/vanilla/components/ChatbotIframe.d.ts +92 -0
  16. package/dist/index.d.ts +0 -8
  17. package/dist/umd/robylon-chatbot.js +1 -1
  18. package/dist/umd/robylon-chatbot.js.map +1 -1
  19. package/dist/umd/types/components/ChatbotIframe.d.ts +16 -0
  20. package/dist/umd/types/constants/fontStyles.d.ts +0 -2
  21. package/dist/umd/types/core/api.d.ts +0 -2
  22. package/dist/umd/types/types.d.ts +0 -8
  23. package/dist/umd/types/vanilla/components/ChatbotIframe.d.ts +92 -0
  24. package/package.json +1 -1
  25. package/dist/cjs/types/components/ChatWidgetPopup.d.ts +0 -8
  26. package/dist/cjs/types/vanilla/components/ChatWidgetPopup.d.ts +0 -17
  27. package/dist/esm/types/components/ChatWidgetPopup.d.ts +0 -8
  28. package/dist/esm/types/vanilla/components/ChatWidgetPopup.d.ts +0 -17
  29. package/dist/umd/types/components/ChatWidgetPopup.d.ts +0 -8
  30. package/dist/umd/types/vanilla/components/ChatWidgetPopup.d.ts +0 -17
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ import { ChatbotConfig } from "../types";
3
+ import { ChatbotEventHandler, AllEventTypes } from "../types/events";
4
+ import { Overrides } from "src/components/RobylonChatbot";
5
+ interface ChatbotIframeProps {
6
+ config: ChatbotConfig;
7
+ isVisible: boolean;
8
+ onClose: () => void;
9
+ onEvent?: ChatbotEventHandler;
10
+ onInternalEvent: (eventType: AllEventTypes, additionalData?: Record<string, any>) => void;
11
+ position?: "Left" | "Right";
12
+ bottomSpacing?: number;
13
+ overrides?: Overrides;
14
+ }
15
+ declare const _default: React.NamedExoticComponent<ChatbotIframeProps>;
16
+ export default _default;
@@ -1,4 +1,2 @@
1
1
  export declare const FONT_FAMILY = "system-ui, Inter, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'";
2
- /** Chat widget popup: same stack as FONT_FAMILY with trailing generic + !important via scoped CSS */
3
- export declare const CHAT_WIDGET_POPUP_FONT_FAMILY = "system-ui, Inter, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", sans-serif";
4
2
  export declare const FONT_LINE_HEIGHT = "21px";
@@ -1,5 +1,3 @@
1
- export declare const USE_WHATSAPP_MOCK_API = false;
2
- export declare const normalizeWhatsappGetResponse: (data: any) => any;
3
1
  /**
4
2
  * Fetches the chatbot configuration from the API
5
3
  * @param apiKey The API key for the chatbot
@@ -50,14 +50,6 @@ export interface ChatbotConfig {
50
50
  delay: number;
51
51
  };
52
52
  launcher_size_multiplier?: number;
53
- redirect_chat_link?: string;
54
- pre_filled_message?: string;
55
- widget_type?: string;
56
- widget_title?: string;
57
- widget_subtitle?: string;
58
- title_bar_color?: string;
59
- button_content?: string;
60
- powered_by_robylon?: boolean;
61
53
  }
62
54
  interface RobylonSdkConfig {
63
55
  chatbot_id: string;
@@ -0,0 +1,92 @@
1
+ import { ChatbotConfig } from "../../types";
2
+ import { ChatbotEventType, AllEventTypes } from "../../types/events";
3
+ interface Overrides {
4
+ header_avatar?: string | null;
5
+ agent_avatar?: string | null;
6
+ header_title?: string | null;
7
+ header_subtitle?: string | null;
8
+ header_title_text_color?: string | null;
9
+ header_subtitle_text_color?: string | null;
10
+ header_bg?: string | null;
11
+ }
12
+ /**
13
+ * Interface for the ChatbotIframe configuration
14
+ */
15
+ interface ChatbotIframeConfig {
16
+ config: ChatbotConfig;
17
+ isVisible: boolean;
18
+ onClose: () => void;
19
+ onEvent?: (event: {
20
+ type: ChatbotEventType;
21
+ timestamp: number;
22
+ data?: any;
23
+ }) => void;
24
+ onInternalEvent: (eventType: AllEventTypes, additionalData?: Record<string, any>) => void;
25
+ position?: "Left" | "Right";
26
+ bottomSpacing?: number;
27
+ overrides?: Overrides;
28
+ }
29
+ /**
30
+ * Class representing the ChatbotIframe component
31
+ */
32
+ export declare class ChatbotIframe {
33
+ private iframeElement;
34
+ private config;
35
+ private isInitialized;
36
+ private hasRegistered;
37
+ private isAppReady;
38
+ private shouldWaitForAppReady;
39
+ private hasPendingOpenRequest;
40
+ private resizeHandler;
41
+ private overridesPayloadCache;
42
+ private proactiveDataSentInRegistration;
43
+ /**
44
+ * Creates a new ChatbotIframe
45
+ * @param config The iframe configuration
46
+ */
47
+ constructor(config: ChatbotIframeConfig);
48
+ /**
49
+ * Gets the iframe element
50
+ * @returns The iframe element
51
+ */
52
+ getElement(): HTMLIFrameElement;
53
+ /**
54
+ * Renders the iframe element
55
+ */
56
+ private render;
57
+ /**
58
+ * Applies responsive styles based on window width
59
+ */
60
+ private applyResponsiveStyles;
61
+ /**
62
+ * Initializes the iframe
63
+ */
64
+ private initialize;
65
+ /**
66
+ * Sets up event listeners
67
+ */
68
+ private setupEventListeners;
69
+ /**
70
+ * Handles messages from the iframe
71
+ */
72
+ private handleMessage;
73
+ /**
74
+ * Updates the iframe visibility
75
+ * @param isVisible Whether the iframe should be visible
76
+ * @param waitForAppReady If true, defer postMessages until APP_READY is received
77
+ */
78
+ updateVisibility(isVisible: boolean, waitForAppReady?: boolean): void;
79
+ private showIframe;
80
+ private hideIframe;
81
+ private sendOpenAndRegisterIfReady;
82
+ /**
83
+ * Updates the iframe with new configuration
84
+ * @param config The new configuration
85
+ */
86
+ update(config: Partial<ChatbotIframeConfig>, waitForAppReady?: boolean): void;
87
+ /**
88
+ * Unmounts and destroys the iframe
89
+ */
90
+ destroy(): void;
91
+ }
92
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robylon/whatsapp-react-sdk",
3
- "version": "1.0.0-staging.1",
3
+ "version": "1.0.0",
4
4
  "description": "React SDK for Robylon WhatsApp",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -1,8 +0,0 @@
1
- import React from "react";
2
- import { ChatbotConfig } from "src/types";
3
- interface ChatWidgetPopupProps {
4
- config: ChatbotConfig;
5
- onCtaClick: () => void;
6
- }
7
- declare const ChatWidgetPopup: React.FC<ChatWidgetPopupProps>;
8
- export default ChatWidgetPopup;
@@ -1,17 +0,0 @@
1
- import { ChatbotConfig } from "../../types";
2
- interface ChatWidgetPopupConfig {
3
- config: ChatbotConfig;
4
- onCtaClick: () => void;
5
- }
6
- export declare class ChatWidgetPopup {
7
- private popupElement;
8
- private config;
9
- constructor(config: ChatWidgetPopupConfig);
10
- private createTitleBar;
11
- private createContent;
12
- private render;
13
- getElement(): HTMLDivElement;
14
- update(config: ChatWidgetPopupConfig): void;
15
- destroy(): void;
16
- }
17
- export {};
@@ -1,8 +0,0 @@
1
- import React from "react";
2
- import { ChatbotConfig } from "src/types";
3
- interface ChatWidgetPopupProps {
4
- config: ChatbotConfig;
5
- onCtaClick: () => void;
6
- }
7
- declare const ChatWidgetPopup: React.FC<ChatWidgetPopupProps>;
8
- export default ChatWidgetPopup;
@@ -1,17 +0,0 @@
1
- import { ChatbotConfig } from "../../types";
2
- interface ChatWidgetPopupConfig {
3
- config: ChatbotConfig;
4
- onCtaClick: () => void;
5
- }
6
- export declare class ChatWidgetPopup {
7
- private popupElement;
8
- private config;
9
- constructor(config: ChatWidgetPopupConfig);
10
- private createTitleBar;
11
- private createContent;
12
- private render;
13
- getElement(): HTMLDivElement;
14
- update(config: ChatWidgetPopupConfig): void;
15
- destroy(): void;
16
- }
17
- export {};
@@ -1,8 +0,0 @@
1
- import React from "react";
2
- import { ChatbotConfig } from "src/types";
3
- interface ChatWidgetPopupProps {
4
- config: ChatbotConfig;
5
- onCtaClick: () => void;
6
- }
7
- declare const ChatWidgetPopup: React.FC<ChatWidgetPopupProps>;
8
- export default ChatWidgetPopup;
@@ -1,17 +0,0 @@
1
- import { ChatbotConfig } from "../../types";
2
- interface ChatWidgetPopupConfig {
3
- config: ChatbotConfig;
4
- onCtaClick: () => void;
5
- }
6
- export declare class ChatWidgetPopup {
7
- private popupElement;
8
- private config;
9
- constructor(config: ChatWidgetPopupConfig);
10
- private createTitleBar;
11
- private createContent;
12
- private render;
13
- getElement(): HTMLDivElement;
14
- update(config: ChatWidgetPopupConfig): void;
15
- destroy(): void;
16
- }
17
- export {};