# Handling Instance
# Instance Actions
Here you can find actions that you can execute
# Exiting application
import { exitApp } from '@pitcher/core'
exitApp(options)
options may have a property named buttonOptions
which defines the actions after exiting the app. If neither options nor buttonOptions provided, impact will ask actions with popup
Value | Action |
---|---|
1 | Exit App without and do nothing after |
2 | Exit App then restart impact |
3 | Exit App then restart impact and open current instance |
Example:
exitApp({ buttonOptions: 3 })
# Showing an alert box
import { showAlertBox } from '@pitcher/core'
showAlertBox('my title', 'my message')
# Set Category
# Sets selected category. In native side, no multi category selection is supported so there can only be one selected category at a moment
import { setCategory } from '@pitcher/core'
setCategory(category)
# Mark a file as favorite
# You can access files from file store
import { addFavorite } from '@pitcher/core'
addFavorite(file)
# Remove a file from favorite files
# You can access files from file store
import { removeFavorite } from '@pitcher/core'
removeFavorite(file)
# Requests favorite files from native and marks the files in file store according to the ids retrieved
import { getFavorites } from '@pitcher/core'
await getFavorites()
# Open a file
# First parameter is the file to be opened, and second parameter is the parameters to send the view
# Native may open files with different kind of views and the Ti event to open a file may differ according to the category of the file They are all handled inside this function
import { openContent } from '@pitcher/core'
openContent(file, parameters)
# Edit a custom deck
import { editFile } from '@pitcher/core'
editFile(file)
# Delete a custom deck
import { deleteFile } from '@pitcher/core'
deleteFile(file)
# Send selected documents
# Send documents via different options.
# First parameter is the file Ids to send, and second parameter is how to send files
via | How to send |
---|---|
0 | Send as attachment via email |
1 | Send via email form |
2 | Send via connect |
3 | Send via native email application as a zero drive link |
import { sendPickingContent } from '@pitcher/core'
sendPickingContent(fileIds, via)
# Open file share dialog
# This function opens a native dialog where you can select files to share
import { sendDocuments } from '@pitcher/core'
sendDocuments()
# Create custom decks
import { createSlideSet } from '@pitcher/core'
createSlideSet()
# Load presentations from local db
# This function refreshes presentation list in file store, by requesting info from native
import { loadPresentationsFromDB } from '@pitcher/core'
loadPresentationsFromDB()
# Open presentation and go to the page
# First parameter is the file Id, second parameter is page index
import { loadPresentationWithPage } from '@pitcher/core'
loadPresentationWithPage(fileId, page)
# Open pdf and go to the page
# First parameter is the file, second parameter is page index, and third one is text to highlight
import { loadPdfWithPage } from '@pitcher/core'
loadPdfWithPage(file, page, searchText)
# Show ios native sync box
options have 2 properties
property | Used for |
---|---|
xPos | Horizontal position of the sync box top left |
yPos | Vertical position of the sync box top left |
import { showIOSSyncWindow } from '@pitcher/core'
showIOSSyncWindow(options)
# Get sync box events
# Returns sync box events (only the ones that are sent via sendStatsFromHTML)
# parameter is the window as source (for ios: homescreen, modal, etc.) (default is homescreen)
import { getSyncEvents } from '@pitcher/core'
await getSyncEvents(source)
# Categories Store
Store for instance categories. Values are retrieved from serverJSON
Property | Description |
---|---|
category | Store the current category |
categories | All categories |
parentCategories | Computed property for parent categories |
subCategories | Computed property for child categories |
# Miscellaneous
When serverJSON data is retrieved, initial category has to be set, or some functions may not work properly. This is done by initializeInstance
function which is the starting point
Initial category is either the one as marked default or the last used category at earlier usage of the instance
If user is not a test device, categories contain only the ones user has a content in it.
# Detailing Store
Store to handle detailing properties & options
Property | Description |
---|---|
currentContact | Contact(s) in the current call (null if there is not an ongoing call) |
currentAccount | Account in the current call (null if there is not an ongoing call) |
hasActiveCall | Computed property indicating if there is an ongoing call |
isFilterActive | If content filtering is active |
quickStartEnabled | If user can quick start a call (enabled/disabled via config) |
quickPlanningEnabled | If user can use quick planning screen (enabled/disabled via config) |
selectedDate | date of the selected day from calendar |
events | Crm events/calls of the selected dat |
unsubmitted | UnSubmitted calls |
syncEvents | Synchronization events with a handler at backend (redirect events) |
# Start/Stop call
# startStopDetailing()
import { startStopDetailing } from '@pitcher/core'
startStopDetailing(options)
Options have 4 properties, contains position of the click event, and if not giveb defaul is used
///Default options
xPos: 50, yPos: 30, widthV: 160, heightV: 50
# startPreCall()
For iOS / Android, shows native planning screen. For Windows / iOS, either goes to quick or detailed planning screen by given options (Options have one property named index
, 1 used for Quick, 2 used for Detailed planning screen in Windows / iOS, and click event position parameters)
import { startPreCall } from '@pitcher/core'
///Windows & iOS
startPreCall({ index: 2, datetime: datetime })
///iOS & Android
startPreCall({
xPos: 120,
yPos: 60,
widthV: 160,
heightV: 50
})
# getCrmEventsByDate() - (Windows only)
With given 2 paramaters, options & timestamp, gets crm events of that specific date
import { getCrmEventsByDate } from '@pitcher/core'
///Windows
getCrmEventsByDate({ xPos: 50, yPos: 30, widthV: 160, heightV: 50 }, 1610025217201)
# startDetailingWithID()
Used to start a specific call with given Id. Also for windows can be used to quick start & unplanned calls
import { startDetailingWithID } from '@pitcher/core'
startDetailingWithID('1234')
///Windows for un planned call
startDetailingWithID('unplannedcall')
///Windows for quick start
startDetailingWithID('quickstart')
# resyncData()
Initiates synchronization
import { resyncData } from '@pitcher/core'
resyncData()
# removeEvent()
Removes a specific synchronization event.
import { removeEvent } from '@pitcher/core'
removeEvent('1234')
# removeAllEvents()
Removes all synchronization events.
import { removeAllEvents } from '@pitcher/core'
removeAllEvents()
# File Store
Store for instance files
Property | Description |
---|---|
files | All file list retrieved from server data |
uiFiles | Computed property for the files can be show in UI (see Miscellaneous) |
slides | Slide list reetrieved from server data |
documentPath | Base path for the documents |
presentations | All presentations list from local database |
customs | Custom deck list |
initialAllowedIDs | Allowed file Id list saved when instance first opened (see Miscellaneous) |
allowedIDs | Current allowed file Id list (see Miscellaneous) |
# Miscellaneous
There are some criteria which decides if a file can be shown in UI. This are defined shouldShowInUI
method
- File should not be a thumbnail
- File typeV should not be one of 7,0,-1
- File should not an image file (image files contain background and ccategory logos)
- File should be ready and not expired (Any file can be distributed for a time period)
When Instance is ready, Impact tells all files Ids that are downloaded and ready to be shown in UI also, These file Ids are retrieved in initialAllowedIDs
. When user starts a call which has pre-selected content, Impact re-notifies UI with new allowed file Ids, which are store in allowedIDs
It's UI's responsibility to filter files at a certain time based on this allowed Ids
# System Store
Store for system data
Property | Description |
---|---|
config | Configuration of instance |
groups | Relevant content data which is set via admin |
appID | Id of the current Instance |
supportEmail | Support email address |
deviceName | Current device's name, which is defined when access given to a device |
metadata | Current device's metadata information. This contains special keywords added to the device |
messages | Push notification messages |
appName | Instance's name |
systemLang | Translation data (used in connect) |
locale | Locale information (used in connect) |
userfullname | Connect user's full name (used in connect) |
ajaxtoken | Session token for ajax requests (used in connect) |
isCustomerUI | Defines profile, if true user is HCP/Customer, if false user is rep |
batteryLevel | Battert level (between 1 - 100) |
statusBadge | Current event count waiting in the queue |
todoBadge | Current opene to-do count (If there is an ongoing call, only the open ones that belong to that account) |
# Getting extraField value
ExtraField is a config property, which is a json object and can contain instance specific settings. Parameters are property name and a default value in case property does not exist
import { getExtraFieldValue } from '@pitcher/core'
getExtraFieldValue(property, defaultValue)