Skip to content

Commit

Permalink
Update sample project
Browse files Browse the repository at this point in the history
Update sample project
  • Loading branch information
yeskay-zohocorp committed Jan 25, 2024
1 parent 1cde5d7 commit ddc34db
Show file tree
Hide file tree
Showing 2,479 changed files with 457,282 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ allprojects {
2. Click **Sync Now** from the toolbar on the IDE.

## Initializing Mobilisten
1. Generate `App` and `Access` keys for iOS and Android platforms.
1. Generate `App` and `Access` keys for iOS and Android platforms by providing your bundle id.
2. Use the **ZohoSalesIQ.init** API with keys for each platform as shown below.
```js
import { ZohoSalesIQ } from 'react-native-zohosalesiq-mobilisten';
Expand All @@ -63,7 +63,7 @@ if (Platform.OS === 'ios'){
ZohoSalesIQ.init("android_app_key","android_access_key");
}
```
3. If you wish to show the default chat launcher, use the [**ZohoSalesIQ.setLauncherVisibility**](https://www.zoho.com/salesiq/help/developer-section/react-native-sdk-set-launcher-visibility.html) API (Optional).
3. If you wish to show the default chat launcher, use the [**ZohoSalesIQ.Launcher.show()**](https://www.zoho.com/salesiq/help/developer-section/react-native-sdk-launcher-show.html) API (Optional).

## API Documentation
You can find the list of all APIs and their documentation [here](https://www.zoho.com/salesiq/help/developer-section/react-native-sdk-add-event-listener.html) under the **API Reference** section.
106 changes: 106 additions & 0 deletions example/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import React, { useEffect } from "react";
import { Platform, StatusBar } from "react-native";
import { addListeners } from "./scripts/listeners";

import { ZohoSalesIQ } from "react-native-zohosalesiq-mobilisten";
import Main from "./screens/Main";

const App: React.FC = () => {
function initSalesIQ() {
/*
Follow the steps outlined in https://www.zoho.com/salesiq/help/developer-guides/android-mobile-sdk-installation-2.0.html
to obtain a distinct app key and access key for Android and iOS for your application from the SalesIQ portal.
*/
const androidAppKey = "<YOUR_ANDROID_APP_KEY>";
const androidAccessKey = "<YOUR_ANDROID_ACCESS_KEY>";

const iosAppKey = "<YOUR_IOS_APP_KEY>";
const iosAccessKey = "<YOUR_IOS_ACCESS_KEY>";

let appkey = "";
let accesskey = "";

if (Platform.OS === "android") {
appkey = androidAppKey;
accesskey = androidAccessKey;
} else if (Platform.OS === "ios") {
appkey = iosAppKey;
accesskey = iosAccessKey;
}

/*
The Mobilisten React-Native SDK provides various events that developers can use to perform customized actions.
Refer ./scripts/listeners file
*/
addListeners();

ZohoSalesIQ.printDebugLogsForAndroid(true);

//This API is used to initialize the SalesIQ SDK with callback.
ZohoSalesIQ.initWithCallback(appkey, accesskey, (success: any) => {
if (success) {
/*
ThisAPI allows managing the visibility of the mobilisten launcher according to your visibility mode.
The three available visibility modes are ALWAYS, NEVER, WHEN_ACTIVE_CHAT.
*/
ZohoSalesIQ.Launcher.show(
ZohoSalesIQ.Launcher.VisibilityMode.ALWAYS
);
ZohoSalesIQ.Launcher.enableDragToDismiss(true);

/*
SalesIQ Android SDK follows the system theme by default. You can opt-out of this option by setting the value to false.
Refer android/app/main/res/values/styles.xml and https://www.zoho.com/salesiq/help/developer-guides/android-mobile-sdk-theme-customization-2.0.html
*/
ZohoSalesIQ.syncThemeWithOsForAndroid(false);

ZohoSalesIQ.showOperatorImageInLauncher(true); //This API can be used to set the operator image in the launcher

/*
This API will set offline banner in chat window when the brand is offline.
Refer https://www.zoho.com/salesiq/help/developer-section/react-native-sdk-chat-show-offline-message.html
*/
ZohoSalesIQ.showOfflineMessage(true);

/*
Chat Actions allows you to define custom actions that can be invoked when a user clicks on them inside the chat.
Refer https://www.zoho.com/salesiq/help/developer-section/react-native-sdk-chatactions-v2.html
*/
ZohoSalesIQ.registerChatAction("book_ticket"); //This API allows you to register any custom action that you have created.
ZohoSalesIQ.setChatActionTimeout(10); //This API allows you to set the timeout value until which loader needs to be shown. Value in seconds

/*
This API allows you to set an icon for the SalesIQ Android SDK notifications.
Refer https://www.zoho.com/salesiq/help/developer-section/react-native-sdk-notification-android.html
*/
ZohoSalesIQ.Notification.setIconForAndroid("salesiq_logo");

/*
You can use this API to enable/disable the conversation history option in the SalesIQ SDK.
Refer https://www.zoho.com/salesiq/help/developer-section/react-native-sdk-set-conversation-visibility.html
*/
ZohoSalesIQ.setConversationVisibility(true);
ZohoSalesIQ.setConversationListTitle("Mobilisten Live Support"); // This API is used to set title in the header of the conversation history section

/*
You can use this API to show/hide the Knowledgebase option in the SalesIQ SDK.
Refer https://www.zoho.com/salesiq/help/developer-section/react-native-sdk-set-faq-visibility.html
*/
ZohoSalesIQ.setFAQVisibility(true);

ZohoSalesIQ.enableInAppNotification();
} else {
console.log("ERROR WHILE initwithcallback");
}
});
}

useEffect(() => {
initSalesIQ();
Platform.OS == 'android' && StatusBar.setBackgroundColor("#007AFF");
}, []);

return <Main />;
};

export default App;
7 changes: 7 additions & 0 deletions example/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source 'https://rubygems.org'

# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby ">= 2.6.10"

gem 'cocoapods', '~> 1.13'
gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'
101 changes: 101 additions & 0 deletions example/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.6)
rexml
activesupport (6.1.7.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
claide (1.1.0)
cocoapods (1.14.3)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.14.3)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 2.1, < 3.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.6.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (>= 2.3.0, < 3.0)
gh_inspector (~> 1.0)
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.23.0, < 2.0)
cocoapods-core (1.14.3)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
netrc (~> 0.11)
public_suffix (~> 4.0)
typhoeus (~> 1.0)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (2.1)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.1)
cocoapods-trunk (1.6.0)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.2.2)
escape (0.0.4)
ethon (0.16.0)
ffi (>= 1.15.0)
ffi (1.16.3)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
json (2.7.1)
minitest (5.20.0)
molinillo (0.8.0)
nanaimo (0.3.0)
nap (1.1.0)
netrc (0.11.0)
public_suffix (4.0.7)
rexml (3.2.6)
ruby-macho (2.5.1)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
xcodeproj (1.23.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
zeitwerk (2.6.12)

PLATFORMS
ruby

DEPENDENCIES
activesupport (>= 6.1.7.3, < 7.1.0)
cocoapods (~> 1.13)

RUBY VERSION
ruby 2.6.10p210

BUNDLED WITH
1.17.2
69 changes: 69 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
[![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-8.0.4-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

Connect with customers at every step of their journey. Give them the best in-app live chat experience with Mobilisten. Mobilisten enables customers to reach you from any screen on your app, get their questions answered, and make better purchase decisions.

## Getting Started
[**Mobilisten**](https://mobilisten.io/) is a support chat SDK that comes with a set of highly configurable APIs to suit your needs. Get started by generating an `App` and `Access` keys for your bundle ID from the SalesIQ console.

## Requirements

**iOS**: Minimum deployment target should be set to iOS 11.

**Android**: Android API level 21 or above is required.

## Installation
Follow the below steps given below to complete installation of **Mobilisten** in your React-Native app.

1. Install the **react-native-zohosalesiq-mobilisten** package using NPM.
```ruby
npm install react-native-zohosalesiq-mobilisten --save
```

2. Link the module with the react native app
```ruby
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.
```diff
- pod 'RNZohoSalesIQ', :path => '../node_modules/react-native-zohosalesiq-mobilisten'
+ pod 'RNZohoSalesIQ', :path => '../node_modules/react-native-zohosalesiq-mobilisten/ios'
```

2. Run the `pod repo update && pod install` command from the **ios** directory.

#### Installation steps for Android

1. Navigate to the **android** folder within the project directory using Android Studio or any other platform of choice for Android development.
Add the following maven repository to the **build.gradle** file.
```ruby
allprojects {
repositories {
.....
maven { url 'https://maven.zohodl.com' }
}
}
```
2. Click **Sync Now** from the toolbar on the IDE.

## Initializing Mobilisten
1. Generate `App` and `Access` keys for iOS and Android platforms by providing your bundle id.
2. Use the **ZohoSalesIQ.init** API with keys for each platform as shown below.
```js
import { ZohoSalesIQ } from 'react-native-zohosalesiq-mobilisten';

if (Platform.OS === 'ios'){
ZohoSalesIQ.init("ios_app_key","ios_access_key");
}else{
ZohoSalesIQ.init("android_app_key","android_access_key");
}
```
3. If you wish to show the default chat launcher, use the [**ZohoSalesIQ.Launcher.show()**](https://www.zoho.com/salesiq/help/developer-section/react-native-sdk-launcher-show.html) API (Optional).

## API Documentation
You can find the list of all APIs and their documentation [here](https://www.zoho.com/salesiq/help/developer-section/react-native-sdk-add-event-listener.html) under the **API Reference** section.
Loading

0 comments on commit ddc34db

Please sign in to comment.