@robylon/react-native-sdk 2.0.16-staging.2 → 2.0.16
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/.npmignore.development +18 -0
- package/babel.config.js +15 -15
- package/ios/Podfile +12 -0
- package/lib/commonjs/Chatbotsdk.js +1 -1
- package/lib/commonjs/Chatbotsdk.js.map +1 -1
- package/lib/commonjs/FloatingButton.js +1 -1
- package/lib/commonjs/FloatingButton.js.map +1 -1
- package/lib/commonjs/components/DebugButton.js +2 -0
- package/lib/commonjs/components/DebugButton.js.map +1 -0
- package/lib/commonjs/components/ErrorBoundary.js +2 -0
- package/lib/commonjs/components/ErrorBoundary.js.map +1 -0
- package/lib/commonjs/config.js +1 -1
- package/lib/commonjs/config.js.map +1 -1
- package/lib/commonjs/constants/errorConstants.js +2 -0
- package/lib/commonjs/constants/errorConstants.js.map +1 -0
- package/lib/commonjs/constants.js +1 -1
- package/lib/commonjs/constants.js.map +1 -1
- package/lib/commonjs/hooks/useChatbotEvents.js +2 -0
- package/lib/commonjs/hooks/useChatbotEvents.js.map +1 -0
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/services/ErrorTrackingService.js +2 -0
- package/lib/commonjs/services/ErrorTrackingService.js.map +1 -0
- package/lib/commonjs/types/events.js +2 -0
- package/lib/commonjs/types/events.js.map +1 -0
- package/lib/commonjs/types/react-native-flipper-performance-plugin.d.js +2 -0
- package/lib/commonjs/types/react-native-flipper-performance-plugin.d.js.map +1 -0
- package/lib/commonjs/types/react-native-globals.d.js +2 -0
- package/lib/commonjs/types/react-native-globals.d.js.map +1 -0
- package/lib/commonjs/utils/cookieUtils.js +2 -0
- package/lib/commonjs/utils/cookieUtils.js.map +1 -0
- package/lib/commonjs/utils/debugConfig.js +2 -0
- package/lib/commonjs/utils/debugConfig.js.map +1 -0
- package/lib/commonjs/utils/debugMenu.js +2 -0
- package/lib/commonjs/utils/debugMenu.js.map +1 -0
- package/lib/commonjs/utils/errorHandler.js +2 -0
- package/lib/commonjs/utils/errorHandler.js.map +1 -0
- package/lib/commonjs/utils/logger.js +2 -0
- package/lib/commonjs/utils/logger.js.map +1 -0
- package/lib/commonjs/utils/systemInfo.js +2 -0
- package/lib/commonjs/utils/systemInfo.js.map +1 -0
- package/lib/commonjs/utils/webViewStorage.js +2 -0
- package/lib/commonjs/utils/webViewStorage.js.map +1 -0
- package/lib/commonjs/version.js +2 -0
- package/lib/commonjs/version.js.map +1 -0
- package/lib/module/Chatbotsdk.js +1 -1
- package/lib/module/Chatbotsdk.js.map +1 -1
- package/lib/module/FloatingButton.js +1 -1
- package/lib/module/FloatingButton.js.map +1 -1
- package/lib/module/components/DebugButton.js +2 -0
- package/lib/module/components/DebugButton.js.map +1 -0
- package/lib/module/components/ErrorBoundary.js +2 -0
- package/lib/module/components/ErrorBoundary.js.map +1 -0
- package/lib/module/config.js +1 -1
- package/lib/module/config.js.map +1 -1
- package/lib/module/constants/errorConstants.js +2 -0
- package/lib/module/constants/errorConstants.js.map +1 -0
- package/lib/module/constants.js +1 -1
- package/lib/module/constants.js.map +1 -1
- package/lib/module/hooks/useChatbotEvents.js +2 -0
- package/lib/module/hooks/useChatbotEvents.js.map +1 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/services/ErrorTrackingService.js +2 -0
- package/lib/module/services/ErrorTrackingService.js.map +1 -0
- package/lib/module/types/events.js +2 -0
- package/lib/module/types/events.js.map +1 -0
- package/lib/module/types/react-native-flipper-performance-plugin.d.js +2 -0
- package/lib/module/types/react-native-flipper-performance-plugin.d.js.map +1 -0
- package/lib/module/types/react-native-globals.d.js +2 -0
- package/lib/module/types/react-native-globals.d.js.map +1 -0
- package/lib/module/utils/cookieUtils.js +2 -0
- package/lib/module/utils/cookieUtils.js.map +1 -0
- package/lib/module/utils/debugConfig.js +2 -0
- package/lib/module/utils/debugConfig.js.map +1 -0
- package/lib/module/utils/debugMenu.js +2 -0
- package/lib/module/utils/debugMenu.js.map +1 -0
- package/lib/module/utils/errorHandler.js +2 -0
- package/lib/module/utils/errorHandler.js.map +1 -0
- package/lib/module/utils/logger.js +2 -0
- package/lib/module/utils/logger.js.map +1 -0
- package/lib/module/utils/systemInfo.js +2 -0
- package/lib/module/utils/systemInfo.js.map +1 -0
- package/lib/module/utils/webViewStorage.js +2 -0
- package/lib/module/utils/webViewStorage.js.map +1 -0
- package/lib/module/version.js +2 -0
- package/lib/module/version.js.map +1 -0
- package/lib/typescript/Chatbotsdk.d.ts +9 -10
- package/lib/typescript/Chatbotsdk.d.ts.map +1 -1
- package/lib/typescript/FloatingButton.d.ts.map +1 -1
- package/lib/typescript/components/DebugButton.d.ts +4 -0
- package/lib/typescript/components/DebugButton.d.ts.map +1 -0
- package/lib/typescript/components/ErrorBoundary.d.ts +16 -0
- package/lib/typescript/components/ErrorBoundary.d.ts.map +1 -0
- package/lib/typescript/constants/errorConstants.d.ts +18 -0
- package/lib/typescript/constants/errorConstants.d.ts.map +1 -0
- package/lib/typescript/hooks/useChatbotEvents.d.ts +17 -0
- package/lib/typescript/hooks/useChatbotEvents.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +5 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/services/ErrorTrackingService.d.ts +34 -0
- package/lib/typescript/services/ErrorTrackingService.d.ts.map +1 -0
- package/lib/typescript/types/events.d.ts +22 -0
- package/lib/typescript/types/events.d.ts.map +1 -0
- package/lib/typescript/utils/cookieUtils.d.ts +2 -0
- package/lib/typescript/utils/cookieUtils.d.ts.map +1 -0
- package/lib/typescript/utils/debugConfig.d.ts +8 -0
- package/lib/typescript/utils/debugConfig.d.ts.map +1 -0
- package/lib/typescript/utils/debugMenu.d.ts +3 -0
- package/lib/typescript/utils/debugMenu.d.ts.map +1 -0
- package/lib/typescript/utils/errorHandler.d.ts +2 -0
- package/lib/typescript/utils/errorHandler.d.ts.map +1 -0
- package/lib/typescript/utils/logger.d.ts +7 -0
- package/lib/typescript/utils/logger.d.ts.map +1 -0
- package/lib/typescript/utils/systemInfo.d.ts +19 -0
- package/lib/typescript/utils/systemInfo.d.ts.map +1 -0
- package/lib/typescript/utils/webViewStorage.d.ts +16 -0
- package/lib/typescript/utils/webViewStorage.d.ts.map +1 -0
- package/lib/typescript/version.d.ts +2 -0
- package/lib/typescript/version.d.ts.map +1 -0
- package/package.json +8 -2
- package/scripts/generate-version.js +9 -0
- package/src/ChatbotWebview.tsx +0 -44
- package/src/Chatbotsdk.tsx +0 -399
- package/src/FloatingButton.tsx +0 -57
- package/src/LoadingIndicator.tsx +0 -11
- package/src/Toast.tsx +0 -65
- package/src/config.ts +0 -4
- package/src/constants.ts +0 -4
- package/src/global.d.ts +0 -11
- package/src/index.tsx +0 -2
- package/src/openChatbot.ts +0 -11
- package/src/openChatbot.tsx +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ChatbotEventType, AllEventTypes, ChatbotEventHandler } from "../types/events";
|
|
2
|
+
interface EventHookProps {
|
|
3
|
+
api_key: string;
|
|
4
|
+
chatbotConfig: any;
|
|
5
|
+
user_profile?: Record<string, any>;
|
|
6
|
+
onEvent?: ChatbotEventHandler;
|
|
7
|
+
systemInfo: {
|
|
8
|
+
os: string;
|
|
9
|
+
browser: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare const useChatbotEvents: ({ api_key, chatbotConfig, user_profile, onEvent, systemInfo, }: EventHookProps) => {
|
|
13
|
+
emitEvent: (type: ChatbotEventType, data?: any) => void;
|
|
14
|
+
onInternalEvent: (eventType: AllEventTypes, additionalData?: Record<string, any>) => Promise<void>;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=useChatbotEvents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChatbotEvents.d.ts","sourceRoot":"","sources":["../../../src/hooks/useChatbotEvents.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AAGzB,UAAU,cAAc;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,GAAG,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,UAAU,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7C;AAED,eAAO,MAAM,gBAAgB,mEAM1B,cAAc;sBAwDN,gBAAgB,SAAS,GAAG;iCArDtB,aAAa,mBACR,OAAO,MAAM,EAAE,GAAG,CAAC;CAgExC,CAAC"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
export { default as
|
|
1
|
+
export { default as Chatbot } from "./Chatbotsdk";
|
|
2
2
|
export { openChatbot } from "./openChatbot";
|
|
3
|
+
export { errorTracker, ErrorTrackingService, } from "./services/ErrorTrackingService";
|
|
4
|
+
export * from "./constants/errorConstants";
|
|
5
|
+
export * from "./types/events";
|
|
6
|
+
export type { ChatbotProps } from "./Chatbotsdk";
|
|
3
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,YAAY,EACZ,oBAAoB,GACrB,MAAM,iCAAiC,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAE/B,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare enum EventType {
|
|
2
|
+
ERROR = "ERROR",
|
|
3
|
+
INFO = "INFO"
|
|
4
|
+
}
|
|
5
|
+
export interface ErrorEvent {
|
|
6
|
+
message: string;
|
|
7
|
+
stack?: string;
|
|
8
|
+
componentName?: string | null | undefined;
|
|
9
|
+
additionalInfo?: Record<string, any>;
|
|
10
|
+
timestamp: number;
|
|
11
|
+
}
|
|
12
|
+
export interface LogPayload {
|
|
13
|
+
org_id: string;
|
|
14
|
+
event_data: ErrorEvent;
|
|
15
|
+
metadata: Record<string, any>;
|
|
16
|
+
event_type: EventType;
|
|
17
|
+
user_id?: string | number | null;
|
|
18
|
+
}
|
|
19
|
+
export declare class ErrorTrackingService {
|
|
20
|
+
private static instance;
|
|
21
|
+
private apiKey;
|
|
22
|
+
private userId;
|
|
23
|
+
private preInitQueue;
|
|
24
|
+
private isInitialized;
|
|
25
|
+
private constructor();
|
|
26
|
+
static getInstance(): ErrorTrackingService;
|
|
27
|
+
initialize(apiKey: string, userId?: string | number | null): void;
|
|
28
|
+
private processPreInitQueue;
|
|
29
|
+
private sendLog;
|
|
30
|
+
trackError(error: Error | string, componentName: string | null | undefined, additionalInfo?: Record<string, any>): Promise<void>;
|
|
31
|
+
trackInfo(message: string, componentName: string | null | undefined, additionalInfo?: Record<string, any>): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
export declare const errorTracker: ErrorTrackingService;
|
|
34
|
+
//# sourceMappingURL=ErrorTrackingService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorTrackingService.d.ts","sourceRoot":"","sources":["../../../src/services/ErrorTrackingService.ts"],"names":[],"mappings":"AAKA,oBAAY,SAAS;IACnB,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC1C,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,UAAU,EAAE,SAAS,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CAClC;AAED,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAuB;IAC9C,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,MAAM,CAA4C;IAC1D,OAAO,CAAC,YAAY,CAIZ;IACR,OAAO,CAAC,aAAa,CAAS;IAE9B,OAAO;IAEP,MAAM,CAAC,WAAW,IAAI,oBAAoB;IAO1C,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,GAAG,MAAM,GAAG,IAAW;YAkDlD,mBAAmB;YAiBnB,OAAO;IAmBf,UAAU,CACd,KAAK,EAAE,KAAK,GAAG,MAAM,EACrB,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACxC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAoDhC,SAAS,CACb,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACxC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAwBvC;AAED,eAAO,MAAM,YAAY,sBAAqC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare enum ChatbotEventType {
|
|
2
|
+
CHATBOT_BUTTON_LOADED = "CHATBOT_BUTTON_LOADED",
|
|
3
|
+
CHATBOT_BUTTON_CLICKED = "CHATBOT_BUTTON_CLICKED",
|
|
4
|
+
CHATBOT_OPENED = "CHATBOT_OPENED",
|
|
5
|
+
CHATBOT_CLOSED = "CHATBOT_CLOSED",
|
|
6
|
+
CHATBOT_APP_READY = "CHATBOT_APP_READY",
|
|
7
|
+
CHATBOT_LOADED = "CHATBOT_LOADED",
|
|
8
|
+
CHAT_INITIALIZED = "CHAT_INITIALIZED",
|
|
9
|
+
SESSION_REFRESHED = "SESSION_REFRESHED",
|
|
10
|
+
CHAT_INITIALIZATION_FAILED = "CHAT_INITIALIZATION_FAILED"
|
|
11
|
+
}
|
|
12
|
+
export declare enum InternalEventType {
|
|
13
|
+
CHAT_MOVED = "CHAT_MOVED"
|
|
14
|
+
}
|
|
15
|
+
export type AllEventTypes = ChatbotEventType | InternalEventType;
|
|
16
|
+
export interface ChatbotEvent {
|
|
17
|
+
type: ChatbotEventType;
|
|
18
|
+
timestamp: number;
|
|
19
|
+
data?: any;
|
|
20
|
+
}
|
|
21
|
+
export type ChatbotEventHandler = (event: ChatbotEvent) => void;
|
|
22
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/types/events.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IAC1B,qBAAqB,0BAA0B;IAC/C,sBAAsB,2BAA2B;IACjD,cAAc,mBAAmB;IACjC,cAAc,mBAAmB;IACjC,iBAAiB,sBAAsB;IACvC,cAAc,mBAAmB;IACjC,gBAAgB,qBAAqB;IACrC,iBAAiB,sBAAsB;IACvC,0BAA0B,+BAA+B;CAC1D;AAED,oBAAY,iBAAiB;IAC3B,UAAU,eAAe;CAC1B;AAED,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAEjE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,gBAAgB,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AAED,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookieUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/cookieUtils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,cAMxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debugConfig.d.ts","sourceRoot":"","sources":["../../../src/utils/debugConfig.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,kBAAkB,EAAE,GAAG,CAAC;KACzB;CACF;AASD,eAAO,MAAM,kBAAkB,YAO9B,CAAC;AAEF,eAAO,MAAM,kBAAkB,eAAgB,GAAG,SA+BjD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debugMenu.d.ts","sourceRoot":"","sources":["../../../src/utils/debugMenu.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,YAIzB,CAAC;AAEF,eAAO,MAAM,mBAAmB,YAK/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorHandler.d.ts","sourceRoot":"","sources":["../../../src/utils/errorHandler.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,wBAAwB,YAmDpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;qBACA,MAAM,UAAU,GAAG;oBAGpB,MAAM,SAAS,GAAG;oBAGlB,MAAM,SAAS,GAAG;qBAGjB,MAAM,SAAS,GAAG;CAGpC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface ScreenSize {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
}
|
|
5
|
+
interface SystemInfo {
|
|
6
|
+
platform: string;
|
|
7
|
+
os: string;
|
|
8
|
+
browser: string;
|
|
9
|
+
SDK_VERSION: string;
|
|
10
|
+
device: string;
|
|
11
|
+
screen_size: ScreenSize;
|
|
12
|
+
}
|
|
13
|
+
export declare const getBrowserAndOSInfoScript: () => string;
|
|
14
|
+
export declare const getSystemInfo: (webViewSystemInfo: {
|
|
15
|
+
os: string;
|
|
16
|
+
browser: string;
|
|
17
|
+
}) => SystemInfo;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=systemInfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"systemInfo.d.ts","sourceRoot":"","sources":["../../../src/utils/systemInfo.ts"],"names":[],"mappings":"AAGA,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,UAAU;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,UAAU,CAAC;CACzB;AAwBD,eAAO,MAAM,yBAAyB,QAAO,MA6B5C,CAAC;AAGF,eAAO,MAAM,aAAa,sBAAuB;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB,KAAG,UASH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare enum StorageMessageType {
|
|
2
|
+
GET_STORAGE = "GET_STORAGE",
|
|
3
|
+
SET_STORAGE = "SET_STORAGE",
|
|
4
|
+
STORAGE_READY = "STORAGE_READY",
|
|
5
|
+
STORAGE_ERROR = "STORAGE_ERROR",
|
|
6
|
+
STORAGE_RESPONSE = "STORAGE_RESPONSE"
|
|
7
|
+
}
|
|
8
|
+
export interface StorageMessage {
|
|
9
|
+
type: StorageMessageType;
|
|
10
|
+
key?: string;
|
|
11
|
+
value?: string;
|
|
12
|
+
error?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const getStorageScript: () => string;
|
|
15
|
+
export declare const createStorageMessage: (type: StorageMessageType, key?: string, value?: string) => string;
|
|
16
|
+
//# sourceMappingURL=webViewStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webViewStorage.d.ts","sourceRoot":"","sources":["../../../src/utils/webViewStorage.ts"],"names":[],"mappings":"AAEA,oBAAY,kBAAkB;IAC5B,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;IAC3B,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;IAC/B,gBAAgB,qBAAqB;CACtC;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,kBAAkB,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,gBAAgB,cAgC5B,CAAC;AAEF,eAAO,MAAM,oBAAoB,SACzB,kBAAkB,QAClB,MAAM,UACJ,MAAM,KACb,MAMF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,WAAW,qBAAqB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robylon/react-native-sdk",
|
|
3
|
-
"version": "2.0.16
|
|
3
|
+
"version": "2.0.16",
|
|
4
4
|
"description": "React Native SDK for Robylon",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -9,14 +9,19 @@
|
|
|
9
9
|
"source": "src/index.tsx",
|
|
10
10
|
"readme": "README.md",
|
|
11
11
|
"scripts": {
|
|
12
|
+
"prebuild": "node scripts/generate-version.js",
|
|
12
13
|
"build": "bob build",
|
|
13
14
|
"clean": "rimraf lib",
|
|
15
|
+
"prebuild:dev": "cp .npmignore.development .npmignore",
|
|
14
16
|
"prebuild:staging": "cp .npmignore.staging .npmignore",
|
|
15
17
|
"prebuild:production": "cp .npmignore.production .npmignore",
|
|
18
|
+
"build:dev": "env-cmd -f .env.development bob build",
|
|
16
19
|
"build:staging": "env-cmd -f .env.staging bob build",
|
|
17
20
|
"build:production": "env-cmd -f .env.production bob build",
|
|
21
|
+
"version:dev": "npm version prerelease --preid dev",
|
|
18
22
|
"version:staging": "npm version prerelease --preid staging",
|
|
19
23
|
"version:production": "npm version patch",
|
|
24
|
+
"publish:dev": "npm run clean && npm run prebuild:dev && npm run version:dev && npm run build:dev && npm publish --tag dev",
|
|
20
25
|
"publish:staging": "npm run clean && npm run prebuild:staging && npm run version:staging && npm run build:staging && npm publish --tag staging",
|
|
21
26
|
"publish:production": "npm run clean && npm run prebuild:production && npm run version:production && npm run build:production && npm publish --tag latest"
|
|
22
27
|
},
|
|
@@ -64,5 +69,6 @@
|
|
|
64
69
|
]
|
|
65
70
|
},
|
|
66
71
|
"author": "",
|
|
67
|
-
"license": "ISC"
|
|
72
|
+
"license": "ISC",
|
|
73
|
+
"dependencies": {}
|
|
68
74
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const package = require("../package.json");
|
|
4
|
+
|
|
5
|
+
const content = `// This file is auto-generated. Do not modify it manually.
|
|
6
|
+
export const SDK_VERSION = '${package.version}';
|
|
7
|
+
`;
|
|
8
|
+
|
|
9
|
+
fs.writeFileSync(path.join(__dirname, "../src/version.ts"), content);
|
package/src/ChatbotWebview.tsx
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// File: src/ChatbotWebview.tsx
|
|
2
|
-
import React, { useEffect, useState } from "react";
|
|
3
|
-
import { View } from "react-native";
|
|
4
|
-
import { WebView } from "react-native-webview";
|
|
5
|
-
import { BASE_CHATBOT_URL } from "./constants";
|
|
6
|
-
import LoadingIndicator from "./LoadingIndicator";
|
|
7
|
-
|
|
8
|
-
interface ChatbotWebviewProps {
|
|
9
|
-
chatbotId: string;
|
|
10
|
-
additionalParams?: Record<string, string>;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const constructUrl = (
|
|
14
|
-
chatbotId: string,
|
|
15
|
-
additionalParams: Record<string, string> = {}
|
|
16
|
-
): string => {
|
|
17
|
-
const params = new URLSearchParams({ id: chatbotId, ...additionalParams });
|
|
18
|
-
return `${BASE_CHATBOT_URL}?${params.toString()}`;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const ChatbotWebview: React.FC<ChatbotWebviewProps> = ({
|
|
22
|
-
chatbotId,
|
|
23
|
-
additionalParams,
|
|
24
|
-
}) => {
|
|
25
|
-
const [url, setUrl] = useState<string>("");
|
|
26
|
-
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
setUrl(constructUrl(chatbotId, additionalParams));
|
|
29
|
-
}, [chatbotId, additionalParams]);
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<View style={{ flex: 1 }}>
|
|
33
|
-
{url ? (
|
|
34
|
-
<WebView
|
|
35
|
-
source={{ uri: url }}
|
|
36
|
-
startInLoadingState={true}
|
|
37
|
-
renderLoading={() => <LoadingIndicator />}
|
|
38
|
-
/>
|
|
39
|
-
) : (
|
|
40
|
-
<LoadingIndicator />
|
|
41
|
-
)}
|
|
42
|
-
</View>
|
|
43
|
-
);
|
|
44
|
-
};
|