@de./sdk 1.0.4 → 2.0.0
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/dist/allend/Access.d.ts +39 -3
- package/dist/allend/Access.js +147 -114
- package/dist/allend/Access.js.map +1 -1
- package/dist/allend/Agent/consolidation.d.ts +16 -0
- package/dist/allend/Agent/consolidation.js +38 -0
- package/dist/allend/Agent/consolidation.js.map +1 -0
- package/dist/allend/Agent/delivery.d.ts +11 -0
- package/dist/allend/Agent/delivery.js +43 -0
- package/dist/allend/Agent/delivery.js.map +1 -0
- package/dist/allend/Agent/dispatch.d.ts +8 -0
- package/dist/allend/Agent/dispatch.js +24 -0
- package/dist/allend/Agent/dispatch.js.map +1 -0
- package/dist/allend/Agent/index.d.ts +49 -0
- package/dist/allend/Agent/index.js +74 -0
- package/dist/allend/Agent/index.js.map +1 -0
- package/dist/allend/Agent/navigation.d.ts +8 -0
- package/dist/allend/Agent/navigation.js +25 -0
- package/dist/allend/Agent/navigation.js.map +1 -0
- package/dist/allend/Agent/origin.d.ts +9 -0
- package/dist/allend/Agent/origin.js +31 -0
- package/dist/allend/Agent/origin.js.map +1 -0
- package/dist/allend/Agent/reallocation.d.ts +7 -0
- package/dist/allend/Agent/reallocation.js +17 -0
- package/dist/allend/Agent/reallocation.js.map +1 -0
- package/dist/allend/Agent/realtime.d.ts +36 -0
- package/dist/allend/Agent/realtime.js +111 -0
- package/dist/allend/Agent/realtime.js.map +1 -0
- package/dist/allend/Agent/rides.d.ts +12 -0
- package/dist/allend/Agent/rides.js +51 -0
- package/dist/allend/Agent/rides.js.map +1 -0
- package/dist/allend/Agent/shipping.d.ts +11 -0
- package/dist/allend/Agent/shipping.js +43 -0
- package/dist/allend/Agent/shipping.js.map +1 -0
- package/dist/allend/CSP/analytics.d.ts +12 -0
- package/dist/allend/CSP/analytics.js +51 -0
- package/dist/allend/CSP/analytics.js.map +1 -0
- package/dist/allend/CSP/index.d.ts +25 -0
- package/dist/allend/CSP/index.js +43 -0
- package/dist/allend/CSP/index.js.map +1 -0
- package/dist/allend/CSP/inventory.d.ts +16 -0
- package/dist/allend/CSP/inventory.js +78 -0
- package/dist/allend/CSP/inventory.js.map +1 -0
- package/dist/allend/CSP/orders.d.ts +19 -0
- package/dist/allend/CSP/orders.js +97 -0
- package/dist/allend/CSP/orders.js.map +1 -0
- package/dist/allend/CSP/webhooks.d.ts +13 -0
- package/dist/allend/CSP/webhooks.js +56 -0
- package/dist/allend/CSP/webhooks.js.map +1 -0
- package/dist/allend/Customer/index.d.ts +27 -0
- package/dist/allend/Customer/index.js +39 -0
- package/dist/allend/Customer/index.js.map +1 -0
- package/dist/allend/Customer/intents.d.ts +12 -0
- package/dist/allend/Customer/intents.js +55 -0
- package/dist/allend/Customer/intents.js.map +1 -0
- package/dist/allend/Customer/orders.d.ts +11 -0
- package/dist/allend/Customer/orders.js +43 -0
- package/dist/allend/Customer/orders.js.map +1 -0
- package/dist/allend/Customer/rides.d.ts +12 -0
- package/dist/allend/Customer/rides.js +50 -0
- package/dist/allend/Customer/rides.js.map +1 -0
- package/dist/allend/DEV/developers.d.ts +11 -0
- package/dist/allend/DEV/developers.js +35 -0
- package/dist/allend/DEV/developers.js.map +1 -0
- package/dist/allend/DEV/index.d.ts +19 -0
- package/dist/allend/DEV/index.js +37 -0
- package/dist/allend/DEV/index.js.map +1 -0
- package/dist/allend/IoTClient.js +29 -35
- package/dist/allend/IoTClient.js.map +1 -1
- package/dist/allend/IoTSP/backend.d.ts +29 -0
- package/dist/allend/IoTSP/backend.js +75 -0
- package/dist/allend/IoTSP/backend.js.map +1 -0
- package/dist/allend/IoTSP/devices.d.ts +14 -0
- package/dist/allend/IoTSP/devices.js +61 -0
- package/dist/allend/IoTSP/devices.js.map +1 -0
- package/dist/allend/IoTSP/index.d.ts +28 -0
- package/dist/allend/IoTSP/index.js +84 -0
- package/dist/allend/IoTSP/index.js.map +1 -0
- package/dist/allend/IoTSP/rules.d.ts +17 -0
- package/dist/allend/IoTSP/rules.js +81 -0
- package/dist/allend/IoTSP/rules.js.map +1 -0
- package/dist/allend/IoTSP/topics.d.ts +17 -0
- package/dist/allend/IoTSP/topics.js +81 -0
- package/dist/allend/IoTSP/topics.js.map +1 -0
- package/dist/allend/LSP/agents.d.ts +20 -0
- package/dist/allend/LSP/agents.js +89 -0
- package/dist/allend/LSP/agents.js.map +1 -0
- package/dist/allend/LSP/carriers.d.ts +54 -0
- package/dist/allend/LSP/carriers.js +315 -0
- package/dist/allend/LSP/carriers.js.map +1 -0
- package/dist/allend/LSP/coverage.d.ts +44 -0
- package/dist/allend/LSP/coverage.js +135 -0
- package/dist/allend/LSP/coverage.js.map +1 -0
- package/dist/allend/LSP/fleets.d.ts +66 -0
- package/dist/allend/LSP/fleets.js +381 -0
- package/dist/allend/LSP/fleets.js.map +1 -0
- package/dist/allend/LSP/hubs.d.ts +39 -0
- package/dist/allend/LSP/hubs.js +186 -0
- package/dist/allend/LSP/hubs.js.map +1 -0
- package/dist/allend/LSP/index.d.ts +37 -0
- package/dist/allend/LSP/index.js +55 -0
- package/dist/allend/LSP/index.js.map +1 -0
- package/dist/allend/LSP/inventory.d.ts +13 -0
- package/dist/allend/LSP/inventory.js +56 -0
- package/dist/allend/LSP/inventory.js.map +1 -0
- package/dist/allend/LSP/operations.d.ts +47 -0
- package/dist/allend/LSP/operations.js +156 -0
- package/dist/allend/LSP/operations.js.map +1 -0
- package/dist/allend/LSP/orders.d.ts +69 -0
- package/dist/allend/LSP/orders.js +303 -0
- package/dist/allend/LSP/orders.js.map +1 -0
- package/dist/allend/LSP/pods.d.ts +26 -0
- package/dist/allend/LSP/pods.js +137 -0
- package/dist/allend/LSP/pods.js.map +1 -0
- package/dist/allend/LSP/pricing.d.ts +35 -0
- package/dist/allend/LSP/pricing.js +151 -0
- package/dist/allend/LSP/pricing.js.map +1 -0
- package/dist/allend/LSP/psl.d.ts +15 -0
- package/dist/allend/LSP/psl.js +68 -0
- package/dist/allend/LSP/psl.js.map +1 -0
- package/dist/allend/LSP/warehouses.d.ts +23 -0
- package/dist/allend/LSP/warehouses.js +94 -0
- package/dist/allend/LSP/warehouses.js.map +1 -0
- package/dist/allend/MSI/Controls.d.ts +9 -5
- package/dist/allend/MSI/Controls.js +269 -297
- package/dist/allend/MSI/Controls.js.map +1 -1
- package/dist/allend/MSI/Handles.d.ts +5 -4
- package/dist/allend/MSI/Handles.js +136 -233
- package/dist/allend/MSI/Handles.js.map +1 -1
- package/dist/allend/MSI/Plugins.d.ts +2 -2
- package/dist/allend/MSI/Plugins.js +12 -15
- package/dist/allend/MSI/Plugins.js.map +1 -1
- package/dist/allend/MSI/index.d.ts +4 -3
- package/dist/allend/MSI/index.js +123 -87
- package/dist/allend/MSI/index.js.map +1 -1
- package/dist/allend/MSI/native.d.ts +32 -0
- package/dist/allend/MSI/native.js +246 -0
- package/dist/allend/MSI/native.js.map +1 -0
- package/dist/allend/MSI/token.d.ts +12 -0
- package/dist/allend/MSI/token.js +21 -0
- package/dist/allend/MSI/token.js.map +1 -0
- package/dist/allend/OTPAuth/index.d.ts +77 -0
- package/dist/allend/OTPAuth/index.js +69 -0
- package/dist/allend/OTPAuth/index.js.map +1 -0
- package/dist/allend/Pipelines/analytics.d.ts +8 -0
- package/dist/allend/Pipelines/analytics.js +24 -0
- package/dist/allend/Pipelines/analytics.js.map +1 -0
- package/dist/allend/Pipelines/escalations.d.ts +8 -0
- package/dist/allend/Pipelines/escalations.js +25 -0
- package/dist/allend/Pipelines/escalations.js.map +1 -0
- package/dist/allend/Pipelines/executions.d.ts +11 -0
- package/dist/allend/Pipelines/executions.js +44 -0
- package/dist/allend/Pipelines/executions.js.map +1 -0
- package/dist/allend/Pipelines/index.d.ts +42 -0
- package/dist/allend/Pipelines/index.js +88 -0
- package/dist/allend/Pipelines/index.js.map +1 -0
- package/dist/allend/Pipelines/interventions.d.ts +8 -0
- package/dist/allend/Pipelines/interventions.js +25 -0
- package/dist/allend/Pipelines/interventions.js.map +1 -0
- package/dist/allend/Pipelines/monitor.d.ts +9 -0
- package/dist/allend/Pipelines/monitor.js +30 -0
- package/dist/allend/Pipelines/monitor.js.map +1 -0
- package/dist/allend/Pipelines/queries.d.ts +8 -0
- package/dist/allend/Pipelines/queries.js +25 -0
- package/dist/allend/Pipelines/queries.js.map +1 -0
- package/dist/allend/Pipelines/templates.d.ts +11 -0
- package/dist/allend/Pipelines/templates.js +46 -0
- package/dist/allend/Pipelines/templates.js.map +1 -0
- package/dist/allend/Pipelines/utils.d.ts +0 -0
- package/dist/allend/Pipelines/utils.js +2 -0
- package/dist/allend/Pipelines/utils.js.map +1 -0
- package/dist/allend/Pipelines/webhooks.d.ts +9 -0
- package/dist/allend/Pipelines/webhooks.js +35 -0
- package/dist/allend/Pipelines/webhooks.js.map +1 -0
- package/dist/allend/Pipelines/workers.d.ts +11 -0
- package/dist/allend/Pipelines/workers.js +45 -0
- package/dist/allend/Pipelines/workers.js.map +1 -0
- package/dist/allend/Queries/capacity.d.ts +11 -0
- package/dist/allend/Queries/capacity.js +44 -0
- package/dist/allend/Queries/capacity.js.map +1 -0
- package/dist/allend/Queries/discovery.d.ts +11 -0
- package/dist/allend/Queries/discovery.js +45 -0
- package/dist/allend/Queries/discovery.js.map +1 -0
- package/dist/allend/Queries/index.d.ts +27 -0
- package/dist/allend/Queries/index.js +40 -0
- package/dist/allend/Queries/index.js.map +1 -0
- package/dist/allend/Queries/matching.d.ts +7 -0
- package/dist/allend/Queries/matching.js +18 -0
- package/dist/allend/Queries/matching.js.map +1 -0
- package/dist/allend/Queries/performance.d.ts +9 -0
- package/dist/allend/Queries/performance.js +31 -0
- package/dist/allend/Queries/performance.js.map +1 -0
- package/dist/allend/Queries/pricing.d.ts +11 -0
- package/dist/allend/Queries/pricing.js +43 -0
- package/dist/allend/Queries/pricing.js.map +1 -0
- package/dist/allend/{DClient/Event.d.ts → Realtime/index.d.ts} +2 -6
- package/dist/allend/Realtime/index.js +62 -0
- package/dist/allend/Realtime/index.js.map +1 -0
- package/dist/allend/Shared/account.d.ts +10 -0
- package/dist/allend/Shared/account.js +22 -0
- package/dist/allend/Shared/account.js.map +1 -0
- package/dist/allend/Shared/buckets.d.ts +21 -0
- package/dist/allend/Shared/buckets.js +95 -0
- package/dist/allend/Shared/buckets.js.map +1 -0
- package/dist/allend/Shared/context.d.ts +14 -0
- package/dist/allend/Shared/context.js +33 -0
- package/dist/allend/Shared/context.js.map +1 -0
- package/dist/allend/Shared/faqs.d.ts +20 -0
- package/dist/allend/Shared/faqs.js +87 -0
- package/dist/allend/Shared/faqs.js.map +1 -0
- package/dist/allend/Shared/invitation.d.ts +42 -0
- package/dist/allend/Shared/invitation.js +40 -0
- package/dist/allend/Shared/invitation.js.map +1 -0
- package/dist/allend/Shared/operators.d.ts +39 -0
- package/dist/allend/Shared/operators.js +37 -0
- package/dist/allend/Shared/operators.js.map +1 -0
- package/dist/allend/Shared/users.d.ts +11 -0
- package/dist/allend/Shared/users.js +29 -0
- package/dist/allend/Shared/users.js.map +1 -0
- package/dist/allend/Tracking/index.d.ts +17 -0
- package/dist/allend/Tracking/index.js +39 -0
- package/dist/allend/Tracking/index.js.map +1 -0
- package/dist/allend/Utilities/common.d.ts +12 -0
- package/dist/allend/Utilities/common.js +53 -0
- package/dist/allend/Utilities/common.js.map +1 -0
- package/dist/allend/Utilities/fares.d.ts +10 -0
- package/dist/allend/Utilities/fares.js +39 -0
- package/dist/allend/Utilities/fares.js.map +1 -0
- package/dist/allend/Utilities/index.d.ts +23 -0
- package/dist/allend/Utilities/index.js +36 -0
- package/dist/allend/Utilities/index.js.map +1 -0
- package/dist/allend/Utilities/nearby.d.ts +9 -0
- package/dist/allend/Utilities/nearby.js +32 -0
- package/dist/allend/Utilities/nearby.js.map +1 -0
- package/dist/allend/Workflows/Client.d.ts +17 -0
- package/dist/allend/Workflows/Client.js +50 -0
- package/dist/allend/Workflows/Client.js.map +1 -0
- package/dist/allend/Workflows/Delivery.d.ts +36 -0
- package/dist/allend/Workflows/Delivery.js +16 -0
- package/dist/allend/Workflows/Delivery.js.map +1 -0
- package/dist/allend/Workflows/index.d.ts +11 -0
- package/dist/allend/Workflows/index.js +25 -0
- package/dist/allend/Workflows/index.js.map +1 -0
- package/dist/allend/Workspace/index.d.ts +162 -0
- package/dist/allend/Workspace/index.js +220 -0
- package/dist/allend/Workspace/index.js.map +1 -0
- package/dist/allend/index.d.ts +8 -5
- package/dist/allend/index.js +15 -8
- package/dist/allend/index.js.map +1 -1
- package/dist/backend/Auth.d.ts +28 -4
- package/dist/backend/Auth.js +125 -245
- package/dist/backend/Auth.js.map +1 -1
- package/dist/baseUrl.d.ts +56 -0
- package/dist/baseUrl.js +72 -4
- package/dist/baseUrl.js.map +1 -1
- package/dist/core.d.ts +88 -0
- package/dist/core.js +121 -0
- package/dist/core.js.map +1 -0
- package/dist/error.d.ts +17 -0
- package/dist/error.js +26 -0
- package/dist/error.js.map +1 -0
- package/dist/index.d.ts +30 -12
- package/dist/index.js +38 -14
- package/dist/index.js.map +1 -1
- package/dist/react-native.d.ts +30 -0
- package/dist/react-native.js +55 -0
- package/dist/react-native.js.map +1 -0
- package/dist/types/access.d.ts +64 -7
- package/dist/types/auth.d.ts +17 -17
- package/dist/types/channel.d.ts +45 -0
- package/dist/types/index.d.ts +379 -237
- package/dist/utils/index.d.ts +25 -0
- package/dist/utils/index.js +11 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/stream.js +25 -26
- package/dist/utils/stream.js.map +1 -1
- package/package.json +38 -18
- package/src/allend/Access.ts +143 -13
- package/src/allend/Agent/consolidation.ts +43 -0
- package/src/allend/Agent/delivery.ts +51 -0
- package/src/allend/Agent/dispatch.ts +27 -0
- package/src/allend/Agent/index.ts +113 -0
- package/src/allend/Agent/navigation.ts +27 -0
- package/src/allend/Agent/origin.ts +36 -0
- package/src/allend/Agent/reallocation.ts +16 -0
- package/src/allend/Agent/realtime.ts +140 -0
- package/src/allend/Agent/rides.ts +61 -0
- package/src/allend/Agent/shipping.ts +51 -0
- package/src/allend/CSP/analytics.ts +61 -0
- package/src/allend/CSP/index.ts +57 -0
- package/src/allend/CSP/inventory.ts +96 -0
- package/src/allend/CSP/orders.ts +121 -0
- package/src/allend/CSP/webhooks.ts +68 -0
- package/src/allend/Customer/index.ts +56 -0
- package/src/allend/Customer/intents.ts +66 -0
- package/src/allend/Customer/orders.ts +51 -0
- package/src/allend/Customer/rides.ts +60 -0
- package/src/allend/DEV/developers.ts +42 -0
- package/src/allend/DEV/index.ts +48 -0
- package/src/allend/IoTSP/backend.ts +103 -0
- package/src/allend/IoTSP/devices.ts +74 -0
- package/src/allend/IoTSP/index.ts +69 -0
- package/src/allend/IoTSP/rules.ts +99 -0
- package/src/allend/IoTSP/topics.ts +99 -0
- package/src/allend/LSP/agents.ts +115 -0
- package/src/allend/LSP/carriers.ts +408 -0
- package/src/allend/LSP/coverage.ts +212 -0
- package/src/allend/LSP/fleets.ts +505 -0
- package/src/allend/LSP/hubs.ts +245 -0
- package/src/allend/LSP/index.ts +75 -0
- package/src/allend/LSP/inventory.ts +65 -0
- package/src/allend/LSP/operations.ts +202 -0
- package/src/allend/LSP/orders.ts +397 -0
- package/src/allend/LSP/pods.ts +176 -0
- package/src/allend/LSP/pricing.ts +192 -0
- package/src/allend/LSP/psl.ts +81 -0
- package/src/allend/LSP/warehouses.ts +118 -0
- package/src/allend/MSI/Controls.ts +109 -90
- package/src/allend/MSI/Handles.ts +24 -15
- package/src/allend/MSI/Plugins.ts +3 -3
- package/src/allend/MSI/index.ts +85 -16
- package/src/allend/MSI/native.tsx +314 -0
- package/src/allend/MSI/token.ts +20 -0
- package/src/allend/OTPAuth/index.ts +130 -0
- package/src/allend/Pipelines/analytics.ts +25 -0
- package/src/allend/Pipelines/escalations.ts +26 -0
- package/src/allend/Pipelines/executions.ts +51 -0
- package/src/allend/Pipelines/index.ts +125 -0
- package/src/allend/Pipelines/interventions.ts +27 -0
- package/src/allend/Pipelines/monitor.ts +33 -0
- package/src/allend/Pipelines/queries.ts +27 -0
- package/src/allend/Pipelines/templates.ts +51 -0
- package/src/allend/Pipelines/utils.ts +0 -0
- package/src/allend/Pipelines/webhooks.ts +36 -0
- package/src/allend/Pipelines/workers.ts +49 -0
- package/src/allend/Queries/capacity.ts +51 -0
- package/src/allend/Queries/discovery.ts +53 -0
- package/src/allend/Queries/index.ts +58 -0
- package/src/allend/Queries/matching.ts +16 -0
- package/src/allend/Queries/performance.ts +35 -0
- package/src/allend/Queries/pricing.ts +51 -0
- package/src/allend/{DClient/Event.ts → Realtime/index.ts} +23 -22
- package/src/allend/Shared/account.ts +24 -0
- package/src/allend/Shared/buckets.ts +117 -0
- package/src/allend/Shared/context.ts +36 -0
- package/src/allend/Shared/faqs.ts +106 -0
- package/src/allend/Shared/invitation.ts +77 -0
- package/src/allend/Shared/operators.ts +84 -0
- package/src/allend/Shared/users.ts +32 -0
- package/src/allend/Tracking/index.ts +48 -0
- package/src/allend/Utilities/common.ts +63 -0
- package/src/allend/Utilities/fares.ts +45 -0
- package/src/allend/Utilities/index.ts +52 -0
- package/src/allend/Utilities/nearby.ts +36 -0
- package/src/allend/{DClient → Workflows}/Client.ts +12 -22
- package/src/allend/Workflows/Delivery.ts +94 -0
- package/src/allend/Workflows/index.ts +31 -0
- package/src/allend/Workspace/index.ts +302 -0
- package/src/allend/index.ts +23 -10
- package/src/backend/Auth.ts +68 -35
- package/src/baseUrl.ts +81 -7
- package/src/core.ts +145 -0
- package/src/error.ts +27 -0
- package/src/index.ts +25 -17
- package/src/react-native.ts +43 -0
- package/src/types/access.d.ts +64 -7
- package/src/types/auth.d.ts +17 -17
- package/src/types/channel.d.ts +45 -0
- package/src/types/index.d.ts +379 -237
- package/src/utils/index.ts +33 -1
- package/dist/allend/DAuth/index.d.ts +0 -20
- package/dist/allend/DAuth/index.js +0 -92
- package/dist/allend/DAuth/index.js.map +0 -1
- package/dist/allend/DClient/Client.d.ts +0 -10
- package/dist/allend/DClient/Client.js +0 -144
- package/dist/allend/DClient/Client.js.map +0 -1
- package/dist/allend/DClient/Event.js +0 -100
- package/dist/allend/DClient/Event.js.map +0 -1
- package/dist/allend/DClient/Order.d.ts +0 -49
- package/dist/allend/DClient/Order.js +0 -601
- package/dist/allend/DClient/Order.js.map +0 -1
- package/dist/bundle.js +0 -1
- package/src/allend/DAuth/index.ts +0 -39
- package/src/allend/DClient/Order.ts +0 -452
|
@@ -1,608 +1,591 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const FUNCTION_EVENT_TIMEOUT = 12000, FUNCTION_EVENT_TIMEOUT_MESSAGE = 'Event timeout';
|
|
4
|
+
class Controls {
|
|
5
|
+
constructor(chn, options) {
|
|
6
6
|
this.chn = chn;
|
|
7
7
|
this.options = options;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* Listen to MSI events
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
on(event, listener) {
|
|
13
13
|
this.chn.on(event, listener);
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
15
|
/**
|
|
16
16
|
* Remove a listener of MSI events
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
off(event, listener) {
|
|
19
19
|
this.chn.off(event, listener);
|
|
20
|
-
}
|
|
20
|
+
}
|
|
21
21
|
/**
|
|
22
22
|
* Remove all listen of MSI events
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
removeListeners(listener) {
|
|
25
25
|
this.chn.removeListeners(listener);
|
|
26
|
-
}
|
|
26
|
+
}
|
|
27
27
|
/**
|
|
28
|
-
* Refresh access token to
|
|
28
|
+
* Refresh access token to remote server
|
|
29
|
+
*
|
|
30
|
+
* Updating the local copy alone is not enough: the gateway captured the token
|
|
31
|
+
* it was bound with, so it has to be told about the rotation as well.
|
|
29
32
|
*
|
|
30
33
|
* @param token - Latest access token
|
|
31
34
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
refreshToken(token) {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
if (!token)
|
|
38
|
+
return reject('Undefined Access Token');
|
|
39
|
+
this.options.accessToken = token;
|
|
40
|
+
// Set timeout
|
|
41
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
42
|
+
this.chn.emit('refresh:token', token, (error) => {
|
|
43
|
+
clearTimeout(timeout);
|
|
44
|
+
if (error)
|
|
45
|
+
return reject(error);
|
|
46
|
+
resolve();
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}
|
|
37
50
|
/**
|
|
38
51
|
* Update map style
|
|
39
52
|
*
|
|
40
53
|
* @param style - Map style ID
|
|
41
54
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return new Promise(function (resolve, reject) {
|
|
55
|
+
setMapStyle(style) {
|
|
56
|
+
return new Promise((resolve, reject) => {
|
|
45
57
|
// Set timeout
|
|
46
|
-
|
|
58
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
47
59
|
// Set style
|
|
48
|
-
|
|
60
|
+
this.chn.emit('set:map:style', style, (error) => {
|
|
61
|
+
clearTimeout(timeout);
|
|
49
62
|
if (error)
|
|
50
63
|
return reject(error);
|
|
51
|
-
clearTimeout(timeout);
|
|
52
64
|
resolve();
|
|
53
65
|
});
|
|
54
66
|
});
|
|
55
|
-
}
|
|
67
|
+
}
|
|
56
68
|
/**
|
|
57
69
|
* @return - User's current GPS location
|
|
58
70
|
*/
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return new Promise(function (resolve, reject) {
|
|
71
|
+
getCurrentLocation() {
|
|
72
|
+
return new Promise((resolve, reject) => {
|
|
62
73
|
// Set timeout
|
|
63
|
-
|
|
74
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
64
75
|
// Get current location
|
|
65
|
-
|
|
76
|
+
this.chn.emit('get:current:location', (error, location) => {
|
|
77
|
+
clearTimeout(timeout);
|
|
66
78
|
if (error)
|
|
67
79
|
return reject(error);
|
|
68
|
-
clearTimeout(timeout);
|
|
69
80
|
resolve(location);
|
|
70
81
|
});
|
|
71
82
|
});
|
|
72
|
-
}
|
|
83
|
+
}
|
|
73
84
|
/**
|
|
74
85
|
* Pin user's current location on the current active map
|
|
75
86
|
*
|
|
76
87
|
* @return - User's current GPS location coordinates or `null` when it failed
|
|
77
88
|
*/
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return new Promise(function (resolve, reject) {
|
|
89
|
+
pinCurrentLocation() {
|
|
90
|
+
return new Promise((resolve, reject) => {
|
|
81
91
|
// Set timeout
|
|
82
|
-
|
|
92
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
83
93
|
// Pin user's current location on the map
|
|
84
|
-
|
|
94
|
+
this.chn.emit('pin:current:location', (error, location) => {
|
|
95
|
+
clearTimeout(timeout);
|
|
85
96
|
if (error)
|
|
86
97
|
return reject(error);
|
|
87
|
-
clearTimeout(timeout);
|
|
88
98
|
resolve(location);
|
|
89
99
|
});
|
|
90
100
|
});
|
|
91
|
-
}
|
|
101
|
+
}
|
|
92
102
|
/**
|
|
93
103
|
* Set live location tracking options
|
|
94
104
|
*
|
|
95
105
|
* @param options - User location tracking options
|
|
96
106
|
*/
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return new Promise(function (resolve, reject) {
|
|
107
|
+
setLiveLocationOptions(options) {
|
|
108
|
+
return new Promise((resolve, reject) => {
|
|
100
109
|
// Set timeout
|
|
101
|
-
|
|
110
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
102
111
|
// Set live location options
|
|
103
|
-
|
|
112
|
+
this.chn.emit('set:live:options', options, (error) => {
|
|
113
|
+
clearTimeout(timeout);
|
|
104
114
|
if (error)
|
|
105
115
|
return reject(error);
|
|
106
|
-
clearTimeout(timeout);
|
|
107
116
|
resolve();
|
|
108
117
|
});
|
|
109
118
|
});
|
|
110
|
-
}
|
|
119
|
+
}
|
|
111
120
|
/**
|
|
112
121
|
* Start tracking user's live location
|
|
113
122
|
*/
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
return new Promise(function (resolve, reject) {
|
|
123
|
+
trackLiveLocation() {
|
|
124
|
+
return new Promise((resolve, reject) => {
|
|
117
125
|
// Set timeout
|
|
118
|
-
|
|
126
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
119
127
|
// Start live location tracking
|
|
120
|
-
|
|
128
|
+
this.chn.emit('track:live:location', (error) => {
|
|
129
|
+
clearTimeout(timeout);
|
|
121
130
|
if (error)
|
|
122
131
|
return reject(error);
|
|
123
|
-
clearTimeout(timeout);
|
|
124
132
|
resolve();
|
|
125
133
|
});
|
|
126
134
|
});
|
|
127
|
-
}
|
|
135
|
+
}
|
|
128
136
|
/**
|
|
129
137
|
* Stop tracking user's live location
|
|
130
138
|
*/
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
return new Promise(function (resolve, reject) {
|
|
139
|
+
untrackLiveLocation() {
|
|
140
|
+
return new Promise((resolve, reject) => {
|
|
134
141
|
// Set timeout
|
|
135
|
-
|
|
142
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
136
143
|
// Stop live location tracking
|
|
137
|
-
|
|
144
|
+
this.chn.emit('untrack:live:location', (error) => {
|
|
145
|
+
clearTimeout(timeout);
|
|
138
146
|
if (error)
|
|
139
147
|
return reject(error);
|
|
140
|
-
clearTimeout(timeout);
|
|
141
148
|
resolve();
|
|
142
149
|
});
|
|
143
150
|
});
|
|
144
|
-
}
|
|
151
|
+
}
|
|
145
152
|
/**
|
|
146
153
|
* Enable drag pick functionality
|
|
147
154
|
*
|
|
148
155
|
* @param location - (Optional) Initial location for drag pick
|
|
149
156
|
*/
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
return new Promise(function (resolve, reject) {
|
|
157
|
+
enableDragPickLocation(location) {
|
|
158
|
+
return new Promise((resolve, reject) => {
|
|
153
159
|
// Set timeout
|
|
154
|
-
|
|
160
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
155
161
|
// Enable drag pick
|
|
156
|
-
|
|
162
|
+
this.chn.emit('enable:dragpick:location', location, (error) => {
|
|
163
|
+
clearTimeout(timeout);
|
|
157
164
|
if (error)
|
|
158
165
|
return reject(error);
|
|
159
|
-
clearTimeout(timeout);
|
|
160
166
|
resolve();
|
|
161
167
|
});
|
|
162
168
|
});
|
|
163
|
-
}
|
|
169
|
+
}
|
|
164
170
|
/**
|
|
165
171
|
* Disable drag pick functionality
|
|
166
172
|
*/
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
return new Promise(function (resolve, reject) {
|
|
173
|
+
disableDragPickLocation() {
|
|
174
|
+
return new Promise((resolve, reject) => {
|
|
170
175
|
// Set timeout
|
|
171
|
-
|
|
176
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
172
177
|
// Disable drag pick
|
|
173
|
-
|
|
178
|
+
this.chn.emit('disable:dragpick:location', (error) => {
|
|
179
|
+
clearTimeout(timeout);
|
|
174
180
|
if (error)
|
|
175
181
|
return reject(error);
|
|
176
|
-
clearTimeout(timeout);
|
|
177
182
|
resolve();
|
|
178
183
|
});
|
|
179
184
|
});
|
|
180
|
-
}
|
|
185
|
+
}
|
|
181
186
|
/**
|
|
182
187
|
* Set drag pick content
|
|
183
188
|
*
|
|
184
189
|
* @param type - Content type for drag pick
|
|
185
190
|
* @param content - Content data for drag pick
|
|
186
191
|
*/
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
return new Promise(function (resolve, reject) {
|
|
192
|
+
setDragPickContent(type, content) {
|
|
193
|
+
return new Promise((resolve, reject) => {
|
|
190
194
|
// Set timeout
|
|
191
|
-
|
|
195
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
192
196
|
// Set drag pick content
|
|
193
|
-
|
|
197
|
+
this.chn.emit('set:dragpick:content', { type, content }, (error) => {
|
|
198
|
+
clearTimeout(timeout);
|
|
194
199
|
if (error)
|
|
195
200
|
return reject(error);
|
|
196
|
-
clearTimeout(timeout);
|
|
197
201
|
resolve();
|
|
198
202
|
});
|
|
199
203
|
});
|
|
200
|
-
}
|
|
204
|
+
}
|
|
201
205
|
/**
|
|
202
206
|
* Get a location coordinates of placed that matched this name
|
|
203
207
|
*
|
|
204
208
|
* @param name - Place name to resolve
|
|
205
209
|
* @return - Array list of coordinates
|
|
206
210
|
*/
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
return new Promise(function (resolve, reject) {
|
|
211
|
+
resolvePlace(name) {
|
|
212
|
+
return new Promise((resolve, reject) => {
|
|
210
213
|
// Set timeout
|
|
211
|
-
|
|
214
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
212
215
|
// Get location coordinates from place name
|
|
213
|
-
|
|
216
|
+
this.chn.emit('resolve:place', name, (error, data) => {
|
|
217
|
+
clearTimeout(timeout);
|
|
214
218
|
if (error)
|
|
215
219
|
return reject(error);
|
|
216
|
-
clearTimeout(timeout);
|
|
217
220
|
resolve(data);
|
|
218
221
|
});
|
|
219
222
|
});
|
|
220
|
-
}
|
|
223
|
+
}
|
|
221
224
|
/**
|
|
222
225
|
* Get a location details of placed that matched this coordinates
|
|
223
226
|
*
|
|
224
227
|
* @param coords - Coordinates
|
|
225
228
|
* @return - Array list of geocoding data
|
|
226
229
|
*/
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
return new Promise(function (resolve, reject) {
|
|
230
|
+
resolveCoordinates(coords) {
|
|
231
|
+
return new Promise((resolve, reject) => {
|
|
230
232
|
// Set timeout
|
|
231
|
-
|
|
233
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
232
234
|
// Get location place from coordinates
|
|
233
|
-
|
|
235
|
+
this.chn.emit('resolve:coordinates', coords, (error, data) => {
|
|
236
|
+
clearTimeout(timeout);
|
|
234
237
|
if (error)
|
|
235
238
|
return reject(error);
|
|
236
|
-
clearTimeout(timeout);
|
|
237
239
|
resolve(data);
|
|
238
240
|
});
|
|
239
241
|
});
|
|
240
|
-
}
|
|
242
|
+
}
|
|
241
243
|
/**
|
|
242
244
|
* Search a location or places
|
|
243
245
|
*
|
|
244
246
|
* @param input - Place in string
|
|
245
247
|
* @return - Autocompletion list matched places
|
|
246
248
|
*/
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
return new Promise(function (resolve, reject) {
|
|
249
|
+
searchQuery(input) {
|
|
250
|
+
return new Promise((resolve, reject) => {
|
|
250
251
|
// Set timeout
|
|
251
|
-
|
|
252
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
252
253
|
// Launch search query
|
|
253
|
-
|
|
254
|
+
this.chn.emit('search:query', input, (error, data) => {
|
|
255
|
+
clearTimeout(timeout);
|
|
254
256
|
if (error)
|
|
255
257
|
return reject(error);
|
|
256
|
-
clearTimeout(timeout);
|
|
257
258
|
resolve(data);
|
|
258
259
|
});
|
|
259
260
|
});
|
|
260
|
-
}
|
|
261
|
+
}
|
|
261
262
|
/**
|
|
262
263
|
* Select a suggested place by the search
|
|
263
264
|
*
|
|
264
265
|
* @param index - Index of place in suggested list
|
|
265
266
|
* @return - More details of selected place
|
|
266
267
|
*/
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
return new Promise(function (resolve, reject) {
|
|
268
|
+
searchSelect(index) {
|
|
269
|
+
return new Promise((resolve, reject) => {
|
|
270
270
|
// Set timeout
|
|
271
|
-
|
|
271
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
272
272
|
// Get place's details
|
|
273
|
-
|
|
273
|
+
this.chn.emit('search:select', index, (error, data) => {
|
|
274
|
+
clearTimeout(timeout);
|
|
274
275
|
if (error)
|
|
275
276
|
return reject(error);
|
|
276
|
-
clearTimeout(timeout);
|
|
277
277
|
resolve(data);
|
|
278
278
|
});
|
|
279
279
|
});
|
|
280
|
-
}
|
|
280
|
+
}
|
|
281
281
|
/**
|
|
282
282
|
* Show nearby entities around coordinates
|
|
283
283
|
*
|
|
284
284
|
* @param list - Array of entity specifications
|
|
285
285
|
*/
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
return new Promise(function (resolve, reject) {
|
|
286
|
+
showNearby(list) {
|
|
287
|
+
return new Promise((resolve, reject) => {
|
|
289
288
|
// Set timeout
|
|
290
|
-
|
|
289
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
291
290
|
// Show nearby entities
|
|
292
|
-
|
|
291
|
+
this.chn.emit('show:nearby', list, (error) => {
|
|
292
|
+
clearTimeout(timeout);
|
|
293
293
|
if (error)
|
|
294
294
|
return reject(error);
|
|
295
|
-
clearTimeout(timeout);
|
|
296
295
|
resolve();
|
|
297
296
|
});
|
|
298
297
|
});
|
|
299
|
-
}
|
|
298
|
+
}
|
|
300
299
|
/**
|
|
301
300
|
* Remove all displaying nearby entities
|
|
302
301
|
*/
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
return new Promise(function (resolve, reject) {
|
|
302
|
+
removeNearby() {
|
|
303
|
+
return new Promise((resolve, reject) => {
|
|
306
304
|
// Set timeout
|
|
307
|
-
|
|
305
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
308
306
|
// Remove nearby entities
|
|
309
|
-
|
|
307
|
+
this.chn.emit('remove:nearby', (error) => {
|
|
308
|
+
clearTimeout(timeout);
|
|
310
309
|
if (error)
|
|
311
310
|
return reject(error);
|
|
312
|
-
clearTimeout(timeout);
|
|
313
311
|
resolve();
|
|
314
312
|
});
|
|
315
313
|
});
|
|
316
|
-
}
|
|
314
|
+
}
|
|
317
315
|
/**
|
|
318
316
|
* Add a new nearby entity
|
|
319
317
|
*
|
|
320
318
|
* @param entity - Entity specification
|
|
321
319
|
*/
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
return new Promise(function (resolve, reject) {
|
|
320
|
+
addNearbyEntity(entity) {
|
|
321
|
+
return new Promise((resolve, reject) => {
|
|
325
322
|
// Set timeout
|
|
326
|
-
|
|
323
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
327
324
|
// Add nearby entity
|
|
328
|
-
|
|
325
|
+
this.chn.emit('add:nearby:entity', entity, (error) => {
|
|
326
|
+
clearTimeout(timeout);
|
|
329
327
|
if (error)
|
|
330
328
|
return reject(error);
|
|
331
|
-
clearTimeout(timeout);
|
|
332
329
|
resolve();
|
|
333
330
|
});
|
|
334
331
|
});
|
|
335
|
-
}
|
|
332
|
+
}
|
|
336
333
|
/**
|
|
337
334
|
* Update a nearby entity position
|
|
338
335
|
*
|
|
339
336
|
* @param activePosition - Entity ID and new position
|
|
340
337
|
*/
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
return new Promise(function (resolve, reject) {
|
|
338
|
+
moveNearbyEntity(activePosition) {
|
|
339
|
+
return new Promise((resolve, reject) => {
|
|
344
340
|
// Set timeout
|
|
345
|
-
|
|
341
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
346
342
|
// Move nearby entity
|
|
347
|
-
|
|
343
|
+
this.chn.emit('move:nearby:entity', activePosition, (error) => {
|
|
344
|
+
clearTimeout(timeout);
|
|
348
345
|
if (error)
|
|
349
346
|
return reject(error);
|
|
350
|
-
clearTimeout(timeout);
|
|
351
347
|
resolve();
|
|
352
348
|
});
|
|
353
349
|
});
|
|
354
|
-
}
|
|
350
|
+
}
|
|
355
351
|
/**
|
|
356
352
|
* Remove a nearby entity
|
|
357
353
|
*
|
|
358
354
|
* @param id - Entity ID to remove
|
|
359
355
|
*/
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
return new Promise(function (resolve, reject) {
|
|
356
|
+
removeNearbyEntity(id) {
|
|
357
|
+
return new Promise((resolve, reject) => {
|
|
363
358
|
// Set timeout
|
|
364
|
-
|
|
359
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
365
360
|
// Remove nearby entity
|
|
366
|
-
|
|
361
|
+
this.chn.emit('remove:nearby:entity', id, (error) => {
|
|
362
|
+
clearTimeout(timeout);
|
|
367
363
|
if (error)
|
|
368
364
|
return reject(error);
|
|
369
|
-
clearTimeout(timeout);
|
|
370
365
|
resolve();
|
|
371
366
|
});
|
|
372
367
|
});
|
|
373
|
-
}
|
|
368
|
+
}
|
|
374
369
|
/**
|
|
375
370
|
* Set complete route with journey specifications
|
|
376
371
|
*
|
|
377
372
|
* @param journey - Journey specifications including route ID, origin, destination, waypoints, and options
|
|
378
373
|
*/
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
return new Promise(function (resolve, reject) {
|
|
374
|
+
setRoute(journey) {
|
|
375
|
+
return new Promise((resolve, reject) => {
|
|
382
376
|
// Set timeout
|
|
383
|
-
|
|
377
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
384
378
|
// Set route
|
|
385
|
-
|
|
379
|
+
this.chn.emit('set:route', journey, (error) => {
|
|
380
|
+
clearTimeout(timeout);
|
|
386
381
|
if (error)
|
|
387
382
|
return reject(error);
|
|
388
|
-
clearTimeout(timeout);
|
|
389
383
|
resolve();
|
|
390
384
|
});
|
|
391
385
|
});
|
|
392
|
-
}
|
|
386
|
+
}
|
|
393
387
|
/**
|
|
394
388
|
* Draw route
|
|
395
389
|
*
|
|
396
390
|
* @param routeId - Route identifier
|
|
397
391
|
*/
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
return new Promise(function (resolve, reject) {
|
|
392
|
+
drawRoute(routeId, data, options) {
|
|
393
|
+
return new Promise((resolve, reject) => {
|
|
401
394
|
// Set timeout
|
|
402
|
-
|
|
395
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
403
396
|
// Draw route
|
|
404
|
-
|
|
397
|
+
this.chn.emit('draw:route', { routeId, data, options }, (error) => {
|
|
398
|
+
clearTimeout(timeout);
|
|
405
399
|
if (error)
|
|
406
400
|
return reject(error);
|
|
407
|
-
clearTimeout(timeout);
|
|
408
401
|
resolve();
|
|
409
402
|
});
|
|
410
403
|
});
|
|
411
|
-
}
|
|
404
|
+
}
|
|
412
405
|
/**
|
|
413
406
|
* Remove route
|
|
414
407
|
*
|
|
415
408
|
* @param routeId - Route identifier
|
|
416
409
|
*/
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
return new Promise(function (resolve, reject) {
|
|
410
|
+
removeRoute(routeId) {
|
|
411
|
+
return new Promise((resolve, reject) => {
|
|
420
412
|
// Set timeout
|
|
421
|
-
|
|
413
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
422
414
|
// Remove route
|
|
423
|
-
|
|
415
|
+
this.chn.emit('remove:route', routeId, (error) => {
|
|
416
|
+
clearTimeout(timeout);
|
|
424
417
|
if (error)
|
|
425
418
|
return reject(error);
|
|
426
|
-
clearTimeout(timeout);
|
|
427
419
|
resolve();
|
|
428
420
|
});
|
|
429
421
|
});
|
|
430
|
-
}
|
|
422
|
+
}
|
|
431
423
|
/**
|
|
432
424
|
* Set route origin
|
|
433
425
|
*
|
|
434
426
|
* @param routeId - Route identifier
|
|
435
427
|
* @param point - Waypoint specification for origin
|
|
436
428
|
*/
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
return new Promise(function (resolve, reject) {
|
|
429
|
+
setRouteOrigin(routeId, point) {
|
|
430
|
+
return new Promise((resolve, reject) => {
|
|
440
431
|
// Set timeout
|
|
441
|
-
|
|
432
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
442
433
|
// Set route origin
|
|
443
|
-
|
|
434
|
+
this.chn.emit('set:route:origin', { routeId, point }, (error) => {
|
|
435
|
+
clearTimeout(timeout);
|
|
444
436
|
if (error)
|
|
445
437
|
return reject(error);
|
|
446
|
-
clearTimeout(timeout);
|
|
447
438
|
resolve();
|
|
448
439
|
});
|
|
449
440
|
});
|
|
450
|
-
}
|
|
441
|
+
}
|
|
451
442
|
/**
|
|
452
443
|
* Remove route origin
|
|
453
444
|
*
|
|
454
445
|
* @param routeId - Route identifier
|
|
455
446
|
*/
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
return new Promise(function (resolve, reject) {
|
|
447
|
+
removeRouteOrigin(routeId) {
|
|
448
|
+
return new Promise((resolve, reject) => {
|
|
459
449
|
// Set timeout
|
|
460
|
-
|
|
450
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
461
451
|
// Remove route origin
|
|
462
|
-
|
|
452
|
+
this.chn.emit('remove:route:origin', { routeId }, (error) => {
|
|
453
|
+
clearTimeout(timeout);
|
|
463
454
|
if (error)
|
|
464
455
|
return reject(error);
|
|
465
|
-
clearTimeout(timeout);
|
|
466
456
|
resolve();
|
|
467
457
|
});
|
|
468
458
|
});
|
|
469
|
-
}
|
|
459
|
+
}
|
|
470
460
|
/**
|
|
471
461
|
* Set route destination
|
|
472
462
|
*
|
|
473
463
|
* @param routeId - Route identifier
|
|
474
464
|
* @param point - Waypoint specification for destination
|
|
475
465
|
*/
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
return new Promise(function (resolve, reject) {
|
|
466
|
+
setRouteDestination(routeId, point) {
|
|
467
|
+
return new Promise((resolve, reject) => {
|
|
479
468
|
// Set timeout
|
|
480
|
-
|
|
469
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
481
470
|
// Set route destination
|
|
482
|
-
|
|
471
|
+
this.chn.emit('set:route:destination', { routeId, point }, (error) => {
|
|
472
|
+
clearTimeout(timeout);
|
|
483
473
|
if (error)
|
|
484
474
|
return reject(error);
|
|
485
|
-
clearTimeout(timeout);
|
|
486
475
|
resolve();
|
|
487
476
|
});
|
|
488
477
|
});
|
|
489
|
-
}
|
|
478
|
+
}
|
|
490
479
|
/**
|
|
491
480
|
* Remove route destination
|
|
492
481
|
*
|
|
493
482
|
* @param routeId - Route identifier
|
|
494
483
|
*/
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
return new Promise(function (resolve, reject) {
|
|
484
|
+
removeRouteDestination(routeId) {
|
|
485
|
+
return new Promise((resolve, reject) => {
|
|
498
486
|
// Set timeout
|
|
499
|
-
|
|
487
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
500
488
|
// Remove route destination
|
|
501
|
-
|
|
489
|
+
this.chn.emit('remove:route:destination', { routeId }, (error) => {
|
|
490
|
+
clearTimeout(timeout);
|
|
502
491
|
if (error)
|
|
503
492
|
return reject(error);
|
|
504
|
-
clearTimeout(timeout);
|
|
505
493
|
resolve();
|
|
506
494
|
});
|
|
507
495
|
});
|
|
508
|
-
}
|
|
496
|
+
}
|
|
509
497
|
/**
|
|
510
498
|
* Add a route waypoint
|
|
511
499
|
*
|
|
512
500
|
* @param routeId - Route identifier
|
|
513
501
|
* @param point - Waypoint specification
|
|
514
502
|
*/
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
return new Promise(function (resolve, reject) {
|
|
503
|
+
addRouteWaypoint(routeId, point) {
|
|
504
|
+
return new Promise((resolve, reject) => {
|
|
518
505
|
// Set timeout
|
|
519
|
-
|
|
506
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
520
507
|
// Add route waypoint
|
|
521
|
-
|
|
508
|
+
this.chn.emit('add:route:waypoint', { routeId, point }, (error) => {
|
|
509
|
+
clearTimeout(timeout);
|
|
522
510
|
if (error)
|
|
523
511
|
return reject(error);
|
|
524
|
-
clearTimeout(timeout);
|
|
525
512
|
resolve();
|
|
526
513
|
});
|
|
527
514
|
});
|
|
528
|
-
}
|
|
515
|
+
}
|
|
529
516
|
/**
|
|
530
517
|
* Update a route waypoint
|
|
531
518
|
*
|
|
532
519
|
* @param routeId - Route identifier
|
|
533
520
|
* @param point - Waypoint specification with index
|
|
534
521
|
*/
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
return new Promise(function (resolve, reject) {
|
|
522
|
+
updateRouteWaypoint(routeId, point) {
|
|
523
|
+
return new Promise((resolve, reject) => {
|
|
538
524
|
// Set timeout
|
|
539
|
-
|
|
525
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
540
526
|
// Update route waypoint
|
|
541
|
-
|
|
527
|
+
this.chn.emit('update:route:waypoint', { routeId, point }, (error) => {
|
|
528
|
+
clearTimeout(timeout);
|
|
542
529
|
if (error)
|
|
543
530
|
return reject(error);
|
|
544
|
-
clearTimeout(timeout);
|
|
545
531
|
resolve();
|
|
546
532
|
});
|
|
547
533
|
});
|
|
548
|
-
}
|
|
534
|
+
}
|
|
549
535
|
/**
|
|
550
536
|
* Remove a route waypoint
|
|
551
537
|
*
|
|
552
538
|
* @param routeId - Route identifier
|
|
553
539
|
* @param index - Waypoint index to remove
|
|
554
540
|
*/
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
return new Promise(function (resolve, reject) {
|
|
541
|
+
removeRouteWaypoint(routeId, index) {
|
|
542
|
+
return new Promise((resolve, reject) => {
|
|
558
543
|
// Set timeout
|
|
559
|
-
|
|
544
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
560
545
|
// Remove route waypoint
|
|
561
|
-
|
|
546
|
+
this.chn.emit('remove:route:waypoint', { routeId, index }, (error) => {
|
|
547
|
+
clearTimeout(timeout);
|
|
562
548
|
if (error)
|
|
563
549
|
return reject(error);
|
|
564
|
-
clearTimeout(timeout);
|
|
565
550
|
resolve();
|
|
566
551
|
});
|
|
567
552
|
});
|
|
568
|
-
}
|
|
553
|
+
}
|
|
569
554
|
/**
|
|
570
555
|
* Fit route bounds
|
|
571
556
|
*
|
|
572
557
|
* @param routeId - Route identifier
|
|
573
558
|
* @param margin - Margin in px
|
|
574
559
|
*/
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
return new Promise(function (resolve, reject) {
|
|
560
|
+
fitRouteBounds(routeId, margin) {
|
|
561
|
+
return new Promise((resolve, reject) => {
|
|
578
562
|
// Set timeout
|
|
579
|
-
|
|
580
|
-
|
|
563
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
564
|
+
this.chn.emit('fit:route:bounds', { routeId, margin }, (error) => {
|
|
565
|
+
clearTimeout(timeout);
|
|
581
566
|
if (error)
|
|
582
567
|
return reject(error);
|
|
583
|
-
clearTimeout(timeout);
|
|
584
568
|
resolve();
|
|
585
569
|
});
|
|
586
570
|
});
|
|
587
|
-
}
|
|
571
|
+
}
|
|
588
572
|
/**
|
|
589
573
|
* Fit all/many routes bounds
|
|
590
574
|
*
|
|
591
575
|
* @param options - Routes fit bounds options
|
|
592
576
|
*/
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
return new Promise(function (resolve, reject) {
|
|
577
|
+
fitRoutesBounds(options) {
|
|
578
|
+
return new Promise((resolve, reject) => {
|
|
596
579
|
// Set timeout
|
|
597
|
-
|
|
598
|
-
|
|
580
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
581
|
+
this.chn.emit('fit:routes:bounds', options, (error) => {
|
|
582
|
+
clearTimeout(timeout);
|
|
599
583
|
if (error)
|
|
600
584
|
return reject(error);
|
|
601
|
-
clearTimeout(timeout);
|
|
602
585
|
resolve();
|
|
603
586
|
});
|
|
604
587
|
});
|
|
605
|
-
}
|
|
588
|
+
}
|
|
606
589
|
/**
|
|
607
590
|
* Set waypoint caption
|
|
608
591
|
*
|
|
@@ -610,20 +593,19 @@ var Controls = /** @class */ (function () {
|
|
|
610
593
|
* @param id - Waypoint identifier (string or number)
|
|
611
594
|
* @param caption - Caption information to set
|
|
612
595
|
*/
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
return new Promise(function (resolve, reject) {
|
|
596
|
+
setWaypointCaption(routeId, id, caption) {
|
|
597
|
+
return new Promise((resolve, reject) => {
|
|
616
598
|
// Set timeout
|
|
617
|
-
|
|
599
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
618
600
|
// Set waypoint caption
|
|
619
|
-
|
|
601
|
+
this.chn.emit('set:waypoint:caption', { routeId, id, caption }, (error) => {
|
|
602
|
+
clearTimeout(timeout);
|
|
620
603
|
if (error)
|
|
621
604
|
return reject(error);
|
|
622
|
-
clearTimeout(timeout);
|
|
623
605
|
resolve();
|
|
624
606
|
});
|
|
625
607
|
});
|
|
626
|
-
}
|
|
608
|
+
}
|
|
627
609
|
/**
|
|
628
610
|
* Update waypoint caption
|
|
629
611
|
*
|
|
@@ -631,131 +613,124 @@ var Controls = /** @class */ (function () {
|
|
|
631
613
|
* @param id - Waypoint identifier (string or number)
|
|
632
614
|
* @param caption - Caption information to update
|
|
633
615
|
*/
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
return new Promise(function (resolve, reject) {
|
|
616
|
+
updateWaypointCaption(routeId, id, caption) {
|
|
617
|
+
return new Promise((resolve, reject) => {
|
|
637
618
|
// Set timeout
|
|
638
|
-
|
|
619
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
639
620
|
// Update waypoint caption
|
|
640
|
-
|
|
621
|
+
this.chn.emit('update:waypoint:caption', { routeId, id, caption }, (error) => {
|
|
622
|
+
clearTimeout(timeout);
|
|
641
623
|
if (error)
|
|
642
624
|
return reject(error);
|
|
643
|
-
clearTimeout(timeout);
|
|
644
625
|
resolve();
|
|
645
626
|
});
|
|
646
627
|
});
|
|
647
|
-
}
|
|
628
|
+
}
|
|
648
629
|
/**
|
|
649
630
|
* Remove waypoint caption
|
|
650
631
|
*
|
|
651
632
|
* @param routeId - Route identifier
|
|
652
633
|
* @param id - Waypoint identifier (string or number)
|
|
653
634
|
*/
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
return new Promise(function (resolve, reject) {
|
|
635
|
+
removeWaypointCaption(routeId, id) {
|
|
636
|
+
return new Promise((resolve, reject) => {
|
|
657
637
|
// Set timeout
|
|
658
|
-
|
|
638
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
659
639
|
// Remove waypoint caption
|
|
660
|
-
|
|
640
|
+
this.chn.emit('remove:waypoint:caption', { routeId, id }, (error) => {
|
|
641
|
+
clearTimeout(timeout);
|
|
661
642
|
if (error)
|
|
662
643
|
return reject(error);
|
|
663
|
-
clearTimeout(timeout);
|
|
664
644
|
resolve();
|
|
665
645
|
});
|
|
666
646
|
});
|
|
667
|
-
}
|
|
647
|
+
}
|
|
668
648
|
/**
|
|
669
649
|
* Mount navigation route
|
|
670
650
|
*
|
|
671
651
|
* @param routeId - Route identifier for navigation
|
|
672
652
|
*/
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
return new Promise(function (resolve, reject) {
|
|
653
|
+
mountNavigation(routeId) {
|
|
654
|
+
return new Promise((resolve, reject) => {
|
|
676
655
|
// Set timeout
|
|
677
|
-
|
|
656
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
678
657
|
// Mount navigation
|
|
679
|
-
|
|
658
|
+
this.chn.emit('mount:navigation', routeId, (error) => {
|
|
659
|
+
clearTimeout(timeout);
|
|
680
660
|
if (error)
|
|
681
661
|
return reject(error);
|
|
682
|
-
clearTimeout(timeout);
|
|
683
662
|
resolve();
|
|
684
663
|
});
|
|
685
664
|
});
|
|
686
|
-
}
|
|
665
|
+
}
|
|
687
666
|
/**
|
|
688
667
|
* Unmount navigation route
|
|
689
668
|
*/
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
return new Promise(function (resolve, reject) {
|
|
669
|
+
unmountNavigation() {
|
|
670
|
+
return new Promise((resolve, reject) => {
|
|
693
671
|
// Set timeout
|
|
694
|
-
|
|
672
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
695
673
|
// Unmount navigation
|
|
696
|
-
|
|
674
|
+
this.chn.emit('unmount:navigation', (error) => {
|
|
675
|
+
clearTimeout(timeout);
|
|
697
676
|
if (error)
|
|
698
677
|
return reject(error);
|
|
699
|
-
clearTimeout(timeout);
|
|
700
678
|
resolve();
|
|
701
679
|
});
|
|
702
680
|
});
|
|
703
|
-
}
|
|
681
|
+
}
|
|
704
682
|
/**
|
|
705
683
|
* Load navigation direction
|
|
706
684
|
*/
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
return new Promise(function (resolve, reject) {
|
|
685
|
+
loadNavigation() {
|
|
686
|
+
return new Promise((resolve, reject) => {
|
|
710
687
|
// Set timeout
|
|
711
|
-
|
|
688
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
712
689
|
// Load navigation
|
|
713
|
-
|
|
690
|
+
this.chn.emit('load:navigation', (error) => {
|
|
691
|
+
clearTimeout(timeout);
|
|
714
692
|
if (error)
|
|
715
693
|
return reject(error);
|
|
716
|
-
clearTimeout(timeout);
|
|
717
694
|
resolve();
|
|
718
695
|
});
|
|
719
696
|
});
|
|
720
|
-
}
|
|
697
|
+
}
|
|
721
698
|
/**
|
|
722
699
|
* Set initial navigation position
|
|
723
700
|
*
|
|
724
701
|
* @param position - Initial GPS location for navigation
|
|
725
702
|
*/
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
return new Promise(function (resolve, reject) {
|
|
703
|
+
setInitialNavigationPosition(position) {
|
|
704
|
+
return new Promise((resolve, reject) => {
|
|
729
705
|
// Set timeout
|
|
730
|
-
|
|
706
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
731
707
|
// Set initial navigation position
|
|
732
|
-
|
|
708
|
+
this.chn.emit('initial:navigation:position', position, (error) => {
|
|
709
|
+
clearTimeout(timeout);
|
|
733
710
|
if (error)
|
|
734
711
|
return reject(error);
|
|
735
|
-
clearTimeout(timeout);
|
|
736
712
|
resolve();
|
|
737
713
|
});
|
|
738
714
|
});
|
|
739
|
-
}
|
|
715
|
+
}
|
|
740
716
|
/**
|
|
741
717
|
* Navigate to new position
|
|
742
718
|
*
|
|
743
719
|
* @param position - Current GPS location for navigation update
|
|
744
720
|
*/
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
return new Promise(function (resolve, reject) {
|
|
721
|
+
navigate(position) {
|
|
722
|
+
return new Promise((resolve, reject) => {
|
|
748
723
|
// Set timeout
|
|
749
|
-
|
|
724
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
750
725
|
// Navigate
|
|
751
|
-
|
|
726
|
+
this.chn.emit('navigate:navigation:direction', position, (error) => {
|
|
727
|
+
clearTimeout(timeout);
|
|
752
728
|
if (error)
|
|
753
729
|
return reject(error);
|
|
754
|
-
clearTimeout(timeout);
|
|
755
730
|
resolve();
|
|
756
731
|
});
|
|
757
732
|
});
|
|
758
|
-
}
|
|
733
|
+
}
|
|
759
734
|
/**
|
|
760
735
|
* Upsert navigation direction data
|
|
761
736
|
*
|
|
@@ -764,38 +739,35 @@ var Controls = /** @class */ (function () {
|
|
|
764
739
|
* @param position - (Optional) Current GPS position
|
|
765
740
|
* @params options - Route options
|
|
766
741
|
*/
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
return new Promise(function (resolve, reject) {
|
|
742
|
+
casting(routeId, direction, position, options) {
|
|
743
|
+
return new Promise((resolve, reject) => {
|
|
770
744
|
// Set timeout
|
|
771
|
-
|
|
745
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
772
746
|
// Casting navigation direction
|
|
773
|
-
|
|
747
|
+
this.chn.emit('casting:navigation:direction', { routeId, direction, position, options }, (error) => {
|
|
748
|
+
clearTimeout(timeout);
|
|
774
749
|
if (error)
|
|
775
750
|
return reject(error);
|
|
776
|
-
clearTimeout(timeout);
|
|
777
751
|
resolve();
|
|
778
752
|
});
|
|
779
753
|
});
|
|
780
|
-
}
|
|
754
|
+
}
|
|
781
755
|
/**
|
|
782
756
|
* Dismiss navigation
|
|
783
757
|
*/
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
return new Promise(function (resolve, reject) {
|
|
758
|
+
dismissNavigation() {
|
|
759
|
+
return new Promise((resolve, reject) => {
|
|
787
760
|
// Set timeout
|
|
788
|
-
|
|
761
|
+
const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
|
|
789
762
|
// Dismiss navigation
|
|
790
|
-
|
|
763
|
+
this.chn.emit('dismiss:navigation', (error) => {
|
|
764
|
+
clearTimeout(timeout);
|
|
791
765
|
if (error)
|
|
792
766
|
return reject(error);
|
|
793
|
-
clearTimeout(timeout);
|
|
794
767
|
resolve();
|
|
795
768
|
});
|
|
796
769
|
});
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
}());
|
|
770
|
+
}
|
|
771
|
+
}
|
|
800
772
|
exports.default = Controls;
|
|
801
773
|
//# sourceMappingURL=Controls.js.map
|