@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,12 +1,11 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
RTLocation,
|
|
3
2
|
Coordinates,
|
|
4
3
|
MapLayerStyle,
|
|
5
4
|
Caption,
|
|
6
5
|
MapOptions,
|
|
7
6
|
SearchPlace,
|
|
8
7
|
SearchPlaceSuggestion,
|
|
9
|
-
Entity,
|
|
8
|
+
MSIEntity as Entity,
|
|
10
9
|
ActivePosition,
|
|
11
10
|
UserLocationOptions,
|
|
12
11
|
DragPickContentType,
|
|
@@ -17,7 +16,11 @@ import type {
|
|
|
17
16
|
RoutesFitBoundsOptions,
|
|
18
17
|
LngLat
|
|
19
18
|
} from '../../types'
|
|
20
|
-
import
|
|
19
|
+
import type {
|
|
20
|
+
RTLocation
|
|
21
|
+
} from '@de./types'
|
|
22
|
+
|
|
23
|
+
import type { Channel, Listener } from '../../types/channel'
|
|
21
24
|
|
|
22
25
|
const
|
|
23
26
|
FUNCTION_EVENT_TIMEOUT = 12000,
|
|
@@ -25,9 +28,9 @@ FUNCTION_EVENT_TIMEOUT_MESSAGE = 'Event timeout'
|
|
|
25
28
|
|
|
26
29
|
export default class Controls {
|
|
27
30
|
private options: MapOptions
|
|
28
|
-
private chn:
|
|
31
|
+
private chn: Channel
|
|
29
32
|
|
|
30
|
-
constructor( chn:
|
|
33
|
+
constructor( chn: Channel, options: MapOptions ){
|
|
31
34
|
this.chn = chn
|
|
32
35
|
this.options = options
|
|
33
36
|
}
|
|
@@ -52,13 +55,29 @@ export default class Controls {
|
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
/**
|
|
55
|
-
* Refresh access token to
|
|
56
|
-
*
|
|
58
|
+
* Refresh access token to remote server
|
|
59
|
+
*
|
|
60
|
+
* Updating the local copy alone is not enough: the gateway captured the token
|
|
61
|
+
* it was bound with, so it has to be told about the rotation as well.
|
|
62
|
+
*
|
|
57
63
|
* @param token - Latest access token
|
|
58
64
|
*/
|
|
59
|
-
refreshToken( token: string ){
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
refreshToken( token: string ): Promise<void> {
|
|
66
|
+
return new Promise( ( resolve, reject ) => {
|
|
67
|
+
if( !token ) return reject('Undefined Access Token')
|
|
68
|
+
|
|
69
|
+
this.options.accessToken = token
|
|
70
|
+
|
|
71
|
+
// Set timeout
|
|
72
|
+
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
73
|
+
|
|
74
|
+
this.chn.emit('refresh:token', token, ( error: string | boolean ) => {
|
|
75
|
+
clearTimeout( timeout )
|
|
76
|
+
|
|
77
|
+
if( error ) return reject( error )
|
|
78
|
+
resolve()
|
|
79
|
+
})
|
|
80
|
+
})
|
|
62
81
|
}
|
|
63
82
|
|
|
64
83
|
/**
|
|
@@ -72,9 +91,9 @@ export default class Controls {
|
|
|
72
91
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
73
92
|
// Set style
|
|
74
93
|
this.chn.emit('set:map:style', style, ( error: string | boolean ) => {
|
|
75
|
-
if( error ) return reject( error )
|
|
76
|
-
|
|
77
94
|
clearTimeout( timeout )
|
|
95
|
+
|
|
96
|
+
if( error ) return reject( error )
|
|
78
97
|
resolve()
|
|
79
98
|
} )
|
|
80
99
|
})
|
|
@@ -89,9 +108,9 @@ export default class Controls {
|
|
|
89
108
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
90
109
|
// Get current location
|
|
91
110
|
this.chn.emit('get:current:location', ( error: string | boolean, location: RTLocation ) => {
|
|
92
|
-
if( error ) return reject( error )
|
|
93
|
-
|
|
94
111
|
clearTimeout( timeout )
|
|
112
|
+
|
|
113
|
+
if( error ) return reject( error )
|
|
95
114
|
resolve( location )
|
|
96
115
|
} )
|
|
97
116
|
} )
|
|
@@ -107,9 +126,9 @@ export default class Controls {
|
|
|
107
126
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
108
127
|
// Pin user's current location on the map
|
|
109
128
|
this.chn.emit('pin:current:location', ( error: string | boolean, location: Coordinates | null ) => {
|
|
110
|
-
if( error ) return reject( error )
|
|
111
|
-
|
|
112
129
|
clearTimeout( timeout )
|
|
130
|
+
|
|
131
|
+
if( error ) return reject( error )
|
|
113
132
|
resolve( location )
|
|
114
133
|
} )
|
|
115
134
|
} )
|
|
@@ -126,9 +145,9 @@ export default class Controls {
|
|
|
126
145
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
127
146
|
// Set live location options
|
|
128
147
|
this.chn.emit('set:live:options', options, ( error: string | boolean ) => {
|
|
129
|
-
if( error ) return reject( error )
|
|
130
|
-
|
|
131
148
|
clearTimeout( timeout )
|
|
149
|
+
|
|
150
|
+
if( error ) return reject( error )
|
|
132
151
|
resolve()
|
|
133
152
|
} )
|
|
134
153
|
} )
|
|
@@ -142,9 +161,9 @@ export default class Controls {
|
|
|
142
161
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
143
162
|
// Start live location tracking
|
|
144
163
|
this.chn.emit('track:live:location', ( error: string | boolean ) => {
|
|
145
|
-
if( error ) return reject( error )
|
|
146
|
-
|
|
147
164
|
clearTimeout( timeout )
|
|
165
|
+
|
|
166
|
+
if( error ) return reject( error )
|
|
148
167
|
resolve()
|
|
149
168
|
} )
|
|
150
169
|
} )
|
|
@@ -158,9 +177,9 @@ export default class Controls {
|
|
|
158
177
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
159
178
|
// Stop live location tracking
|
|
160
179
|
this.chn.emit('untrack:live:location', ( error: string | boolean ) => {
|
|
161
|
-
if( error ) return reject( error )
|
|
162
|
-
|
|
163
180
|
clearTimeout( timeout )
|
|
181
|
+
|
|
182
|
+
if( error ) return reject( error )
|
|
164
183
|
resolve()
|
|
165
184
|
} )
|
|
166
185
|
} )
|
|
@@ -177,9 +196,9 @@ export default class Controls {
|
|
|
177
196
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
178
197
|
// Enable drag pick
|
|
179
198
|
this.chn.emit('enable:dragpick:location', location, ( error: string | boolean ) => {
|
|
180
|
-
if( error ) return reject( error )
|
|
181
|
-
|
|
182
199
|
clearTimeout( timeout )
|
|
200
|
+
|
|
201
|
+
if( error ) return reject( error )
|
|
183
202
|
resolve()
|
|
184
203
|
} )
|
|
185
204
|
} )
|
|
@@ -193,9 +212,9 @@ export default class Controls {
|
|
|
193
212
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
194
213
|
// Disable drag pick
|
|
195
214
|
this.chn.emit('disable:dragpick:location', ( error: string | boolean ) => {
|
|
196
|
-
if( error ) return reject( error )
|
|
197
|
-
|
|
198
215
|
clearTimeout( timeout )
|
|
216
|
+
|
|
217
|
+
if( error ) return reject( error )
|
|
199
218
|
resolve()
|
|
200
219
|
} )
|
|
201
220
|
} )
|
|
@@ -212,9 +231,9 @@ export default class Controls {
|
|
|
212
231
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
213
232
|
// Set drag pick content
|
|
214
233
|
this.chn.emit('set:dragpick:content', { type, content }, ( error: string | boolean ) => {
|
|
215
|
-
if( error ) return reject( error )
|
|
216
|
-
|
|
217
234
|
clearTimeout( timeout )
|
|
235
|
+
|
|
236
|
+
if( error ) return reject( error )
|
|
218
237
|
resolve()
|
|
219
238
|
} )
|
|
220
239
|
} )
|
|
@@ -232,9 +251,9 @@ export default class Controls {
|
|
|
232
251
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
233
252
|
// Get location coordinates from place name
|
|
234
253
|
this.chn.emit('resolve:place', name, ( error: string | boolean, data: any ) => {
|
|
235
|
-
if( error ) return reject( error )
|
|
236
|
-
|
|
237
254
|
clearTimeout( timeout )
|
|
255
|
+
|
|
256
|
+
if( error ) return reject( error )
|
|
238
257
|
resolve( data )
|
|
239
258
|
} )
|
|
240
259
|
} )
|
|
@@ -251,9 +270,9 @@ export default class Controls {
|
|
|
251
270
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
252
271
|
// Get location place from coordinates
|
|
253
272
|
this.chn.emit('resolve:coordinates', coords, ( error: string | boolean, data: any ) => {
|
|
254
|
-
if( error ) return reject( error )
|
|
255
|
-
|
|
256
273
|
clearTimeout( timeout )
|
|
274
|
+
|
|
275
|
+
if( error ) return reject( error )
|
|
257
276
|
resolve( data )
|
|
258
277
|
} )
|
|
259
278
|
} )
|
|
@@ -271,9 +290,9 @@ export default class Controls {
|
|
|
271
290
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
272
291
|
// Launch search query
|
|
273
292
|
this.chn.emit('search:query', input, ( error: string | boolean, data: any ) => {
|
|
274
|
-
if( error ) return reject( error )
|
|
275
|
-
|
|
276
293
|
clearTimeout( timeout )
|
|
294
|
+
|
|
295
|
+
if( error ) return reject( error )
|
|
277
296
|
resolve( data )
|
|
278
297
|
} )
|
|
279
298
|
} )
|
|
@@ -290,9 +309,9 @@ export default class Controls {
|
|
|
290
309
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
291
310
|
// Get place's details
|
|
292
311
|
this.chn.emit('search:select', index, ( error: string | boolean, data: SearchPlace | null ) => {
|
|
293
|
-
if( error ) return reject( error )
|
|
294
|
-
|
|
295
312
|
clearTimeout( timeout )
|
|
313
|
+
|
|
314
|
+
if( error ) return reject( error )
|
|
296
315
|
resolve( data )
|
|
297
316
|
} )
|
|
298
317
|
} )
|
|
@@ -309,9 +328,9 @@ export default class Controls {
|
|
|
309
328
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
310
329
|
// Show nearby entities
|
|
311
330
|
this.chn.emit('show:nearby', list, ( error: string | boolean ) => {
|
|
312
|
-
if( error ) return reject( error )
|
|
313
|
-
|
|
314
331
|
clearTimeout( timeout )
|
|
332
|
+
|
|
333
|
+
if( error ) return reject( error )
|
|
315
334
|
resolve()
|
|
316
335
|
} )
|
|
317
336
|
} )
|
|
@@ -325,9 +344,9 @@ export default class Controls {
|
|
|
325
344
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
326
345
|
// Remove nearby entities
|
|
327
346
|
this.chn.emit('remove:nearby', ( error: string | boolean ) => {
|
|
328
|
-
if( error ) return reject( error )
|
|
329
|
-
|
|
330
347
|
clearTimeout( timeout )
|
|
348
|
+
|
|
349
|
+
if( error ) return reject( error )
|
|
331
350
|
resolve()
|
|
332
351
|
} )
|
|
333
352
|
} )
|
|
@@ -343,9 +362,9 @@ export default class Controls {
|
|
|
343
362
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
344
363
|
// Add nearby entity
|
|
345
364
|
this.chn.emit('add:nearby:entity', entity, ( error: string | boolean ) => {
|
|
346
|
-
if( error ) return reject( error )
|
|
347
|
-
|
|
348
365
|
clearTimeout( timeout )
|
|
366
|
+
|
|
367
|
+
if( error ) return reject( error )
|
|
349
368
|
resolve()
|
|
350
369
|
} )
|
|
351
370
|
} )
|
|
@@ -361,9 +380,9 @@ export default class Controls {
|
|
|
361
380
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
362
381
|
// Move nearby entity
|
|
363
382
|
this.chn.emit('move:nearby:entity', activePosition, ( error: string | boolean ) => {
|
|
364
|
-
if( error ) return reject( error )
|
|
365
|
-
|
|
366
383
|
clearTimeout( timeout )
|
|
384
|
+
|
|
385
|
+
if( error ) return reject( error )
|
|
367
386
|
resolve()
|
|
368
387
|
} )
|
|
369
388
|
} )
|
|
@@ -379,9 +398,9 @@ export default class Controls {
|
|
|
379
398
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
380
399
|
// Remove nearby entity
|
|
381
400
|
this.chn.emit('remove:nearby:entity', id, ( error: string | boolean ) => {
|
|
382
|
-
if( error ) return reject( error )
|
|
383
|
-
|
|
384
401
|
clearTimeout( timeout )
|
|
402
|
+
|
|
403
|
+
if( error ) return reject( error )
|
|
385
404
|
resolve()
|
|
386
405
|
} )
|
|
387
406
|
} )
|
|
@@ -398,9 +417,9 @@ export default class Controls {
|
|
|
398
417
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
399
418
|
// Set route
|
|
400
419
|
this.chn.emit('set:route', journey, ( error: string | boolean ) => {
|
|
401
|
-
if( error ) return reject( error )
|
|
402
|
-
|
|
403
420
|
clearTimeout( timeout )
|
|
421
|
+
|
|
422
|
+
if( error ) return reject( error )
|
|
404
423
|
resolve()
|
|
405
424
|
} )
|
|
406
425
|
} )
|
|
@@ -416,9 +435,9 @@ export default class Controls {
|
|
|
416
435
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
417
436
|
// Draw route
|
|
418
437
|
this.chn.emit('draw:route', { routeId, data, options }, ( error: string | boolean ) => {
|
|
419
|
-
if( error ) return reject( error )
|
|
420
|
-
|
|
421
438
|
clearTimeout( timeout )
|
|
439
|
+
|
|
440
|
+
if( error ) return reject( error )
|
|
422
441
|
resolve()
|
|
423
442
|
} )
|
|
424
443
|
} )
|
|
@@ -434,9 +453,9 @@ export default class Controls {
|
|
|
434
453
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
435
454
|
// Remove route
|
|
436
455
|
this.chn.emit('remove:route', routeId, ( error: string | boolean ) => {
|
|
437
|
-
if( error ) return reject( error )
|
|
438
|
-
|
|
439
456
|
clearTimeout( timeout )
|
|
457
|
+
|
|
458
|
+
if( error ) return reject( error )
|
|
440
459
|
resolve()
|
|
441
460
|
} )
|
|
442
461
|
} )
|
|
@@ -453,9 +472,9 @@ export default class Controls {
|
|
|
453
472
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
454
473
|
// Set route origin
|
|
455
474
|
this.chn.emit('set:route:origin', { routeId, point }, ( error: string | boolean ) => {
|
|
456
|
-
if( error ) return reject( error )
|
|
457
|
-
|
|
458
475
|
clearTimeout( timeout )
|
|
476
|
+
|
|
477
|
+
if( error ) return reject( error )
|
|
459
478
|
resolve()
|
|
460
479
|
} )
|
|
461
480
|
} )
|
|
@@ -471,9 +490,9 @@ export default class Controls {
|
|
|
471
490
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
472
491
|
// Remove route origin
|
|
473
492
|
this.chn.emit('remove:route:origin', { routeId }, ( error: string | boolean ) => {
|
|
474
|
-
if( error ) return reject( error )
|
|
475
|
-
|
|
476
493
|
clearTimeout( timeout )
|
|
494
|
+
|
|
495
|
+
if( error ) return reject( error )
|
|
477
496
|
resolve()
|
|
478
497
|
} )
|
|
479
498
|
} )
|
|
@@ -490,9 +509,9 @@ export default class Controls {
|
|
|
490
509
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
491
510
|
// Set route destination
|
|
492
511
|
this.chn.emit('set:route:destination', { routeId, point }, ( error: string | boolean ) => {
|
|
493
|
-
if( error ) return reject( error )
|
|
494
|
-
|
|
495
512
|
clearTimeout( timeout )
|
|
513
|
+
|
|
514
|
+
if( error ) return reject( error )
|
|
496
515
|
resolve()
|
|
497
516
|
} )
|
|
498
517
|
} )
|
|
@@ -508,9 +527,9 @@ export default class Controls {
|
|
|
508
527
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
509
528
|
// Remove route destination
|
|
510
529
|
this.chn.emit('remove:route:destination', { routeId }, ( error: string | boolean ) => {
|
|
511
|
-
if( error ) return reject( error )
|
|
512
|
-
|
|
513
530
|
clearTimeout( timeout )
|
|
531
|
+
|
|
532
|
+
if( error ) return reject( error )
|
|
514
533
|
resolve()
|
|
515
534
|
} )
|
|
516
535
|
} )
|
|
@@ -527,9 +546,9 @@ export default class Controls {
|
|
|
527
546
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
528
547
|
// Add route waypoint
|
|
529
548
|
this.chn.emit('add:route:waypoint', { routeId, point }, ( error: string | boolean ) => {
|
|
530
|
-
if( error ) return reject( error )
|
|
531
|
-
|
|
532
549
|
clearTimeout( timeout )
|
|
550
|
+
|
|
551
|
+
if( error ) return reject( error )
|
|
533
552
|
resolve()
|
|
534
553
|
} )
|
|
535
554
|
} )
|
|
@@ -546,9 +565,9 @@ export default class Controls {
|
|
|
546
565
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
547
566
|
// Update route waypoint
|
|
548
567
|
this.chn.emit('update:route:waypoint', { routeId, point }, ( error: string | boolean ) => {
|
|
549
|
-
if( error ) return reject( error )
|
|
550
|
-
|
|
551
568
|
clearTimeout( timeout )
|
|
569
|
+
|
|
570
|
+
if( error ) return reject( error )
|
|
552
571
|
resolve()
|
|
553
572
|
} )
|
|
554
573
|
} )
|
|
@@ -565,9 +584,9 @@ export default class Controls {
|
|
|
565
584
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
566
585
|
// Remove route waypoint
|
|
567
586
|
this.chn.emit('remove:route:waypoint', { routeId, index }, ( error: string | boolean ) => {
|
|
568
|
-
if( error ) return reject( error )
|
|
569
|
-
|
|
570
587
|
clearTimeout( timeout )
|
|
588
|
+
|
|
589
|
+
if( error ) return reject( error )
|
|
571
590
|
resolve()
|
|
572
591
|
} )
|
|
573
592
|
} )
|
|
@@ -585,9 +604,9 @@ export default class Controls {
|
|
|
585
604
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
586
605
|
|
|
587
606
|
this.chn.emit('fit:route:bounds', { routeId, margin }, ( error: string | boolean ) => {
|
|
588
|
-
if( error ) return reject( error )
|
|
589
|
-
|
|
590
607
|
clearTimeout( timeout )
|
|
608
|
+
|
|
609
|
+
if( error ) return reject( error )
|
|
591
610
|
resolve()
|
|
592
611
|
} )
|
|
593
612
|
} )
|
|
@@ -603,9 +622,9 @@ export default class Controls {
|
|
|
603
622
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
604
623
|
|
|
605
624
|
this.chn.emit('fit:routes:bounds', options, ( error: string | boolean ) => {
|
|
606
|
-
if( error ) return reject( error )
|
|
607
|
-
|
|
608
625
|
clearTimeout( timeout )
|
|
626
|
+
|
|
627
|
+
if( error ) return reject( error )
|
|
609
628
|
resolve()
|
|
610
629
|
} )
|
|
611
630
|
} )
|
|
@@ -624,9 +643,9 @@ export default class Controls {
|
|
|
624
643
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
625
644
|
// Set waypoint caption
|
|
626
645
|
this.chn.emit('set:waypoint:caption', { routeId, id, caption }, ( error: string | boolean ) => {
|
|
627
|
-
if( error ) return reject( error )
|
|
628
|
-
|
|
629
646
|
clearTimeout( timeout )
|
|
647
|
+
|
|
648
|
+
if( error ) return reject( error )
|
|
630
649
|
resolve()
|
|
631
650
|
} )
|
|
632
651
|
} )
|
|
@@ -644,9 +663,9 @@ export default class Controls {
|
|
|
644
663
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
645
664
|
// Update waypoint caption
|
|
646
665
|
this.chn.emit('update:waypoint:caption', { routeId, id, caption }, ( error: string | boolean ) => {
|
|
647
|
-
if( error ) return reject( error )
|
|
648
|
-
|
|
649
666
|
clearTimeout( timeout )
|
|
667
|
+
|
|
668
|
+
if( error ) return reject( error )
|
|
650
669
|
resolve()
|
|
651
670
|
} )
|
|
652
671
|
} )
|
|
@@ -663,9 +682,9 @@ export default class Controls {
|
|
|
663
682
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
664
683
|
// Remove waypoint caption
|
|
665
684
|
this.chn.emit('remove:waypoint:caption', { routeId, id }, ( error: string | boolean ) => {
|
|
666
|
-
if( error ) return reject( error )
|
|
667
|
-
|
|
668
685
|
clearTimeout( timeout )
|
|
686
|
+
|
|
687
|
+
if( error ) return reject( error )
|
|
669
688
|
resolve()
|
|
670
689
|
} )
|
|
671
690
|
} )
|
|
@@ -682,9 +701,9 @@ export default class Controls {
|
|
|
682
701
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
683
702
|
// Mount navigation
|
|
684
703
|
this.chn.emit('mount:navigation', routeId, ( error: string | boolean ) => {
|
|
685
|
-
if( error ) return reject( error )
|
|
686
|
-
|
|
687
704
|
clearTimeout( timeout )
|
|
705
|
+
|
|
706
|
+
if( error ) return reject( error )
|
|
688
707
|
resolve()
|
|
689
708
|
} )
|
|
690
709
|
} )
|
|
@@ -698,9 +717,9 @@ export default class Controls {
|
|
|
698
717
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
699
718
|
// Unmount navigation
|
|
700
719
|
this.chn.emit('unmount:navigation', ( error: string | boolean ) => {
|
|
701
|
-
if( error ) return reject( error )
|
|
702
|
-
|
|
703
720
|
clearTimeout( timeout )
|
|
721
|
+
|
|
722
|
+
if( error ) return reject( error )
|
|
704
723
|
resolve()
|
|
705
724
|
} )
|
|
706
725
|
} )
|
|
@@ -714,9 +733,9 @@ export default class Controls {
|
|
|
714
733
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
715
734
|
// Load navigation
|
|
716
735
|
this.chn.emit('load:navigation', ( error: string | boolean ) => {
|
|
717
|
-
if( error ) return reject( error )
|
|
718
|
-
|
|
719
736
|
clearTimeout( timeout )
|
|
737
|
+
|
|
738
|
+
if( error ) return reject( error )
|
|
720
739
|
resolve()
|
|
721
740
|
} )
|
|
722
741
|
} )
|
|
@@ -732,9 +751,9 @@ export default class Controls {
|
|
|
732
751
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
733
752
|
// Set initial navigation position
|
|
734
753
|
this.chn.emit('initial:navigation:position', position, ( error: string | boolean ) => {
|
|
735
|
-
if( error ) return reject( error )
|
|
736
|
-
|
|
737
754
|
clearTimeout( timeout )
|
|
755
|
+
|
|
756
|
+
if( error ) return reject( error )
|
|
738
757
|
resolve()
|
|
739
758
|
} )
|
|
740
759
|
} )
|
|
@@ -750,9 +769,9 @@ export default class Controls {
|
|
|
750
769
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
751
770
|
// Navigate
|
|
752
771
|
this.chn.emit('navigate:navigation:direction', position, ( error: string | boolean ) => {
|
|
753
|
-
if( error ) return reject( error )
|
|
754
|
-
|
|
755
772
|
clearTimeout( timeout )
|
|
773
|
+
|
|
774
|
+
if( error ) return reject( error )
|
|
756
775
|
resolve()
|
|
757
776
|
} )
|
|
758
777
|
} )
|
|
@@ -772,9 +791,9 @@ export default class Controls {
|
|
|
772
791
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
773
792
|
// Casting navigation direction
|
|
774
793
|
this.chn.emit('casting:navigation:direction', { routeId, direction, position, options }, ( error: string | boolean ) => {
|
|
775
|
-
if( error ) return reject( error )
|
|
776
|
-
|
|
777
794
|
clearTimeout( timeout )
|
|
795
|
+
|
|
796
|
+
if( error ) return reject( error )
|
|
778
797
|
resolve()
|
|
779
798
|
} )
|
|
780
799
|
} )
|
|
@@ -788,9 +807,9 @@ export default class Controls {
|
|
|
788
807
|
const timeout = setTimeout( () => reject( FUNCTION_EVENT_TIMEOUT_MESSAGE ), FUNCTION_EVENT_TIMEOUT )
|
|
789
808
|
// Dismiss navigation
|
|
790
809
|
this.chn.emit('dismiss:navigation', ( error: string | boolean ) => {
|
|
791
|
-
if( error ) return reject( error )
|
|
792
|
-
|
|
793
810
|
clearTimeout( timeout )
|
|
811
|
+
|
|
812
|
+
if( error ) return reject( error )
|
|
794
813
|
resolve()
|
|
795
814
|
} )
|
|
796
815
|
} )
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
Coordinates,
|
|
3
3
|
RTLocation,
|
|
4
|
-
Entity,
|
|
4
|
+
MSIEntity as Entity,
|
|
5
|
+
MSIEntityType,
|
|
5
6
|
MapOptions,
|
|
6
7
|
Caption,
|
|
7
8
|
Journey,
|
|
@@ -13,17 +14,17 @@ import type {
|
|
|
13
14
|
LRStreamer
|
|
14
15
|
} from '../../types'
|
|
15
16
|
|
|
16
|
-
import
|
|
17
|
+
import type { Channel } from '../../types/channel'
|
|
17
18
|
import { EventEmitter } from 'events'
|
|
18
19
|
import Controls from './Controls'
|
|
19
20
|
import Stream from '../../utils/stream'
|
|
20
21
|
|
|
21
22
|
export default class Handles extends EventEmitter {
|
|
22
|
-
private chn:
|
|
23
|
+
private chn: Channel
|
|
23
24
|
private controls: Controls
|
|
24
25
|
private options: MapOptions
|
|
25
26
|
|
|
26
|
-
constructor( chn:
|
|
27
|
+
constructor( chn: Channel, controls: Controls, options: MapOptions ){
|
|
27
28
|
super()
|
|
28
29
|
|
|
29
30
|
this.chn = chn
|
|
@@ -70,7 +71,9 @@ export default class Handles extends EventEmitter {
|
|
|
70
71
|
|
|
71
72
|
this.chn
|
|
72
73
|
.off('current:location')
|
|
73
|
-
.off('
|
|
74
|
+
.off('live:location:start')
|
|
75
|
+
.off('live:location:update')
|
|
76
|
+
.off('live:location:end')
|
|
74
77
|
.off('current:location:error')
|
|
75
78
|
} )
|
|
76
79
|
|
|
@@ -83,21 +86,27 @@ export default class Handles extends EventEmitter {
|
|
|
83
86
|
*
|
|
84
87
|
* @param position - Peer's current GPS location
|
|
85
88
|
* @param caption - (Optional) Caption information of the peer
|
|
89
|
+
* @param type - (Default: `car`) Marker representing the peer on the map
|
|
86
90
|
* @return - Readable stream
|
|
87
91
|
*/
|
|
88
|
-
peerLocation( position: RTLocation
|
|
92
|
+
peerLocation( position: RTLocation, caption?: Caption, type?: MSIEntityType ){
|
|
89
93
|
if( !this.chn ) return
|
|
90
|
-
this.chn?.emit('pin:peer:location', { id: 'peer', position, caption } )
|
|
91
|
-
|
|
94
|
+
this.chn?.emit('pin:peer:location', { id: 'peer', position, caption, type } )
|
|
95
|
+
|
|
92
96
|
const stream = new Stream
|
|
93
|
-
|
|
94
|
-
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Listen to incoming new position data.
|
|
100
|
+
*
|
|
101
|
+
* Caption is re-sent on every update so a peer can stream a changing
|
|
102
|
+
* label (Eg. a live ETA) alongside its position.
|
|
103
|
+
*/
|
|
95
104
|
stream
|
|
96
105
|
.on('data', ({ position, caption }: any ) => {
|
|
97
106
|
if( !position )
|
|
98
107
|
return stream.error( new Error('Invalid Data') )
|
|
99
108
|
|
|
100
|
-
this.chn?.emit('pin:peer:location', { id: 'peer', position, caption } )
|
|
109
|
+
this.chn?.emit('pin:peer:location', { id: 'peer', position, caption, type } )
|
|
101
110
|
})
|
|
102
111
|
.onerror( error => console.error('[Stream Error] ', error ) )
|
|
103
112
|
.onclose( () => this.chn?.emit('unpin:peer:location', 'peer') )
|
|
@@ -154,7 +163,7 @@ export default class Handles extends EventEmitter {
|
|
|
154
163
|
self.emit('nearby--stream', 'add', entity )
|
|
155
164
|
} )
|
|
156
165
|
|
|
157
|
-
setTimeout( () => reject('Add entity timeout'), 8000 )
|
|
166
|
+
TIMEOUT = setTimeout( () => reject('Add entity timeout'), 8000 )
|
|
158
167
|
})
|
|
159
168
|
},
|
|
160
169
|
|
|
@@ -178,7 +187,7 @@ export default class Handles extends EventEmitter {
|
|
|
178
187
|
self.emit('nearby--stream', 'remove', id )
|
|
179
188
|
} )
|
|
180
189
|
|
|
181
|
-
setTimeout( () => reject('Remove entity timeout'), 8000 )
|
|
190
|
+
TIMEOUT = setTimeout( () => reject('Remove entity timeout'), 8000 )
|
|
182
191
|
} )
|
|
183
192
|
},
|
|
184
193
|
|
|
@@ -205,7 +214,7 @@ export default class Handles extends EventEmitter {
|
|
|
205
214
|
self.emit('nearby--stream', 'panto', id )
|
|
206
215
|
} )
|
|
207
216
|
|
|
208
|
-
setTimeout( () => reject('PanTo entity timeout'), 8000 )
|
|
217
|
+
TIMEOUT = setTimeout( () => reject('PanTo entity timeout'), 8000 )
|
|
209
218
|
} )
|
|
210
219
|
},
|
|
211
220
|
|
|
@@ -237,7 +246,7 @@ export default class Handles extends EventEmitter {
|
|
|
237
246
|
self.emit('nearby--stream', 'move', active )
|
|
238
247
|
} )
|
|
239
248
|
|
|
240
|
-
setTimeout( () => reject('Move entity timeout'), 8000 )
|
|
249
|
+
TIMEOUT = setTimeout( () => reject('Move entity timeout'), 8000 )
|
|
241
250
|
} )
|
|
242
251
|
}
|
|
243
252
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MapOptions } from '../../types'
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import type { Channel } from '../../types/channel'
|
|
4
4
|
import Handles from './Handles'
|
|
5
5
|
import Controls from './Controls'
|
|
6
6
|
import Utils from '../../utils'
|
|
@@ -14,13 +14,13 @@ export type PluginHook = {
|
|
|
14
14
|
export type Plugin<PluginAPI, PluginOptions = {}> = ( hooks: PluginHook, options?: PluginOptions ) => PluginAPI
|
|
15
15
|
|
|
16
16
|
export default class Plugins {
|
|
17
|
-
private chn:
|
|
17
|
+
private chn: Channel
|
|
18
18
|
private handles: Handles
|
|
19
19
|
private controls: Controls
|
|
20
20
|
private options: MapOptions
|
|
21
21
|
private ACTIVE_PLUGINS: Record<string, Plugin<any>> = {}
|
|
22
22
|
|
|
23
|
-
constructor( chn:
|
|
23
|
+
constructor( chn: Channel, handles: Handles, controls: Controls, options: MapOptions ){
|
|
24
24
|
this.chn = chn
|
|
25
25
|
this.options = options
|
|
26
26
|
this.handles = handles
|