@glympse-inc/com.glympse.enroute 2.105.232 → 2.105.235

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,201 @@
1
+ Glympse En Route Cordova Plugin
2
+ ===============================
3
+
4
+ Interact with Glympse's native iOS/Android SDKs through this plugin from your Cordova application.
5
+
6
+ ## What you need
7
+
8
+ Before getting started you'll need a Firebase app id from Glympse based on your application's package name. This will allow push notifications from Glympse to be sent to your application on Android. iOS will need separate configuration for push notifications (see [Push Notifications](#Push-Notifications))
9
+
10
+ This plugin requires a minimum of `cordova@8`
11
+
12
+ ## Installation
13
+
14
+ During installation you'll add the Firebase App ID you received from Glympse.
15
+ ```
16
+ cordova plugin add @glympse-inc/com.glympse.enroute --variable GLYMPSE_FIREBASE_APP_ID="[YOUR_FIREBASE_APP_ID_FROM_GLYMPSE]"
17
+ ```
18
+ If you don't yet have this ID you can pass in an empty string, but push notifications won't work until this ID is set.
19
+
20
+ ## Starting up the Glympse Platform
21
+
22
+ The first call to Glympse should be call to `init()`. This method initializes the plugin and starts to sync basic cached data from the native SDK such as whether or not a user is logged in.
23
+ ```javascript
24
+ EnRouteManager.init();
25
+ ````
26
+
27
+ Next an application declares whether it uses credentials for login or if login will use an authentication token.
28
+ ```javascript
29
+ EnRouteManager.setAuthenticationModeCredentials();
30
+ // or
31
+ EnRouteManager.setAuthenticationModeToken();
32
+ ````
33
+
34
+ Last step during every startup is a call to `start()`
35
+ ```javascript
36
+ EnRouteManager.start();
37
+ ````
38
+
39
+ If authentication is needed at this point the `authenticationNeeded` event will be sent and the application can then perform a `login()` using credentials entered by the user or by using an authentication token.
40
+
41
+ ## Listening for Events
42
+
43
+ You can add listeners to respond to a variety of events that are emitted by the plugin.
44
+
45
+ A listener is an object that implements functions matching the events you want to listen for.
46
+
47
+ Example
48
+ ```javascript
49
+ var glympseListener = {};
50
+ glympseListener.started = function() {
51
+ console.log('Glympse platform started');
52
+ }
53
+ glympseListener.authenticationNeeded = function() {
54
+ console.log('Glympse authentication needed');
55
+ }
56
+ glympseListener.loggedOut = function(reason) {
57
+ console.log('Glympse logged out: ' + reason);
58
+ }
59
+ // etc...
60
+ EnRouteManager.addListener(glympseListener);
61
+ ````
62
+
63
+ ### EnRouteManager events
64
+ * available - Occurs after a call to `EnRouteManager.init()` to notify that the plugin finished its first sync
65
+ * started - Occurs after a call to `EnRouteManager.start()`
66
+ * authenticationNeeded - Occurs anytime after a call to `EnRouteManager.start()` notifying that re-authentication is needed
67
+ * loginCompleted - Occurs after a call to `EnRouteManager.loginWithToken() or loginWithCredentials()`
68
+ * synced - Occurs after login indicating that the platform has synced data with the server
69
+ * loggedOut(reason) - Occurs after a logout from user action or auth token becoming invalid
70
+ * stopped - Occurs when the platform has been stopped
71
+ * locationAccuracyUpdated - Platform detected that location accuracy authorization has changed
72
+ * predefinedMessagesUpdated - Predefined chat messages for the Organization have changed
73
+
74
+ ### TaskManager events
75
+ * taskListChanged - Task manager's task list has updated
76
+ * taskStarted(task) - Occurs after a call to `TaskManager.startTask()`
77
+ * operationCompleted(taskId) - Occurs when a Task has completed
78
+ * taskPhaseChanged(task, phase) - Task has changed to a different phase
79
+ * taskChatMessagesChanged(task) - Chat messages for a Task have changed
80
+ * taskTravelModeUpdated(task) - Travel mode updated (drive/cycle/transit/walk)
81
+ * taskRouteChanged(task) - Calculated route for a Task updated
82
+ * taskCreated(taskJsonData) - Occurs after a call to `TaskManager.createTask()`
83
+ * taskCreateFailed(taskJsonData, error) - Call to `TaskManager.createTask()` failed
84
+
85
+ ### AgentManager events
86
+ * agentListChanged - Occurs when the list of Agents is refreshed
87
+ * agentUpdated - Occurs after a change was made to the logged in Agent (name/email/etc)
88
+ * agentUpdateFailed - A call to update the logged in Agent failed
89
+
90
+ ### PickupManager events
91
+ * pickupListChanged - PickupManager's list of pickups has updated
92
+ * pickupChanged(pickup) - Occurs when a Pickup is updated
93
+ * pickupAccepted(pickup) - Occurs when a Pickup has entered the live phase. This indicates the customer has started to interact with the Pickup by sharing location or with a manual ETA
94
+ * pickupCompleted(pickup) - Occurs when a Pickup is completed
95
+ * pickupFailedToComplete(pickup) - The call to complete a Pickup failed
96
+ * pickupPhaseUpdated(pickup) - Occurs when a Pickup changes to a different phase
97
+ * pickupFailedToUpdatePhase(pickup) - The call to update a Pickup's phase failed
98
+ * pickupAssigned(pickup) - Occurs when a Pickup is claimed or assigned to an Agent
99
+ * pickupFailedToAssign(pickup) - The fall to claim a pickup failed
100
+ * pickupChatMessagesChanged(pickup) - Chat message for a Task have changed
101
+
102
+ ## Plugin Usage
103
+
104
+ Most functions in the plugin's interface serve as a bridge to make a call on the native SDK. It may be helpful to reference the Programming Guide for the native SDK to understand the terminology used in this plugin https://developer.glympse.com/docs/enroute/client-sdk/guides/programming-guide
105
+
106
+ ### EnRouteManager
107
+
108
+ This is the central manager through which all other managers are accessed. It handles the state of the SDK during startup, login, and foreground/background changes.
109
+
110
+ #### Methods
111
+ * init() - Called first when using the plugin to initialize the plugin
112
+ * setActive(active: bool) - Called when the application enters the foreground(true) or background(false)
113
+ * addListener(listener: object) - Called to set a listener for events from EnRouteManager
114
+ * removeListener(listener: object) - Called to remove a listener from EnRouteManager
115
+ * getTaskManager(): TaskManager - Get the TaskManager object
116
+ * getAgentManager(): AgentManager - Get the AgentManager object
117
+ * getPickupManager(): PickupManager - Get the PickupManager object
118
+ * isStarted(): bool - Returns true if the plugin is in the started state
119
+ * isLoginNeeded(): bool - Returns true if a call to login is currently needed
120
+ * getLoggedInAgent(): Agent - Returns the currently logged in Agent
121
+ * getLoggedInOrg(): Organization - Returns the currently logged in Organization
122
+ * getEnRouteToken(): string - Returns the current authentication token for the logged in Agent
123
+ * registerDeviceToken(tokenType: string, deviceToken: string) - Registers a push token. tokenType should be "apple_background" for iOS
124
+ * handleRemoteNotification(payload: string) - Used to forward a received push notification from Glympse
125
+ * setAuthenticationModeCredentials() - Called before `start()` to specify that credentials will be used for login
126
+ * setAuthenticationModeToken() - Called before `start()` to specify that an auth token will be used for login
127
+ * start() - Starts the plugin and native SDK. If the Agent is already logged in this will start to sync data, otherwise the `authenticationNeeded` event will fire.
128
+ * loginWithCredentials(username, password) - Used to login with a username and password
129
+ * loginWithToken(token, expireTime) - Used to login with an authentication token. expireTime is epoch time in milliseconds
130
+ * logout() - Called to logout the current Agent
131
+ * stop() - Stops the plugin and the native SDK. This should be called if it's expected that the user will no longer be utilizing En Route during the current session.
132
+ * overrideLoggingLevels(fileLogLevel: number, debugLogLevel: number) - Can be used to increase log output for debugging and development (1=verbose logs, 7=no logs)
133
+ * setFetchCompletedTasks(enabled: bool) - Configures the SDK to fetch completed Tasks or to only fetch tasks that have not been completed (default)
134
+
135
+ ### TaskManager
136
+
137
+ Keeps track of currently fetched Tasks that are assigned to the logged in Agent. It's used to update these Tasks if the Agent needs to perform a manual action such as marking a Task as completed or cancelled.
138
+
139
+ #### Methods
140
+ * addListener(listener: object) - Called to set a listener for events from TaskManager
141
+ * removeListener(listener: object) - Called to remove a listener from TaskManager
142
+ * getTasks(): Task[] - Retrieve the list of currently fetched Tasks
143
+ * refreshTasks() - Manually refreshes the list of Tasks
144
+ * startTask(task: Task, duration: number) - Start the provided task with a specified duration in milliseconds. The duration will be extended or shortened as needed by the platform, so it is acceptable to provide a reasonable default such as 1 hour (3600000)
145
+ * createTask(taskData: Object) - Create a Task with the provided json object. See https://developer.glympse.com/docs/enroute/api/reference/org/id/create_task/post
146
+ * setTaskPhase(task: Task, phase: string) - Update the phase of a started Task
147
+ * setTaskVisibility(task: Task, visibility: string) - Update the visibility of a Task (visible, cloaked, or hidden)
148
+ * completeTask(task: Task) - Mark a Task is completed. This is a final state for a Task, so if it is initiated by a user you should ask for confirmation
149
+ * findTaskById(taskId: number): Task - Lookup a Task by its id number
150
+ * addOrUpdateMetadataItem(task: Task, key: string, value: string|number|bool) - Add or update a Task Metadata field. Value can be a string, number, or bool
151
+ * setTravelModeForTask(task: Task, travelMode: string) - Update the travel mode for a Task (drive/cycle/transit/walk)
152
+ * sendMessageToTask(task: Task, message: string, predefinedMessageId: number, successCallback: function, errorCallback: function) - Send a chat message to this Task as the logged in Agent
153
+ * markMessagesAsRead(task: Task) - Set the status of the chat messages for this Task as read. Called when the user views the most recent message
154
+
155
+ ### AgentManager
156
+
157
+ Manages the currently logged in Agent and allows the user to update some of the Agent's properties. Admin and Manager Agents can update other Agents in their Organization.
158
+
159
+ #### Methods
160
+ * addListener(listener: object) - Called to set a listener for events from AgentManager
161
+ * removeListener(listener: object) - Called to remove a listener from AgentManager
162
+ * getSelf(): Agent - Get the currently logged in Agent
163
+ * getAgents(): Agent[] - Retrieve the list of currently fetched Agents from the Organization
164
+ * refreshAgents() - Manually refreshes the list of Agents in the Organization
165
+ * updateAgentName(agent: Agent, name: string) - Updates the Agent's name
166
+ * updateAgentDisplayName(agent: Agent, displayname: string) - Updates the Agent's name that is displayed to the customer
167
+ * updateAgentEmail(agent: Agent, email: string) - Updates the Agent's email address
168
+ * updateAgentPassword(agent: Agent, password: string) - Updates the Agent's password
169
+ * updateAgentAvatar(agent: Agent, avatar: string, contentType: string) - Updates the Agent's avatar. The avatar parameter is image data as a string. contentType should be "image/png" or "image/jpeg"
170
+ * findAgentById(agentId: number): Agent - Lookup an Agent by their id number
171
+
172
+ ### PickupManager
173
+
174
+ Keeps track of currently fetched Pickups from the logged in Organization. All Pickups from the Organization are fetched including ones that are unassigned and assigned to other Agents. This manager is used to update these Pickups if the Agent needs to perform a manual action such as changing the Pickup phase or assigning it to themselves.
175
+
176
+ #### Methods
177
+ * addListener(listener: object) - Called to set a listener for events from PickupManager
178
+ * removeListener(listener: object) - Called to remove a listener from PickupManager
179
+ * getPickups(): Pickup[] - Retrieve the list of currently fetched Pickups
180
+ * findPickupById(pickupId: string): Pickup - Lookup a Pickup by its id number
181
+ * refreshPickups() - Manually refreshes the list of Pickups
182
+ * setPickupPhase(pickup: Pickup, phase: string) - Update the phase of a Pickup
183
+ * completePickup(pickup: Pickup) - Mark a Pickup as completed. This is a final state for a Pickup, so if it is initiated by a user you should ask for confirmation
184
+ * claimPickup(pickup: Pickup) - Assign a Pickup to the currently logged in Agent
185
+ * unclaimPickup(pickup: Pickup) - Release assignement of a Pickup
186
+ * sendMessageToPickup(pickup: Pickup, message: string, predefinedMessageId: number, successCallback: function, errorCallback: function) - Send a chat message to this Pickup as the logged in Agent
187
+ * markMessagesAsRead(pickup: Pickup) - Set the status of the chat messages for this Pickup as read. Called when the user views the most recent message
188
+
189
+ ## Push Notifications
190
+
191
+ On iOS, a cordova application will need to register for push notifications, and pass these push notifications onto the En Route platform.
192
+
193
+ Glympse will need you to also send your APNS certificate so that we can send notifications to your app.
194
+
195
+ If your application is already registering for push tokens and handling notification payloads, there are two methods that will need to be called inside of your existing code.
196
+ ```javascript
197
+ // When a token is available
198
+ EnRoute.registerDeviceToken('apple_background', token);
199
+ // When a payload is available
200
+ EnRoute.handleRemoteNotification(payload);
201
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glympse-inc/com.glympse.enroute",
3
- "version": "2.105.232",
3
+ "version": "2.105.235",
4
4
  "description": "Glympse En Route Cordova Plugin",
5
5
  "cordova": {
6
6
  "id": "com.glympse.enroute",
@@ -17,13 +17,16 @@
17
17
  "engines": [
18
18
  {
19
19
  "name": "cordova",
20
- "version": ">=5.0.0"
20
+ "version": ">=8.0.0"
21
21
  },
22
22
  {
23
23
  "name": "cordova-plugman",
24
24
  "version": ">=4.2.1-dev"
25
25
  }
26
26
  ],
27
+ "devDependencies": {
28
+ "cordova-plugin-androidx-adapter": "^1.1.3"
29
+ },
27
30
  "homepage": "http://developer.glympse.com",
28
31
  "author": "Glympse Inc.",
29
32
  "license": "ISC",
package/plugin.xml CHANGED
@@ -1,5 +1,5 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
- <plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" id="com.glympse.enroute" version="2.105.232">
2
+ <plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" id="com.glympse.enroute" version="2.105.235">
3
3
 
4
4
  <name>Glympse En Route</name>
5
5
 
@@ -240,7 +240,7 @@
240
240
  <source url="https://github.com/CocoaPods/Specs.git"/>
241
241
  </config>
242
242
  <pods use-frameworks="true">
243
- <pod name="EnRouteApi"/>
243
+ <pod name="EnRouteApi" spec="~> 2.105.235"/>
244
244
  </pods>
245
245
  </podspec>
246
246
  <!-- RELEASE END -->
@@ -17,7 +17,7 @@ android {
17
17
  }
18
18
 
19
19
  dependencies {
20
- def GLYMPSE_VERSION = '2.105.232'
20
+ def GLYMPSE_VERSION = '2.105.235'
21
21
  implementation "com.glympse:enrouteapi:$GLYMPSE_VERSION"
22
22
  implementation "com.glympse:glympseapi:$GLYMPSE_VERSION"
23
23
  implementation "com.glympse:glympseapi-push:$GLYMPSE_VERSION"