@robylon/web-react-sdk 2.0.0-alpha-staging.11 → 2.0.0-alpha-staging.13

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.
@@ -6,5 +6,6 @@ export declare enum IframeAction {
6
6
  I_CLICKED_PROACTIVE_BUBBLE = "i_clicked_proactive_bubble",
7
7
  CAPTURED_SESSION_DATA = "capturedSessionData",
8
8
  UPDATE_USER_PROFILE = "updateUserProfile",
9
- OPENED_IFRAME_EVENT = "openedIframe"
9
+ OPENED_IFRAME_EVENT = "openedIframe",
10
+ I_CHANGED_URL = "i_changed_url"
10
11
  }
@@ -4,7 +4,7 @@ import { ChatbotEvent, ChatbotEventType, AllEventTypes } from "../types/events";
4
4
  */
5
5
  export interface EventEmitter {
6
6
  emit: (eventType: ChatbotEventType, data?: any) => void;
7
- onInternalEvent: (eventType: AllEventTypes, additionalData?: Record<string, any>) => void;
7
+ onInternalEvent: (eventType: AllEventTypes, additionalData?: Record<string, any>) => Promise<void>;
8
8
  }
9
9
  /**
10
10
  * Creates an event emitter for handling chatbot events
@@ -1,5 +1,5 @@
1
1
  import { SystemInfo } from "./systemInfo";
2
- interface LauncherInfo {
2
+ export interface LauncherInfo {
3
3
  current_page_url: string;
4
4
  browser_language: string;
5
5
  browser_version: string;
@@ -8,4 +8,3 @@ interface LauncherInfo {
8
8
  system_info?: SystemInfo;
9
9
  }
10
10
  export declare const getLauncherInfo: () => LauncherInfo;
11
- export {};
@@ -1,6 +1,7 @@
1
1
  import { ConditionType, DisplayAttributesType } from "src/types";
2
2
  type UrlChangeListener = (href: string) => void;
3
3
  export declare const getCurrentHref: () => string;
4
+ export declare const getPreviousHref: () => string;
4
5
  export declare const buildLocationKey: () => string;
5
6
  export declare const subscribeToUrlChanges: (cb: UrlChangeListener) => (() => void);
6
7
  export declare const initUrlObserver: () => void;
@@ -0,0 +1,5 @@
1
+ export type UrlChangeEvent = {
2
+ prev_url: string;
3
+ current_url: string;
4
+ };
5
+ export declare const subscribeToUrlChangeEvents: (cb: (event: UrlChangeEvent) => void) => (() => void);
@@ -0,0 +1,16 @@
1
+ import { IframeAction } from "../constants/iframeActions";
2
+ import { UrlChangeEvent } from "./urlChangeEvents";
3
+ export declare const getIframePageContext: (prevUrl?: string) => {
4
+ prev_url: string;
5
+ current_url: string;
6
+ launcher_info: import("./launcherInfo").LauncherInfo;
7
+ };
8
+ export declare const buildUrlChangeIframePayload: (event: UrlChangeEvent) => {
9
+ domain: string;
10
+ action: IframeAction;
11
+ data: {
12
+ prev_url: string;
13
+ current_url: string;
14
+ launcher_info: import("./launcherInfo").LauncherInfo;
15
+ };
16
+ };
@@ -42,6 +42,7 @@ export declare class ChatbotIframe {
42
42
  private overridesPayloadCache;
43
43
  private proactiveDataSentInRegistration;
44
44
  private openedDueToProactive;
45
+ private urlUnsubscribe;
45
46
  private buildOverridesPayload;
46
47
  private hasUserProvidedOverrides;
47
48
  /**
@@ -70,6 +71,7 @@ export declare class ChatbotIframe {
70
71
  * Sets up event listeners
71
72
  */
72
73
  private setupEventListeners;
74
+ private sendUrlChangeToIframe;
73
75
  /**
74
76
  * Handles messages from the iframe
75
77
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robylon/web-react-sdk",
3
- "version": "2.0.0-alpha-staging.11",
3
+ "version": "2.0.0-alpha-staging.13",
4
4
  "description": "React SDK for Robylon AI Chatbot",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",