From bc37e65b0ca729b30e3826f041f4afe56ce30d5e Mon Sep 17 00:00:00 2001 From: Kasiviswanath Senthilkumar Date: Tue, 6 Aug 2024 18:03:36 +0530 Subject: [PATCH] Release v10.0.0 Release v10.0.0 --- README.md | 20 +- RNZohoSalesIQ.podspec | 43 ++ android/gradle.properties | 5 + android/gradlew | 172 ----- android/gradlew.bat | 84 --- .../reactlibrary/RNZohoSalesIQ.java | 155 +++- babel.config.js | 3 + ios/RNZSIQNotifications.h | 24 + ios/RNZSIQNotifications.m | 33 + ios/RNZohoSalesIQ.h | 12 +- ios/RNZohoSalesIQ.m | 211 ++++-- ios/RNZohoSalesIQ.podspec | 36 - .../project.pbxproj | 260 ------- .../contents.xcworkspacedata | 7 - .../xcshareddata/IDEWorkspaceChecks.plist | 8 - .../UserInterfaceState.xcuserstate | Bin 25940 -> 0 bytes .../xcschemes/xcschememanagement.plist | 14 - .../contents.xcworkspacedata | 9 - package.json | 155 +++- src/commons/ZSIQConstants.ts | 63 ++ src/commons/utils.ts | 21 + src/components/chat/index.ts | 39 + src/components/chat/types/Chat.ts | 130 ++++ src/components/chat/types/Listener.ts | 133 ++++ src/components/chat/types/SalesIQChat.ts | 32 + src/components/chat/types/SalesIQVisitor.ts | 20 + src/components/index.ts | 272 +++++++ .../ios-theme/SIQArticleMessageTheme.ts | 6 + src/components/ios-theme/SIQArticleTheme.ts | 5 + .../ios-theme/SIQAttachmentSheetTheme.ts | 6 + .../ios-theme/SIQAudioPlayerTheme.ts | 10 + .../ios-theme/SIQBannerColorTheme.ts | 4 + src/components/ios-theme/SIQBannerTheme.ts | 7 + src/components/ios-theme/SIQButtonTheme.ts | 4 + src/components/ios-theme/SIQChatFormTheme.ts | 15 + src/components/ios-theme/SIQChatInputTheme.ts | 28 + .../ios-theme/SIQChatScrollButtonTheme.ts | 7 + .../ios-theme/SIQChatWindowTheme.ts | 22 + .../ios-theme/SIQConversationListItemTheme.ts | 15 + .../ios-theme/SIQConversationTheme.ts | 6 + .../ios-theme/SIQEmailTranscriptTheme.ts | 3 + src/components/ios-theme/SIQEmptyViewTheme.ts | 6 + .../ios-theme/SIQFAQBottomBarTheme.ts | 7 + .../ios-theme/SIQFAQListItemTheme.ts | 9 + src/components/ios-theme/SIQFAQTheme.ts | 8 + src/components/ios-theme/SIQFeedbackTheme.ts | 10 + .../ios-theme/SIQFileMessageTheme.ts | 10 + .../ios-theme/SIQHandOffBannerTheme.ts | 5 + .../ios-theme/SIQInAppNotificationTheme.ts | 8 + .../ios-theme/SIQInfoMessageTheme.ts | 4 + src/components/ios-theme/SIQInputCardTheme.ts | 9 + src/components/ios-theme/SIQLauncherTheme.ts | 7 + .../ios-theme/SIQLauncherUnreadBadgeTheme.ts | 6 + src/components/ios-theme/SIQLogViewTheme.ts | 9 + .../ios-theme/SIQMessageCommonTheme.ts | 35 + src/components/ios-theme/SIQMessageTheme.ts | 23 + .../ios-theme/SIQNavigationTheme.ts | 5 + .../ios-theme/SIQNoNetworkBannnerTheme.ts | 5 + .../ios-theme/SIQOfflineBannerTheme.ts | 4 + .../ios-theme/SIQProgressButtonTheme.ts | 4 + .../ios-theme/SIQQueueBannerTheme.ts | 9 + src/components/ios-theme/SIQReplyViewTheme.ts | 8 + .../ios-theme/SIQSelectionComponentTheme.ts | 9 + .../ios-theme/SIQSkipActionButtonTheme.ts | 6 + .../ios-theme/SIQSliderCardTheme.ts | 9 + .../ios-theme/SIQSuggestionTheme.ts | 7 + src/components/ios-theme/SIQTabBarTheme.ts | 5 + src/components/ios-theme/index.ts | 28 + src/components/knowledgebase/index.ts | 68 ++ .../knowledgebase/types/KnowledgeBase.ts | 189 +++++ .../knowledgebase/types/Listener.ts | 32 + .../knowledgebase/types/Resource.ts | 50 ++ src/components/launcher/index.ts | 27 + src/components/launcher/types/Launcher.ts | 56 ++ src/components/launcher/types/Listener.ts | 13 + src/components/logger/index.ts | 26 + src/components/logger/types/Logger.ts | 53 ++ src/components/notification/index.ts | 31 + src/components/notification/types/Listener.ts | 13 + .../notification/types/Notification.ts | 141 ++++ src/index.tsx | 417 +++++++++++ src/types/Listener.ts | 288 ++++++++ src/types/ZSIQWrapperTypes.ts | 679 ++++++++++++++++++ tsconfig.build.json | 4 + tsconfig.json | 28 + turbo.json | 34 + 86 files changed, 3816 insertions(+), 687 deletions(-) create mode 100644 RNZohoSalesIQ.podspec create mode 100644 android/gradle.properties delete mode 100644 android/gradlew delete mode 100644 android/gradlew.bat create mode 100644 babel.config.js create mode 100644 ios/RNZSIQNotifications.h create mode 100644 ios/RNZSIQNotifications.m delete mode 100644 ios/RNZohoSalesIQ.podspec delete mode 100644 ios/RNZohosalesiqMobilisten.xcodeproj/project.pbxproj delete mode 100644 ios/RNZohosalesiqMobilisten.xcodeproj/project.xcworkspace/contents.xcworkspacedata delete mode 100644 ios/RNZohosalesiqMobilisten.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist delete mode 100644 ios/RNZohosalesiqMobilisten.xcodeproj/project.xcworkspace/xcuserdata/rishabh.xcuserdatad/UserInterfaceState.xcuserstate delete mode 100644 ios/RNZohosalesiqMobilisten.xcodeproj/xcuserdata/rishabh.xcuserdatad/xcschemes/xcschememanagement.plist delete mode 100644 ios/RNZohosalesiqMobilisten.xcworkspace/contents.xcworkspacedata create mode 100644 src/commons/ZSIQConstants.ts create mode 100644 src/commons/utils.ts create mode 100644 src/components/chat/index.ts create mode 100644 src/components/chat/types/Chat.ts create mode 100644 src/components/chat/types/Listener.ts create mode 100644 src/components/chat/types/SalesIQChat.ts create mode 100644 src/components/chat/types/SalesIQVisitor.ts create mode 100644 src/components/index.ts create mode 100644 src/components/ios-theme/SIQArticleMessageTheme.ts create mode 100644 src/components/ios-theme/SIQArticleTheme.ts create mode 100644 src/components/ios-theme/SIQAttachmentSheetTheme.ts create mode 100644 src/components/ios-theme/SIQAudioPlayerTheme.ts create mode 100644 src/components/ios-theme/SIQBannerColorTheme.ts create mode 100644 src/components/ios-theme/SIQBannerTheme.ts create mode 100644 src/components/ios-theme/SIQButtonTheme.ts create mode 100644 src/components/ios-theme/SIQChatFormTheme.ts create mode 100644 src/components/ios-theme/SIQChatInputTheme.ts create mode 100644 src/components/ios-theme/SIQChatScrollButtonTheme.ts create mode 100644 src/components/ios-theme/SIQChatWindowTheme.ts create mode 100644 src/components/ios-theme/SIQConversationListItemTheme.ts create mode 100644 src/components/ios-theme/SIQConversationTheme.ts create mode 100644 src/components/ios-theme/SIQEmailTranscriptTheme.ts create mode 100644 src/components/ios-theme/SIQEmptyViewTheme.ts create mode 100644 src/components/ios-theme/SIQFAQBottomBarTheme.ts create mode 100644 src/components/ios-theme/SIQFAQListItemTheme.ts create mode 100644 src/components/ios-theme/SIQFAQTheme.ts create mode 100644 src/components/ios-theme/SIQFeedbackTheme.ts create mode 100644 src/components/ios-theme/SIQFileMessageTheme.ts create mode 100644 src/components/ios-theme/SIQHandOffBannerTheme.ts create mode 100644 src/components/ios-theme/SIQInAppNotificationTheme.ts create mode 100644 src/components/ios-theme/SIQInfoMessageTheme.ts create mode 100644 src/components/ios-theme/SIQInputCardTheme.ts create mode 100644 src/components/ios-theme/SIQLauncherTheme.ts create mode 100644 src/components/ios-theme/SIQLauncherUnreadBadgeTheme.ts create mode 100644 src/components/ios-theme/SIQLogViewTheme.ts create mode 100644 src/components/ios-theme/SIQMessageCommonTheme.ts create mode 100644 src/components/ios-theme/SIQMessageTheme.ts create mode 100644 src/components/ios-theme/SIQNavigationTheme.ts create mode 100644 src/components/ios-theme/SIQNoNetworkBannnerTheme.ts create mode 100644 src/components/ios-theme/SIQOfflineBannerTheme.ts create mode 100644 src/components/ios-theme/SIQProgressButtonTheme.ts create mode 100644 src/components/ios-theme/SIQQueueBannerTheme.ts create mode 100644 src/components/ios-theme/SIQReplyViewTheme.ts create mode 100644 src/components/ios-theme/SIQSelectionComponentTheme.ts create mode 100644 src/components/ios-theme/SIQSkipActionButtonTheme.ts create mode 100644 src/components/ios-theme/SIQSliderCardTheme.ts create mode 100644 src/components/ios-theme/SIQSuggestionTheme.ts create mode 100644 src/components/ios-theme/SIQTabBarTheme.ts create mode 100644 src/components/ios-theme/index.ts create mode 100644 src/components/knowledgebase/index.ts create mode 100644 src/components/knowledgebase/types/KnowledgeBase.ts create mode 100644 src/components/knowledgebase/types/Listener.ts create mode 100644 src/components/knowledgebase/types/Resource.ts create mode 100644 src/components/launcher/index.ts create mode 100644 src/components/launcher/types/Launcher.ts create mode 100644 src/components/launcher/types/Listener.ts create mode 100644 src/components/logger/index.ts create mode 100644 src/components/logger/types/Logger.ts create mode 100644 src/components/notification/index.ts create mode 100644 src/components/notification/types/Listener.ts create mode 100644 src/components/notification/types/Notification.ts create mode 100644 src/index.tsx create mode 100644 src/types/Listener.ts create mode 100644 src/types/ZSIQWrapperTypes.ts create mode 100644 tsconfig.build.json create mode 100644 tsconfig.json create mode 100644 turbo.json diff --git a/README.md b/README.md index 73857f8..d8e786f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![SupportedLanguages](https://img.shields.io/badge/Platforms-iOS%20%7C%20%20Android-green.svg)](https://www.zoho.com/salesiq/help/developer-section/react-native-sdk-installation.html) [![Version](https://img.shields.io/badge/version-9.3.2-blue.svg)](https://mobilisten.io/) [![Mobilisten NPM CD](https://github.com/zoho/SalesIQ-Mobilisten-ReactNative/workflows/Mobilisten%20NPM%20CD/badge.svg)](https://github.com/zoho/SalesIQ-Mobilisten-ReactNative/actions) +[![SupportedLanguages](https://img.shields.io/badge/Platforms-iOS%20%7C%20%20Android-green.svg)](https://www.zoho.com/salesiq/help/developer-section/react-native-sdk-installation.html) [![Version](https://img.shields.io/badge/version-10.0.0-blue.svg)](https://mobilisten.io/) [![Mobilisten NPM CD](https://github.com/zoho/SalesIQ-Mobilisten-ReactNative/workflows/Mobilisten%20NPM%20CD/badge.svg)](https://github.com/zoho/SalesIQ-Mobilisten-ReactNative/actions) # React Native module for SalesIQ Mobilisten SDK @@ -28,15 +28,23 @@ react-native link react-native-zohosalesiq-mobilisten #### Installation steps for iOS -1. Navigate to the `ios` folder in the project directory and open **Podfile**. - Add the "**/ios**" to the path for the `RNZohoSalesIQ` pod as shown below. +1. Navigate to the `ios` folder in the project directory. +2. Run the `pod repo update && pod install` command from the `ios` directory. + +For the RNZohoSalesIQ version below `10.0.0`: + +1. Open your podfile. + +2. Add the "/ios" to the path for the RNZohoSalesIQ pod, as shown below. + ```diff - pod 'RNZohoSalesIQ', :path => '../node_modules/react-native-zohosalesiq-mobilisten' + pod 'RNZohoSalesIQ', :path => '../node_modules/react-native-zohosalesiq-mobilisten/ios' -``` +``` +3. Run `pod install` after saving the changes made to the Podfile. -2. Run the `pod repo update && pod install` command from the `ios` directory. +**Note:** If you're updating from the SDK versions below `10.0.0` to above, remove the above path in your `Podfile` and run the `pod install` in the iOS folder. #### Installation steps for Android @@ -118,7 +126,7 @@ if (Platform.OS === 'ios') { accessKey = "android_access_key"; } -ZohoSalesIQ.initWithCallback(appKey, accessKey, success => { +ZohoSalesIQ.initWithCallback((appKey, accessKey, success) => { // Your code }); ``` diff --git a/RNZohoSalesIQ.podspec b/RNZohoSalesIQ.podspec new file mode 100644 index 0000000..eb1d4a4 --- /dev/null +++ b/RNZohoSalesIQ.podspec @@ -0,0 +1,43 @@ +require "json" + +package = JSON.parse(File.read(File.join(__dir__, "package.json"))) +folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' + +Pod::Spec.new do |s| + s.name = "RNZohoSalesIQ" + s.version = "9.1.1" + s.summary = package["description"] + s.homepage = package["homepage"] + s.license = package["license"] + s.authors = package["author"] + + s.platforms = { :ios => 11.0 } + s.source = { :git => "https://github.com/zoho/SalesIQ-Mobilisten-iOS", :tag => "v#{s.version}" } + + s.source_files = "ios/**/*.{h,m}" + + # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0. + # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79. + if respond_to?(:install_modules_dependencies, true) + install_modules_dependencies(s) + else + s.dependency "React-Core" + + # Don't install the dependencies when we run `pod install` in the old architecture. + if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then + s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1" + s.pod_target_xcconfig = { + "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"", + "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1", + "CLANG_CXX_LANGUAGE_STANDARD" => "c++17" + } + s.dependency "React-Codegen" + s.dependency "RCT-Folly" + s.dependency "RCTRequired" + s.dependency "RCTTypeSafety" + s.dependency "ReactCommon/turbomodule/core" + end + + end + s.dependency "Mobilisten", "#{s.version}" +end diff --git a/android/gradle.properties b/android/gradle.properties new file mode 100644 index 0000000..582bfce --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,5 @@ +ReactNativeZohosalesiqMobilisten_kotlinVersion=1.7.0 +ReactNativeZohosalesiqMobilisten_minSdkVersion=21 +ReactNativeZohosalesiqMobilisten_targetSdkVersion=31 +ReactNativeZohosalesiqMobilisten_compileSdkVersion=31 +ReactNativeZohosalesiqMobilisten_ndkversion=21.4.7075529 diff --git a/android/gradlew b/android/gradlew deleted file mode 100644 index cccdd3d..0000000 --- a/android/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/android/gradlew.bat b/android/gradlew.bat deleted file mode 100644 index e95643d..0000000 --- a/android/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/android/src/main/java/com/zohosalesiq/reactlibrary/RNZohoSalesIQ.java b/android/src/main/java/com/zohosalesiq/reactlibrary/RNZohoSalesIQ.java index a867839..7b546f1 100644 --- a/android/src/main/java/com/zohosalesiq/reactlibrary/RNZohoSalesIQ.java +++ b/android/src/main/java/com/zohosalesiq/reactlibrary/RNZohoSalesIQ.java @@ -30,6 +30,7 @@ import com.facebook.react.bridge.WritableNativeArray; import com.facebook.react.bridge.WritableNativeMap; import com.facebook.react.modules.core.DeviceEventManagerModule; +import com.google.gson.JsonObject; import com.google.gson.reflect.TypeToken; import com.zoho.commons.ChatComponent; import com.zoho.commons.LauncherModes; @@ -78,6 +79,8 @@ import com.zoho.salesiqembed.ZohoSalesIQ; import com.zoho.salesiqembed.ktx.GsonExtensionsKt; +import org.json.JSONObject; + import java.io.ByteArrayOutputStream; import java.lang.reflect.Type; import java.util.ArrayList; @@ -173,6 +176,12 @@ public class RNZohoSalesIQ extends ReactContextBaseJavaModule { private static final String ACTION_SOURCE_APP = "APP"; // No I18N private static final String ACTION_SOURCE_SDK = "SDK"; // No I18N + // Common event names; + private static final String ZSIQ_EVENT_LISTENER = "ZSIQ_EVENT_LISTENER"; // No I18N + private static final String CHAT_EVENT_LISTENER = "CHAT_EVENT_LISTENER"; // No I18N + private static final String KNOWLEDGEBASE_EVENT_LISTENER = "KNOWLEDGEBASE_EVENT_LISTENER"; // No I18N + private static final String NOTIFICATION_EVENT_LISTENER = "NOTIFICATION_EVENT_LISTENER"; // No I18N + private static final String LAUNCHER_EVENT_LISTENER = "LAUNCHER_EVENT_LISTENER"; // No I18N enum Tab { CONVERSATIONS("TAB_CONVERSATIONS"), @@ -256,6 +265,13 @@ public Map getConstants() { constants.put("LAUNCHER_VERTICAL_BOTTOM", LAUNCHER_VERTICAL_BOTTOM); // No I18N constants.put("RESOURCE_ARTICLES", RESOURCE_ARTICLES); // No I18N + + constants.put("CHAT_EVENT_LISTENER", CHAT_EVENT_LISTENER); // No I18N + constants.put("KNOWLEDGEBASE_EVENT_LISTENER", KNOWLEDGEBASE_EVENT_LISTENER); // No I18N + constants.put("NOTIFICATION_EVENT_LISTENER", NOTIFICATION_EVENT_LISTENER); // No I18N + constants.put("LAUNCHER_EVENT_LISTENER", LAUNCHER_EVENT_LISTENER); // No I18N + constants.put("ZSIQ_EVENT_LISTENER", ZSIQ_EVENT_LISTENER); // No I18N + return constants; } @@ -684,9 +700,21 @@ public void openChatWithID(final String chat_id) { } @ReactMethod - public void showPayloadChat(final ReadableMap payload) { - if (payload.hasKey("chatId")) { - String chatId = payload.getString("chatId"); + public void showPayloadChat(final ReadableMap result) { + String chatId; + if (result.hasKey("chatId")) { + chatId = result.getString("chatId"); + } else if (result.hasKey("payload")) { + ReadableMap payload = result.getMap("payload"); // No I18N + if (payload != null && payload.hasKey("chatId")) { + chatId = payload.getString("chatId"); + } else { + chatId = null; + } + } else { + chatId = null; + } + if (chatId != null) { LiveChatUtil.log("Opening payload chat with id: " + chatId); HANDLER.post(() -> ZohoSalesIQ.Chat.open(chatId)); } @@ -809,15 +837,6 @@ public void disableInAppNotification() { HANDLER.post(() -> ZohoSalesIQ.Notification.disableInApp()); } - @ReactMethod - @Deprecated - public void setThemeColorforAndroid(String attribute, String color_code) { - int color = Color.parseColor(color_code); - int r = (color & 0xFF0000) >> 16; - int g = (color & 0xFF00) >> 8; - int b = (color & 0xFF); - } - @ReactMethod public void setThemeColorforiOS(String color_code) { @@ -1430,32 +1449,58 @@ public static WritableMap getVisitorInfoObject(SIQVisitor siqVisitor) { return infoMap; } + public static WritableMap getEventEmitterObjectWithMap(String eventName, ReadableMap body) { + try { + WritableMap eventEmitterObject = new WritableNativeMap(); + eventEmitterObject.putString("event", eventName); // No I18N + eventEmitterObject.putMap("body", body); // No I18N + return eventEmitterObject; + } catch (Exception e) { + return null; + } + } + + public static WritableMap getEventEmitterObjectWithBoolean(String eventName, Boolean body) { + WritableMap eventEmitterObject = new WritableNativeMap(); + eventEmitterObject.putString("event", eventName); // No I18N + eventEmitterObject.putBoolean("body", body); // No I18N + return eventEmitterObject; + } + public static class RNZohoSalesIQListener implements SalesIQListener, SalesIQChatListener, SalesIQKnowledgeBaseListener, SalesIQActionListener, NotificationListener { @Override public void handleFeedback(VisitorChat visitorChat) { WritableMap visitorMap = getChatMapObject(visitorChat); - eventEmitter(EVENT_FEEDBACK_RECEIVED, visitorMap); + eventEmitter(EVENT_FEEDBACK_RECEIVED, visitorMap.copy()); + eventEmitter(CHAT_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_FEEDBACK_RECEIVED, visitorMap)); } @Override public void handleQueuePositionChange(VisitorChat visitorChat) { WritableMap visitorMap = getChatMapObject(visitorChat); - eventEmitter(EVENT_CHAT_QUEUE_POSITION_CHANGED, visitorMap); + eventEmitter(EVENT_CHAT_QUEUE_POSITION_CHANGED, visitorMap.copy()); + eventEmitter(CHAT_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_CHAT_QUEUE_POSITION_CHANGED, visitorMap)); } @Override public void handleRating(VisitorChat visitorChat) { WritableMap visitorMap = getChatMapObject(visitorChat); + eventEmitter(CHAT_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_RATING_RECEIVED, visitorMap.copy())); + // DEPRECATED eventEmitter(EVENT_RATING_RECEIVED, visitorMap); } @Override public void handleOperatorsOnline() { + eventEmitter(ZSIQ_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_OPERATORS_ONLINE, null)); + // DEPRECATED eventEmitter(EVENT_OPERATORS_ONLINE, null); } @Override public void handleOperatorsOffline() { + eventEmitter(ZSIQ_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_OPERATORS_OFFLINE, null)); + // DEPRECATED eventEmitter(EVENT_OPERATORS_OFFLINE, null); } @@ -1464,7 +1509,10 @@ public void handleResourceOpened(@NonNull ZohoSalesIQ.ResourceType resourceType, WritableMap resourceMap = new WritableNativeMap(); resourceMap.putString("type", RESOURCE_ARTICLES); // No I18N resourceMap.putMap("resource", getWritableMap(resource)); // No I18N - eventEmitter(EVENT_RESOURCE_OPENED, resourceMap); + eventEmitter(EVENT_RESOURCE_OPENED, resourceMap.copy()); + + eventEmitter(KNOWLEDGEBASE_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_RESOURCE_OPENED, resourceMap)); + eventEmitter(EVENT_ARTICLE_OPENED, resource != null ? resource.getId() : null); } @@ -1473,7 +1521,9 @@ public void handleResourceClosed(@NonNull ZohoSalesIQ.ResourceType resourceType, WritableMap resourceMap = new WritableNativeMap(); resourceMap.putString("type", RESOURCE_ARTICLES); // No I18N resourceMap.putMap("resource", getWritableMap(resource)); // No I18N - eventEmitter(EVENT_RESOURCE_CLOSED, resourceMap); + eventEmitter(EVENT_RESOURCE_CLOSED, resourceMap.copy()); + + eventEmitter(KNOWLEDGEBASE_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_RESOURCE_CLOSED, resourceMap)); eventEmitter(EVENT_ARTICLE_CLOSED, resource != null ? resource.getId() : null); } @@ -1482,7 +1532,10 @@ public void handleResourceLiked(@NonNull ZohoSalesIQ.ResourceType resourceType, WritableMap resourceMap = new WritableNativeMap(); resourceMap.putString("type", RESOURCE_ARTICLES); // No I18N resourceMap.putMap("resource", getWritableMap(resource)); // No I18N - eventEmitter(EVENT_RESOURCE_LIKED, resourceMap); + eventEmitter(EVENT_RESOURCE_LIKED, resourceMap.copy()); + + eventEmitter(KNOWLEDGEBASE_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_RESOURCE_LIKED, resourceMap)); + eventEmitter(EVENT_ARTICLE_LIKED, resource != null ? resource.getId() : null); } @@ -1491,32 +1544,48 @@ public void handleResourceDisliked(@NonNull ZohoSalesIQ.ResourceType resourceTyp WritableMap resourceMap = new WritableNativeMap(); resourceMap.putString("type", RESOURCE_ARTICLES); // No I18N resourceMap.putMap("resource", getWritableMap(resource)); // No I18N - eventEmitter(EVENT_RESOURCE_DISLIKED, resourceMap); + eventEmitter(EVENT_RESOURCE_DISLIKED, resourceMap.copy()); + eventEmitter(KNOWLEDGEBASE_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_RESOURCE_DISLIKED, resourceMap)); + eventEmitter(EVENT_ARTICLE_DISLIKED, resource != null ? resource.getId() : null); } @Override public void handleSupportOpen() { + eventEmitter(ZSIQ_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_SUPPORT_OPENED, null)); + // DEPRECATED eventEmitter(EVENT_SUPPORT_OPENED, null); } @Override public void handleSupportClose() { + eventEmitter(ZSIQ_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_SUPPORT_CLOSED, null)); + // DEPRECATED eventEmitter(EVENT_SUPPORT_CLOSED, null); } @Override public void handleChatViewOpen(String id) { + WritableMap chatMap = new WritableNativeMap(); + chatMap.putString("id", id); // No I18N + eventEmitter(CHAT_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_CHATVIEW_OPENED, chatMap)); + // DEPRECATED eventEmitter(EVENT_CHATVIEW_OPENED, id); } @Override public void handleChatViewClose(String id) { + WritableMap chatMap = new WritableNativeMap(); + chatMap.putString("id", id); // No I18N + eventEmitter(CHAT_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_CHATVIEW_CLOSED, chatMap)); + // DEPRECATED eventEmitter(EVENT_CHATVIEW_CLOSED, id); } @Override public void handleIPBlock() { + eventEmitter(ZSIQ_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_VISITOR_IPBLOCKED, null)); + // DEPRECATED eventEmitter(EVENT_VISITOR_IPBLOCKED, null); } @@ -1526,46 +1595,65 @@ public void handleTrigger(String triggerName, SIQVisitor visitor) { WritableMap triggerMap = new WritableNativeMap(); triggerMap.putString("triggerName", triggerName); // No I18N triggerMap.putMap("visitorInformation", visitorInfoMap); // No I18N + + eventEmitter(CHAT_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_CUSTOMTRIGGER, triggerMap.copy())); + + // DEPRECATED eventEmitter(EVENT_CUSTOMTRIGGER, triggerMap); } @Override public void handleBotTrigger() { + eventEmitter(CHAT_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_BOT_TRIGGER, null)); eventEmitter(EVENT_BOT_TRIGGER, null); } @Override public void handleCustomLauncherVisibility(boolean visible) { + WritableMap launcherMap = new WritableNativeMap(); + launcherMap.putBoolean("visible", visible); // No I18N + eventEmitter(LAUNCHER_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_HANDLE_CUSTOM_LAUNCHER_VISIBILITY, launcherMap)); + // DEPRECATED eventEmitter(EVENT_HANDLE_CUSTOM_LAUNCHER_VISIBILITY, visible); } @Override public void handleChatOpened(VisitorChat visitorChat) { WritableMap visitorMap = getChatMapObject(visitorChat); + eventEmitter(CHAT_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_CHAT_OPENED, visitorMap.copy())); + // DEPRECATED eventEmitter(EVENT_CHAT_OPENED, visitorMap); } @Override public void handleChatClosed(VisitorChat visitorChat) { WritableMap visitorMap = getChatMapObject(visitorChat); + eventEmitter(CHAT_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_CHAT_CLOSED, visitorMap.copy())); + eventEmitter(EVENT_CHAT_CLOSED, visitorMap); } @Override public void handleChatAttended(VisitorChat visitorChat) { WritableMap visitorMap = getChatMapObject(visitorChat); + eventEmitter(CHAT_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_CHAT_ATTENDED, visitorMap.copy())); + eventEmitter(EVENT_CHAT_ATTENDED, visitorMap); } @Override public void handleChatMissed(VisitorChat visitorChat) { WritableMap visitorMap = getChatMapObject(visitorChat); + eventEmitter(CHAT_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_CHAT_MISSED, visitorMap.copy())); + eventEmitter(EVENT_CHAT_MISSED, visitorMap); } @Override public void handleChatReOpened(VisitorChat visitorChat) { WritableMap visitorMap = getChatMapObject(visitorChat); + eventEmitter(CHAT_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_CHAT_REOPENED, visitorMap.copy())); + eventEmitter(EVENT_CHAT_REOPENED, visitorMap); } @@ -1584,18 +1672,29 @@ public void handleCustomAction( actionDetailsMap.putString("clientActionName", salesIQCustomAction.clientActionName); // No I18N actionsList.put(uuid.toString(), salesIQCustomActionListener); - eventEmitter(EVENT_PERFORM_CHATACTION, actionDetailsMap); + // DEPRECATED + eventEmitter(EVENT_PERFORM_CHATACTION, actionDetailsMap.copy()); + eventEmitter(CHAT_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_PERFORM_CHATACTION, actionDetailsMap)); } @Override public void onBadgeChange(int count) { + WritableMap countMap = new WritableNativeMap(); + countMap.putInt("count", count); // No I18N + eventEmitter(CHAT_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_CHAT_UNREAD_COUNT_CHANGED, countMap)); + eventEmitter(EVENT_CHAT_UNREAD_COUNT_CHANGED, count); } @Override public void onClick(@Nullable Context context, @NonNull SalesIQNotificationPayload payload) { LiveChatUtil.log("NotificationListener onClick Received"); - eventEmitter(EVENT_NOTIFICATION_CLICKED, getNotificationPayloadMap(payload)); + WritableMap notificationPayloadMap = getNotificationPayloadMap(payload); + if (notificationPayloadMap != null) { + eventEmitter(EVENT_NOTIFICATION_CLICKED, notificationPayloadMap.copy()); + + eventEmitter(NOTIFICATION_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_NOTIFICATION_CLICKED, notificationPayloadMap)); + } if (SalesIQActivitiesManager.getInstance().isActivityStackEmpty(true)) { Intent intent = null; if (context != null) { @@ -1615,9 +1714,14 @@ public void onClick(@Nullable Context context, @NonNull SalesIQNotificationPaylo @Override public boolean handleUri(final Uri uri, final VisitorChat visitorChat) { - WritableMap visitorMap = getChatMapObject(visitorChat); - visitorMap.putString("url", uri.toString()); // No I18N - eventEmitter(EVENT_HANDLE_URL, visitorMap); + WritableMap visitorChatMap = getChatMapObject(visitorChat); + WritableMap chatMap = new WritableNativeMap(); + chatMap.putMap("chat", visitorChatMap.copy()); // No I18N + chatMap.putString("url", uri.toString()); // No I18N + eventEmitter(CHAT_EVENT_LISTENER, getEventEmitterObjectWithMap(EVENT_HANDLE_URL, chatMap)); + // DEPRECATED + visitorChatMap.putString("url", uri.toString()); // No I18N + eventEmitter(EVENT_HANDLE_URL, visitorChatMap); return shouldOpenUrl; } } @@ -1938,6 +2042,11 @@ public void onFailure(int code, @Nullable String message) { })); } + @ReactMethod + public void setThemeColor(final ReadableMap theme) { + + } + static WritableArray getWritableArray(Object object) { WritableNativeArray finalWritableNativeArray = new WritableNativeArray(); if (object != null) { diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 0000000..7f606b9 --- /dev/null +++ b/babel.config.js @@ -0,0 +1,3 @@ +module.exports = { + presets: ['module:@react-native/babel-preset'] // No I18N +}; diff --git a/ios/RNZSIQNotifications.h b/ios/RNZSIQNotifications.h new file mode 100644 index 0000000..dc30788 --- /dev/null +++ b/ios/RNZSIQNotifications.h @@ -0,0 +1,24 @@ +// +// RNZSIQNotifications.h +// RNZohoSalesIQ +// +// Created by Kishore Kumar A on 17/06/24. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface RNZSIQNotifications : NSObject + +typedef void (^RNZohoSalesIQRemoteNotificationCallback)(UIBackgroundFetchResult result); + ++ (void)enablePush:(NSString *)token isTestDevice:(BOOL)isTestDevice isProductionMode:(BOOL)isProductionMode; ++ (void)processNotificationWithInfo: (NSDictionary *) info; ++ (BOOL)isMobilistenNotification:(NSDictionary *)info; ++ (void)handleNotificationAction: (NSDictionary *) info response:(NSString *) response; ++ (void)didReceiveNotification:(NSDictionary *)notification fetchCompletionHandler:(RNZohoSalesIQRemoteNotificationCallback)completionHandler; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/RNZSIQNotifications.m b/ios/RNZSIQNotifications.m new file mode 100644 index 0000000..41579c0 --- /dev/null +++ b/ios/RNZSIQNotifications.m @@ -0,0 +1,33 @@ +// +// RNZSIQNotifications.m +// RNZohoSalesIQ +// +// Created by Kishore Kumar A on 17/06/24. +// + +#import "RNZSIQNotifications.h" +#import "RNZohoSalesIQ.h" + +@implementation RNZSIQNotifications + ++ (void)enablePush:(NSString *)token isTestDevice:(BOOL)isTestDevice isProductionMode:(BOOL)isProductionMode { + [RNZohoSalesIQ enablePush:token isTestDevice:isTestDevice isProductionMode:isProductionMode]; +} + ++ (void)processNotificationWithInfo:(NSDictionary *)info { + [RNZohoSalesIQ processNotificationWithInfo:info]; +} + ++ (BOOL)isMobilistenNotification:(NSDictionary *)info { + return [RNZohoSalesIQ isMobilistenNotification:info]; +} + ++ (void)handleNotificationAction:(NSDictionary *)info response:(NSString *)response { + [RNZohoSalesIQ handleNotificationAction:info response:response]; +} + ++ (void)didReceiveNotification:(NSDictionary *)notification fetchCompletionHandler:(RNZohoSalesIQRemoteNotificationCallback)completionHandler { + [RNZohoSalesIQ didReceiveNotification:notification fetchCompletionHandler:completionHandler]; +} + +@end diff --git a/ios/RNZohoSalesIQ.h b/ios/RNZohoSalesIQ.h index fe86ad2..9c035a3 100644 --- a/ios/RNZohoSalesIQ.h +++ b/ios/RNZohoSalesIQ.h @@ -12,19 +12,19 @@ #import #endif -@interface RNZohoSalesIQ : RCTEventEmitter +@interface RNZohoSalesIQ : RCTEventEmitter @property (nonatomic, strong) NSMutableDictionary *remoteNotificationCallbacks; typedef void (^RNZohoSalesIQRemoteNotificationCallback)(UIBackgroundFetchResult result); -+ (void)enablePush:(NSString *)token isTestDevice:(BOOL)isTestDevice isProductionMode:(BOOL)isProductionMode; -+ (void)processNotificationWithInfo: (NSDictionary *) info; -+ (BOOL)isMobilistenNotification:(NSDictionary *)info; -+ (void)handleNotificationAction: (NSDictionary *) info response:(NSString *) response; ++ (void)enablePush:(NSString *)token isTestDevice:(BOOL)isTestDevice isProductionMode:(BOOL)isProductionMode __attribute__ ((deprecated("This method is deprecated. Use [RNZSIQNotifications enablePush] instead."))); ++ (void)processNotificationWithInfo: (NSDictionary *) info __attribute__ ((deprecated("This method is deprecated. Use [RNZSIQNotifications processNotificationWithInfo] instead."))); ++ (BOOL)isMobilistenNotification:(NSDictionary *)info __attribute__ ((deprecated("This method is deprecated. Use [RNZSIQNotifications isMobilistenNotification] instead."))); ++ (void)handleNotificationAction: (NSDictionary *) info response:(NSString *) response __attribute__ ((deprecated("This method is deprecated. Use [RNZSIQNotifications handleNotificationAction] instead."))); + (NSMutableDictionary *)getFAQCategoryObject: (SIQFAQCategory*) category; + (NSMutableDictionary *)getFAQArticleObject: (SIQFAQArticle*) article; + (NSMutableDictionary *)getChatObject: (SIQVisitorChat*) chat; -+ (void)didReceiveNotification:(NSDictionary *)notification fetchCompletionHandler:(RNZohoSalesIQRemoteNotificationCallback)completionHandler; ++ (void)didReceiveNotification:(NSDictionary *)notification fetchCompletionHandler:(RNZohoSalesIQRemoteNotificationCallback)completionHandler __attribute__ ((deprecated("This method is deprecated. Use [RNZSIQNotifications didReceiveNotification] instead."))); @end diff --git a/ios/RNZohoSalesIQ.m b/ios/RNZohoSalesIQ.m index 64d16e8..49d2fee 100644 --- a/ios/RNZohoSalesIQ.m +++ b/ios/RNZohoSalesIQ.m @@ -23,6 +23,13 @@ - (void)sendEventName:(NSString *)eventName body:(id)body { } } ++ (NSDictionary *)getEventEmitterObject: (NSString *)eventName body:(id)body { + return @{ + @"event": eventName, + @"body": body + }; +} + RCT_EXPORT_METHOD(init:(NSString *)appKey accessKey:(NSString *)accessKey){ [ZohoSalesIQ setPlatformWithPlatform:@"ReactNative"]; [ZohoSalesIQ initWithAppKey:appKey accessKey:accessKey authProvider:NULL completion:^(id _Nullable error) { @@ -76,34 +83,34 @@ -(void)stopObserving { //MARK:- EVENT TYPES NSMutableDictionary *actionDictionary; -NSString *OPERATORS_OFFLINE = @"OPERATORS_OFFLINE"; -NSString *OPERATORS_ONLINE = @"OPERATORS_ONLINE"; -NSString *CHATVIEW_CLOSED = @"CHATVIEW_CLOSED"; -NSString *CHATVIEW_OPENED = @"CHATVIEW_OPENED"; +NSString *OPERATORS_OFFLINE = @"EVENT_OPERATORS_OFFLINE"; +NSString *OPERATORS_ONLINE = @"EVENT_OPERATORS_ONLINE"; +NSString *CHATVIEW_CLOSED = @"EVENT_CHATVIEW_CLOSED"; +NSString *CHATVIEW_OPENED = @"EVENT_CHATVIEW_OPENED"; NSString *HOMEVIEW_CLOSED = @"HOMEVIEW_CLOSED"; NSString *HOMEVIEW_OPENED = @"HOMEVIEW_OPENED"; -NSString *SUPPORT_OPENED = @"SUPPORT_OPENED"; -NSString *SUPPORT_CLOSED = @"SUPPORT_CLOSED"; +NSString *SUPPORT_OPENED = @"EVENT_SUPPORT_OPENED"; +NSString *SUPPORT_CLOSED = @"EVENT_SUPPORT_CLOSED"; NSString *ARTICLE_OPENED = @"ARTICLE_OPENED"; NSString *ARTICLE_CLOSED = @"ARTICLE_CLOSED"; NSString *ARTICLE_LIKED = @"ARTICLE_LIKED"; NSString *ARTICLE_DISLIKED = @"ARTICLE_DISLIKED"; -NSString *CHAT_ATTENDED = @"CHAT_ATTENDED"; -NSString *CHAT_CLOSED = @"CHAT_CLOSED"; -NSString *FEEDBACK_RECEIVED = @"FEEDBACK_RECEIVED"; -NSString *CHAT_MISSED = @"CHAT_MISSED"; -NSString *CHAT_OPENED = @"CHAT_OPENED"; -NSString *RATING_RECEIVED = @"RATING_RECEIVED"; -NSString *CHAT_REOPENED = @"CHAT_REOPENED"; -NSString *CHAT_QUEUE_POSITION_CHANGED = @"CHAT_QUEUE_POSITION_CHANGED"; -NSString *CHAT_UNREAD_COUNT_CHANGED = @"CHAT_UNREAD_COUNT_CHANGED"; -NSString *PERFORM_CHATACTION = @"PERFORM_CHATACTION"; - -NSString *VISITOR_IPBLOCKED = @"VISITOR_IPBLOCKED"; -NSString *CUSTOMTRIGGER = @"CUSTOMTRIGGER"; -NSString *BOT_TRIGGER = @"BOT_TRIGGER"; +NSString *CHAT_ATTENDED = @"EVENT_CHAT_ATTENDED"; +NSString *CHAT_CLOSED = @"EVENT_CHAT_CLOSED"; +NSString *FEEDBACK_RECEIVED = @"EVENT_FEEDBACK_RECEIVED"; +NSString *CHAT_MISSED = @"EVENT_CHAT_MISSED"; +NSString *CHAT_OPENED = @"EVENT_CHAT_OPENED"; +NSString *RATING_RECEIVED = @"EVENT_RATING_RECEIVED"; +NSString *CHAT_REOPENED = @"EVENT_CHAT_REOPENED"; +NSString *CHAT_QUEUE_POSITION_CHANGED = @"EVENT_CHAT_QUEUE_POSITION_CHANGED"; +NSString *CHAT_UNREAD_COUNT_CHANGED = @"EVENT_CHAT_UNREAD_COUNT_CHANGED"; +NSString *PERFORM_CHATACTION = @"EVENT_PERFORM_CHATACTION"; + +NSString *VISITOR_IPBLOCKED = @"EVENT_VISITOR_IPBLOCKED"; +NSString *CUSTOMTRIGGER = @"EVENT_CUSTOMTRIGGER"; +NSString *BOT_TRIGGER = @"EVENT_BOT_TRIGGER"; //MARK:- CHAT TYPES NSString *TYPE_OPEN = @"OPEN"; @@ -144,6 +151,13 @@ -(void)stopObserving { NSString *EVENT_NOTIFICATION_CLICKED = @"EVENT_NOTIFICATION_CLICKED"; +// Common Listeners +NSString *ZSIQ_EVENT_LISTENER = @"ZSIQ_EVENT_LISTENER"; +NSString *CHAT_EVENT_LISTENER = @"CHAT_EVENT_LISTENER"; +NSString *KNOWLEDGEBASE_EVENT_LISTENER = @"KNOWLEDGEBASE_EVENT_LISTENER"; +NSString *NOTIFICATION_EVENT_LISTENER = @"NOTIFICATION_EVENT_LISTENER"; +NSString *LAUNCHER_EVENT_LISTENER = @"LAUNCHER_EVENT_LISTENER"; + - (NSArray *)supportedEvents { return @[OPERATORS_OFFLINE, OPERATORS_ONLINE, @@ -190,7 +204,12 @@ -(void)stopObserving { EVENT_HANDLE_CUSTOM_LAUNCHER_VISIBILITY, ACTION_SOURCE_APP, ACTION_SOURCE_SDK, - EVENT_NOTIFICATION_CLICKED]; + EVENT_NOTIFICATION_CLICKED, + CHAT_EVENT_LISTENER, + KNOWLEDGEBASE_EVENT_LISTENER, + LAUNCHER_EVENT_LISTENER, + ZSIQ_EVENT_LISTENER, + NOTIFICATION_EVENT_LISTENER]; } - (NSDictionary *) constantsToExport { @@ -249,6 +268,11 @@ - (NSDictionary *) constantsToExport { @"ACTION_SOURCE_APP" : ACTION_SOURCE_APP, @"ACTION_SOURCE_SDK" : ACTION_SOURCE_SDK, @"EVENT_NOTIFICATION_CLICKED" : EVENT_NOTIFICATION_CLICKED, + @"CHAT_EVENT_LISTENER" : CHAT_EVENT_LISTENER, + @"KNOWLEDGEBASE_EVENT_LISTENER" : KNOWLEDGEBASE_EVENT_LISTENER, + @"NOTIFICATION_EVENT_LISTENER" : NOTIFICATION_EVENT_LISTENER, + @"LAUNCHER_EVENT_LISTENER": LAUNCHER_EVENT_LISTENER, + @"ZSIQ_EVENT_LISTENER": ZSIQ_EVENT_LISTENER }; } @@ -998,9 +1022,6 @@ + (void)handleNotificationAction: (NSDictionary *) info response:(NSString *) re RCT_EXPORT_METHOD(setOperatorEmail: (NSString *)email){ [[ZohoSalesIQ Chat] setAgentEmail:email]; } -RCT_EXPORT_METHOD(setThemeColorforAndroid: (NSString *)attribute color_code:(NSString *)color_code){ - // No Implementation -} RCT_EXPORT_METHOD(setThemeForAndroid: (NSString *)attribute){ // No Implementation @@ -1297,9 +1318,9 @@ + (void)handleNotificationAction: (NSDictionary *) info response:(NSString *) re [[ZohoSalesIQ Chat] showWithReferenceID:id new:NO]; } -RCT_EXPORT_METHOD(showPayloadChat: (NSDictionary *)payload) { - NSString *type = payload[@"type"]; - NSDictionary *payloadData = payload[@"payload"]; +RCT_EXPORT_METHOD(showPayloadChat: (NSDictionary *) result) { + NSString *type = result[@"type"]; + NSDictionary *payloadData = result[@"payload"]; if ([type isEqualToString:@"chat"]) { SalesIQChatNotificationPayload *chatObject = [[SalesIQChatNotificationPayload alloc] initWithDictionary:payloadData]; @@ -1307,7 +1328,19 @@ + (void)handleNotificationAction: (NSDictionary *) info response:(NSString *) re } else if ([type isEqualToString:@"endChatDetails"]) { SalesIQEndChatNotificationPayload *endChatObject = [[SalesIQEndChatNotificationPayload alloc] initWithDictionary:payloadData]; [[ZohoSalesIQ Chat] openWith:endChatObject]; + } else { + SalesIQChatNotificationPayload *chatObject = [[SalesIQChatNotificationPayload alloc] initWithDictionary:result]; + if (chatObject.messageUID != nil) { + [[ZohoSalesIQ Chat] openWith:chatObject]; + } else { + SalesIQEndChatNotificationPayload *endChatObject = [[SalesIQEndChatNotificationPayload alloc] initWithDictionary:result]; + if (endChatObject != nil) { + [[ZohoSalesIQ Chat] openWith:endChatObject]; + } + } + } + } RCT_EXPORT_METHOD(openNewChat){ @@ -1468,7 +1501,11 @@ + (void)handleNotificationAction: (NSDictionary *) info response:(NSString *) re SIQChatAction *chatAction = [[SIQChatAction alloc] initWithName:actionName action:^(SIQChatActionArguments * _Nonnull arguments, SIQActionHandler * _Nonnull handler) { NSString *uuid = [[NSUUID UUID] UUIDString]; [actionDictionary setObject:handler forKey:uuid]; - [self sendEventWithName:PERFORM_CHATACTION body: [RNZohoSalesIQ getChatActionArguments:arguments withID:uuid actionName:actionName]]; + NSMutableDictionary *eventResponse = [RNZohoSalesIQ getChatActionArguments:arguments withID:uuid actionName:actionName]; + [self sendEventWithName:CHAT_EVENT_LISTENER body: [RNZohoSalesIQ getEventEmitterObject:PERFORM_CHATACTION body: eventResponse]]; + + // DEPRECATED + [self sendEventWithName:PERFORM_CHATACTION body: eventResponse]; }]; [[ZohoSalesIQ ChatActions] registerWithAction:chatAction]; @@ -1727,9 +1764,9 @@ + (void)handleNotificationAction: (NSDictionary *) info response:(NSString *) re NSNumber *succeeded = [NSNumber numberWithBool:success]; if (error != nil) { NSMutableDictionary *errorDictionary = [RNZohoSalesIQ getSIQErrorObject:error]; - callback(@[succeeded, errorDictionary]); + callback(@[errorDictionary, succeeded]); } else { - callback(@[succeeded, [NSNull null]]); + callback(@[[NSNull null], succeeded]); } }]; } @@ -1888,23 +1925,35 @@ - (NSMutableDictionary *)getNotificationActionPayload:(id)payload { //MARK:- DELEGATE METHODS - EVENTS - (void)agentsOffline { - if (hasSIQEventListener) - [self sendEventWithName:OPERATORS_OFFLINE body:[NSNull null]]; + if (hasSIQEventListener) { + [self sendEventWithName:ZSIQ_EVENT_LISTENER body: [RNZohoSalesIQ getEventEmitterObject:OPERATORS_OFFLINE body: [NSNull null]]]; + // DEPRECATED + [self sendEventWithName:OPERATORS_OFFLINE body: [NSNull null]]; + } } - (void)agentsOnline { - if (hasSIQEventListener) + if (hasSIQEventListener) { + [self sendEventWithName:ZSIQ_EVENT_LISTENER body: [RNZohoSalesIQ getEventEmitterObject:OPERATORS_ONLINE body: [NSNull null]]]; + // DEPRECATED [self sendEventWithName:OPERATORS_ONLINE body:[NSNull null]]; + } } - (void)chatViewClosedWithId:(NSString * _Nullable)id { - if (hasSIQEventListener) + if (hasSIQEventListener) { + [self sendEventWithName:CHAT_EVENT_LISTENER body: [RNZohoSalesIQ getEventEmitterObject:CHATVIEW_CLOSED body: @{ @"id": id ? id : [NSNull null] }]]; + // DEPRECATED [self sendEventWithName:CHATVIEW_CLOSED body:id]; + } } - (void)chatViewOpenedWithId:(NSString * _Nullable)id { - if (hasSIQEventListener) + if (hasSIQEventListener) { + [self sendEventWithName:CHAT_EVENT_LISTENER body: [RNZohoSalesIQ getEventEmitterObject:CHATVIEW_OPENED body: @{ @"id": id ? id : [NSNull null] }]]; + // DEPRECATED [self sendEventWithName:CHATVIEW_OPENED body:id]; + } } - (void)homeViewClosed { @@ -1918,13 +1967,19 @@ - (void)homeViewOpened { } - (void)supportClosed { - if (hasSIQEventListener) + if (hasSIQEventListener) { + [self sendEventWithName:ZSIQ_EVENT_LISTENER body: [RNZohoSalesIQ getEventEmitterObject:SUPPORT_CLOSED body: [NSNull null]]]; + // DEPRECATED [self sendEventWithName:SUPPORT_CLOSED body:[NSNull null]]; + } } - (void)supportOpened { - if (hasSIQEventListener) + if (hasSIQEventListener) { + [self sendEventWithName:ZSIQ_EVENT_LISTENER body: [RNZohoSalesIQ getEventEmitterObject:SUPPORT_OPENED body: [NSNull null]]]; + // DEPRECATED [self sendEventWithName:SUPPORT_OPENED body:[NSNull null]]; + } } - (void)articleClosedWithId:(NSString * _Nullable)id { @@ -1948,58 +2003,100 @@ - (void)articleOpenedWithId:(NSString * _Nullable)id { } - (void)chatAttendedWithChat:(SIQVisitorChat * _Nullable)chat { - if (hasSIQEventListener) + if (hasSIQEventListener) { + [self sendEventWithName:CHAT_EVENT_LISTENER body: [RNZohoSalesIQ getEventEmitterObject:CHAT_ATTENDED body: [RNZohoSalesIQ getChatObject:chat]]]; + + // DEPRECATED [self sendEventWithName:CHAT_ATTENDED body: [RNZohoSalesIQ getChatObject:chat]]; + } } - (void)chatClosedWithChat:(SIQVisitorChat * _Nullable)chat { - if (hasSIQEventListener) + if (hasSIQEventListener) { + [self sendEventWithName:CHAT_EVENT_LISTENER body: [RNZohoSalesIQ getEventEmitterObject:CHAT_CLOSED body: [RNZohoSalesIQ getChatObject:chat]]]; + + // DEPRECATED [self sendEventWithName:CHAT_CLOSED body: [RNZohoSalesIQ getChatObject:chat]]; + } } - (void)chatFeedbackRecievedWithChat:(SIQVisitorChat * _Nullable)chat { - if (hasSIQEventListener) + if (hasSIQEventListener) { + [self sendEventWithName:CHAT_EVENT_LISTENER body: [RNZohoSalesIQ getEventEmitterObject:FEEDBACK_RECEIVED body: [RNZohoSalesIQ getChatObject:chat]]]; + + // DEPRECATED [self sendEventWithName:FEEDBACK_RECEIVED body: [RNZohoSalesIQ getChatObject:chat]]; + } } - (void)chatMissedWithChat:(SIQVisitorChat * _Nullable)chat { - if (hasSIQEventListener) + if (hasSIQEventListener) { + [self sendEventWithName:CHAT_EVENT_LISTENER body: [RNZohoSalesIQ getEventEmitterObject:CHAT_MISSED body: [RNZohoSalesIQ getChatObject:chat]]]; + + // DEPRECATED [self sendEventWithName:CHAT_MISSED body: [RNZohoSalesIQ getChatObject:chat]]; + } } - (void)chatOpenedWithChat:(SIQVisitorChat * _Nullable)chat { - if (hasSIQEventListener) + if (hasSIQEventListener) { + [self sendEventWithName:CHAT_EVENT_LISTENER body: [RNZohoSalesIQ getEventEmitterObject:CHAT_OPENED body: [RNZohoSalesIQ getChatObject:chat]]]; + + // DEPRECATED [self sendEventWithName:CHAT_OPENED body: [RNZohoSalesIQ getChatObject:chat]]; + } } - (void)chatQueuePositionChangedWithChat:(SIQVisitorChat *)chat { - if (hasSIQEventListener) + if (hasSIQEventListener) { + [self sendEventWithName:CHAT_EVENT_LISTENER body: [RNZohoSalesIQ getEventEmitterObject:CHAT_QUEUE_POSITION_CHANGED body: [RNZohoSalesIQ getChatObject:chat]]]; + + // DEPRECATED [self sendEventWithName:CHAT_QUEUE_POSITION_CHANGED body: [RNZohoSalesIQ getChatObject:chat]]; + } } - (void)chatRatingRecievedWithChat:(SIQVisitorChat * _Nullable)chat { - if (hasSIQEventListener) + if (hasSIQEventListener) { + [self sendEventWithName:CHAT_EVENT_LISTENER body: [RNZohoSalesIQ getEventEmitterObject:RATING_RECEIVED body: [RNZohoSalesIQ getChatObject:chat]]]; + + // DEPRECATED [self sendEventWithName:RATING_RECEIVED body: [RNZohoSalesIQ getChatObject:chat]]; + } } - (void)chatReopenedWithChat:(SIQVisitorChat * _Nullable)chat { - if (hasSIQEventListener) + if (hasSIQEventListener) { + [self sendEventWithName:CHAT_EVENT_LISTENER body: [RNZohoSalesIQ getEventEmitterObject:CHAT_REOPENED body: [RNZohoSalesIQ getChatObject:chat]]]; + + // DEPRECATED [self sendEventWithName:CHAT_REOPENED body: [RNZohoSalesIQ getChatObject:chat]]; + } } - (void)unreadCountChanged:(NSInteger)count { - if (hasSIQEventListener) + if (hasSIQEventListener) { + [self sendEventWithName:CHAT_EVENT_LISTENER body: [RNZohoSalesIQ getEventEmitterObject:CHAT_UNREAD_COUNT_CHANGED body: @{ @"count": @(count) }]]; + + // DEPRECATED [self sendEventWithName:CHAT_UNREAD_COUNT_CHANGED body: @(count)]; + } } - (void)visitorIPBlocked { - if (hasSIQEventListener) - [self sendEventWithName:VISITOR_IPBLOCKED body:[NSNull null]]; + if (hasSIQEventListener) { + [self sendEventWithName:ZSIQ_EVENT_LISTENER body: [RNZohoSalesIQ getEventEmitterObject:VISITOR_IPBLOCKED body: [NSNull null]]]; + // DEPRECATED + [self sendEventWithName:VISITOR_IPBLOCKED body: [NSNull null]]; + } } - (BOOL)shouldOpenURL:(NSURL *)url in:(SIQVisitorChat * _Nullable)chat { NSMutableDictionary *chatDict = [NSMutableDictionary dictionary]; chatDict = [RNZohoSalesIQ getChatObject:chat]; + [self sendEventWithName:CHAT_EVENT_LISTENER body:[RNZohoSalesIQ getEventEmitterObject:EVENT_HANDLE_URL body: @{ @"chat": chatDict, @"url": url.absoluteString }]]; + + // DEPRECATED [chatDict setObject:url.absoluteString forKey:@"url"]; [self sendEventWithName:EVENT_HANDLE_URL body: chatDict]; return handleURI; @@ -2020,19 +2117,25 @@ - (void) handleTriggerWithName:(NSString *)name visitorInformation:(SIQVisitor * [triggerInformation setObject:name forKey:@"triggerName"]; } + [self sendEventWithName:CHAT_EVENT_LISTENER body: [RNZohoSalesIQ getEventEmitterObject:CUSTOMTRIGGER body: triggerInformation]]; + [self sendEventWithName:CUSTOMTRIGGER body: triggerInformation]; } } - (void)handleBotTrigger { - if (hasSIQEventListener) + if (hasSIQEventListener) { + [self sendEventWithName:CHAT_EVENT_LISTENER body: [RNZohoSalesIQ getEventEmitterObject:BOT_TRIGGER body:[NSNull null]]]; [self sendEventWithName:BOT_TRIGGER body:[NSNull null]]; + } } - (void)handleResourceOpened:(enum SIQResourceType)type resource:(SIQKnowledgeBaseResource * _Nullable)resource { if (hasSIQEventListener) { NSMutableDictionary *resourceInformation = [self prepareResourceInformation:type resource:resource]; + [self sendEventWithName:KNOWLEDGEBASE_EVENT_LISTENER body: [RNZohoSalesIQ getEventEmitterObject:EVENT_RESOURCE_OPENED body: resourceInformation]]; + [self sendEventWithName:EVENT_RESOURCE_OPENED body: resourceInformation]; } } @@ -2040,6 +2143,8 @@ - (void)handleResourceOpened:(enum SIQResourceType)type resource:(SIQKnowledgeBa - (void)handleResourceClosed:(enum SIQResourceType)type resource:(SIQKnowledgeBaseResource * _Nullable)resource { if (hasSIQEventListener) { NSMutableDictionary *resourceInformation = [self prepareResourceInformation:type resource:resource]; + [self sendEventWithName:KNOWLEDGEBASE_EVENT_LISTENER body: [RNZohoSalesIQ getEventEmitterObject:EVENT_RESOURCE_CLOSED body: resourceInformation]]; + [self sendEventWithName:EVENT_RESOURCE_CLOSED body: resourceInformation]; } } @@ -2048,6 +2153,8 @@ - (void)handleResourceClosed:(enum SIQResourceType)type resource:(SIQKnowledgeBa - (void)handleResourceLiked:(enum SIQResourceType)type resource:(SIQKnowledgeBaseResource * _Nullable)resource { if (hasSIQEventListener) { NSMutableDictionary *resourceInformation = [self prepareResourceInformation:type resource:resource]; + [self sendEventWithName:KNOWLEDGEBASE_EVENT_LISTENER body: [RNZohoSalesIQ getEventEmitterObject:EVENT_RESOURCE_LIKED body: resourceInformation]]; + [self sendEventWithName:EVENT_RESOURCE_LIKED body: resourceInformation]; } } @@ -2055,6 +2162,8 @@ - (void)handleResourceLiked:(enum SIQResourceType)type resource:(SIQKnowledgeBas - (void)handleResourceDisliked:(enum SIQResourceType)type resource:(SIQKnowledgeBaseResource * _Nullable)resource { if (hasSIQEventListener) { NSMutableDictionary *resourceInformation = [self prepareResourceInformation:type resource:resource]; + [self sendEventWithName:KNOWLEDGEBASE_EVENT_LISTENER body: [RNZohoSalesIQ getEventEmitterObject:EVENT_RESOURCE_DISLIKED body: resourceInformation]]; + [self sendEventWithName:EVENT_RESOURCE_DISLIKED body: resourceInformation]; } } @@ -2062,6 +2171,7 @@ - (void)handleResourceDisliked:(enum SIQResourceType)type resource:(SIQKnowledge - (void)handleCustomLauncherVisibility:(BOOL)visible { if (hasSIQEventListener) { NSNumber *visibleLauncher = [NSNumber numberWithBool:visible]; + [self sendEventWithName:LAUNCHER_EVENT_LISTENER body: [RNZohoSalesIQ getEventEmitterObject:EVENT_HANDLE_CUSTOM_LAUNCHER_VISIBILITY body: @{ @"visible": visibleLauncher }]]; [self sendEventWithName:EVENT_HANDLE_CUSTOM_LAUNCHER_VISIBILITY body: visibleLauncher]; } } @@ -2069,6 +2179,9 @@ - (void)handleCustomLauncherVisibility:(BOOL)visible { - (void)handleNotificationAction:(SalesIQNotificationPayload *)payload { if (hasSIQEventListener) { NSMutableDictionary *resultMap = [self getNotificationActionPayload:payload]; + [self sendEventWithName:NOTIFICATION_EVENT_LISTENER body:[RNZohoSalesIQ getEventEmitterObject:EVENT_NOTIFICATION_CLICKED body:resultMap]]; + + // DEPRECATED [self sendEventWithName:EVENT_NOTIFICATION_CLICKED body: resultMap]; } } diff --git a/ios/RNZohoSalesIQ.podspec b/ios/RNZohoSalesIQ.podspec deleted file mode 100644 index f03141e..0000000 --- a/ios/RNZohoSalesIQ.podspec +++ /dev/null @@ -1,36 +0,0 @@ -Pod::Spec.new do |s| - s.name = "RNZohoSalesIQ" - s.version = "9.1.0" - s.summary = "A React-Native module for the SalesIQ Mobilisten SDK" - s.description = "A React-Native module for the SalesIQ Mobilisten SDK" - s.homepage = "https://zoho.com" - s.license = { :type => "MIT", :text=> <<-LICENSE - MIT License - Copyright (c) 2021 Zoho Corporation - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE - LICENSE - } - s.author = { "Rishabh Raghunath" => "rishabh.r@zohocorp.com" } - s.platform = :ios, "11.0" - s.source = { :git => "https://github.com/zoho/SalesIQ-Mobilisten-iOS", :tag => "v#{s.version}" } - s.source_files = "*.{h,m}" - s.requires_arc = true - - s.dependency "React" - s.dependency "Mobilisten", "#{s.version}" - -end diff --git a/ios/RNZohosalesiqMobilisten.xcodeproj/project.pbxproj b/ios/RNZohosalesiqMobilisten.xcodeproj/project.pbxproj deleted file mode 100644 index 5ef05a3..0000000 --- a/ios/RNZohosalesiqMobilisten.xcodeproj/project.pbxproj +++ /dev/null @@ -1,260 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - B3E7B58A1CC2AC0600A0062D /* RNZohoSalesIQ.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNZohoSalesIQ.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 58B511D91A9E6C8500147676 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "include/$(PRODUCT_NAME)"; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 134814201AA4EA6300B7C361 /* libRNZohosalesiqMobilisten.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNZohosalesiqMobilisten.a; sourceTree = BUILT_PRODUCTS_DIR; }; - B3E7B5881CC2AC0600A0062D /* RNZohoSalesIQ.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNZohoSalesIQ.h; sourceTree = ""; }; - B3E7B5891CC2AC0600A0062D /* RNZohoSalesIQ.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNZohoSalesIQ.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 58B511D81A9E6C8500147676 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 134814211AA4EA7D00B7C361 /* Products */ = { - isa = PBXGroup; - children = ( - 134814201AA4EA6300B7C361 /* libRNZohosalesiqMobilisten.a */, - ); - name = Products; - sourceTree = ""; - }; - 58B511D21A9E6C8500147676 = { - isa = PBXGroup; - children = ( - B3E7B5881CC2AC0600A0062D /* RNZohoSalesIQ.h */, - B3E7B5891CC2AC0600A0062D /* RNZohoSalesIQ.m */, - 134814211AA4EA7D00B7C361 /* Products */, - ); - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 58B511DA1A9E6C8500147676 /* RNZohosalesiqMobilisten */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNZohosalesiqMobilisten" */; - buildPhases = ( - 58B511D71A9E6C8500147676 /* Sources */, - 58B511D81A9E6C8500147676 /* Frameworks */, - 58B511D91A9E6C8500147676 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RNZohosalesiqMobilisten; - productName = RCTDataManager; - productReference = 134814201AA4EA6300B7C361 /* libRNZohosalesiqMobilisten.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511D31A9E6C8500147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0830; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 58B511DA1A9E6C8500147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNZohosalesiqMobilisten" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - English, - en, - ); - mainGroup = 58B511D21A9E6C8500147676; - productRefGroup = 58B511D21A9E6C8500147676; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 58B511DA1A9E6C8500147676 /* RNZohosalesiqMobilisten */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 58B511D71A9E6C8500147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - B3E7B58A1CC2AC0600A0062D /* RNZohoSalesIQ.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 58B511ED1A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 58B511EE1A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 58B511F01A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/../../../React/**", - "$(SRCROOT)/../../react-native/React/**", - ); - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RNZohosalesiqMobilisten; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - 58B511F11A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/../../../React/**", - "$(SRCROOT)/../../react-native/React/**", - ); - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RNZohosalesiqMobilisten; - SKIP_INSTALL = YES; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNZohosalesiqMobilisten" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511ED1A9E6C8500147676 /* Debug */, - 58B511EE1A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNZohosalesiqMobilisten" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511F01A9E6C8500147676 /* Debug */, - 58B511F11A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511D31A9E6C8500147676 /* Project object */; -} diff --git a/ios/RNZohosalesiqMobilisten.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/RNZohosalesiqMobilisten.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a..0000000 --- a/ios/RNZohosalesiqMobilisten.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/ios/RNZohosalesiqMobilisten.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/RNZohosalesiqMobilisten.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d9810..0000000 --- a/ios/RNZohosalesiqMobilisten.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/ios/RNZohosalesiqMobilisten.xcodeproj/project.xcworkspace/xcuserdata/rishabh.xcuserdatad/UserInterfaceState.xcuserstate b/ios/RNZohosalesiqMobilisten.xcodeproj/project.xcworkspace/xcuserdata/rishabh.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 1d4467d0dceca49a5c86588f1f4a0123100325aa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 25940 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 NqO2Yh;j`rY{{gs(bd3N2 diff --git a/ios/RNZohosalesiqMobilisten.xcodeproj/xcuserdata/rishabh.xcuserdatad/xcschemes/xcschememanagement.plist b/ios/RNZohosalesiqMobilisten.xcodeproj/xcuserdata/rishabh.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 3f0aefb..0000000 --- a/ios/RNZohosalesiqMobilisten.xcodeproj/xcuserdata/rishabh.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - SchemeUserState - - RNZohosalesiqMobilisten.xcscheme_^#shared#^_ - - orderHint - 0 - - - - diff --git a/ios/RNZohosalesiqMobilisten.xcworkspace/contents.xcworkspacedata b/ios/RNZohosalesiqMobilisten.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 0848320..0000000 --- a/ios/RNZohosalesiqMobilisten.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,9 +0,0 @@ -// !$*UTF8*$! - - - - - - \ No newline at end of file diff --git a/package.json b/package.json index 0146169..17c760d 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,34 @@ { "name": "react-native-zohosalesiq-mobilisten", - "version": "9.3.2", + "version": "10.0.0", "description": "A React Native module for the ZohoSalesIQ Mobilisten SDK", - "bugs": { - "email": "support@zohosalesiq.com" - }, - "main": "index.js", - "peerDependencies": { - "react-native": ">=0.41.2" - }, - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/zoho/SalesIQ-Mobilisten-ReactNative.git" + "main": "lib/commonjs/index", + "module": "lib/module/index", + "types": "lib/typescript/src/index.d.ts", + "files": [ + "lib", + "android", + "ios", + "cpp", + "*.podspec", + "!ios/build", + "!android/build", + "!android/gradle", + "!android/gradlew", + "!android/gradlew.bat", + "!android/local.properties", + "!**/__tests__", + "!**/__fixtures__", + "!**/__mocks__", + "!**/.*" + ], + "scripts": { + "test": "jest", + "typecheck": "tsc --noEmit", + "lint": "eslint \"**/*.{js,ts,tsx}\"", + "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib", + "prepare": "bob build", + "release": "release-it" }, "keywords": [ "mobilisten", @@ -23,5 +39,118 @@ "chat", "chat sdk", "sdk" - ] + ], + "repository": { + "type": "git", + "url": "https://github.com/zoho/SalesIQ-Mobilisten-ReactNative.git" + }, + "author": "Rishabh Raghunath ", + "license": "MIT", + "bugs": { + "email": "support@zohosalesiq.com" + }, + "homepage": "https://www.zoho.com/salesiq/", + "publishConfig": { + "registry": "https://registry.npmjs.org/" + }, + "devDependencies": { + "@commitlint/config-conventional": "^17.0.2", + "@evilmartians/lefthook": "^1.5.0", + "@react-native/eslint-config": "^0.73.1", + "@release-it/conventional-changelog": "^5.0.0", + "@types/jest": "^29.5.5", + "@types/react": "^18.2.44", + "commitlint": "^17.0.2", + "del-cli": "^5.1.0", + "eslint": "^8.51.0", + "eslint-config-prettier": "^9.0.0", + "eslint-plugin-prettier": "^5.0.1", + "jest": "^29.7.0", + "prettier": "^3.0.3", + "react": "18.2.0", + "react-native": "0.74.2", + "react-native-builder-bob": "^0.20.0", + "release-it": "^15.0.0", + "turbo": "^1.10.7", + "typescript": "^5.2.2" + }, + "resolutions": { + "@types/react": "^18.2.44" + }, + "peerDependencies": { + "react-native": ">=0.41.2" + }, + "jest": { + "preset": "react-native", + "modulePathIgnorePatterns": [ + "/example/node_modules", + "/lib/" + ] + }, + "commitlint": { + "extends": [ + "@commitlint/config-conventional" + ] + }, + "release-it": { + "git": { + "commitMessage": "chore: release ${version}", + "tagName": "v${version}" + }, + "npm": { + "publish": true + }, + "github": { + "release": true + }, + "plugins": { + "@release-it/conventional-changelog": { + "preset": "angular" + } + } + }, + "eslintConfig": { + "root": true, + "extends": [ + "@react-native", + "prettier" + ], + "rules": { + "prettier/prettier": [ + "error", + { + "quoteProps": "consistent", + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "es5", + "useTabs": false + } + ] + } + }, + "eslintIgnore": [ + "node_modules/", + "lib/" + ], + "prettier": { + "quoteProps": "consistent", + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "es5", + "useTabs": false + }, + "react-native-builder-bob": { + "source": "src", + "output": "lib", + "targets": [ + "commonjs", + "module", + [ + "typescript", + { + "project": "tsconfig.build.json" + } + ] + ] + } } diff --git a/src/commons/ZSIQConstants.ts b/src/commons/ZSIQConstants.ts new file mode 100644 index 0000000..938078f --- /dev/null +++ b/src/commons/ZSIQConstants.ts @@ -0,0 +1,63 @@ +import { ResourceType } from '../components/knowledgebase/types/KnowledgeBase'; +import { ZSIQTabs } from '../types/Listener'; +import RNZohoSalesIQ from './utils'; + +export const ZSIQListenerEvents = { + EVENT_SUPPORT_OPENED: RNZohoSalesIQ.SUPPORT_OPENED, + EVENT_SUPPORT_CLOSED: RNZohoSalesIQ.SUPPORT_CLOSED, + EVENT_VISITOR_IPBLOCKED: RNZohoSalesIQ.VISITOR_IPBLOCKED, + EVENT_OPERATORS_ONLINE: RNZohoSalesIQ.OPERATORS_ONLINE, + EVENT_OPERATORS_OFFLINE: RNZohoSalesIQ.OPERATORS_OFFLINE, + + EVENT_CHATVIEW_OPENED: RNZohoSalesIQ.CHATVIEW_OPENED, + EVENT_CHATVIEW_CLOSED: RNZohoSalesIQ.CHATVIEW_CLOSED, + EVENT_CHAT_OPENED: RNZohoSalesIQ.CHAT_OPENED, + EVENT_CHAT_CLOSED: RNZohoSalesIQ.CHAT_CLOSED, + EVENT_CHAT_REOPENED: RNZohoSalesIQ.CHAT_REOPENED, + EVENT_CHAT_ATTENDED: RNZohoSalesIQ.CHAT_ATTENDED, + EVENT_CHAT_MISSED: RNZohoSalesIQ.CHAT_MISSED, + EVENT_CHAT_QUEUE_POSITION_CHANGED: RNZohoSalesIQ.CHAT_QUEUE_POSITION_CHANGED, + EVENT_CHAT_UNREAD_COUNT_CHANGED: RNZohoSalesIQ.CHAT_UNREAD_COUNT_CHANGED, + EVENT_FEEDBACK_RECEIVED: RNZohoSalesIQ.FEEDBACK_RECEIVED, + EVENT_RATING_RECEIVED: RNZohoSalesIQ.RATING_RECEIVED, + + EVENT_ARTICLE_LIKED: RNZohoSalesIQ.ARTICLE_LIKED, + EVENT_ARTICLE_DISLIKED: RNZohoSalesIQ.ARTICLE_DISLIKED, + EVENT_ARTICLE_OPENED: RNZohoSalesIQ.ARTICLE_OPENED, + EVENT_ARTICLE_CLOSED: RNZohoSalesIQ.ARTICLE_CLOSED, + EVENT_PERFORM_CHATACTION: RNZohoSalesIQ.PERFORM_CHATACTION, + EVENT_CUSTOMTRIGGER: RNZohoSalesIQ.CUSTOMTRIGGER, + EVENT_BOT_TRIGGER: RNZohoSalesIQ.BOT_TRIGGER, + EVENT_HANDLE_URL: RNZohoSalesIQ.EVENT_HANDLE_URL, + + EVENT_RESOURCE_OPENED: RNZohoSalesIQ.EVENT_RESOURCE_OPENED, + EVENT_RESOURCE_CLOSED: RNZohoSalesIQ.EVENT_RESOURCE_CLOSED, + EVENT_RESOURCE_LIKED: RNZohoSalesIQ.EVENT_RESOURCE_LIKED, + EVENT_RESOURCE_DISLIKED: RNZohoSalesIQ.EVENT_RESOURCE_DISLIKED, + + EVENT_HANDLE_CUSTOM_LAUNCHER_VISIBILITY: + RNZohoSalesIQ.EVENT_HANDLE_CUSTOM_LAUNCHER_VISIBILITY, + + EVENT_NOTIFICATION_CLICKED: RNZohoSalesIQ.EVENT_NOTIFICATION_CLICKED, +}; + +export const ZSIQConstants = { + ...ZSIQListenerEvents, + + Tab: ZSIQTabs, + TYPE_OPEN: RNZohoSalesIQ.TYPE_OPEN, + TYPE_WAITING: RNZohoSalesIQ.TYPE_WAITING, + TYPE_CONNECTED: RNZohoSalesIQ.TYPE_CONNECTED, + TYPE_ENDED: RNZohoSalesIQ.TYPE_ENDED, + TYPE_CLOSED: RNZohoSalesIQ.TYPE_CLOSED, + TYPE_MISSED: RNZohoSalesIQ.TYPE_MISSED, + // DEPRECATED + LAUNCHER_MODE_STATIC: RNZohoSalesIQ.LAUNCHER_MODE_STATIC, + // DEPRECATED + LAUNCHER_MODE_FLOATING: RNZohoSalesIQ.LAUNCHER_MODE_FLOATING, + ActionSource: { + APP: RNZohoSalesIQ.ACTION_SOURCE_APP, + SDK: RNZohoSalesIQ.ACTION_SOURCE_SDK, + }, + Resource: ResourceType, +}; diff --git a/src/commons/utils.ts b/src/commons/utils.ts new file mode 100644 index 0000000..34f80a9 --- /dev/null +++ b/src/commons/utils.ts @@ -0,0 +1,21 @@ +import { Platform, NativeModules, NativeEventEmitter } from "react-native"; + +const LINKING_ERROR = + `The package 'react-native-zohosalesiq-mobilisten' doesn't seem to be linked. Make sure: \n\n` + + Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) + + `- You rebuilt the app after following installation steps in our documentation(${"https://www.zoho.com/salesiq/help/developer-section/react-native-sdk-installation.html"}).` + +const RNZohoSalesIQ = NativeModules.RNZohoSalesIQ + ? NativeModules.RNZohoSalesIQ + : new Proxy( + {}, + { + get() { + throw new Error(LINKING_ERROR); + }, + } + ); + +export const RNZohoSalesIQEmitter = new NativeEventEmitter(RNZohoSalesIQ); + +export default RNZohoSalesIQ; \ No newline at end of file diff --git a/src/components/chat/index.ts b/src/components/chat/index.ts new file mode 100644 index 0000000..e7d34f1 --- /dev/null +++ b/src/components/chat/index.ts @@ -0,0 +1,39 @@ +import RNZohoSalesIQ, { RNZohoSalesIQEmitter } from '../../commons/utils'; +import type { ChatTypes } from './types/Chat'; +import {ChatListenerEvent} from './types/Listener'; + +export const ZSIQChats = { + Chat: { + shouldOpenUrl: function (value) { + RNZohoSalesIQ.shouldOpenUrl(value); + }, + showFeedbackAfterSkip: function (enable) { + RNZohoSalesIQ.showFeedbackAfterSkip(enable); + }, + showFeedback: function (durationInSec) { + RNZohoSalesIQ.showFeedbackUpToDuration(durationInSec); + }, + hideQueueTime: function (value) { + RNZohoSalesIQ.hideQueueTime(value); + }, + open: function (map = {}) { + RNZohoSalesIQ.showPayloadChat(map); + }, + start: function (question, customChatId = null, departmentName = null, callback = () => { }) { + RNZohoSalesIQ.startNewChat(question, customChatId, departmentName, callback); + }, + startWithTrigger: function (customChatId = null, departmentName = null, callback = () => { }) { + RNZohoSalesIQ.startNewChatWithTrigger(customChatId, departmentName, callback); + }, + setWaitingTime: function (seconds) { + RNZohoSalesIQ.setChatWaitingTime(seconds); + }, + get: function (chatId, callback) { + RNZohoSalesIQ.getChat(chatId, callback); + }, + addListener: function (callback) { + RNZohoSalesIQEmitter.addListener("CHAT_EVENT_LISTENER", callback); + }, + Event: ChatListenerEvent + }, +} as ChatTypes; diff --git a/src/components/chat/types/Chat.ts b/src/components/chat/types/Chat.ts new file mode 100644 index 0000000..eb8290f --- /dev/null +++ b/src/components/chat/types/Chat.ts @@ -0,0 +1,130 @@ +import type { ZSIQNotificationTypes } from './../../notification/types/Notification'; +import type { ZSIQListenerEventsType } from './../../../types/Listener'; +import type { ZSIQWrapperTypes } from './../../../types/ZSIQWrapperTypes'; +import type { CallbackError } from '../../../types/ZSIQWrapperTypes'; +import type { SalesIQChat } from './SalesIQChat'; +import type { ChatNotificationPayloadType, EndChatDetailsNotificationPayload, VisitorHistoryNotificationPayloadType, ZSIQNotificationPayloadResult } from '../../notification/types/Notification'; +import type { ChatListenerEvent } from './Listener'; +import type { ChatListeners } from './Listener'; + +type OpenChatPayload = + | ChatNotificationPayloadType["payload"] + | VisitorHistoryNotificationPayloadType["payload"] + | EndChatDetailsNotificationPayload["payload"] | ZSIQNotificationPayloadResult; + +export interface ChatTypes { + Chat: { + /** + * This API is used to handle URL-related actions inside Mobilisten. + * + * By default, clicking on a URL will redirect to the specific URL. But if you want further control over the URL, like sending a notification after the visitor clicks on the URL or performing any custom actions, you can use this API. + * + * To handle the URL behavior, the value inside the shouldOpenUrl() API must be false. i.e., ```ZohoSalesIQ.Chat.shouldOpenUrl(false)```, then the default action will not be executed. Now you can use the API {@link ZSIQWrapperTypes.sendEvent ZohoSalesIQ.sendEvent} to open the URL. + * + * Note: Only when `shouldOpenUrl` is *false*, the action block in {@link ZSIQListenerEventsType.EVENT_HANDLE_URL ZohoSalesIQ.EVENT_HANDLE_URL} event listener will be executed on clicking the URL. + * @param open + * @returns + * + * @see {@link https://www.zoho.com/salesiq/help/developer-section/react-native-sdk-should-open-URL.html} + */ + shouldOpenUrl: (open: boolean) => void; + + /** + * This API allows managing the duration of the feedback card for 24 hours after the chat ends. + * @param enable - boolean + * + * @see + * - *true* - `(Default)` The feedback card will be displayed permanently. + * - *false* - The feedback card will displayed for 24 hours until feedback is given. + * @returns + */ + showFeedbackAfterSkip: (enable: boolean) => void; + + /** + * + * @param durationInSec + * @returns + */ + showFeedback: (durationInSec: number) => void; + + /** + * This API is used to control the visibility of the estimated wait time in the chat window when connecting to an operator. Setting it to true hides the chat queue time while setting it to false displays it. + * @param value + * @returns + */ + hideQueueTime: (value: boolean) => void; + + /** + * This API is used to open the SDK UI based on the data provided in the notification payload. + * + * @param map - The data payload obtained from the {@link ZSIQNotificationTypes.Notification getPayload} API containing information required to identify and open SDK UI. + * @returns + * + * @see {@link https://www.zoho.com/salesiq/help/developer-section/react-native-sdk-chat-open.html} + */ + open: (map: OpenChatPayload) => void; + + /** + * + * @param question + * @param customChatId + * @param departmentName + * @param callback + * @returns + */ + start: ( + question: string, + customChatId: string | null, + departmentName: string | null, + callback?: (error: CallbackError, result: SalesIQChat | null) => void + ) => void; + + /** + * + * @param customChatId + * @param departmentName + * @param callback + * @returns + */ + startWithTrigger: ( + customChatId: string | null, + departmentName: string | null, + callback?: (error: CallbackError, result: SalesIQChat | null) => void + ) => void; + + /** + * + * @param seconds + * @returns + */ + setWaitingTime: (seconds: number) => void; + + /** + * This API retrieves chat details for the specified chat ID. + * @param chatId + * @param callback + * @returns + */ + get: ( + chatId: string, + callback: (error: CallbackError, result: SalesIQChat | null) => void + ) => void; + + /** + * This listener provides an interface for various chat event callbacks to help developers track different chat-related actions like open, close performed by the app user. The {@link ChatTypes ZohoSalesIQ.Chat.addListener} invokes callback methods for various chat actions performed by the visitors. + * + * {@link SalesIQChat VisitorChat} object returned in the callback will hold the properties mentioned in the following {@link https://www.zoho.com/salesiq/help/developer-guides/android-Chat-v4-2-0.html link}. The method returns an instance of the Visitor Chat class, which contains information related to the chat. + * @param callback + * @returns + */ + addListener: ( + callback: (callbackData: ChatListeners) => void + ) => void; + + Event: typeof ChatListenerEvent + }; +} + +export type _ZSIQListenerEventsType = ZSIQListenerEventsType; +export type _ZSIQWrapperTypes = ZSIQWrapperTypes; +export type _ZSIQNotificationTypes = ZSIQNotificationTypes; \ No newline at end of file diff --git a/src/components/chat/types/Listener.ts b/src/components/chat/types/Listener.ts new file mode 100644 index 0000000..f7833a8 --- /dev/null +++ b/src/components/chat/types/Listener.ts @@ -0,0 +1,133 @@ +import type { SalesIQChat } from './SalesIQChat'; + +interface ChatAction { + uuid: string; + elementID: string; + label: string; + name: string; + clientActionName: string; +} + +interface CommonChatEventPayload { + event: + | ChatListenerEvent.CHAT_OPENED + | ChatListenerEvent.CHAT_ATTENDED + | ChatListenerEvent.CHAT_CLOSED + | ChatListenerEvent.FEEDBACK_RECEIVED + | ChatListenerEvent.CHAT_MISSED + | ChatListenerEvent.CHAT_QUEUE_POSITION_CHANGED + | ChatListenerEvent.RATING_RECEIVED + | ChatListenerEvent.CHAT_REOPENED; + body: SalesIQChat; +} + +interface ChatViewEventPayload { + event: ChatListenerEvent.CHAT_VIEW_CLOSED | ChatListenerEvent.CHAT_VIEW_OPENED; + body: { id?: string }; +} + +export type ChatListeners = + | CommonChatEventPayload + | { + event: ChatListenerEvent.CHAT_UNREAD_COUNT_CHANGED; + body: { count: number }; + } + | { event: ChatListenerEvent.PERFORM_CHATACTION; body: ChatAction } + | { + event: ChatListenerEvent.CUSTOM_TRIGGER; + body: { + triggerName: string; + visitorInformation: SalesIQChat; + }; + } + | { + event: ChatListenerEvent.BOT_TRIGGER; + body?: null; + } + | ChatViewEventPayload + | { + event: ChatListenerEvent.HANDLE_URL; + body: { + url: string; + chat: SalesIQChat; + }; + }; + +export enum ChatListenerEvent { + /** + * Invoked when a chat is picked up. + */ + CHAT_ATTENDED = 'EVENT_CHAT_ATTENDED', + + /** + * Invoked when a chat is ended. + */ + CHAT_CLOSED = 'EVENT_CHAT_CLOSED', + + /** + * Invoked when feedback is given by the visitor. + */ + FEEDBACK_RECEIVED = 'EVENT_FEEDBACK_RECEIVED', + + /** + * Invoked when a chat is missed. + */ + CHAT_MISSED = 'EVENT_CHAT_MISSED', + + /** + * Invoked when a chat is initiated. + */ + CHAT_OPENED = 'EVENT_CHAT_OPENED', + + /** + * Invoked when the position in the queue of a queued chat changes. + */ + CHAT_QUEUE_POSITION_CHANGED = 'EVENT_CHAT_QUEUE_POSITION_CHANGED', + + /** + * Invoked when a chat is rated by the visitor. + */ + RATING_RECEIVED = 'EVENT_RATING_RECEIVED', + + /** + * Invoked when a chat is reopened. + */ + CHAT_REOPENED = 'EVENT_CHAT_REOPENED', + + /** + * Invoked when the unread count is changed. + */ + CHAT_UNREAD_COUNT_CHANGED = 'EVENT_CHAT_UNREAD_COUNT_CHANGED', + + /** + * Invoked when a URL in the chat is clicked. + */ + HANDLE_URL = 'EVENT_HANDLE_URL', + + /** + * Invoked when a chat action is to be executed. {@link https://www.zoho.com/salesiq/help/developer-section/react-native-sdk-chatactions-v2.html Learn More} + */ + PERFORM_CHATACTION = 'EVENT_PERFORM_CHATACTION', + + /** + * Invoked when a chat window is closed. + */ + CHAT_VIEW_CLOSED = 'EVENT_CHATVIEW_CLOSED', + + /** + * Invoked when a chat window is opened. + */ + CHAT_VIEW_OPENED = 'EVENT_CHATVIEW_OPENED', + + /** + * Invoked when a custom trigger is executed. {@link http://www.zoho.com/salesiq/help/developer-section/react-native-sdk-custom-trigger.html Learn More} + */ + CUSTOM_TRIGGER = 'EVENT_CUSTOMTRIGGER', + + /** + * Invoked when a bot has been triggered. + * + * Note: Android only + */ + BOT_TRIGGER = 'EVENT_BOT_TRIGGER', +} \ No newline at end of file diff --git a/src/components/chat/types/SalesIQChat.ts b/src/components/chat/types/SalesIQChat.ts new file mode 100644 index 0000000..f82adec --- /dev/null +++ b/src/components/chat/types/SalesIQChat.ts @@ -0,0 +1,32 @@ +type ChatStatus = "WAITING" | "CONNECTED" | "MISSED" | "CLOSED" | "WAITING" | "TRIGGERED" | "PROACTIVE"; + +export interface SalesIQChat { + id?: string; + unreadCount?: number; + isBotAttender?: boolean; + queuePosition?: number; + question?: string; + departmentName?: string; + status?: ChatStatus; + lastMessage?: string; + lastMessageSender?: string; + lastMessageTime?: string; + recentMessage?: { + text?: string; + sender?: string; + time?: string; + is_read?: string; + file?: { + name?: string; + content_type?: string; + comment?: string; + size?: string; + + } + }; + attenderName?: string; + attenderID?: string; + attenderEmail?: string; + feedback?: string; + rating?: string; +} \ No newline at end of file diff --git a/src/components/chat/types/SalesIQVisitor.ts b/src/components/chat/types/SalesIQVisitor.ts new file mode 100644 index 0000000..0062342 --- /dev/null +++ b/src/components/chat/types/SalesIQVisitor.ts @@ -0,0 +1,20 @@ +export interface SalesIQVisitor { + name?: string; + email?: string; + phone?: string; + numberOfChats?: string; + city?: string; + state?: string; + region?: string; + countryCode?: string; + ip?: string; + firstVisitTime?: string; + lastVisitTime?: string; + os?: string; + browser?: string; + totalTimeSpent?: string; + numberOfVisits?: string; + noOfDaysVisited?: string; + searchEngine?: string; + searchQuery?: string; +} diff --git a/src/components/index.ts b/src/components/index.ts new file mode 100644 index 0000000..c54620f --- /dev/null +++ b/src/components/index.ts @@ -0,0 +1,272 @@ +import type { + ZSIQWrapperTypes, +} from '../types/ZSIQWrapperTypes'; +import { Dimensions, Platform, NativeEventEmitter } from 'react-native'; //No I18N +import RNZohoSalesIQ, { RNZohoSalesIQEmitter } from '../commons/utils'; +import { + ListenerEvent, + type ZSIQConstantsTypes, + type ZSIQListenerEventsType, +} from '../types/Listener'; +import { ZSIQConstants } from '../commons/ZSIQConstants'; +import { ZSIQChats } from './chat'; +import { ZSIQNotification } from './notification'; +import { ZSIQLauncher } from './launcher'; +import { ZSIQKnowledgeBase } from './knowledgebase'; +import type { ZSIQNotificationTypes } from './notification/types/Notification'; +import type { ZSIQLoggerTypes } from './logger/types/Logger'; +import type { ZSIQKnowledgeBaseTypes } from './knowledgebase/types/KnowledgeBase'; +import type { ZSIQLauncherTypes } from './launcher/types/Launcher'; +import type { ChatTypes } from './chat/types/Chat'; +import { ZSIQLogger } from './logger'; + +const emitter = new NativeEventEmitter(RNZohoSalesIQ); + +export const ZSIQWrapper = { + ...ZSIQConstants, + init: function (appKey, accessKey) { + RNZohoSalesIQ.init(appKey, accessKey); + }, + initWithCallback: function (appKey, accessKey, callback) { + RNZohoSalesIQ.initWithCallback(appKey, accessKey, callback); + }, + present: function (tab = null, id = null, callback = () => {}) { + RNZohoSalesIQ.present(tab, id, callback); + }, + setChatTitle: function (title) { + RNZohoSalesIQ.setChatTitle(title); + }, + setLanguage: function (languageCode) { + RNZohoSalesIQ.setLanguage(languageCode); + }, + setDepartment: function (departmentName) { + RNZohoSalesIQ.setDepartment(departmentName); + }, + setOperatorEmail: function (operatorMailID) { + RNZohoSalesIQ.setOperatorEmail(operatorMailID); + }, + showOperatorImageInChat: function (show) { + RNZohoSalesIQ.showOperatorImageInChat(show); + }, + setFeedbackVisibility: function (visibility) { + RNZohoSalesIQ.setFeedbackVisibility(visibility); + }, + setRatingVisibility: function (visibility) { + RNZohoSalesIQ.setRatingVisibility(visibility); + }, + showOperatorImageInLauncher: function (show) { + RNZohoSalesIQ.showOperatorImageInLauncher(show); + }, + openChat: function () { + RNZohoSalesIQ.openChat(); + }, + openChatWithID: function (id) { + RNZohoSalesIQ.openChatWithID(id); + }, + showOfflineMessage: function (show) { + RNZohoSalesIQ.showOfflineMessage(show); + }, + endChat: function (id) { + RNZohoSalesIQ.endChat(id); + }, + getChats: function (callback) { + RNZohoSalesIQ.getChats(callback); + }, + getChatsWithFilter: function (filter, callback) { + RNZohoSalesIQ.getChatsWithFilter(filter, callback); + }, + setLauncherVisibility: function (visibility) { + RNZohoSalesIQ.setLauncherVisibility(visibility); + }, + setVisitorName: function (name) { + RNZohoSalesIQ.setVisitorName(name); + }, + setVisitorEmail: function (email) { + RNZohoSalesIQ.setVisitorEmail(email); + }, + setVisitorContactNumber: function (number) { + RNZohoSalesIQ.setVisitorContactNumber(number); + }, + setVisitorAddInfo: function (key, value) { + RNZohoSalesIQ.setVisitorAddInfo(key, value); + }, + setQuestion: function (question) { + RNZohoSalesIQ.setQuestion(question); + }, + startChat: function (message) { + RNZohoSalesIQ.startChat(message); + }, + setConversationVisibility: function (visibility) { + RNZohoSalesIQ.setConversationVisibility(visibility); + }, + setConversationListTitle: function (title) { + RNZohoSalesIQ.setConversationListTitle(title); + }, + setFAQVisibility: function (visibility) { + RNZohoSalesIQ.setFAQVisibility(visibility); + }, + getArticles: function (callback) { + RNZohoSalesIQ.getArticles(callback); + }, + getArticlesWithCategoryID: function (id, callback) { + RNZohoSalesIQ.getArticlesWithCategoryID(id, callback); + }, + getCategories: function (callback) { + RNZohoSalesIQ.getCategories(callback); + }, + openArticle: function (id, callback) { + RNZohoSalesIQ.openArticle(id, callback); + }, + fetchAttenderImage: function (atttenderId, fetchDefaultImage, callback) { + RNZohoSalesIQ.fetchAttenderImage(atttenderId, fetchDefaultImage, callback); + }, + registerVisitor: function (visitorId, callback) { + RNZohoSalesIQ.registerVisitor(visitorId, callback); + }, + setThemeColorforiOS: function (colorCode) { + RNZohoSalesIQ.setThemeColorforiOS(colorCode); + }, + setVisitorNameVisibility: function (visible) { + RNZohoSalesIQ.setVisitorNameVisibility(visible); + }, + enablePreChatForms: function () { + RNZohoSalesIQ.enablePreChatForms(); + }, + disablePreChatForms: function () { + RNZohoSalesIQ.disablePreChatForms(); + }, + enableScreenshotOption: function () { + RNZohoSalesIQ.enableScreenshotOption(); + }, + disableScreenshotOption: function () { + RNZohoSalesIQ.disableScreenshotOption(); + }, + enableInAppNotification: function () { + RNZohoSalesIQ.enableInAppNotification(); + }, + disableInAppNotification: function () { + RNZohoSalesIQ.disableInAppNotification(); + }, + unregisterVisitor: function (callback = () => {}) { + RNZohoSalesIQ.unregisterVisitor(callback); + }, + setPageTitle: function (title) { + RNZohoSalesIQ.setPageTitle(title); + }, + setCustomAction: function (actionName) { + RNZohoSalesIQ.setCustomAction(actionName); + }, + performCustomAction: function (actionName, shouldOpenChatWindow = false) { + RNZohoSalesIQ.performCustomAction(actionName, shouldOpenChatWindow); + }, + registerChatAction: function (chatActionName) { + RNZohoSalesIQ.registerChatAction(chatActionName); + }, + unregisterChatAction: function (chatActionName) { + RNZohoSalesIQ.unregisterChatAction(chatActionName); + }, + unregisterAllChatActions: function () { + RNZohoSalesIQ.unregisterAllChatActions(); + }, + // DEPRECATED + completeChatAction: function (uuid) { + RNZohoSalesIQ.completeChatAction(uuid); + }, + // DEPRECATED + completeChatActionWithMessage: function (uuid, success, message) { + RNZohoSalesIQ.completeChatActionWithMessage(uuid, success, message); + }, + setChatActionTimeout: function (timeoutInSec) { + RNZohoSalesIQ.setChatActionTimeout(timeoutInSec); + }, + setVisitorLocation: function (location) { + RNZohoSalesIQ.setVisitorLocation(location); + }, + addEventListener: function (type, listener) { + RNZohoSalesIQ.updateListener(type); + emitter.addListener(type, listener); + }, + addListener: function (callback) { + RNZohoSalesIQEmitter.addListener("ZSIQ_EVENT_LISTENER", callback); + }, + Event: ListenerEvent, + syncThemeWithOsForAndroid: function (sync) { + RNZohoSalesIQ.syncThemeWithOsForAndroid(sync); + }, + getDepartments: function (callback) { + RNZohoSalesIQ.getDepartments(callback); + }, + isMultipleOpenChatRestricted: function (callback) { + RNZohoSalesIQ.isMultipleOpenChatRestricted(callback); + }, + isChatEnabled: function (callback) { + RNZohoSalesIQ.isChatEnabled(callback); + }, + getChatUnreadCount: function (callback) { + RNZohoSalesIQ.getChatUnreadCount(callback); + }, + setLauncherPropertiesForAndroid: function (launcherPropertiesMap) { + RNZohoSalesIQ.setLauncherPropertiesForAndroid(launcherPropertiesMap); + }, + printDebugLogsForAndroid: function (value) { + RNZohoSalesIQ.printDebugLogsForAndroid(value); + }, + setThemeForAndroid: function (value) { + RNZohoSalesIQ.setThemeForAndroid(value); + }, + registerLocalizationFileForiOS: function (fileName) { + RNZohoSalesIQ.registerLocalizationFile(fileName); + }, + refreshLauncher: function () { + RNZohoSalesIQ.refreshLauncher(); + }, + setThemeForiOS: function (value) { + RNZohoSalesIQ.setThemeColor(value); + }, + + ...ZSIQChats, + + sendEvent: function (eventName, ...values) { + RNZohoSalesIQ.sendEvent(eventName, values); + }, + + /** + * + * @param {...Tab} tabNames + */ + setTabOrder: function (...tabNames) { + RNZohoSalesIQ.setTabOrder(tabNames); + }, + + dismissUI: function () { + RNZohoSalesIQ.dismissUI(); + }, + + ...ZSIQNotification, + + ...ZSIQLogger, + + ...ZSIQLauncher, + + ...ZSIQKnowledgeBase, +} as ZSIQWrapperTypes & + ZSIQConstantsTypes & + ZSIQListenerEventsType & + ChatTypes & + ZSIQNotificationTypes & + ZSIQLoggerTypes & + ZSIQLauncherTypes & + ZSIQKnowledgeBaseTypes; + +// MessageStatus: { +// SENDING: RNZohoSalesIQ.SENDING, +// UPLOADING: RNZohoSalesIQ.UPLOADING, +// SENT: RNZohoSalesIQ.SENT, +// FAILURE: RNZohoSalesIQ.FAILURE +// } + +if (Platform.OS === 'android') { + Dimensions.addEventListener('change', () => { + RNZohoSalesIQ.refreshLauncherPropertiesForAndroid(); + }); +} diff --git a/src/components/ios-theme/SIQArticleMessageTheme.ts b/src/components/ios-theme/SIQArticleMessageTheme.ts new file mode 100644 index 0000000..d98e36c --- /dev/null +++ b/src/components/ios-theme/SIQArticleMessageTheme.ts @@ -0,0 +1,6 @@ +export class SIQArticleMessageTheme { + cardTitleColor = "null"; + articleTitleColor = "null"; + authorTextColor = "null"; + backgroundColor = "null"; +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQArticleTheme.ts b/src/components/ios-theme/SIQArticleTheme.ts new file mode 100644 index 0000000..c9432af --- /dev/null +++ b/src/components/ios-theme/SIQArticleTheme.ts @@ -0,0 +1,5 @@ +import { SIQFAQBottomBarTheme } from "./SIQFAQBottomBarTheme"; + +export class SIQArticleTheme { + Toolbar = new SIQFAQBottomBarTheme(); +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQAttachmentSheetTheme.ts b/src/components/ios-theme/SIQAttachmentSheetTheme.ts new file mode 100644 index 0000000..e7649c3 --- /dev/null +++ b/src/components/ios-theme/SIQAttachmentSheetTheme.ts @@ -0,0 +1,6 @@ +export class SIQAttachmentSheetTheme { + backgroundColor = "null"; + overlayColor = "null"; + tintColor = "null"; + separatorColor = "null"; +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQAudioPlayerTheme.ts b/src/components/ios-theme/SIQAudioPlayerTheme.ts new file mode 100644 index 0000000..e14ebac --- /dev/null +++ b/src/components/ios-theme/SIQAudioPlayerTheme.ts @@ -0,0 +1,10 @@ +export class SIQAudioPlayerTheme { + thumbColor = "null"; + playButtonBackgroundColor = "null"; + incomingTrackColor = "null"; + outgoingTrackColor = "null"; + incomingButtonIconColor = "null"; + outgoingButtonIconColor = "null"; + outgoingDurationTextColor = "null"; + incomingDurationTextColor = "null"; +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQBannerColorTheme.ts b/src/components/ios-theme/SIQBannerColorTheme.ts new file mode 100644 index 0000000..ea12840 --- /dev/null +++ b/src/components/ios-theme/SIQBannerColorTheme.ts @@ -0,0 +1,4 @@ +export class SIQBannerColorTheme { + backgroundColor = "null"; + textColor = "null"; +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQBannerTheme.ts b/src/components/ios-theme/SIQBannerTheme.ts new file mode 100644 index 0000000..c414c5a --- /dev/null +++ b/src/components/ios-theme/SIQBannerTheme.ts @@ -0,0 +1,7 @@ +import { SIQBannerColorTheme } from "./SIQBannerColorTheme"; + +export class SIQBannerTheme { + successTheme = new SIQBannerColorTheme(); + infoTheme = new SIQBannerColorTheme(); + failureTheme = new SIQBannerColorTheme(); + } \ No newline at end of file diff --git a/src/components/ios-theme/SIQButtonTheme.ts b/src/components/ios-theme/SIQButtonTheme.ts new file mode 100644 index 0000000..a71d4e8 --- /dev/null +++ b/src/components/ios-theme/SIQButtonTheme.ts @@ -0,0 +1,4 @@ +export class SIQButtonTheme { + selectedColor = "null"; + normalColor = "null"; +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQChatFormTheme.ts b/src/components/ios-theme/SIQChatFormTheme.ts new file mode 100644 index 0000000..fa93f4e --- /dev/null +++ b/src/components/ios-theme/SIQChatFormTheme.ts @@ -0,0 +1,15 @@ +export class SIQChatFormTheme { + backgroundColor = "null"; + textFieldBackgroundColor = "null"; + textFieldTextColor = "null"; + textFieldTintColor = "null"; + textFieldPlaceholderColor = "null"; + textFieldTitleColor = "null"; + textFieldRequiredIndicatorColor = "null"; + errorColor = "null"; + submitButtonBackgroundColor = "null"; + submitButtonTextColor = "null"; + campaignOptInTextColor = "null"; + checkboxCheckedColor = "null"; + checkboxUncheckedColor = "null"; +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQChatInputTheme.ts b/src/components/ios-theme/SIQChatInputTheme.ts new file mode 100644 index 0000000..be8f544 --- /dev/null +++ b/src/components/ios-theme/SIQChatInputTheme.ts @@ -0,0 +1,28 @@ +import { SIQReplyViewTheme } from "./SIQReplyViewTheme"; + +export class SIQChatInputTheme { + backgroundColor = "null"; + audioRecordHintBackgroundColor = "null"; + audioRecordHintTextColor = "null"; + textFieldBorderColor = "null"; + textFieldTintColor = "null"; + textFieldBackgroundColor = "null"; + textFieldPlaceholderColor = "null"; + textFieldTextColor = "null"; + attachmentButtonBackgroundColor = "null"; + recordButtonBackgroundColor = "null"; + recordSoundPulseBackgroundColor = "null"; + sendButtonBackgroundColor = "null"; + buttonDisabledBackgroundColor = "null"; + recordTimerBackgroundColor = "null"; + recordTimerTextColor = "null"; + recordTimerIndicatorColor = "null"; + recordSlideTextColor = "null"; + recordSlideIconColor = "null"; + recordCancelTextColor = "null"; + moreIconColor = "null"; + sendIconColor = "null"; + recordIconColor = "null"; + Reply = new SIQReplyViewTheme(); + Edit = new SIQReplyViewTheme(); +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQChatScrollButtonTheme.ts b/src/components/ios-theme/SIQChatScrollButtonTheme.ts new file mode 100644 index 0000000..38efbd1 --- /dev/null +++ b/src/components/ios-theme/SIQChatScrollButtonTheme.ts @@ -0,0 +1,7 @@ +import { SIQLauncherUnreadBadgeTheme } from "./SIQLauncherUnreadBadgeTheme"; + +export class SIQChatScrollButtonTheme { + iconColor = "null"; + backgroundColor = "null"; + UnreadBadge = new SIQLauncherUnreadBadgeTheme(); +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQChatWindowTheme.ts b/src/components/ios-theme/SIQChatWindowTheme.ts new file mode 100644 index 0000000..180e091 --- /dev/null +++ b/src/components/ios-theme/SIQChatWindowTheme.ts @@ -0,0 +1,22 @@ +import { SIQAttachmentSheetTheme } from "./SIQAttachmentSheetTheme"; +import { SIQBannerTheme } from "./SIQBannerTheme"; +import { SIQChatInputTheme } from "./SIQChatInputTheme"; +import { SIQChatScrollButtonTheme } from "./SIQChatScrollButtonTheme"; +import { SIQEmailTranscriptTheme } from "./SIQEmailTranscriptTheme"; +import { SIQHandOffBannerTheme } from "./SIQHandOffBannerTheme"; +import { SIQLogViewTheme } from "./SIQLogViewTheme"; +import { SIQMessageTheme } from "./SIQMessageTheme"; +import { SIQQueueBannerTheme } from "./SIQQueueBannerTheme"; + +export class SIQChatWindowTheme { + backgroundColor = "null"; + Message = new SIQMessageTheme(); + HandOffBanner = new SIQHandOffBannerTheme(); + Banner = new SIQBannerTheme(); + QueueBanner = new SIQQueueBannerTheme(); + Input = new SIQChatInputTheme(); + AttachmentsSheet = new SIQAttachmentSheetTheme(); + ScrollButton = new SIQChatScrollButtonTheme(); + EmailTranscript = new SIQEmailTranscriptTheme(); + DebugLog = new SIQLogViewTheme(); +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQConversationListItemTheme.ts b/src/components/ios-theme/SIQConversationListItemTheme.ts new file mode 100644 index 0000000..308f800 --- /dev/null +++ b/src/components/ios-theme/SIQConversationListItemTheme.ts @@ -0,0 +1,15 @@ +import { SIQLauncherUnreadBadgeTheme } from "./SIQLauncherUnreadBadgeTheme"; + +export class SIQConversationListItemTheme { + backgroundColor = "null"; + timerTextColor = "null"; + timerIconColor = "null"; + titleTextColor = "null"; + subtitleTextColor = "null"; + timeTextColor = "null"; + openBadgeBackgroundColor = "null"; + openBadgeBorderColor = "null"; + openBadgeTextColor = "null"; + separatorColor = "null"; + UnreadBadge = new SIQLauncherUnreadBadgeTheme(); +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQConversationTheme.ts b/src/components/ios-theme/SIQConversationTheme.ts new file mode 100644 index 0000000..d77bbdb --- /dev/null +++ b/src/components/ios-theme/SIQConversationTheme.ts @@ -0,0 +1,6 @@ +import { SIQConversationListItemTheme } from "./SIQConversationListItemTheme"; + +export class SIQConversationTheme { + backgroundColor = "null"; + ListItem = new SIQConversationListItemTheme(); +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQEmailTranscriptTheme.ts b/src/components/ios-theme/SIQEmailTranscriptTheme.ts new file mode 100644 index 0000000..e72c49f --- /dev/null +++ b/src/components/ios-theme/SIQEmailTranscriptTheme.ts @@ -0,0 +1,3 @@ +export class SIQEmailTranscriptTheme { + textFieldTintColor = "null"; +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQEmptyViewTheme.ts b/src/components/ios-theme/SIQEmptyViewTheme.ts new file mode 100644 index 0000000..6db5fa6 --- /dev/null +++ b/src/components/ios-theme/SIQEmptyViewTheme.ts @@ -0,0 +1,6 @@ +export class SIQEmptyViewTheme { + backgroundColor = "null"; + chatButtonBackgroundColor = "null"; + chatButtonTitleColor = "null"; + textColor = "null"; +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQFAQBottomBarTheme.ts b/src/components/ios-theme/SIQFAQBottomBarTheme.ts new file mode 100644 index 0000000..9a5f9d4 --- /dev/null +++ b/src/components/ios-theme/SIQFAQBottomBarTheme.ts @@ -0,0 +1,7 @@ +import { SIQButtonTheme } from "./SIQButtonTheme"; + +export class SIQFAQBottomBarTheme { + backgroundColor = "null"; + LikeButton = new SIQButtonTheme(); + DislikeButton = new SIQButtonTheme(); +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQFAQListItemTheme.ts b/src/components/ios-theme/SIQFAQListItemTheme.ts new file mode 100644 index 0000000..4363c97 --- /dev/null +++ b/src/components/ios-theme/SIQFAQListItemTheme.ts @@ -0,0 +1,9 @@ +export class SIQFAQListItemTheme { + backgroundColor = "null"; + titleTextColor = "null"; + subtitleTextColor = "null"; + subtitlePartitionColor = "null"; + likePendingColor = "null"; + likedColor = "null"; + separatorColor = "null"; +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQFAQTheme.ts b/src/components/ios-theme/SIQFAQTheme.ts new file mode 100644 index 0000000..c63e38d --- /dev/null +++ b/src/components/ios-theme/SIQFAQTheme.ts @@ -0,0 +1,8 @@ +import { SIQArticleTheme } from "./SIQArticleTheme"; +import { SIQFAQListItemTheme } from "./SIQFAQListItemTheme"; + +export class SIQFAQTheme { + headerTextColor = "null"; + ListItem = new SIQFAQListItemTheme(); + Article = new SIQArticleTheme(); +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQFeedbackTheme.ts b/src/components/ios-theme/SIQFeedbackTheme.ts new file mode 100644 index 0000000..4abef29 --- /dev/null +++ b/src/components/ios-theme/SIQFeedbackTheme.ts @@ -0,0 +1,10 @@ +export class SIQFeedbackTheme { + backgroundColor = "null"; + primaryTextColor = "null"; + secondaryTextColor = "null"; + skipButtonTextColor = "null"; + submitButtonTextColor = "null"; + submitButtonBackgroundColor = "null"; + feedbackTextFieldTintColor = "null"; + feedbackPlaceholderTextColor = "null"; +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQFileMessageTheme.ts b/src/components/ios-theme/SIQFileMessageTheme.ts new file mode 100644 index 0000000..ce0d719 --- /dev/null +++ b/src/components/ios-theme/SIQFileMessageTheme.ts @@ -0,0 +1,10 @@ +export class SIQFileMessageTheme { + incomingTitleColor = "null"; + incomingSubTitleColor = "null"; + outgoingTitleColor = "null"; + outgoingSubTitleColor = "null"; + incomingFileViewBackgroundColor = "null"; + outgoingFileViewBackgroundColor = "null"; + incomingCommentBackgoundColor = "null"; + outgoingCommentBackgoundColor = "null"; +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQHandOffBannerTheme.ts b/src/components/ios-theme/SIQHandOffBannerTheme.ts new file mode 100644 index 0000000..a61d572 --- /dev/null +++ b/src/components/ios-theme/SIQHandOffBannerTheme.ts @@ -0,0 +1,5 @@ +export class SIQHandOffBannerTheme { + backgroundColor = "null"; + textColor = "null"; + buttonTitleColor = "null"; +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQInAppNotificationTheme.ts b/src/components/ios-theme/SIQInAppNotificationTheme.ts new file mode 100644 index 0000000..793f792 --- /dev/null +++ b/src/components/ios-theme/SIQInAppNotificationTheme.ts @@ -0,0 +1,8 @@ +export class SIQInAppNotificationTheme { + titleColor = "null"; + subtitleColor = "null"; + backgroundColor = "null"; + imageBackgroundColor = "null"; + cornerRadius: number | null = null; // Int + imageCornerRadius: number | null = null; // Int +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQInfoMessageTheme.ts b/src/components/ios-theme/SIQInfoMessageTheme.ts new file mode 100644 index 0000000..05978ee --- /dev/null +++ b/src/components/ios-theme/SIQInfoMessageTheme.ts @@ -0,0 +1,4 @@ +export class SIQInfoMessageTheme { + textColor = "null"; + lineColor = "null"; +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQInputCardTheme.ts b/src/components/ios-theme/SIQInputCardTheme.ts new file mode 100644 index 0000000..5ecc935 --- /dev/null +++ b/src/components/ios-theme/SIQInputCardTheme.ts @@ -0,0 +1,9 @@ +export class SIQInputCardTheme { + titleColor = "null"; + textFieldTextColor = "null"; + textFieldBackgroundColor = "null"; + textFieldPlaceholderColor = "null"; + sendButtonBackgroundColor = "null"; + sendButtonIconColor = "null"; + separatorColor = "null"; +} diff --git a/src/components/ios-theme/SIQLauncherTheme.ts b/src/components/ios-theme/SIQLauncherTheme.ts new file mode 100644 index 0000000..5e8dcd0 --- /dev/null +++ b/src/components/ios-theme/SIQLauncherTheme.ts @@ -0,0 +1,7 @@ +import { SIQLauncherUnreadBadgeTheme } from "./SIQLauncherUnreadBadgeTheme"; + +export class SIQLauncherTheme { + backgroundColor = "null"; + iconColor = "null"; + UnreadBadge = new SIQLauncherUnreadBadgeTheme(); +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQLauncherUnreadBadgeTheme.ts b/src/components/ios-theme/SIQLauncherUnreadBadgeTheme.ts new file mode 100644 index 0000000..9da9091 --- /dev/null +++ b/src/components/ios-theme/SIQLauncherUnreadBadgeTheme.ts @@ -0,0 +1,6 @@ +export class SIQLauncherUnreadBadgeTheme { + backgroundColor = "null"; + textColor = "null"; + borderColor = "null"; + borderWidth: number | null = null; // Int +} diff --git a/src/components/ios-theme/SIQLogViewTheme.ts b/src/components/ios-theme/SIQLogViewTheme.ts new file mode 100644 index 0000000..3708691 --- /dev/null +++ b/src/components/ios-theme/SIQLogViewTheme.ts @@ -0,0 +1,9 @@ +export class SIQLogViewTheme { + backgroundColor = "null"; + titleColor = "null"; + textViewColor = "null"; + textViewBackgroundColor = "null"; + sendTitleColor = "null"; + sendBackgroundColor = "null"; + cancelTitleColor = "null"; +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQMessageCommonTheme.ts b/src/components/ios-theme/SIQMessageCommonTheme.ts new file mode 100644 index 0000000..6a3eff4 --- /dev/null +++ b/src/components/ios-theme/SIQMessageCommonTheme.ts @@ -0,0 +1,35 @@ +import { SIQProgressButtonTheme } from "./SIQProgressButtonTheme"; +import { SIQReplyViewTheme } from "./SIQReplyViewTheme"; + +export class SIQMessageCommonTheme { + botTypingIndicatorStyle: number | null = null; // Int + messageSenderNameColor = "null"; + outgoingBackgroundColor = "null"; + outgoingTextColor = "null"; + outgoingBorderColor = "null"; + outgoingTimeTextColor = "null"; + outgoingTimeIconColor = "null"; + incomingBackgroundColor = "null"; + incomingTextColor = "null"; + incomingBorderColor = "null"; + incomingTimeTextColor = "null"; + incomingTimeIconColor = "null"; + incomingTextTimeColor = "null"; + outgoingTextTimeColor = "null"; + messageStatusIconColor = "null"; + incomingMessageEditedTagColor = "null"; + outgoingMessageEditedTagColor = "null"; + incomingMessageTimeStampColor = "null"; + outgoingMessageTimeStampColor = "null"; + incomingDeletedMessageColor = "null"; + outgoingDeletedMessageColor = "null"; + deletingMessageTitleColor = "null"; + deliveryStatusIconColor = "null"; + repliedMessageHighLightColor = "null"; + incomingMessageReplyIconColor = "null"; + outgoingMessageReplyIconColor = "null"; + incomingProgressButton = new SIQProgressButtonTheme(); + outgoingProgressButton = new SIQProgressButtonTheme(); + outgoingRepliedMessage = new SIQReplyViewTheme(); + incomingRepliedMessage = new SIQReplyViewTheme(); +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQMessageTheme.ts b/src/components/ios-theme/SIQMessageTheme.ts new file mode 100644 index 0000000..9f402f0 --- /dev/null +++ b/src/components/ios-theme/SIQMessageTheme.ts @@ -0,0 +1,23 @@ +import { SIQArticleMessageTheme } from "./SIQArticleMessageTheme" +import { SIQAudioPlayerTheme } from "./SIQAudioPlayerTheme" +import { SIQFileMessageTheme } from "./SIQFileMessageTheme" +import { SIQInfoMessageTheme } from "./SIQInfoMessageTheme" +import { SIQInputCardTheme } from "./SIQInputCardTheme" +import { SIQMessageCommonTheme } from "./SIQMessageCommonTheme" +import { SIQSelectionComponentTheme } from "./SIQSelectionComponentTheme" +import { SIQSkipActionButtonTheme } from "./SIQSkipActionButtonTheme" +import { SIQSliderCardTheme } from "./SIQSliderCardTheme" +import { SIQSuggestionTheme } from "./SIQSuggestionTheme" + +export class SIQMessageTheme { + Common = new SIQMessageCommonTheme() + Suggestion = new SIQSuggestionTheme() + SkipActionButton = new SIQSkipActionButtonTheme() + AudioPlayer = new SIQAudioPlayerTheme() + Selection = new SIQSelectionComponentTheme() + InputCard = new SIQInputCardTheme() + Slider = new SIQSliderCardTheme() + InfoMessage = new SIQInfoMessageTheme() + Article = new SIQArticleMessageTheme() + File = new SIQFileMessageTheme() +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQNavigationTheme.ts b/src/components/ios-theme/SIQNavigationTheme.ts new file mode 100644 index 0000000..c7842a4 --- /dev/null +++ b/src/components/ios-theme/SIQNavigationTheme.ts @@ -0,0 +1,5 @@ +export class SIQNavigationTheme { + backgroundColor = "null"; + titleColor = "null"; + tintColor = "null" +} diff --git a/src/components/ios-theme/SIQNoNetworkBannnerTheme.ts b/src/components/ios-theme/SIQNoNetworkBannnerTheme.ts new file mode 100644 index 0000000..3eed44f --- /dev/null +++ b/src/components/ios-theme/SIQNoNetworkBannnerTheme.ts @@ -0,0 +1,5 @@ +export class SIQNoNetworkBannnerTheme { + backgroundColor = "null"; + textColor = "null"; + loaderColor = "null"; +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQOfflineBannerTheme.ts b/src/components/ios-theme/SIQOfflineBannerTheme.ts new file mode 100644 index 0000000..7b3cbe7 --- /dev/null +++ b/src/components/ios-theme/SIQOfflineBannerTheme.ts @@ -0,0 +1,4 @@ +export class SIQOfflineBannerTheme { + textColor = "null"; + backgroundColor = "null"; +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQProgressButtonTheme.ts b/src/components/ios-theme/SIQProgressButtonTheme.ts new file mode 100644 index 0000000..2c0881d --- /dev/null +++ b/src/components/ios-theme/SIQProgressButtonTheme.ts @@ -0,0 +1,4 @@ +export class SIQProgressButtonTheme { + backgroundColor = "null"; + tintcolor = "null"; +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQQueueBannerTheme.ts b/src/components/ios-theme/SIQQueueBannerTheme.ts new file mode 100644 index 0000000..e9ae996 --- /dev/null +++ b/src/components/ios-theme/SIQQueueBannerTheme.ts @@ -0,0 +1,9 @@ +export class SIQQueueBannerTheme { + backgroundColor = "null"; + titleColor = "null"; + subtitleColor = "null"; + subtitleTimeColor = "null"; + positionTextColor = "null"; + positionSubtitleColor = "null"; + positionContainerBackgroundColor = "null"; +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQReplyViewTheme.ts b/src/components/ios-theme/SIQReplyViewTheme.ts new file mode 100644 index 0000000..5dc1de7 --- /dev/null +++ b/src/components/ios-theme/SIQReplyViewTheme.ts @@ -0,0 +1,8 @@ +export class SIQReplyViewTheme { + backgroundColor = "null"; + titleColor = "null"; + subtitleColor = "null"; + verticalLine = "null"; + messageTypeIconColor = "null"; + closeButton = "null"; +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQSelectionComponentTheme.ts b/src/components/ios-theme/SIQSelectionComponentTheme.ts new file mode 100644 index 0000000..642c211 --- /dev/null +++ b/src/components/ios-theme/SIQSelectionComponentTheme.ts @@ -0,0 +1,9 @@ +export class SIQSelectionComponentTheme { + textColor = "null"; + accessoryColor = "null"; + backgroundColor = "null"; + selectionBackgroundColor = "null"; + buttonTextColor = "null"; + buttonBackgroundColor = "null"; + linkTextColor = "null"; +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQSkipActionButtonTheme.ts b/src/components/ios-theme/SIQSkipActionButtonTheme.ts new file mode 100644 index 0000000..124c9eb --- /dev/null +++ b/src/components/ios-theme/SIQSkipActionButtonTheme.ts @@ -0,0 +1,6 @@ +export class SIQSkipActionButtonTheme { + textColor = "null"; + borderColor = "null"; + backgroundColor = "null"; + cornerRadius: number | null = null; // Int +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQSliderCardTheme.ts b/src/components/ios-theme/SIQSliderCardTheme.ts new file mode 100644 index 0000000..828849d --- /dev/null +++ b/src/components/ios-theme/SIQSliderCardTheme.ts @@ -0,0 +1,9 @@ +export class SIQSliderCardTheme { + thumbBorderColor = "null"; + selectedTrackColor = "null"; + selectedValueTextColor = "null"; + unSelectedTrackColor = "null"; + thumbBackgroundColor = "null"; + minRangeTextColor = "null"; + maxRangeTextColor = "null"; +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQSuggestionTheme.ts b/src/components/ios-theme/SIQSuggestionTheme.ts new file mode 100644 index 0000000..794c9ba --- /dev/null +++ b/src/components/ios-theme/SIQSuggestionTheme.ts @@ -0,0 +1,7 @@ +export class SIQSuggestionTheme { + textColor = "null"; + borderColor = "null"; + backgroundColor = "null"; + cornerRadius: number | null = null; // Int + displayStyle: number | null = null; // Int +} \ No newline at end of file diff --git a/src/components/ios-theme/SIQTabBarTheme.ts b/src/components/ios-theme/SIQTabBarTheme.ts new file mode 100644 index 0000000..2f7e203 --- /dev/null +++ b/src/components/ios-theme/SIQTabBarTheme.ts @@ -0,0 +1,5 @@ +export class SIQTabBarTheme { + backgroundColor = "null"; + activeTabColor = "null"; + inactiveTabColor = "null"; +} \ No newline at end of file diff --git a/src/components/ios-theme/index.ts b/src/components/ios-theme/index.ts new file mode 100644 index 0000000..1567029 --- /dev/null +++ b/src/components/ios-theme/index.ts @@ -0,0 +1,28 @@ +import { SIQChatFormTheme } from "./SIQChatFormTheme"; +import { SIQChatWindowTheme } from "./SIQChatWindowTheme"; +import { SIQConversationTheme } from "./SIQConversationTheme"; +import { SIQEmptyViewTheme } from "./SIQEmptyViewTheme"; +import { SIQFAQTheme } from "./SIQFAQTheme"; +import { SIQFeedbackTheme } from "./SIQFeedbackTheme"; +import { SIQInAppNotificationTheme } from "./SIQInAppNotificationTheme"; +import { SIQLauncherTheme } from "./SIQLauncherTheme"; +import { SIQNavigationTheme } from "./SIQNavigationTheme"; +import { SIQNoNetworkBannnerTheme } from "./SIQNoNetworkBannnerTheme"; +import { SIQOfflineBannerTheme } from "./SIQOfflineBannerTheme"; +import { SIQTabBarTheme } from "./SIQTabBarTheme"; + +export default class ZSIQTheme { + themeColor = "null"; //No I18N + Launcher = new SIQLauncherTheme(); + TabBar = new SIQTabBarTheme();; + Navigation = new SIQNavigationTheme(); + EmptyView = new SIQEmptyViewTheme(); + OfflineBanner = new SIQOfflineBannerTheme(); + NetworkWaitingBanner = new SIQNoNetworkBannnerTheme(); + Conversation = new SIQConversationTheme(); + FAQ = new SIQFAQTheme(); + Chat = new SIQChatWindowTheme(); + Form = new SIQChatFormTheme(); + Feedback = new SIQFeedbackTheme(); + InAppNotification = new SIQInAppNotificationTheme(); +} \ No newline at end of file diff --git a/src/components/knowledgebase/index.ts b/src/components/knowledgebase/index.ts new file mode 100644 index 0000000..1fc759d --- /dev/null +++ b/src/components/knowledgebase/index.ts @@ -0,0 +1,68 @@ +import RNZohoSalesIQ, { RNZohoSalesIQEmitter } from '../../commons/utils'; +import type { ZSIQKnowledgeBaseTypes } from './types/KnowledgeBase'; +import { KnowledgeBaseListenerEvent } from './types/Listener'; + +export const ZSIQKnowledgeBase = { + KnowledgeBase: { + isEnabled: function (type, callback) { + RNZohoSalesIQ.isKnowledgeBaseEnabled(type, callback); + }, + setVisibility: function (type, shouldShow) { + RNZohoSalesIQ.setKnowledgeBaseVisibility(type, shouldShow); + }, + categorize: function (type, shouldCategorize) { + RNZohoSalesIQ.categorizeKnowledgeBase(type, shouldCategorize); + }, + combineDepartments: function (type, merge) { + RNZohoSalesIQ.combineKnowledgeBaseDepartments(type, merge); + }, + setRecentlyViewedCount: function (limit) { + RNZohoSalesIQ.setKnowledgeBaseRecentlyViewedCount(limit); + }, + getResourceDepartments: function (callback) { + RNZohoSalesIQ.getKnowledgeBaseResourceDepartments(callback); + }, + open: function (type, id, callback) { + RNZohoSalesIQ.openKnowledgeBase(type, id, callback); + }, + getSingleResource: function (type, id, callback) { + RNZohoSalesIQ.getKnowledgeBaseSingleResource(type, id, callback); + }, + getResources: function ( + type, + departmentId = null, + parentCategoryId = null, + page = 1, + limit = 99, + searchKey = null, + callback + ) { + RNZohoSalesIQ.getKnowledgeBaseResources( + type, + departmentId, + parentCategoryId, + page, + limit, + searchKey, + callback + ); + }, + getCategories: function ( + type, + departmentId = null, + parentCategoryId = null, + callback + ) { + RNZohoSalesIQ.getKnowledgeBaseCategories( + type, + departmentId, + parentCategoryId, + callback + ); + }, + addListener: function (callback) { + RNZohoSalesIQEmitter.addListener("KNOWLEDGEBASE_EVENT_LISTENER", callback); + }, + Event: KnowledgeBaseListenerEvent, + }, +} as ZSIQKnowledgeBaseTypes; diff --git a/src/components/knowledgebase/types/KnowledgeBase.ts b/src/components/knowledgebase/types/KnowledgeBase.ts new file mode 100644 index 0000000..f127e35 --- /dev/null +++ b/src/components/knowledgebase/types/KnowledgeBase.ts @@ -0,0 +1,189 @@ +import type { + CallbackError +} from '../../../types/ZSIQWrapperTypes'; +import type { + KnowledgeBaseListenerEvent, + knowledgeBaseListeners, +} from './Listener'; +import type { Category, Resource } from './Resource'; + +export enum ResourceType { + ARTICLES = 'RESOURCE_ARTICLES', +} + +interface ResourceDepartment { + id?: string; + name?: string; +} + +export interface ZSIQKnowledgeBaseTypes { + KnowledgeBase: { + /** + * This API allows to get the status (enabled/disabled) of the specified resource type in the portal. + * + * @param type - (articles) The type of the resource. + * @param callback - This callback returns a boolean value: `true` signifies that the specified resource type is enabled, while `false` indicates it is disabled. + * @returns + */ + isEnabled: ( + type: (typeof ResourceType)[keyof typeof ResourceType], + callback: (value: boolean) => void + ) => void; + /** + * This API allows to manage the visibility of the resources in the Mobilisten knowledge base section. + * + * @param type - (Article) The type of the resource + * @param shouldShow - (true/false) `true` will display the resource type, and `false` will hide. The default value is `true`. + * @returns + * + * The API will work when the "Articles" is enabled under brand settings. To check, from your SalesIQ dashboard, navigate to `Settings > Brands > Personalisation > Knowledge Base > Article`. + */ + setVisibility: ( + type: (typeof ResourceType)[keyof typeof ResourceType], + shouldShow: boolean + ) => void; + /** + * This API allows managing category visibility while displaying the resources in the Mobilisten knowledge base section. + * + * @param type - (Articles) The type of the resource + * @param shouldCategorize - (true/false) + * + * - *true* - will list the categories, and when a category is selected, only the resources associated with the selected category will be listed. The default value is true. + * + * - *false* - will hide the categories and list all the resources. + * + * @returns + */ + categorize: ( + type: (typeof ResourceType)[keyof typeof ResourceType], + shouldCategorize: boolean + ) => void; + /** + * This API allows to manage the department's visibility while displaying the resources in the Mobilisten knowledge base section. + * + * @param type - (Articles) The type of the resource. + * + * + * @param merge - (true/false) + * - `true` - will hide the departments and merge resources from all the departments. + * - `false` - will list the departments. When a department is selected, only the resources associated with the selected department will be listed. + * @returns + */ + combineDepartments: ( + type: (typeof ResourceType)[keyof typeof ResourceType], + merge: boolean + ) => void; + /** + * This API allows configuring the number of recently viewed resources to be displayed in the Mobilisten UI. + * + * @param limit - The number limit to display recently viewed resources. The default value is 5. + * @returns + */ + setRecentlyViewedCount: (limit: number) => void; + /** + * This API allows fetching the list of resource departments associated with the brand. Upon execution, the array of `ResourceDepartment` objects will include the resource departments under the brand settings `(Settings > Brand > Select your brand > Flow Controls > Department responsible for chats/Use the resource of associated department)`. + * @param callback - `(Optional)`: A closure that receives an array of `ResourceDepartment` as its parameter, when the operation is completed. + * @returns + */ + getResourceDepartments: ( + callback: (error: CallbackError, departments: ResourceDepartment[]) => void + ) => void; + /** + * This API helps to open a specific resource. + * @param type - (Article) Type of the resource + * @param id - ID of the resource + * @param callback - The callback for the resource if it's failed or opened successfully + * + * @see + * + * Errorcodes: + * - `18008` Provide a valid language code. + * - `18009` Provided language code is not supported. + * - `500` Mobilisten SDK not initialized. + * - `600` No network connection. + * - `605` Mobilisten SDK is disabled. + * + * @returns + */ + open: ( + type: (typeof ResourceType)[keyof typeof ResourceType], + id: string, + callback: (error: CallbackError, success: boolean) => void + ) => void; + /** + * This API allows getting details of a resource. + * + * @param type - Type of the resource + * @param id - ID of the resource + * @param callback - The callback to get the resources details. + * + * @see Errorcodes: + * - `500` - Mobilisten SDK not initialized + * - `600` - No network connection + * - `605` - Mobilisten SDK is disabled + * + * @returns + */ + getSingleResource: ( + type: (typeof ResourceType)[keyof typeof ResourceType], + id: string, + callback: (error: CallbackError, resource: Resource) => void + ) => void; + /** + * This API allows to get a list of resources (articles). To get a specific resource list, use the below parameters as filters. + * @param type `(Article)` - The type of the resource. + * @param departmentId `(Optional)` - Department ID to fetch resource associated with it. + * @param parentCategoryId `(Optional)` - Category ID to get the articles. + * @param page `(Optional)` - Specify the number of pages. (Default value is 1) + * @param limit `(Optional)` - Specify the number of articles to be fetched for a page. (Default & maximum value is 99) + * @param searchKey `(Optional)` - A search keyword to further filter the results. + * @param callback - The callback to get the resources. + * + * @property `moreDataAvailable` - (callback parameter) A boolean indicating an excess of resources beyond the specified page limit​ + * + * @see + * Errorcodes: + * - `500` - Mobilisten SDK not initialized + * - `600` - No network connection + * - `605` - Mobilisten is disabled + * @returns + */ + getResources: ( + type: (typeof ResourceType)[keyof typeof ResourceType], + departmentId: string | null, + parentCategoryId: string | null, + page: number, + limit: number, + searchKey: string | null, + callback: ( + error: CallbackError, + resources: Resource[], + moreDataAvailable: boolean + ) => void + ) => void; + /** + * This API allows to get a list of resource's (article) categories based on the below parameters. To get a specific resource list, use the below parameters as filters. + * @param type - `(Articles)` The type of the resource. + * @param departmentId `(Optional)` - Department ID to fetch resource categories associated with it. + * @param parentCategoryId + * @param callback + * @returns + */ + getCategories: ( + type: (typeof ResourceType)[keyof typeof ResourceType], + departmentId: string | null, + parentCategoryId: string | null, + callback: (error: CallbackError, categories: Category[]) => void + ) => void; + /** + * This listener provides resource event callbacks, allowing you to monitor various visitor actions related to the resources. These actions includes opening, closing, liking and disliking a resource. + * @param callback + * @returns + */ + addListener: ( + callback: (callbackData: knowledgeBaseListeners) => void + ) => void; + Event: typeof KnowledgeBaseListenerEvent; + }; +} +//# sourceMappingURL=KnowledgeBase.d.ts.map diff --git a/src/components/knowledgebase/types/Listener.ts b/src/components/knowledgebase/types/Listener.ts new file mode 100644 index 0000000..c00bf07 --- /dev/null +++ b/src/components/knowledgebase/types/Listener.ts @@ -0,0 +1,32 @@ +import type { Resource } from './Resource'; +import type { ResourceType } from './KnowledgeBase'; + +export enum KnowledgeBaseListenerEvent { + /** + * Invoked when a resource is opened. + */ + RESOURCE_OPENED = 'EVENT_RESOURCE_OPENED', + + /** + * Invoked when a resource is closed. + */ + RESOURCE_CLOSED = 'EVENT_RESOURCE_CLOSED', + + /** + * Invoked when a resource is liked. + */ + RESOURCE_LIKED = 'EVENT_RESOURCE_LIKED', + + /** + * Invoked when a resource is disliked. + */ + RESOURCE_DISLIKED = 'EVENT_RESOURCE_DISLIKED', +} + +export type knowledgeBaseListeners = { + event: typeof KnowledgeBaseListenerEvent[keyof typeof KnowledgeBaseListenerEvent]; + body: { + type?: ResourceType; + resource?: Resource; + }; +}; diff --git a/src/components/knowledgebase/types/Resource.ts b/src/components/knowledgebase/types/Resource.ts new file mode 100644 index 0000000..1698778 --- /dev/null +++ b/src/components/knowledgebase/types/Resource.ts @@ -0,0 +1,50 @@ +export interface Resource { + id?: string; + category?: ResourceCategory; + title?: string; + departmentId?: string; + language?: Language; + creator?: User; + modifier?: User; + createdTime?: number; + modifiedTime?: number; + publicUrl?: string; + stats?: Stats; + content?: string; + ratedType?: "liked" | "disliked"; +} + +interface ResourceCategory { + id?: string; + name?: string +} + +interface Language { + code?: string; + id?: string; +} + +interface User { + displayName?: String, + email?: String, + id: String + imageUrl?: String, + name?: String +} + +interface Stats { + disliked?: number; + liked?: number; + used?: number; + viewed?: number; +} + +export interface Category { + count?: number; + childrenCount?: number; + order?: number; + id?: string; + resourceModifiedTime?: number; + departmentId?: string; + name?: string +} \ No newline at end of file diff --git a/src/components/launcher/index.ts b/src/components/launcher/index.ts new file mode 100644 index 0000000..2755f3b --- /dev/null +++ b/src/components/launcher/index.ts @@ -0,0 +1,27 @@ +import RNZohoSalesIQ, { RNZohoSalesIQEmitter } from "../../commons/utils"; +import { LauncherProps } from "../../types/Listener"; +import { type ZSIQLauncherTypes, ZSIQLauncherModes } from "./types/Launcher"; +import { LauncherEvent } from "./types/Listener"; + +export const ZSIQLauncher = { + Launcher: { + VisibilityMode: ZSIQLauncherModes, + show: function (mode) { + RNZohoSalesIQ.showLauncher(mode); + }, + setVisibilityModeToCustomLauncher: function (mode) { + RNZohoSalesIQ.setVisibilityModeToCustomLauncher(mode); + }, + enableDragToDismiss: function (enabled) { + RNZohoSalesIQ.enableDragToDismiss(enabled); + }, + setMinimumPressDuration: function (duration) { + RNZohoSalesIQ.setMinimumPressDuration(duration); + }, + addListener: function (callback) { + RNZohoSalesIQEmitter.addListener("LAUNCHER_EVENT_LISTENER", callback); + }, + Event: LauncherEvent, + ...LauncherProps + }, +} as ZSIQLauncherTypes; \ No newline at end of file diff --git a/src/components/launcher/types/Launcher.ts b/src/components/launcher/types/Launcher.ts new file mode 100644 index 0000000..b820ab2 --- /dev/null +++ b/src/components/launcher/types/Launcher.ts @@ -0,0 +1,56 @@ +import { type LauncherProps, type ZSIQListenerEventsType } from '../../../types/Listener'; +import type { LauncherEvent, LauncherListeners } from './Listener'; +export enum ZSIQLauncherModes { + ALWAYS = 'LAUNCHER_VISIBILITY_MODE_ALWAYS', + NEVER = 'LAUNCHER_VISIBILITY_MODE_NEVER', + WHEN_ACTIVE_CHAT = 'LAUNCHER_VISIBILITY_MODE_WHEN_ACTIVE_CHAT', +} + +export interface ZSIQLauncherTypes { + Launcher: { + VisibilityMode: typeof ZSIQLauncherModes; + /** + * This API allows managing the visibility of the mobilisten launcher according to your {@link ZSIQLauncherTypes.Launcher visibility} mode. + * + * @param mode + * @returns + */ + show: (mode: ZSIQLauncherModes) => void; + + /** + * This API allows managing the visibility of the custom launcher. This will subsequently emit the {@link ZSIQListenerEventsType.EVENT_HANDLE_CUSTOM_LAUNCHER_VISIBILITY EVENT_HANDLE_CUSTOM_LAUNCHER_VISIBILITY} event, allowing you to display your customized launcher as required. + * @param mode + * @returns + */ + setVisibilityModeToCustomLauncher: (mode: ZSIQLauncherModes) => void; + + /** + * This API allows to close the mobilisten launcher by dragging and dropping on the close button. + * + * @param enabled + * @returns + */ + enableDragToDismiss: (enabled: boolean) => void; + + /** + * + * @param duration + * @returns + */ + setMinimumPressDuration: (duration: number) => void; + + /** + * This listener allows you to register a callback that is to be invoked whenever an event is triggered regarding the launcher. + * @param type + * @param listener + * @returns + */ + addListener: (callback: (callbackData: LauncherListeners) => void) => void; + + Event: typeof LauncherEvent; + } & { + [key in keyof typeof LauncherProps]: (typeof LauncherProps)[key] + }; +} + +export type _ZSIQListenerEventsType = ZSIQListenerEventsType; diff --git a/src/components/launcher/types/Listener.ts b/src/components/launcher/types/Listener.ts new file mode 100644 index 0000000..7d60bdc --- /dev/null +++ b/src/components/launcher/types/Listener.ts @@ -0,0 +1,13 @@ +export enum LauncherEvent { + /** + * Show/hide your custom launcher with the triggered boolean value. + */ + HANDLE_CUSTOM_LAUNCHER_VISIBILITY = 'EVENT_HANDLE_CUSTOM_LAUNCHER_VISIBILITY', +} + +export type LauncherListeners = { + event: LauncherEvent.HANDLE_CUSTOM_LAUNCHER_VISIBILITY; + body: { + visible: boolean + } +} \ No newline at end of file diff --git a/src/components/logger/index.ts b/src/components/logger/index.ts new file mode 100644 index 0000000..36f0f14 --- /dev/null +++ b/src/components/logger/index.ts @@ -0,0 +1,26 @@ +import RNZohoSalesIQ from '../../commons/utils'; +import type { ZSIQLoggerTypes } from './types/Logger'; + +export const ZSIQLogger = { + Logger: { + INFO: RNZohoSalesIQ.INFO_LOG, + WARNING: RNZohoSalesIQ.WARNING_LOG, + ERROR: RNZohoSalesIQ.ERROR_LOG, + + setEnabled: function (value) { + RNZohoSalesIQ.setLoggerEnabled(value); + }, + isEnabled: function (callback) { + RNZohoSalesIQ.isLoggerEnabled(callback); + }, + setPathForiOS: function (url) { + RNZohoSalesIQ.setLoggerPathForiOS(url); + }, + clearLogsForiOS: function () { + RNZohoSalesIQ.clearLogsForiOS(); + }, + writeLogForiOS: function (log, level, callback) { + RNZohoSalesIQ.writeLogForiOS(log, level, callback); + }, + }, +} as ZSIQLoggerTypes; diff --git a/src/components/logger/types/Logger.ts b/src/components/logger/types/Logger.ts new file mode 100644 index 0000000..8ecda99 --- /dev/null +++ b/src/components/logger/types/Logger.ts @@ -0,0 +1,53 @@ +type LogTypes = 'INFO_LOG' | 'WARNING_LOG' | 'ERROR_LOG'; + +export interface ZSIQLoggerTypes { + Logger: { + INFO: LogTypes; + WARNING: LogTypes; + ERROR: LogTypes; + + /** + * This API lets you request the application debug logs from the visitor. You can either choose to enable or disable the request app log feature for your operators in the SalesIQ chat window by setting the boolean value. + * @param value + * @returns + */ + setEnabled: (value: boolean) => void; + + /** + * This API is used to check whether the Logger is enabled. + * @param callback + * @returns + */ + isEnabled: (callback?: (enabled: boolean) => void) => void; + + /** + * This API helps to set the path for recording and storing the debug Logs. + * + * When using this API, logs will be written in the given path, else it will be saved on the default path. + * @param url + * @returns + */ + setPathForiOS: (url: string) => void; + + /** + * This API is used to clear the written debug logs. + * + * @returns + */ + clearLogsForiOS: () => void; + + /** + * The logs are disabled by default. In order to use {@link ZSIQLoggerTypes.Logger ZohoSalesIQ.Logger.writeLogForiOS()} function, Ensure the bool value of `ZohoSalesIQ.Logger.setEnabled(value: boolean)` is set as true. + * + * @param log + * @param level + * @param callback + * @returns + */ + writeLogForiOS: ( + log: string, + level: LogTypes, + callback?: (success: boolean) => void + ) => void; + }; +} \ No newline at end of file diff --git a/src/components/notification/index.ts b/src/components/notification/index.ts new file mode 100644 index 0000000..9ce5c95 --- /dev/null +++ b/src/components/notification/index.ts @@ -0,0 +1,31 @@ +import RNZohoSalesIQ, { RNZohoSalesIQEmitter } from '../../commons/utils'; +import { NotificationListenerEvent } from './types/Listener'; +import type { ZSIQNotificationTypes } from './types/Notification'; + +export const ZSIQNotification = { + Notification: { + setIconForAndroid: function (resourceName) { + RNZohoSalesIQ.setNotificationIconForAndroid(resourceName); + }, + registerPush: function (token, isTestDevice) { + RNZohoSalesIQ.registerPush(token, isTestDevice); + }, + isSDKMessage: function (map = {}, callback) { + RNZohoSalesIQ.isSDKMessage(map, callback); + }, + process: function (map = {}) { + RNZohoSalesIQ.processNotificationMessage(map); + }, + getPayload: function (map = {}, callback) { + RNZohoSalesIQ.getNotificationPayload(map, callback); + }, + setActionSource: function (actionSource) { + RNZohoSalesIQ.setNotificationActionSource(actionSource); + }, + addListener: function (callback) { + RNZohoSalesIQ.updateListener(NotificationListenerEvent.NOTIFICATION_CLICKED); + RNZohoSalesIQEmitter.addListener("NOTIFICATION_EVENT_LISTENER", callback); + }, + Event: NotificationListenerEvent + }, +} as ZSIQNotificationTypes; diff --git a/src/components/notification/types/Listener.ts b/src/components/notification/types/Listener.ts new file mode 100644 index 0000000..8c0b344 --- /dev/null +++ b/src/components/notification/types/Listener.ts @@ -0,0 +1,13 @@ +import type { ZSIQNotificationPayloadResult } from './Notification'; + +export enum NotificationListenerEvent { + /** + * Invoked when the notification clicked. + */ + NOTIFICATION_CLICKED = 'EVENT_NOTIFICATION_CLICKED', +} + +export type NotificationListener = { + event: NotificationListenerEvent.NOTIFICATION_CLICKED; + body: ZSIQNotificationPayloadResult; +}; diff --git a/src/components/notification/types/Notification.ts b/src/components/notification/types/Notification.ts new file mode 100644 index 0000000..35ff2a4 --- /dev/null +++ b/src/components/notification/types/Notification.ts @@ -0,0 +1,141 @@ +import type { + NotificationListenerEvent, + NotificationListener, +} from './Listener'; + +export type ChatNotificationPayloadType = { + type?: 'chat'; + payload?: { + message?: string; + userId?: string; + chatId?: string; + senderName?: string; + previousMessageUID?: string; + messageUID?: string; + sender?: string; + title?: string; + department?: { + id?: string; + name?: string; + }; + }; +}; + +export type VisitorHistoryNotificationPayloadType = { + type?: 'visitorHistory'; + payload?: { + imagePath?: string; + message?: string; + targetLink?: string; + title?: string; + }; +}; + +export type EndChatDetailsNotificationPayload = { + type?: 'endChatDetails'; + payload?: { + message: string; + userId: string; + chatId: string; + title: string; + department: { + id?: string; + name?: string; + }; + }; +}; + +export type ZSIQNotificationPayloadResult = + | ChatNotificationPayloadType + | VisitorHistoryNotificationPayloadType + | EndChatDetailsNotificationPayload; + +export interface ZSIQNotificationTypes { + Notification: { + /** + * This API allows you to set an icon for the Mobilisten related notifications in your Android application. + * + * @param resourceName Add name of the icon in the drawable folder inside android, without extension. + * + * + * Steps: + * 1. Add the icon to the drawable folder of your project's resources (res/drawable). + * 2. When mentioning the icon name in the API, do not use the extension names. + * + * + * For example: If you have an icon called "siq_notify.xml" in your drawable folder. Then the name used in the API should be ZohoSalesIQ.Notification.setIconForAndroid("siq_notify"). + * @returns + */ + setIconForAndroid: (resourceName: string) => void; + + /** + * This API allows device registration to receive push notifications from SalesIQ by the FCM token. + * + * + * @param token - FCM token received from the firebase. + * @param isTestDevice - (true/false) registers the device as a test device if the value is true. + * + * Note: + * + * 1. The isTestDevice must be false in production. + * 2. Use this API onTokenRefresh() method. + * @returns + */ + registerPush: (token: string, isTestDevice: boolean) => void; + + /** + * This API returns a boolean value indicating whether the received push is a message from SalesIQ. + * + * + * @param map + * @param callback + * @returns + */ + isSDKMessage: ( + map?: object, + callback?: (isSDKMessage: boolean) => void + ) => void; + + /** + * This API processes the push message and generates a notification if it originated from SalesIQ. + * @param map + * @returns + */ + process: (map?: object) => void; + + /** + * The API parses the map that was received from the Firebase push message to the SalesIQNotificationPayload map. This API can be used when the notifications need to be created on your own. + * + * The API needs to be handled using the onMessage() method from the firebase. + * @param map + * @param callback + * @returns + * + * @see https://www.zoho.com/salesiq/help/developer-section/react-native-sdk-notification.html + */ + getPayload: ( + map?: object, + callback?: (result: ZSIQNotificationPayloadResult) => void + ) => void; + + /** + * API enables you to specify whether the notification click action should be managed by the App or the Mobilisten SDK. + * + * If the ACTION_SOURCE.APP value is set, and the taps of SDK notifications will be invoked in the EVENT_NOTIFICATION_CLICKED listeners. + * @param actionSource + * @returns + */ + setActionSource: (actionSource: string) => void; + + /** + * This listener allows you to register a callback that is to be invoked whenever an event is triggered regarding the notification. + * @param callback + * @returns + */ + addListener: ( + callback: (callbackData: NotificationListener) => void + ) => void; + + Event: typeof NotificationListenerEvent; + }; +} diff --git a/src/index.tsx b/src/index.tsx new file mode 100644 index 0000000..584b7c7 --- /dev/null +++ b/src/index.tsx @@ -0,0 +1,417 @@ +export { default as SIQTheme } from './components/ios-theme'; +export { ZSIQWrapper as ZohoSalesIQ } from "./components"; +// {/** + +// import { +// Dimensions, +// Platform, +// // NativeEventEmitter +// } from 'react-native'; //No I18N +// import RNZohoSalesIQ from '../commons/utils'; +// // const emitter = new NativeEventEmitter(RNZohoSalesIQ); + +// interface ZSIQWrapper { +// init: (appKey: string, accessKey: string) => void; +// initWithCallback: (appKey: string, accessKey: string, callback: () => void) => void; +// setChatTitle: (title: string) => void; +// setLanguage: (language_code: string) => void; +// setDepartment: (department: any) => void +// setOperatorEmail: (email: string) => void; +// showOperatorImageInChat: (show: boolean) => void; +// setRatingVisibility: (visibility) => void; +// showOperatorImageInLauncher: (show) => void; +// openChat: () => void; +// openChatWithID: (id) => void; +// showOfflineMessage: (show) => void; +// endChat: (id) => void; +// getChats: (callback) => void; +// getChatsWithFilter: (filter, callback) => void; +// setLauncherVisibility: (visibility) => void; +// setVisitorName: (name) => void; +// setVisitorEmail: (email) => void; +// setVisitorContactNumber: (number) => void; +// setVisitorAddInfo: (key, value) => void; +// setQuestion: (question) => void; +// startChat: (message) => void; +// setConversationVisibility: (visibility) => void; +// setConversationListTitle: (title) => void; +// setFAQVisibility: (visibility) => void; +// getArticles: (callback) => void; +// getArticlesWithCategoryID: (id, callback) => void; +// getCategories: (callback) => void; +// openArticle: (id, callback) => void; +// fetchAttenderImage: (atttenderId, fetchDefaultImage, callback) => void; +// registerVisitor: (visitorId, callback) => void; +// setThemeColorforiOS: (colorCode) => void; +// setVisitorNameVisibility: (visible) => void; +// enablePreChatForms: () => void; +// disablePreChatForms: () => void; +// enableScreenshotOption: () => void; +// disableScreenshotOption: () => void; +// enableInAppNotification: () => void; +// disableInAppNotification: () => void; +// unregisterVisitor: (callback) => void; +// setPageTitle: (title) => void; +// setCustomAction: (actionName) => void; +// performCustomAction: (actionName, shouldOpenChatWindow = false) => void; +// registerChatAction: (chatActionName) => void; +// unregisterChatAction: (chatActionName) => void; +// unregisterAllChatActions: () => void; +// // DEPRECATED +// completeChatAction: (uuid) => void; +// // DEPRECATED +// completeChatActionWithMessage: (uuid, success, message) => void; +// setChatActionTimeout: (timeout) => void; +// setVisitorLocation: (location) => void; +// addEventListener: (type, listener) => void; +// syncThemeWithOsForAndroid: (sync) => void; +// getDepartments: (callback) => void; +// isMultipleOpenChatRestricted: (callback) => void; +// isChatEnabled: (callback) => void; +// getChatUnreadCount: (callback) => void; +// setLauncherPropertiesForAndroid: (launcherPropertiesMap) => void; +// printDebugLogsForAndroid: (value) => void; +// setThemeForAndroid: (value) => void; +// registerLocalizationFileForiOS: (value) => void; +// refreshLauncher: () => void; +// setThemeForiOS: (value) => void; +// } + +// export default { +// init: function (appKey, accessKey) { +// RNZohoSalesIQ.init(appKey, accessKey); +// }, +// initWithCallback: function (appKey, accessKey, callback) { +// RNZohoSalesIQ.initWithCallback(appKey, accessKey, callback); +// }, +// setChatTitle: function (title) { +// RNZohoSalesIQ.setChatTitle(title); +// }, +// setLanguage: function (language_code) { +// RNZohoSalesIQ.setLanguage(language_code); +// }, +// setDepartment: function (department) { +// RNZohoSalesIQ.setDepartment(department); +// }, +// setOperatorEmail: function (email) { +// RNZohoSalesIQ.setOperatorEmail(email); +// }, +// showOperatorImageInChat: function (show) { +// RNZohoSalesIQ.showOperatorImageInChat(show); +// }, +// setFeedbackVisibility: function (visibility) { +// RNZohoSalesIQ.setFeedbackVisibility(visibility); +// }, +// setRatingVisibility: function (visibility) { +// RNZohoSalesIQ.setRatingVisibility(visibility); +// }, +// showOperatorImageInLauncher: function (show) { +// RNZohoSalesIQ.showOperatorImageInLauncher(show); +// }, +// openChat: function () { +// RNZohoSalesIQ.openChat(); +// }, +// openChatWithID: function (id) { +// RNZohoSalesIQ.openChatWithID(id); +// }, +// showOfflineMessage: function (show) { +// RNZohoSalesIQ.showOfflineMessage(show); +// }, +// endChat: function (id) { +// RNZohoSalesIQ.endChat(id); +// }, +// getChats: function (callback) { +// RNZohoSalesIQ.getChats(callback); +// }, +// getChatsWithFilter: function (filter, callback) { +// RNZohoSalesIQ.getChatsWithFilter(filter, callback); +// }, +// setLauncherVisibility: function (visibility) { +// RNZohoSalesIQ.setLauncherVisibility(visibility); +// }, +// setVisitorName: function (name) { +// RNZohoSalesIQ.setVisitorName(name); +// }, +// setVisitorEmail: function (email) { +// RNZohoSalesIQ.setVisitorEmail(email); +// }, +// setVisitorContactNumber: function (number) { +// RNZohoSalesIQ.setVisitorContactNumber(number); +// }, +// setVisitorAddInfo: function (key, value) { +// RNZohoSalesIQ.setVisitorAddInfo(key, value); +// }, +// setQuestion: function (question) { +// RNZohoSalesIQ.setQuestion(question); +// }, +// startChat: function (message) { +// RNZohoSalesIQ.startChat(message); +// }, +// setConversationVisibility: function (visibility) { +// RNZohoSalesIQ.setConversationVisibility(visibility); +// }, +// setConversationListTitle: function (title) { +// RNZohoSalesIQ.setConversationListTitle(title); +// }, +// setFAQVisibility: function (visibility) { +// RNZohoSalesIQ.setFAQVisibility(visibility); +// }, +// getArticles: function (callback) { +// RNZohoSalesIQ.getArticles(callback); +// }, +// getArticlesWithCategoryID: function (id, callback) { +// RNZohoSalesIQ.getArticlesWithCategoryID(id, callback); +// }, +// getCategories: function (callback) { +// RNZohoSalesIQ.getCategories(callback); +// }, +// openArticle: function (id, callback) { +// RNZohoSalesIQ.openArticle(id, callback); +// }, +// fetchAttenderImage: function (atttenderId, fetchDefaultImage, callback) { +// RNZohoSalesIQ.fetchAttenderImage(atttenderId, fetchDefaultImage, callback); +// }, +// registerVisitor: function (visitorId, callback) { +// RNZohoSalesIQ.registerVisitor(visitorId, callback ? callback : () => {}); +// }, +// setThemeColorforiOS: function (colorCode) { +// RNZohoSalesIQ.setThemeColorforiOS(colorCode); +// }, +// setVisitorNameVisibility: function (visible) { +// RNZohoSalesIQ.setVisitorNameVisibility(visible); +// }, +// enablePreChatForms: function () { +// RNZohoSalesIQ.enablePreChatForms(); +// }, +// disablePreChatForms: function () { +// RNZohoSalesIQ.disablePreChatForms(); +// }, +// enableScreenshotOption: function () { +// RNZohoSalesIQ.enableScreenshotOption(); +// }, +// disableScreenshotOption: function () { +// RNZohoSalesIQ.disableScreenshotOption(); +// }, +// enableInAppNotification: function () { +// RNZohoSalesIQ.enableInAppNotification(); +// }, +// disableInAppNotification: function () { +// RNZohoSalesIQ.disableInAppNotification(); +// }, +// unregisterVisitor: function (callback) { +// RNZohoSalesIQ.unregisterVisitor(callback ? callback : () => {}); +// }, +// setPageTitle: function (title) { +// RNZohoSalesIQ.setPageTitle(title); +// }, +// setCustomAction: function (actionName) { +// RNZohoSalesIQ.setCustomAction(actionName); +// }, +// performCustomAction: function (actionName, shouldOpenChatWindow = false) { +// RNZohoSalesIQ.performCustomAction(actionName, shouldOpenChatWindow); +// }, +// registerChatAction: function (chatActionName) { +// RNZohoSalesIQ.registerChatAction(chatActionName); +// }, +// unregisterChatAction: function (chatActionName) { +// RNZohoSalesIQ.unregisterChatAction(chatActionName); +// }, +// unregisterAllChatActions: function () { +// RNZohoSalesIQ.unregisterAllChatActions(); +// }, +// // DEPRECATED +// completeChatAction: function (uuid) { +// RNZohoSalesIQ.completeChatAction(uuid); +// }, +// // DEPRECATED +// completeChatActionWithMessage: function (uuid, success, message) { +// RNZohoSalesIQ.completeChatActionWithMessage(uuid, success, message); +// }, +// setChatActionTimeout: function (timeout) { +// RNZohoSalesIQ.setChatActionTimeout(timeout); +// }, +// setVisitorLocation: function (location) { +// RNZohoSalesIQ.setVisitorLocation(location); +// }, +// addEventListener: function (type, listener) { +// RNZohoSalesIQ.updateListener(type); +// listener = emitter.addListener(type, listener); +// }, +// syncThemeWithOsForAndroid: function (sync) { +// RNZohoSalesIQ.syncThemeWithOsForAndroid(sync); +// }, +// getDepartments: function (callback) { +// RNZohoSalesIQ.getDepartments(callback); +// }, +// isMultipleOpenChatRestricted: function (callback) { +// RNZohoSalesIQ.isMultipleOpenChatRestricted(callback); +// }, +// isChatEnabled: function (callback) { +// RNZohoSalesIQ.isChatEnabled(callback); +// }, +// getChatUnreadCount: function (callback) { +// RNZohoSalesIQ.getChatUnreadCount(callback); +// }, +// setLauncherPropertiesForAndroid: function (launcherPropertiesMap) { +// RNZohoSalesIQ.setLauncherPropertiesForAndroid(launcherPropertiesMap); +// }, +// printDebugLogsForAndroid: function (value) { +// RNZohoSalesIQ.printDebugLogsForAndroid(value) +// }, +// setThemeForAndroid: function (value) { +// RNZohoSalesIQ.setThemeForAndroid(value) +// }, +// registerLocalizationFileForiOS: function (value) { +// RNZohoSalesIQ.registerLocalizationFile(value) +// }, +// refreshLauncher: function() { +// RNZohoSalesIQ.refreshLauncher(); +// }, +// setThemeForiOS: function (value) { +// RNZohoSalesIQ.setThemeColor(value) +// }, + +// Chat: { +// shouldOpenUrl: function (value) { +// RNZohoSalesIQ.shouldOpenUrl(value) +// }, +// showFeedbackAfterSkip: function (enable) { +// RNZohoSalesIQ.showFeedbackAfterSkip(enable) +// }, +// showFeedback: function (UpToDuration) { +// RNZohoSalesIQ.showFeedbackUpToDuration(UpToDuration) +// }, +// hideQueueTime: function (value) { +// RNZohoSalesIQ.hideQueueTime(value) +// }, +// open: function (map) { +// RNZohoSalesIQ.showPayloadChat(map); +// } +// }, +// sendEvent: function (eventName, ...values) { +// RNZohoSalesIQ.sendEvent(eventName, values) +// }, + +// /** +// * +// * @param {...Tab} tabNames +// */ +// setTabOrder: function (...tabNames) { +// RNZohoSalesIQ.setTabOrder(tabNames) +// }, + +// dismissUI: function () { +// RNZohoSalesIQ.dismissUI() +// }, + +// Notification: { +// setIconForAndroid: function(resourceName) { +// RNZohoSalesIQ.setNotificationIconForAndroid(resourceName) +// }, +// registerPush: function(token, isTestDevice) { +// RNZohoSalesIQ.registerPush(token, isTestDevice) +// }, +// isSDKMessage: function(map, callback) { +// RNZohoSalesIQ.isSDKMessage(map, callback) +// }, +// process: function(map) { +// RNZohoSalesIQ.processNotificationMessage(map) +// }, +// getPayload: function(map, callback) { +// RNZohoSalesIQ.getNotificationPayload(map, callback) +// }, +// setActionSource: function(actionSource) { +// RNZohoSalesIQ.setNotificationActionSource(actionSource) +// } +// }, + +// Logger: { + +// INFO: RNZohoSalesIQ.INFO_LOG, +// WARNING: RNZohoSalesIQ.WARNING_LOG, +// ERROR: RNZohoSalesIQ.ERROR_LOG, + +// setEnabled: function (value) { +// RNZohoSalesIQ.setLoggerEnabled(value) +// }, +// isEnabled: function (callback) { +// RNZohoSalesIQ.isLoggerEnabled(callback) +// }, +// setPathForiOS: function (url) { +// RNZohoSalesIQ.setLoggerPathForiOS(url) +// }, +// clearLogsForiOS: function () { +// RNZohoSalesIQ.clearLogsForiOS() +// }, +// writeLogForiOS: function (log, level, callback) { +// RNZohoSalesIQ.writeLogForiOS(log, level, callback); +// } +// }, + +// Launcher: { +// VisibilityMode: { +// ALWAYS: RNZohoSalesIQ.LAUNCHER_VISIBILITY_MODE_ALWAYS, +// NEVER: RNZohoSalesIQ.LAUNCHER_VISIBILITY_MODE_NEVER, +// WHEN_ACTIVE_CHAT: RNZohoSalesIQ.LAUNCHER_VISIBILITY_MODE_WHEN_ACTIVE_CHAT +// }, +// show: function (mode) { +// RNZohoSalesIQ.showLauncher(mode) +// }, +// setVisibilityModeToCustomLauncher: function (mode) { +// RNZohoSalesIQ.setVisibilityModeToCustomLauncher(mode) +// }, +// enableDragToDismiss: function (enabled) { +// RNZohoSalesIQ.enableDragToDismiss(enabled) +// }, +// setMinimumPressDuration: function (duration) { +// RNZohoSalesIQ.setMinimumPressDuration(duration) +// } +// }, + +// KnowledgeBase: { +// isEnabled: function (type, callback) { +// RNZohoSalesIQ.isKnowledgeBaseEnabled(type, callback); +// }, +// setVisibility: function (type, shouldShow) { +// RNZohoSalesIQ.setKnowledgeBaseVisibility(type, shouldShow) +// }, +// categorize: function (type, shouldCategorize) { +// RNZohoSalesIQ.categorizeKnowledgeBase(type, shouldCategorize) +// }, +// combineDepartments: function (type, merge) { +// RNZohoSalesIQ.combineKnowledgeBaseDepartments(type, merge) +// }, +// setRecentlyViewedCount: function (limit) { +// RNZohoSalesIQ.setKnowledgeBaseRecentlyViewedCount(limit) +// }, +// getResourceDepartments: function (callback) { +// RNZohoSalesIQ.getKnowledgeBaseResourceDepartments(callback); +// }, +// open: function (type, id, callback) { +// RNZohoSalesIQ.openKnowledgeBase(type, id, callback); +// }, +// getSingleResource: function (type, id, callback) { +// RNZohoSalesIQ.getKnowledgeBaseSingleResource(type, id, callback); +// }, +// getResources: function (type, departmentId = null, parentCategoryId = null, page = 1, limit = 99, searchKey = null, callback) { +// RNZohoSalesIQ.getKnowledgeBaseResources(type, departmentId, parentCategoryId, page, limit, searchKey, callback); +// }, +// getCategories: function (type, departmentId = null, parentCategoryId = null, callback) { +// RNZohoSalesIQ.getKnowledgeBaseCategories(type, departmentId, parentCategoryId, callback); +// } +// } as ZSIQWrapper; + +// // MessageStatus: { +// // SENDING: RNZohoSalesIQ.SENDING, +// // UPLOADING: RNZohoSalesIQ.UPLOADING, +// // SENT: RNZohoSalesIQ.SENT, +// // FAILURE: RNZohoSalesIQ.FAILURE +// // } + +// if (Platform.OS === 'android') { +// Dimensions.addEventListener('change', () => { +// RNZohoSalesIQ.refreshLauncherPropertiesForAndroid(); +// }); +// } + +// */} \ No newline at end of file diff --git a/src/types/Listener.ts b/src/types/Listener.ts new file mode 100644 index 0000000..cd5ec59 --- /dev/null +++ b/src/types/Listener.ts @@ -0,0 +1,288 @@ +import type { SalesIQChat } from '../components/chat/types/SalesIQChat'; +import type { ResourceType } from '../components/knowledgebase/types/KnowledgeBase'; + +export enum ListenerEvent { + /** + * Invoked when the user opens the SDK. + */ + SUPPORT_OPENED = 'EVENT_SUPPORT_OPENED', + + /** + * Invoked when the user closes the SDK. + */ + SUPPORT_CLOSED = 'EVENT_SUPPORT_CLOSED', + + /** + * Invoked when any of the operators are online. + */ + OPERATORS_ONLINE = 'EVENT_OPERATORS_ONLINE', + + /** + * Invoked when all the operators are offline. + */ + OPERATORS_OFFLINE = 'EVENT_OPERATORS_OFFLINE', + + /** + * Invoked when the visitor's IP is blocked. + */ + VISITOR_IPBLOCKED = 'EVENT_VISITOR_IPBLOCKED', + + /** + * This event allows you to open a URL when invoked. When using this event followed by a URL, this will open the mentioned URL. + */ + OPEN_URL = 'EVENT_OPEN_URL', + + /** + * This event will complete the chat action as a success or failure, with or without a message + */ + COMPLETE_CHAT_ACTION = 'EVENT_COMPLETE_CHAT_ACTION', +} + +export type Listeners = { + event: ListenerEvent.SUPPORT_OPENED | ListenerEvent.SUPPORT_CLOSED | ListenerEvent.OPERATORS_ONLINE | ListenerEvent.OPERATORS_OFFLINE | ListenerEvent.VISITOR_IPBLOCKED, + body?: null +} + +export type ZSIQListenerEventsType = { + /** + * @deprecated + * Invoked when the user opens the SDK. + */ + EVENT_SUPPORT_OPENED: string; + + /** + * @deprecated + * Invoked when the user closes the SDK. + */ + EVENT_SUPPORT_CLOSED: string; + + /** + * @deprecated + * Invoked when the visitor's IP is blocked. + */ + EVENT_VISITOR_IPBLOCKED: string; + + /** + * @deprecated + * Invoked when any of the operators are online. + */ + EVENT_OPERATORS_ONLINE: string; + + /** + * @deprecated + * Invoked when all the operators are offline. + */ + EVENT_OPERATORS_OFFLINE: string; + + /** + * @deprecated + * Invoked when a chat window is opened. + */ + EVENT_CHATVIEW_OPENED: string; + + /** + * @deprecated + * Invoked when a chat window is closed. + */ + EVENT_CHATVIEW_CLOSED: string; + + /** + * @deprecated + * Invoked when a chat is initiated. + * @param visitorChat - {@link SalesIQChat} + */ + EVENT_CHAT_OPENED: string; + + /** + * @deprecated + * Invoked when a chat is ended. + * @param visitorChat - {@link SalesIQChat} + */ + EVENT_CHAT_CLOSED: string; + + /** + * @deprecated + * Invoked when a chat is reopened. + * @param visitorChat - {@link SalesIQChat} + */ + EVENT_CHAT_REOPENED: string; + + /** + * @deprecated + * Invoked when a chat is picked up. + * @param visitorChat - {@link SalesIQChat} + */ + EVENT_CHAT_ATTENDED: string; + + /** + * @deprecated + * Invoked when a chat is missed. + * @param visitorChat - {@link SalesIQChat} + */ + EVENT_CHAT_MISSED: string; + + /** + * @deprecated + * Invoked when the position in the queue of a queued chat changes. + * @param visitorChat - {@link SalesIQChat} + */ + EVENT_CHAT_QUEUE_POSITION_CHANGED: string; + + /** + * @deprecated + * Invoked when the unread count is changed. + */ + EVENT_CHAT_UNREAD_COUNT_CHANGED: string; + + /** + * @deprecated + * Invoked when feedback is given by the visitor. + * @param visitorChat - {@link SalesIQChat SalesIQChat} + */ + EVENT_FEEDBACK_RECEIVED: string; + + /** + * @deprecated + * Invoked when a chat is rated by the visitor. + * @param visitorChat - {@link SalesIQChat SalesIQChat} + */ + EVENT_RATING_RECEIVED: string; + + /** + * @deprecated + * Invoked when an article is liked. + */ + EVENT_ARTICLE_LIKED: string; + + /** + * @deprecated + * Invoked when an article is disliked. + */ + EVENT_ARTICLE_DISLIKED: string; + + /** + * @deprecated + * Invoked when an article is opened. + */ + EVENT_ARTICLE_OPENED: string; + + /** + * @deprecated + * Invoked when an article is closed. + */ + EVENT_ARTICLE_CLOSED: string; + + /** + * @deprecated + * Invoked when a chat action is to be executed. {@link https://www.zoho.com/salesiq/help/developer-section/react-native-sdk-chatactions-v2.html Learn More} + */ + EVENT_PERFORM_CHATACTION: string; + + /** + * @deprecated + * Invoked when a custom trigger is executed. {@link http://www.zoho.com/salesiq/help/developer-section/react-native-sdk-custom-trigger.html Learn More} + */ + EVENT_CUSTOMTRIGGER: string; + /** + * @deprecated + * Invoked when a bot has been triggered. + * + * Note: Android only + */ + EVENT_BOT_TRIGGER: string; + + /** + * @deprecated + * Invoked when a URL in the chat is clicked. + * @param chat - {@link SalesIQChat} + */ + EVENT_HANDLE_URL: string; + + /** + * @deprecated + * Invoked when a resource is opened. + */ + EVENT_RESOURCE_OPENED: string; + + /** + * @deprecated + * Invoked when a resource is closed. + */ + EVENT_RESOURCE_CLOSED: string; + + /** + * @deprecated + * Invoked when a resource is liked. + */ + EVENT_RESOURCE_LIKED: string; + + /** + * @deprecated + * Invoked when a resource is disliked. + */ + EVENT_RESOURCE_DISLIKED: string; + + /** + * @deprecated + * Show/hide your custom launcher with the triggered boolean value. + */ + EVENT_HANDLE_CUSTOM_LAUNCHER_VISIBILITY: string; + + /** + * @deprecated + * Invoked when the notification clicked. + */ + EVENT_NOTIFICATION_CLICKED: string; +}; + +export enum ZSIQTabs { + CONVERSATIONS = 'TAB_CONVERSATIONS', + KNOWLEDGE_BASE = 'TAB_KNOWLEDGE_BASE', + /** + * @deprecated + */ + FAQ = 'TAB_FAQ', +} + +export enum LauncherProps { + MODE_STATIC = 1, + MODE_FLOATING = 2, + HORIZONTAL_LEFT = 'LAUNCHER_HORIZONTAL_LEFT', + HORIZONTAL_RIGHT = 'LAUNCHER_HORIZONTAL_RIGHT', + VERTICAL_TOP = 'LAUNCHER_VERTICAL_TOP', + VERTICAL_BOTTOM = 'LAUNCHER_VERTICAL_BOTTOM', +} + +export interface ZSIQConstantsTypes { + Tab: typeof ZSIQTabs; + TYPE_OPEN: string; + TYPE_WAITING: string; + TYPE_CONNECTED: string; + TYPE_ENDED: string; + TYPE_CLOSED: string; + TYPE_MISSED: string; + + /** + * @deprecated + */ + LAUNCHER_MODE_STATIC: string; + + /** + * @deprecated + */ + LAUNCHER_MODE_FLOATING: string; + ActionSource: { + /** + * Source of action will be managed by the App. + */ + APP: string; + /** + * Source of action will be managed by the Mobilisten SDK. + */ + SDK: string; + }; + + Resource: typeof ResourceType; +} + +export type _SalesIQChat = SalesIQChat \ No newline at end of file diff --git a/src/types/ZSIQWrapperTypes.ts b/src/types/ZSIQWrapperTypes.ts new file mode 100644 index 0000000..cd95de2 --- /dev/null +++ b/src/types/ZSIQWrapperTypes.ts @@ -0,0 +1,679 @@ +import type { ZSIQLauncherTypes } from './../components/launcher/types/Launcher'; +import type { ZSIQKnowledgeBaseTypes } from './../components/knowledgebase/types/KnowledgeBase'; +import type { SalesIQChat } from '../components/chat/types/SalesIQChat'; +import type { ListenerEvent, Listeners, LauncherProps, ZSIQTabs } from './Listener'; +import ZSIQTheme from '../components/ios-theme'; + +export type SalesIQLanguageCodes = + | 'fr' + | 'de' + | 'es' + | 'nl' + | 'nb' + | 'tr' + | 'ru' + | 'pt' + | 'it' + | 'ko' + | 'ja' + | 'da' + | 'pl' + | 'ar' + | 'hu' + | 'zh' + | 'he' + | 'ga' + | 'ro' + | 'th' + | 'sv' + | 'el' + | 'cs' + | 'sk' + | 'sl' + | 'hr' + | 'bg' + | 'vi' + | 'fil' + | 'fi' + | 'in' + | 'zh_TW' + | 'ka' + | 'hy' + | 'fa' + | 'ta' + | 'kn' + | 'bn' + | 'hi' + | 'gu' + | 'mr' + | 'te' + | 'pa' + | 'or' + | 'ml' + | 'en'; + +export type CallbackError = { + code?: string | number; + message?: string; +}; + +type VisitorLocationType = { + latitude?: number; + longitude?: number; + country?: string; + city?: string; + state?: string; + countryCode?: string; + zipCode?: string; +}; + +type ZSIQLauncherPropTypes = { + mode?: LauncherProps.MODE_FLOATING | LauncherProps.MODE_STATIC; + x?: number; + y?: number; + horizontalDirection?: LauncherProps.HORIZONTAL_LEFT | LauncherProps.HORIZONTAL_RIGHT; + verticalDirection?: LauncherProps.VERTICAL_TOP | LauncherProps.VERTICAL_BOTTOM; + icon?: string; +}; + +export interface Department { + id?: string; + name?: string; + available?: boolean; +} + +export interface ZSIQWrapperTypes { + /** + * This API is used to initialize Mobilisten with an appKey and accessKey generated from the SalesIQ console for a specific bundle ID. + * @param appKey + * @param accessKey + * @returns + */ + init: (appKey: string, accessKey: string) => void; + + /** + * This API is used to initialize Mobilisten with an appKey and accessKey generated from the SalesIQ console for a specific bundle ID. + * @param appKey + * @param accessKey + * @param callback + * @returns + */ + initWithCallback: ( + appKey: string, + accessKey: string, + callback: (success: boolean) => void + ) => void; + + present: ( + tab?: string | null, + id?: string | null, + callback?: (error: CallbackError, result: boolean) => void + ) => void; + + /** + * This API lets you set a title in the toolbar of the chat window. + * @param title + * @returns + */ + setChatTitle: (title: string) => void; + + /** + * This API lets you configure language preferences for the embedded chat widget in your mobile application. + * @param languageCode + * @returns + */ + setLanguage: (languageCode: SalesIQLanguageCodes) => void; + + /** + * This API lets you set a default department to which you would like to route all the chat requests placed by the visitors. + * @param departmentName + * @returns + */ + setDepartment: (departmentName: string) => void; + + /** + * This API lets you specify the email address of a particular operator, to whom you would like to route all the incoming chat requests. + * @param operatorMailID + * @returns + */ + setOperatorEmail: (operatorMailID: string) => void; + + /** + * This API lets you configure the visibility status of operator's profile picture in the chat window. + * @param visibility + * @returns + */ + showOperatorImageInChat: (visibility: boolean) => void; + + /** + * This API lets you control the visibility of the feedback form which would appear right after a chat session concludes. + * @param visibility + * @returns + */ + setFeedbackVisibility: (visibility: boolean) => void; + + /** + * This API would let you control the visibility of the rating option right after a chat session concludes. + * @param visibility + * @returns + */ + setRatingVisibility: (visibility: boolean) => void; + + /** + * This API lets you to dynamically set the profile picture of the operator to whom the chat will be routed to in the embedded chat widget icon. + * + * Note: By default, pictures of the operators will not be set on the chat widget icon. + * @param visibility + * @returns + */ + showOperatorImageInLauncher: (visibility: boolean) => void; + + /** + * This API is used to open a recent chat. In case there are no chats, a new chat window will be opened to initiate a new chat. + * @returns + */ + openChat: () => void; + + /** + * This API is used to open a specific chat, given the chatID. + * @param chatID + * @returns + */ + openChatWithID: (chatID: string) => void; + + /** + * This API will set offline banner in chat window during the non-business hours and when the agents are busy inorder to help the visitors leave a message even when agents are unavailable. + * @param visibility + * @returns + */ + showOfflineMessage: (visibility: boolean) => void; + + /** + * This API can be used to end the specified chat if it is in an open state. + * @param chatID - Chat ID + * @returns + */ + endChat: (chatID: string) => void; + + /** + * This API is used to get a list of all the chats had by a visitor along with the details of each chat. It returns an array of VisitorChat objects. + * @param callback - (error, chats) => void + * @returns + */ + getChats: ( + callback: (error: CallbackError, chats: SalesIQChat[] | null) => void + ) => void; + + /** + * This API lets you obtain a list of chats and additionally provides a filter parameter to let you filter out the type of chats based on their current status. + * @param filter + * @param callback + * @returns + */ + getChatsWithFilter: ( + filter: string, + callback: (error: CallbackError, chats: SalesIQChat[] | null) => void + ) => void; + + /** + * @deprecated + * This API was deprecated in version {@link https://github.com/zoho/SalesIQ-Mobilisten-ReactNative/releases/tag/v8.0.0 8.0.0}. Use {@link ZSIQLauncherTypes.Launcher ZohoSalesIQ.Launcher.show} instead. + * @param visibility + * @returns + */ + setLauncherVisibility: (visibility: boolean) => void; + + /** + * This API would dynamically set the names of the visitors(if known) in the chat windows on your app as well as on the pane right beside your operator's chat window. If you had disabled the name field in the chat windows, then this API would set the names of the visitors in the pane beside your operator's chat window alone. + * @param name + * @returns + */ + setVisitorName: (name: string) => void; + + /** + * This API would dynamically set the email address of the visitors(if known) in the chat windows on your app, as well as on the pane right beside your operator's chat window. If you had disabled the email address field in the chat windows, then this API would set the email address of the visitors in the pane beside your operator's chat window alone. + * @param email + * @returns + */ + setVisitorEmail: (email: string) => void; + + /** + * This API would dynamically set the contact number of the visitors(if known) in the chat windows on your app, as well as on the pane right beside your operator's chat window. If you had disabled the contact number field in the chat windows, then this API would set the contact number of the visitors in the pane beside your operator's chat window alone. + * @param contactNumber + * @returns + */ + setVisitorContactNumber: (contactNumber: string) => void; + + /** + * This API would let you add additional information about the visitors and display it to the operators of your firm in the pane right beside their chat windows while conversing with the visitors. + * @param key + * @param value + * @returns + */ + setVisitorAddInfo: (key: string, value: string) => void; + + /** + * This API would let you auto-fill a pre-defined question in the message boxes when the visitor tries to initiate a chat with the operators of your firm. + * @param question + * @returns + */ + setQuestion: (question: string) => void; + + /** + * @deprecated + * This API can be used to automatically initiate a chat from the visitor side with a pre-defined message which you can configure using this API, right after the visitor clicks on the chat widget to initiate a chat. + * @param message + * @returns + */ + startChat: (message: string) => void; + + /** + * You can use this API to either enable or disable the conversation history option in the visitor's chat windows. + * + * Note: This API will not work, if you had already disabled the conversation history configuration under the Settings tab in your portal. + * + * @param visibility + * @returns + */ + setConversationVisibility: (visibility: boolean) => void; + + /** + * This API allows you to set the title for the conversations list screen within the Mobilisten SDK. + * @param title + * @returns + */ + setConversationListTitle: (title: string) => void; + + /** + * @deprecated This API was deprecated in version {@link https://github.com/zoho/SalesIQ-Mobilisten-ReactNative/releases/tag/v7.0.0 7.0.0}. Use {@link ZSIQKnowledgeBaseTypes.KnowledgeBase ZohoSalesIQ.KnowledgeBase.setVisibility()} instead. + * @param visibility + * @returns + */ + setFAQVisibility: (visibility: boolean) => void; + + /** + * @deprecated This API was deprecated in version {@link https://github.com/zoho/SalesIQ-Mobilisten-ReactNative/releases/tag/v7.0.0 7.0.0}. Use {@link ZSIQKnowledgeBaseTypes.KnowledgeBase ZohoSalesIQ.KnowledgeBase.getResources()} instead. + * @see {@link ZSIQKnowledgeBaseTypes ZohoSalesIQ.KnowledgeBase} + * @param callback + * @returns + */ + getArticles: ( + callback: (error: CallbackError, articlesList: any) => void + ) => void; + + /** + * @deprecated This API was deprecated in version {@link https://github.com/zoho/SalesIQ-Mobilisten-ReactNative/releases/tag/v7.0.0 7.0.0}. Use {@link ZSIQKnowledgeBaseTypes.KnowledgeBase ZohoSalesIQ.KnowledgeBase.getResources()} instead. + * @param id + * @param callback + * @returns + */ + getArticlesWithCategoryID: ( + id: string, + callback: (error: CallbackError, articlesList: any) => void + ) => void; + + /** + * @deprecated This API was deprecated in version {@link https://github.com/zoho/SalesIQ-Mobilisten-ReactNative/releases/tag/v7.0.0 7.0.0}. Use {@link ZSIQKnowledgeBaseTypes.KnowledgeBase ZohoSalesIQ.KnowledgeBase.getCategories()} instead. + * @param callback + * @returns + */ + getCategories: ( + callback: (error: CallbackError, categoryList: any) => void + ) => void; + + /** + * @deprecated This API was deprecated in version {@link https://github.com/zoho/SalesIQ-Mobilisten-ReactNative/releases/tag/v7.0.0 7.0.0}. Use {@link ZSIQKnowledgeBaseTypes.KnowledgeBase ZohoSalesIQ.KnowledgeBase.open()} instead. + * @param id + * @param callback + * @returns + */ + openArticle: (id: string, callback: (error: CallbackError) => void) => void; + + /** + * This API can be used to fetch the image of the person who has attended the chat. + * @param atttenderId + * @param fetchDefaultImage + * @param callback + * @returns + */ + fetchAttenderImage: ( + atttenderId: string, + fetchDefaultImage: boolean, + callback: (error: CallbackError, image: string) => void + ) => void; + + /** + * This API allows you to register a user using a unique ID with the SalesIQ SDK. If your application has login and logout life cycles, you can enroll your visitor and their activity in the SDK will be synchronized across multiple platforms. + * @param visitorId + * @param callback + * @returns + */ + registerVisitor: ( + visitorId: string, + callback: (error: CallbackError, result: boolean) => void + ) => void; + + /** + * You can change the default SDK theme color using the .setThemeColorforiOS() property. The default theme Color of the SDK is a shade of blue. Any modifications to the .setThemeColorforiOS() property will be applied across all screens in the Mobilisten UI for iOS devices. + * @param hexcode + * @returns + */ + setThemeColorforiOS: (hexcode: string) => void; + + /** + * This API allows you to display the visitor's name if available as the message sender name for all outgoing messages within the chat window. + * @param visible + * @returns + */ + setVisitorNameVisibility: (visible: boolean) => void; + + /** + * This API allows you to enable pre-chat forms before initiating a chat. + * @returns + */ + enablePreChatForms: () => void; + + /** + * This API allows you to disable pre-chat forms before initiating a chat. + * @returns + */ + disablePreChatForms: () => void; + + /** + * This API allows you to enable the ability to capture and send screenshots. + * + * + * Note: The option to capture and send screenshots is enabled by default. + * @returns + */ + enableScreenshotOption: () => void; + + /** + * This API allows you to disable the option to capture and send screenshots. + * + * + * Note: The option to capture and send screenshots is enabled by default. + * @returns + */ + disableScreenshotOption: () => void; + + /** + * This API can be used to enable in-app notifications for the embedded mobile SDK. + * @returns + */ + enableInAppNotification: () => void; + + /** + * This API can be used to disable in-app notifications for the embedded mobile SDK. + * @returns + */ + disableInAppNotification: () => void; + + /** + * This API allows you to unregister a user once they are registered using the .registerVisitor() API. If your application has login and logout life cycles, you can unregister a visitor during a session logout which would clear any data the SDK may hold such as past conversations had by the registered user. + * @param callback + * @returns + */ + unregisterVisitor: (callback?: (error: CallbackError) => void) => void; + + /** + * This API lets you set an apt title for each and every screen in your application, thus making it easy for you to track down the trail of your visitors when they navigate through the screens of your mobile app. + * @param title + * @returns + */ + setPageTitle: (title: string) => void; + + /** + * @deprecated + * This API was deprecated. Instead use {@link performCustomAction ZohoSalesIQ.performCustomAction()}. + * @param actionName + * @returns + */ + setCustomAction: (actionName: string) => void; + + /** + * This API lets you initiate a trigger upon an action, like clicking a button in your mobile app. + * @param actionName - Name of the action performed by the visitor. + * + * + * @param shouldOpenChatWindow `(optional)` + * + * - *true* - When the shouldOpenChatWindow parameter is set to true, the Zoho SalesIQ chat window in the user's app will open directly when the API is triggered. + * + * - *false* `(Default)` - When the shouldOpenChatWindow parameter is set to false, an in-app notification will be sent to the user's mobile device when the trigger is activated. + * + * + * @returns + */ + performCustomAction: ( + actionName: string, + shouldOpenChatWindow?: boolean + ) => void; + + /** + * This API allows you to register any custom action that you have created + * + * + * Note: It is mandatory to register any custom actions that are used in the bot script. If an action is not registered, it cannot be used within chat. + * @param actionName + * @returns + */ + registerChatAction: (actionName: string) => void; + + /** + * This API allows you to unregister an action by using the name it is registered with. + * + * + * Note: Once an action is unregistered, it will no longer be available for use in chat. + * @param actionName + * @returns + */ + unregisterChatAction: (actionName: string) => void; + + /** + * This API allows you to unregister all custom actions that have been registered using the {@link registerChatAction registerChatAction} API. + * @returns + */ + unregisterAllChatActions: () => void; + + // DEPRECATED + /** + * @deprecated - This API allows you to mark a chat action that is in progress as completed. This API takes an action's unique ID as a parameter. + * + * Note: This API must be called to mark an action as completed before the timeout period. If it is not called within the timeout period, an action is considered as timed out. If you wish to show a message on completion, use the {@link completeChatActionWithMessage completeChatActionWithMessage} API. + * @param actionUUID + * @returns + */ + completeChatAction: (actionUUID: string) => void; + + /** + * @deprecated + * This API lets your mark a chat action that is in progress as completed. This API takes an action's unique ID as a parameter and an action completion message which is shown in chat after completion. + * + * Note: This API must be called to mark an action as completed before the set timeout period. If it is not called within the timeout period, the action will be considered as timed out. + * @param actionUUID + * @param completed + * @param message + * @returns + */ + completeChatActionWithMessage: ( + actionUUID: string, + completed: boolean, + message: string + ) => void; + + /** + * This API lets you set the timeout for any custom action in seconds. An action is timed out if it has been in progress for a time greater than the set timeout period. + * + * Note: The default timeout period is 30 seconds. + * @param timeoutInSec + * @returns + */ + setChatActionTimeout: (timeoutInSec: number) => void; + + /** + * This API allows you to set a secondary location for a visitor. The secondary location set using this API will be visible within the visitor information page under the Secondary Location section. + * The setLocation() API takes an object with specific keys representing the visitor's location as a parameter. + * + * Note: If the latitude and longitude of the visitor are set using this API, the visitor's device location will be overridden while showing the current location in the map for the location widget. This is applicable only if a pre-selected location is not added within the bot script. + * @param location - {@link VisitorLocationType} + * @returns + */ + setVisitorLocation: (location: VisitorLocationType) => void; + + /** + * @deprecated + * + * Note: This API was deprecated in version {@link https://github.com/zoho/SalesIQ-Mobilisten-ReactNative/releases/tag/v9.4.0 9.4.0}. + * Use, + * - ZohoSalesIQ.addListener(), + * - ZohoSalesIQ.Chat.addListener() for chat events, + * - ZohoSalesIQ.KnowledgeBase.addListener() for KnowledgeBase events, + * - ZohoSalesIQ.Notification.addListener() for Notification events, + * - ZohoSalesIQ.Launcher.addListener() for Launcher events + * + * The Mobilisten React-Native SDK provides various events that developers can use to perform customized actions. + * @param type + * @param listener + * @returns + */ + addEventListener: ( + type: string, + listener: ({ ...params }?: any) => void + ) => void; + + /** + * This API allows you to sync the SalesIQ theme mode with the device's theme. + * + * Note: Android only + * @param sync + * @returns + */ + syncThemeWithOsForAndroid: (sync: boolean) => void; + + /** + * This API allows you to programmatically get a list of all the departments that have been associated with the brand in which Mobilisten is configured. + * @param callback + * @returns + * + * @link https://www.zoho.com/salesiq/help/developer-section/react-native-sdk-get-departments.html + */ + getDepartments: ( + callback: (error: CallbackError, departments: Department[]) => void + ) => void; + + /** + * This API is used to check if the user can maintain multiple open chats with support at the same time. The value returned by the API corresponds to the configuration under Settings → Brands → {Your_Brand} → Flow Controls → Parallel conversations. + * + * Note: It is required that the API must be called only after the SDK has been successfully initialized to receive the accurate configuration state + * + * @param callback + * @returns + */ + isMultipleOpenChatRestricted: ( + callback: (restricted: boolean) => void + ) => void; + + /** + * This method can check if a visitor can initiate a new chat. This property changes based on the business hours and hide embed when offline configurations. If an operator blocks the visitor's IP, the property will also be false. You may use this property if you have implemented a custom support UI where the {@link ZSIQWrapperTypes.openChat() ZohoSalesIQ.openChat()} API allows the visitor to start a new support conversation. + * @param callback + * @returns + */ + isChatEnabled: (callback: (isEnabled: boolean) => void) => void; + + /** + * This API can be used to get the count of unread messages. + * @param callback + * @returns + */ + getChatUnreadCount: (callback: (unreadCount: number) => void) => void; + + /** + * You can use this API to customize the position and mode of the Launcher Button. You can choose the mode of the launcher button according to your application needs. + * + * + * @param launcherPropertiesMap + * @returns + * + * @see {@link https://www.zoho.com/salesiq/help/developer-section/react-native-sdk-launcher-button-customization.html} + */ + setLauncherPropertiesForAndroid: ( + launcherPropertiesMap: ZSIQLauncherPropTypes + ) => void; + + /** + * For debugging purpose only + * @param value + * @returns + */ + printDebugLogsForAndroid: (value: boolean) => void; + + /** + * + * @param value + * @returns + */ + setThemeForAndroid: (value: string) => void; + + /** + * This API is used to override the localizable strings by registering the file name of the ".xcstrings" or ".strings" file containing the custom localized strings. + * + * + * @param fileName + * @returns + */ + registerLocalizationFileForiOS: (fileName: string) => void; + + /** + * + * @returns + */ + refreshLauncher: () => void; + + /** + * The themeColor property allows you to change the default SDK theme color to a shade of blue. Any modifications to the themeColor property will be applied across all screens in the Mobilisten UI. + * + * @see {@link https://www.zoho.com/salesiq/help/developer-section/react-native-sdk-ui-theme-color.html} + * @param value + * @returns + */ + setThemeForiOS: (value: ZSIQTheme) => void; + + /** + * This API is used to send events to the SDK for several returning callbacks + * + * @param eventName + * @param rest + * @returns + */ + sendEvent: (eventName: ListenerEvent.OPEN_URL | ListenerEvent.COMPLETE_CHAT_ACTION, ...rest: any[]) => void; + + /** + * This API allows you to change the order of the tabs in the SalesIQ SDK inside your mobile app. + * + * + * Note: By default, the first tab will be conversation and followed by the Knowledge Base. The enum value for the FAQ has been deprecated in version {@link https://github.com/zoho/SalesIQ-Mobilisten-ReactNative/releases/tag/v7.0.0 7.0.0}. Instead, use KNOWLEDGE_BASE enum value. + * @param tabNames + * @returns + */ + setTabOrder: (...tabNames: typeof ZSIQTabs[keyof typeof ZSIQTabs][]) => void; + + /** + * This API allows users to navigate back to your app instantly by dismissing all Mobilisten UI elements (the launcher will not be affected). + */ + dismissUI: () => void; + + /** + * This listener provides an interface for various event callbacks to help developers track different actions performed by the app user. The {@link addListener ZohoSalesIQ.addListener} would invoke callback methods for various actions performed by the visitors. + * @param type + * @param listener + * @returns + */ + addListener: (callback: (callbackData: Listeners) => void) => void; + + Event: typeof ListenerEvent; +} + +// Sample export for using ZSIQKnowledgeBaseTypes in this file +export type _ZSIQKnowledgeBaseTypes = ZSIQKnowledgeBaseTypes; +export type _ZSIQLauncherTypes = ZSIQLauncherTypes; \ No newline at end of file diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 0000000..2a21c28 --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,4 @@ +{ + "extends": "./tsconfig", + "exclude": ["example"] +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..74b2a61 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "rootDir": ".", + "paths": { + "react_native_zohosalesiq_mobilisten": ["./src/index"] + }, + "allowUnreachableCode": false, + "allowUnusedLabels": false, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react", + "lib": ["esnext"], + "module": "esnext", + "moduleResolution": "node", + "noFallthroughCasesInSwitch": true, + "noImplicitReturns": true, + "noImplicitUseStrict": false, + "noStrictGenericChecks": false, + "noUncheckedIndexedAccess": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "resolveJsonModule": true, + "skipLibCheck": true, + "strict": true, + "target": "esnext", + "verbatimModuleSyntax": true + } +} diff --git a/turbo.json b/turbo.json new file mode 100644 index 0000000..331e289 --- /dev/null +++ b/turbo.json @@ -0,0 +1,34 @@ +{ + "$schema": "https://turbo.build/schema.json", + "pipeline": { + "build:android": { + "inputs": [ + "package.json", + "android", + "!android/build", + "src/*.ts", + "src/*.tsx", + "example/package.json", + "example/android", + "!example/android/.gradle", + "!example/android/build", + "!example/android/app/build" + ], + "outputs": [] + }, + "build:ios": { + "inputs": [ + "package.json", + "*.podspec", + "ios", + "src/*.ts", + "src/*.tsx", + "example/package.json", + "example/ios", + "!example/ios/build", + "!example/ios/Pods" + ], + "outputs": [] + } + } +}