@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.
Files changed (383) hide show
  1. package/dist/allend/Access.d.ts +39 -3
  2. package/dist/allend/Access.js +147 -114
  3. package/dist/allend/Access.js.map +1 -1
  4. package/dist/allend/Agent/consolidation.d.ts +16 -0
  5. package/dist/allend/Agent/consolidation.js +38 -0
  6. package/dist/allend/Agent/consolidation.js.map +1 -0
  7. package/dist/allend/Agent/delivery.d.ts +11 -0
  8. package/dist/allend/Agent/delivery.js +43 -0
  9. package/dist/allend/Agent/delivery.js.map +1 -0
  10. package/dist/allend/Agent/dispatch.d.ts +8 -0
  11. package/dist/allend/Agent/dispatch.js +24 -0
  12. package/dist/allend/Agent/dispatch.js.map +1 -0
  13. package/dist/allend/Agent/index.d.ts +49 -0
  14. package/dist/allend/Agent/index.js +74 -0
  15. package/dist/allend/Agent/index.js.map +1 -0
  16. package/dist/allend/Agent/navigation.d.ts +8 -0
  17. package/dist/allend/Agent/navigation.js +25 -0
  18. package/dist/allend/Agent/navigation.js.map +1 -0
  19. package/dist/allend/Agent/origin.d.ts +9 -0
  20. package/dist/allend/Agent/origin.js +31 -0
  21. package/dist/allend/Agent/origin.js.map +1 -0
  22. package/dist/allend/Agent/reallocation.d.ts +7 -0
  23. package/dist/allend/Agent/reallocation.js +17 -0
  24. package/dist/allend/Agent/reallocation.js.map +1 -0
  25. package/dist/allend/Agent/realtime.d.ts +36 -0
  26. package/dist/allend/Agent/realtime.js +111 -0
  27. package/dist/allend/Agent/realtime.js.map +1 -0
  28. package/dist/allend/Agent/rides.d.ts +12 -0
  29. package/dist/allend/Agent/rides.js +51 -0
  30. package/dist/allend/Agent/rides.js.map +1 -0
  31. package/dist/allend/Agent/shipping.d.ts +11 -0
  32. package/dist/allend/Agent/shipping.js +43 -0
  33. package/dist/allend/Agent/shipping.js.map +1 -0
  34. package/dist/allend/CSP/analytics.d.ts +12 -0
  35. package/dist/allend/CSP/analytics.js +51 -0
  36. package/dist/allend/CSP/analytics.js.map +1 -0
  37. package/dist/allend/CSP/index.d.ts +25 -0
  38. package/dist/allend/CSP/index.js +43 -0
  39. package/dist/allend/CSP/index.js.map +1 -0
  40. package/dist/allend/CSP/inventory.d.ts +16 -0
  41. package/dist/allend/CSP/inventory.js +78 -0
  42. package/dist/allend/CSP/inventory.js.map +1 -0
  43. package/dist/allend/CSP/orders.d.ts +19 -0
  44. package/dist/allend/CSP/orders.js +97 -0
  45. package/dist/allend/CSP/orders.js.map +1 -0
  46. package/dist/allend/CSP/webhooks.d.ts +13 -0
  47. package/dist/allend/CSP/webhooks.js +56 -0
  48. package/dist/allend/CSP/webhooks.js.map +1 -0
  49. package/dist/allend/Customer/index.d.ts +27 -0
  50. package/dist/allend/Customer/index.js +39 -0
  51. package/dist/allend/Customer/index.js.map +1 -0
  52. package/dist/allend/Customer/intents.d.ts +12 -0
  53. package/dist/allend/Customer/intents.js +55 -0
  54. package/dist/allend/Customer/intents.js.map +1 -0
  55. package/dist/allend/Customer/orders.d.ts +11 -0
  56. package/dist/allend/Customer/orders.js +43 -0
  57. package/dist/allend/Customer/orders.js.map +1 -0
  58. package/dist/allend/Customer/rides.d.ts +12 -0
  59. package/dist/allend/Customer/rides.js +50 -0
  60. package/dist/allend/Customer/rides.js.map +1 -0
  61. package/dist/allend/DEV/developers.d.ts +11 -0
  62. package/dist/allend/DEV/developers.js +35 -0
  63. package/dist/allend/DEV/developers.js.map +1 -0
  64. package/dist/allend/DEV/index.d.ts +19 -0
  65. package/dist/allend/DEV/index.js +37 -0
  66. package/dist/allend/DEV/index.js.map +1 -0
  67. package/dist/allend/IoTClient.js +29 -35
  68. package/dist/allend/IoTClient.js.map +1 -1
  69. package/dist/allend/IoTSP/backend.d.ts +29 -0
  70. package/dist/allend/IoTSP/backend.js +75 -0
  71. package/dist/allend/IoTSP/backend.js.map +1 -0
  72. package/dist/allend/IoTSP/devices.d.ts +14 -0
  73. package/dist/allend/IoTSP/devices.js +61 -0
  74. package/dist/allend/IoTSP/devices.js.map +1 -0
  75. package/dist/allend/IoTSP/index.d.ts +28 -0
  76. package/dist/allend/IoTSP/index.js +84 -0
  77. package/dist/allend/IoTSP/index.js.map +1 -0
  78. package/dist/allend/IoTSP/rules.d.ts +17 -0
  79. package/dist/allend/IoTSP/rules.js +81 -0
  80. package/dist/allend/IoTSP/rules.js.map +1 -0
  81. package/dist/allend/IoTSP/topics.d.ts +17 -0
  82. package/dist/allend/IoTSP/topics.js +81 -0
  83. package/dist/allend/IoTSP/topics.js.map +1 -0
  84. package/dist/allend/LSP/agents.d.ts +20 -0
  85. package/dist/allend/LSP/agents.js +89 -0
  86. package/dist/allend/LSP/agents.js.map +1 -0
  87. package/dist/allend/LSP/carriers.d.ts +54 -0
  88. package/dist/allend/LSP/carriers.js +315 -0
  89. package/dist/allend/LSP/carriers.js.map +1 -0
  90. package/dist/allend/LSP/coverage.d.ts +44 -0
  91. package/dist/allend/LSP/coverage.js +135 -0
  92. package/dist/allend/LSP/coverage.js.map +1 -0
  93. package/dist/allend/LSP/fleets.d.ts +66 -0
  94. package/dist/allend/LSP/fleets.js +381 -0
  95. package/dist/allend/LSP/fleets.js.map +1 -0
  96. package/dist/allend/LSP/hubs.d.ts +39 -0
  97. package/dist/allend/LSP/hubs.js +186 -0
  98. package/dist/allend/LSP/hubs.js.map +1 -0
  99. package/dist/allend/LSP/index.d.ts +37 -0
  100. package/dist/allend/LSP/index.js +55 -0
  101. package/dist/allend/LSP/index.js.map +1 -0
  102. package/dist/allend/LSP/inventory.d.ts +13 -0
  103. package/dist/allend/LSP/inventory.js +56 -0
  104. package/dist/allend/LSP/inventory.js.map +1 -0
  105. package/dist/allend/LSP/operations.d.ts +47 -0
  106. package/dist/allend/LSP/operations.js +156 -0
  107. package/dist/allend/LSP/operations.js.map +1 -0
  108. package/dist/allend/LSP/orders.d.ts +69 -0
  109. package/dist/allend/LSP/orders.js +303 -0
  110. package/dist/allend/LSP/orders.js.map +1 -0
  111. package/dist/allend/LSP/pods.d.ts +26 -0
  112. package/dist/allend/LSP/pods.js +137 -0
  113. package/dist/allend/LSP/pods.js.map +1 -0
  114. package/dist/allend/LSP/pricing.d.ts +35 -0
  115. package/dist/allend/LSP/pricing.js +151 -0
  116. package/dist/allend/LSP/pricing.js.map +1 -0
  117. package/dist/allend/LSP/psl.d.ts +15 -0
  118. package/dist/allend/LSP/psl.js +68 -0
  119. package/dist/allend/LSP/psl.js.map +1 -0
  120. package/dist/allend/LSP/warehouses.d.ts +23 -0
  121. package/dist/allend/LSP/warehouses.js +94 -0
  122. package/dist/allend/LSP/warehouses.js.map +1 -0
  123. package/dist/allend/MSI/Controls.d.ts +9 -5
  124. package/dist/allend/MSI/Controls.js +269 -297
  125. package/dist/allend/MSI/Controls.js.map +1 -1
  126. package/dist/allend/MSI/Handles.d.ts +5 -4
  127. package/dist/allend/MSI/Handles.js +136 -233
  128. package/dist/allend/MSI/Handles.js.map +1 -1
  129. package/dist/allend/MSI/Plugins.d.ts +2 -2
  130. package/dist/allend/MSI/Plugins.js +12 -15
  131. package/dist/allend/MSI/Plugins.js.map +1 -1
  132. package/dist/allend/MSI/index.d.ts +4 -3
  133. package/dist/allend/MSI/index.js +123 -87
  134. package/dist/allend/MSI/index.js.map +1 -1
  135. package/dist/allend/MSI/native.d.ts +32 -0
  136. package/dist/allend/MSI/native.js +246 -0
  137. package/dist/allend/MSI/native.js.map +1 -0
  138. package/dist/allend/MSI/token.d.ts +12 -0
  139. package/dist/allend/MSI/token.js +21 -0
  140. package/dist/allend/MSI/token.js.map +1 -0
  141. package/dist/allend/OTPAuth/index.d.ts +77 -0
  142. package/dist/allend/OTPAuth/index.js +69 -0
  143. package/dist/allend/OTPAuth/index.js.map +1 -0
  144. package/dist/allend/Pipelines/analytics.d.ts +8 -0
  145. package/dist/allend/Pipelines/analytics.js +24 -0
  146. package/dist/allend/Pipelines/analytics.js.map +1 -0
  147. package/dist/allend/Pipelines/escalations.d.ts +8 -0
  148. package/dist/allend/Pipelines/escalations.js +25 -0
  149. package/dist/allend/Pipelines/escalations.js.map +1 -0
  150. package/dist/allend/Pipelines/executions.d.ts +11 -0
  151. package/dist/allend/Pipelines/executions.js +44 -0
  152. package/dist/allend/Pipelines/executions.js.map +1 -0
  153. package/dist/allend/Pipelines/index.d.ts +42 -0
  154. package/dist/allend/Pipelines/index.js +88 -0
  155. package/dist/allend/Pipelines/index.js.map +1 -0
  156. package/dist/allend/Pipelines/interventions.d.ts +8 -0
  157. package/dist/allend/Pipelines/interventions.js +25 -0
  158. package/dist/allend/Pipelines/interventions.js.map +1 -0
  159. package/dist/allend/Pipelines/monitor.d.ts +9 -0
  160. package/dist/allend/Pipelines/monitor.js +30 -0
  161. package/dist/allend/Pipelines/monitor.js.map +1 -0
  162. package/dist/allend/Pipelines/queries.d.ts +8 -0
  163. package/dist/allend/Pipelines/queries.js +25 -0
  164. package/dist/allend/Pipelines/queries.js.map +1 -0
  165. package/dist/allend/Pipelines/templates.d.ts +11 -0
  166. package/dist/allend/Pipelines/templates.js +46 -0
  167. package/dist/allend/Pipelines/templates.js.map +1 -0
  168. package/dist/allend/Pipelines/utils.d.ts +0 -0
  169. package/dist/allend/Pipelines/utils.js +2 -0
  170. package/dist/allend/Pipelines/utils.js.map +1 -0
  171. package/dist/allend/Pipelines/webhooks.d.ts +9 -0
  172. package/dist/allend/Pipelines/webhooks.js +35 -0
  173. package/dist/allend/Pipelines/webhooks.js.map +1 -0
  174. package/dist/allend/Pipelines/workers.d.ts +11 -0
  175. package/dist/allend/Pipelines/workers.js +45 -0
  176. package/dist/allend/Pipelines/workers.js.map +1 -0
  177. package/dist/allend/Queries/capacity.d.ts +11 -0
  178. package/dist/allend/Queries/capacity.js +44 -0
  179. package/dist/allend/Queries/capacity.js.map +1 -0
  180. package/dist/allend/Queries/discovery.d.ts +11 -0
  181. package/dist/allend/Queries/discovery.js +45 -0
  182. package/dist/allend/Queries/discovery.js.map +1 -0
  183. package/dist/allend/Queries/index.d.ts +27 -0
  184. package/dist/allend/Queries/index.js +40 -0
  185. package/dist/allend/Queries/index.js.map +1 -0
  186. package/dist/allend/Queries/matching.d.ts +7 -0
  187. package/dist/allend/Queries/matching.js +18 -0
  188. package/dist/allend/Queries/matching.js.map +1 -0
  189. package/dist/allend/Queries/performance.d.ts +9 -0
  190. package/dist/allend/Queries/performance.js +31 -0
  191. package/dist/allend/Queries/performance.js.map +1 -0
  192. package/dist/allend/Queries/pricing.d.ts +11 -0
  193. package/dist/allend/Queries/pricing.js +43 -0
  194. package/dist/allend/Queries/pricing.js.map +1 -0
  195. package/dist/allend/{DClient/Event.d.ts → Realtime/index.d.ts} +2 -6
  196. package/dist/allend/Realtime/index.js +62 -0
  197. package/dist/allend/Realtime/index.js.map +1 -0
  198. package/dist/allend/Shared/account.d.ts +10 -0
  199. package/dist/allend/Shared/account.js +22 -0
  200. package/dist/allend/Shared/account.js.map +1 -0
  201. package/dist/allend/Shared/buckets.d.ts +21 -0
  202. package/dist/allend/Shared/buckets.js +95 -0
  203. package/dist/allend/Shared/buckets.js.map +1 -0
  204. package/dist/allend/Shared/context.d.ts +14 -0
  205. package/dist/allend/Shared/context.js +33 -0
  206. package/dist/allend/Shared/context.js.map +1 -0
  207. package/dist/allend/Shared/faqs.d.ts +20 -0
  208. package/dist/allend/Shared/faqs.js +87 -0
  209. package/dist/allend/Shared/faqs.js.map +1 -0
  210. package/dist/allend/Shared/invitation.d.ts +42 -0
  211. package/dist/allend/Shared/invitation.js +40 -0
  212. package/dist/allend/Shared/invitation.js.map +1 -0
  213. package/dist/allend/Shared/operators.d.ts +39 -0
  214. package/dist/allend/Shared/operators.js +37 -0
  215. package/dist/allend/Shared/operators.js.map +1 -0
  216. package/dist/allend/Shared/users.d.ts +11 -0
  217. package/dist/allend/Shared/users.js +29 -0
  218. package/dist/allend/Shared/users.js.map +1 -0
  219. package/dist/allend/Tracking/index.d.ts +17 -0
  220. package/dist/allend/Tracking/index.js +39 -0
  221. package/dist/allend/Tracking/index.js.map +1 -0
  222. package/dist/allend/Utilities/common.d.ts +12 -0
  223. package/dist/allend/Utilities/common.js +53 -0
  224. package/dist/allend/Utilities/common.js.map +1 -0
  225. package/dist/allend/Utilities/fares.d.ts +10 -0
  226. package/dist/allend/Utilities/fares.js +39 -0
  227. package/dist/allend/Utilities/fares.js.map +1 -0
  228. package/dist/allend/Utilities/index.d.ts +23 -0
  229. package/dist/allend/Utilities/index.js +36 -0
  230. package/dist/allend/Utilities/index.js.map +1 -0
  231. package/dist/allend/Utilities/nearby.d.ts +9 -0
  232. package/dist/allend/Utilities/nearby.js +32 -0
  233. package/dist/allend/Utilities/nearby.js.map +1 -0
  234. package/dist/allend/Workflows/Client.d.ts +17 -0
  235. package/dist/allend/Workflows/Client.js +50 -0
  236. package/dist/allend/Workflows/Client.js.map +1 -0
  237. package/dist/allend/Workflows/Delivery.d.ts +36 -0
  238. package/dist/allend/Workflows/Delivery.js +16 -0
  239. package/dist/allend/Workflows/Delivery.js.map +1 -0
  240. package/dist/allend/Workflows/index.d.ts +11 -0
  241. package/dist/allend/Workflows/index.js +25 -0
  242. package/dist/allend/Workflows/index.js.map +1 -0
  243. package/dist/allend/Workspace/index.d.ts +162 -0
  244. package/dist/allend/Workspace/index.js +220 -0
  245. package/dist/allend/Workspace/index.js.map +1 -0
  246. package/dist/allend/index.d.ts +8 -5
  247. package/dist/allend/index.js +15 -8
  248. package/dist/allend/index.js.map +1 -1
  249. package/dist/backend/Auth.d.ts +28 -4
  250. package/dist/backend/Auth.js +125 -245
  251. package/dist/backend/Auth.js.map +1 -1
  252. package/dist/baseUrl.d.ts +56 -0
  253. package/dist/baseUrl.js +72 -4
  254. package/dist/baseUrl.js.map +1 -1
  255. package/dist/core.d.ts +88 -0
  256. package/dist/core.js +121 -0
  257. package/dist/core.js.map +1 -0
  258. package/dist/error.d.ts +17 -0
  259. package/dist/error.js +26 -0
  260. package/dist/error.js.map +1 -0
  261. package/dist/index.d.ts +30 -12
  262. package/dist/index.js +38 -14
  263. package/dist/index.js.map +1 -1
  264. package/dist/react-native.d.ts +30 -0
  265. package/dist/react-native.js +55 -0
  266. package/dist/react-native.js.map +1 -0
  267. package/dist/types/access.d.ts +64 -7
  268. package/dist/types/auth.d.ts +17 -17
  269. package/dist/types/channel.d.ts +45 -0
  270. package/dist/types/index.d.ts +379 -237
  271. package/dist/utils/index.d.ts +25 -0
  272. package/dist/utils/index.js +11 -1
  273. package/dist/utils/index.js.map +1 -1
  274. package/dist/utils/stream.js +25 -26
  275. package/dist/utils/stream.js.map +1 -1
  276. package/package.json +38 -18
  277. package/src/allend/Access.ts +143 -13
  278. package/src/allend/Agent/consolidation.ts +43 -0
  279. package/src/allend/Agent/delivery.ts +51 -0
  280. package/src/allend/Agent/dispatch.ts +27 -0
  281. package/src/allend/Agent/index.ts +113 -0
  282. package/src/allend/Agent/navigation.ts +27 -0
  283. package/src/allend/Agent/origin.ts +36 -0
  284. package/src/allend/Agent/reallocation.ts +16 -0
  285. package/src/allend/Agent/realtime.ts +140 -0
  286. package/src/allend/Agent/rides.ts +61 -0
  287. package/src/allend/Agent/shipping.ts +51 -0
  288. package/src/allend/CSP/analytics.ts +61 -0
  289. package/src/allend/CSP/index.ts +57 -0
  290. package/src/allend/CSP/inventory.ts +96 -0
  291. package/src/allend/CSP/orders.ts +121 -0
  292. package/src/allend/CSP/webhooks.ts +68 -0
  293. package/src/allend/Customer/index.ts +56 -0
  294. package/src/allend/Customer/intents.ts +66 -0
  295. package/src/allend/Customer/orders.ts +51 -0
  296. package/src/allend/Customer/rides.ts +60 -0
  297. package/src/allend/DEV/developers.ts +42 -0
  298. package/src/allend/DEV/index.ts +48 -0
  299. package/src/allend/IoTSP/backend.ts +103 -0
  300. package/src/allend/IoTSP/devices.ts +74 -0
  301. package/src/allend/IoTSP/index.ts +69 -0
  302. package/src/allend/IoTSP/rules.ts +99 -0
  303. package/src/allend/IoTSP/topics.ts +99 -0
  304. package/src/allend/LSP/agents.ts +115 -0
  305. package/src/allend/LSP/carriers.ts +408 -0
  306. package/src/allend/LSP/coverage.ts +212 -0
  307. package/src/allend/LSP/fleets.ts +505 -0
  308. package/src/allend/LSP/hubs.ts +245 -0
  309. package/src/allend/LSP/index.ts +75 -0
  310. package/src/allend/LSP/inventory.ts +65 -0
  311. package/src/allend/LSP/operations.ts +202 -0
  312. package/src/allend/LSP/orders.ts +397 -0
  313. package/src/allend/LSP/pods.ts +176 -0
  314. package/src/allend/LSP/pricing.ts +192 -0
  315. package/src/allend/LSP/psl.ts +81 -0
  316. package/src/allend/LSP/warehouses.ts +118 -0
  317. package/src/allend/MSI/Controls.ts +109 -90
  318. package/src/allend/MSI/Handles.ts +24 -15
  319. package/src/allend/MSI/Plugins.ts +3 -3
  320. package/src/allend/MSI/index.ts +85 -16
  321. package/src/allend/MSI/native.tsx +314 -0
  322. package/src/allend/MSI/token.ts +20 -0
  323. package/src/allend/OTPAuth/index.ts +130 -0
  324. package/src/allend/Pipelines/analytics.ts +25 -0
  325. package/src/allend/Pipelines/escalations.ts +26 -0
  326. package/src/allend/Pipelines/executions.ts +51 -0
  327. package/src/allend/Pipelines/index.ts +125 -0
  328. package/src/allend/Pipelines/interventions.ts +27 -0
  329. package/src/allend/Pipelines/monitor.ts +33 -0
  330. package/src/allend/Pipelines/queries.ts +27 -0
  331. package/src/allend/Pipelines/templates.ts +51 -0
  332. package/src/allend/Pipelines/utils.ts +0 -0
  333. package/src/allend/Pipelines/webhooks.ts +36 -0
  334. package/src/allend/Pipelines/workers.ts +49 -0
  335. package/src/allend/Queries/capacity.ts +51 -0
  336. package/src/allend/Queries/discovery.ts +53 -0
  337. package/src/allend/Queries/index.ts +58 -0
  338. package/src/allend/Queries/matching.ts +16 -0
  339. package/src/allend/Queries/performance.ts +35 -0
  340. package/src/allend/Queries/pricing.ts +51 -0
  341. package/src/allend/{DClient/Event.ts → Realtime/index.ts} +23 -22
  342. package/src/allend/Shared/account.ts +24 -0
  343. package/src/allend/Shared/buckets.ts +117 -0
  344. package/src/allend/Shared/context.ts +36 -0
  345. package/src/allend/Shared/faqs.ts +106 -0
  346. package/src/allend/Shared/invitation.ts +77 -0
  347. package/src/allend/Shared/operators.ts +84 -0
  348. package/src/allend/Shared/users.ts +32 -0
  349. package/src/allend/Tracking/index.ts +48 -0
  350. package/src/allend/Utilities/common.ts +63 -0
  351. package/src/allend/Utilities/fares.ts +45 -0
  352. package/src/allend/Utilities/index.ts +52 -0
  353. package/src/allend/Utilities/nearby.ts +36 -0
  354. package/src/allend/{DClient → Workflows}/Client.ts +12 -22
  355. package/src/allend/Workflows/Delivery.ts +94 -0
  356. package/src/allend/Workflows/index.ts +31 -0
  357. package/src/allend/Workspace/index.ts +302 -0
  358. package/src/allend/index.ts +23 -10
  359. package/src/backend/Auth.ts +68 -35
  360. package/src/baseUrl.ts +81 -7
  361. package/src/core.ts +145 -0
  362. package/src/error.ts +27 -0
  363. package/src/index.ts +25 -17
  364. package/src/react-native.ts +43 -0
  365. package/src/types/access.d.ts +64 -7
  366. package/src/types/auth.d.ts +17 -17
  367. package/src/types/channel.d.ts +45 -0
  368. package/src/types/index.d.ts +379 -237
  369. package/src/utils/index.ts +33 -1
  370. package/dist/allend/DAuth/index.d.ts +0 -20
  371. package/dist/allend/DAuth/index.js +0 -92
  372. package/dist/allend/DAuth/index.js.map +0 -1
  373. package/dist/allend/DClient/Client.d.ts +0 -10
  374. package/dist/allend/DClient/Client.js +0 -144
  375. package/dist/allend/DClient/Client.js.map +0 -1
  376. package/dist/allend/DClient/Event.js +0 -100
  377. package/dist/allend/DClient/Event.js.map +0 -1
  378. package/dist/allend/DClient/Order.d.ts +0 -49
  379. package/dist/allend/DClient/Order.js +0 -601
  380. package/dist/allend/DClient/Order.js.map +0 -1
  381. package/dist/bundle.js +0 -1
  382. package/src/allend/DAuth/index.ts +0 -39
  383. 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
- var FUNCTION_EVENT_TIMEOUT = 12000, FUNCTION_EVENT_TIMEOUT_MESSAGE = 'Event timeout';
4
- var Controls = /** @class */ (function () {
5
- function Controls(chn, options) {
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
- Controls.prototype.on = function (event, listener) {
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
- Controls.prototype.off = function (event, listener) {
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
- Controls.prototype.removeListeners = function (listener) {
24
+ removeListeners(listener) {
25
25
  this.chn.removeListeners(listener);
26
- };
26
+ }
27
27
  /**
28
- * Refresh access token to remove server
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
- Controls.prototype.refreshToken = function (token) {
33
- if (!token)
34
- return;
35
- this.options.accessToken = token;
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
- Controls.prototype.setMapStyle = function (style) {
43
- var _this = this;
44
- return new Promise(function (resolve, reject) {
55
+ setMapStyle(style) {
56
+ return new Promise((resolve, reject) => {
45
57
  // Set timeout
46
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
58
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
47
59
  // Set style
48
- _this.chn.emit('set:map:style', style, function (error) {
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
- Controls.prototype.getCurrentLocation = function () {
60
- var _this = this;
61
- return new Promise(function (resolve, reject) {
71
+ getCurrentLocation() {
72
+ return new Promise((resolve, reject) => {
62
73
  // Set timeout
63
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
74
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
64
75
  // Get current location
65
- _this.chn.emit('get:current:location', function (error, location) {
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
- Controls.prototype.pinCurrentLocation = function () {
79
- var _this = this;
80
- return new Promise(function (resolve, reject) {
89
+ pinCurrentLocation() {
90
+ return new Promise((resolve, reject) => {
81
91
  // Set timeout
82
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
92
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
83
93
  // Pin user's current location on the map
84
- _this.chn.emit('pin:current:location', function (error, location) {
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
- Controls.prototype.setLiveLocationOptions = function (options) {
98
- var _this = this;
99
- return new Promise(function (resolve, reject) {
107
+ setLiveLocationOptions(options) {
108
+ return new Promise((resolve, reject) => {
100
109
  // Set timeout
101
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
110
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
102
111
  // Set live location options
103
- _this.chn.emit('set:live:options', options, function (error) {
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
- Controls.prototype.trackLiveLocation = function () {
115
- var _this = this;
116
- return new Promise(function (resolve, reject) {
123
+ trackLiveLocation() {
124
+ return new Promise((resolve, reject) => {
117
125
  // Set timeout
118
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
126
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
119
127
  // Start live location tracking
120
- _this.chn.emit('track:live:location', function (error) {
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
- Controls.prototype.untrackLiveLocation = function () {
132
- var _this = this;
133
- return new Promise(function (resolve, reject) {
139
+ untrackLiveLocation() {
140
+ return new Promise((resolve, reject) => {
134
141
  // Set timeout
135
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
142
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
136
143
  // Stop live location tracking
137
- _this.chn.emit('untrack:live:location', function (error) {
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
- Controls.prototype.enableDragPickLocation = function (location) {
151
- var _this = this;
152
- return new Promise(function (resolve, reject) {
157
+ enableDragPickLocation(location) {
158
+ return new Promise((resolve, reject) => {
153
159
  // Set timeout
154
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
160
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
155
161
  // Enable drag pick
156
- _this.chn.emit('enable:dragpick:location', location, function (error) {
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
- Controls.prototype.disableDragPickLocation = function () {
168
- var _this = this;
169
- return new Promise(function (resolve, reject) {
173
+ disableDragPickLocation() {
174
+ return new Promise((resolve, reject) => {
170
175
  // Set timeout
171
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
176
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
172
177
  // Disable drag pick
173
- _this.chn.emit('disable:dragpick:location', function (error) {
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
- Controls.prototype.setDragPickContent = function (type, content) {
188
- var _this = this;
189
- return new Promise(function (resolve, reject) {
192
+ setDragPickContent(type, content) {
193
+ return new Promise((resolve, reject) => {
190
194
  // Set timeout
191
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
195
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
192
196
  // Set drag pick content
193
- _this.chn.emit('set:dragpick:content', { type: type, content: content }, function (error) {
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
- Controls.prototype.resolvePlace = function (name) {
208
- var _this = this;
209
- return new Promise(function (resolve, reject) {
211
+ resolvePlace(name) {
212
+ return new Promise((resolve, reject) => {
210
213
  // Set timeout
211
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
214
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
212
215
  // Get location coordinates from place name
213
- _this.chn.emit('resolve:place', name, function (error, data) {
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
- Controls.prototype.resolveCoordinates = function (coords) {
228
- var _this = this;
229
- return new Promise(function (resolve, reject) {
230
+ resolveCoordinates(coords) {
231
+ return new Promise((resolve, reject) => {
230
232
  // Set timeout
231
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
233
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
232
234
  // Get location place from coordinates
233
- _this.chn.emit('resolve:coordinates', coords, function (error, data) {
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
- Controls.prototype.searchQuery = function (input) {
248
- var _this = this;
249
- return new Promise(function (resolve, reject) {
249
+ searchQuery(input) {
250
+ return new Promise((resolve, reject) => {
250
251
  // Set timeout
251
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
252
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
252
253
  // Launch search query
253
- _this.chn.emit('search:query', input, function (error, data) {
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
- Controls.prototype.searchSelect = function (index) {
268
- var _this = this;
269
- return new Promise(function (resolve, reject) {
268
+ searchSelect(index) {
269
+ return new Promise((resolve, reject) => {
270
270
  // Set timeout
271
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
271
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
272
272
  // Get place's details
273
- _this.chn.emit('search:select', index, function (error, data) {
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
- Controls.prototype.showNearby = function (list) {
287
- var _this = this;
288
- return new Promise(function (resolve, reject) {
286
+ showNearby(list) {
287
+ return new Promise((resolve, reject) => {
289
288
  // Set timeout
290
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
289
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
291
290
  // Show nearby entities
292
- _this.chn.emit('show:nearby', list, function (error) {
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
- Controls.prototype.removeNearby = function () {
304
- var _this = this;
305
- return new Promise(function (resolve, reject) {
302
+ removeNearby() {
303
+ return new Promise((resolve, reject) => {
306
304
  // Set timeout
307
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
305
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
308
306
  // Remove nearby entities
309
- _this.chn.emit('remove:nearby', function (error) {
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
- Controls.prototype.addNearbyEntity = function (entity) {
323
- var _this = this;
324
- return new Promise(function (resolve, reject) {
320
+ addNearbyEntity(entity) {
321
+ return new Promise((resolve, reject) => {
325
322
  // Set timeout
326
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
323
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
327
324
  // Add nearby entity
328
- _this.chn.emit('add:nearby:entity', entity, function (error) {
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
- Controls.prototype.moveNearbyEntity = function (activePosition) {
342
- var _this = this;
343
- return new Promise(function (resolve, reject) {
338
+ moveNearbyEntity(activePosition) {
339
+ return new Promise((resolve, reject) => {
344
340
  // Set timeout
345
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
341
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
346
342
  // Move nearby entity
347
- _this.chn.emit('move:nearby:entity', activePosition, function (error) {
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
- Controls.prototype.removeNearbyEntity = function (id) {
361
- var _this = this;
362
- return new Promise(function (resolve, reject) {
356
+ removeNearbyEntity(id) {
357
+ return new Promise((resolve, reject) => {
363
358
  // Set timeout
364
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
359
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
365
360
  // Remove nearby entity
366
- _this.chn.emit('remove:nearby:entity', id, function (error) {
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
- Controls.prototype.setRoute = function (journey) {
380
- var _this = this;
381
- return new Promise(function (resolve, reject) {
374
+ setRoute(journey) {
375
+ return new Promise((resolve, reject) => {
382
376
  // Set timeout
383
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
377
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
384
378
  // Set route
385
- _this.chn.emit('set:route', journey, function (error) {
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
- Controls.prototype.drawRoute = function (routeId, data, options) {
399
- var _this = this;
400
- return new Promise(function (resolve, reject) {
392
+ drawRoute(routeId, data, options) {
393
+ return new Promise((resolve, reject) => {
401
394
  // Set timeout
402
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
395
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
403
396
  // Draw route
404
- _this.chn.emit('draw:route', { routeId: routeId, data: data, options: options }, function (error) {
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
- Controls.prototype.removeRoute = function (routeId) {
418
- var _this = this;
419
- return new Promise(function (resolve, reject) {
410
+ removeRoute(routeId) {
411
+ return new Promise((resolve, reject) => {
420
412
  // Set timeout
421
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
413
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
422
414
  // Remove route
423
- _this.chn.emit('remove:route', routeId, function (error) {
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
- Controls.prototype.setRouteOrigin = function (routeId, point) {
438
- var _this = this;
439
- return new Promise(function (resolve, reject) {
429
+ setRouteOrigin(routeId, point) {
430
+ return new Promise((resolve, reject) => {
440
431
  // Set timeout
441
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
432
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
442
433
  // Set route origin
443
- _this.chn.emit('set:route:origin', { routeId: routeId, point: point }, function (error) {
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
- Controls.prototype.removeRouteOrigin = function (routeId) {
457
- var _this = this;
458
- return new Promise(function (resolve, reject) {
447
+ removeRouteOrigin(routeId) {
448
+ return new Promise((resolve, reject) => {
459
449
  // Set timeout
460
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
450
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
461
451
  // Remove route origin
462
- _this.chn.emit('remove:route:origin', { routeId: routeId }, function (error) {
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
- Controls.prototype.setRouteDestination = function (routeId, point) {
477
- var _this = this;
478
- return new Promise(function (resolve, reject) {
466
+ setRouteDestination(routeId, point) {
467
+ return new Promise((resolve, reject) => {
479
468
  // Set timeout
480
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
469
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
481
470
  // Set route destination
482
- _this.chn.emit('set:route:destination', { routeId: routeId, point: point }, function (error) {
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
- Controls.prototype.removeRouteDestination = function (routeId) {
496
- var _this = this;
497
- return new Promise(function (resolve, reject) {
484
+ removeRouteDestination(routeId) {
485
+ return new Promise((resolve, reject) => {
498
486
  // Set timeout
499
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
487
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
500
488
  // Remove route destination
501
- _this.chn.emit('remove:route:destination', { routeId: routeId }, function (error) {
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
- Controls.prototype.addRouteWaypoint = function (routeId, point) {
516
- var _this = this;
517
- return new Promise(function (resolve, reject) {
503
+ addRouteWaypoint(routeId, point) {
504
+ return new Promise((resolve, reject) => {
518
505
  // Set timeout
519
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
506
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
520
507
  // Add route waypoint
521
- _this.chn.emit('add:route:waypoint', { routeId: routeId, point: point }, function (error) {
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
- Controls.prototype.updateRouteWaypoint = function (routeId, point) {
536
- var _this = this;
537
- return new Promise(function (resolve, reject) {
522
+ updateRouteWaypoint(routeId, point) {
523
+ return new Promise((resolve, reject) => {
538
524
  // Set timeout
539
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
525
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
540
526
  // Update route waypoint
541
- _this.chn.emit('update:route:waypoint', { routeId: routeId, point: point }, function (error) {
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
- Controls.prototype.removeRouteWaypoint = function (routeId, index) {
556
- var _this = this;
557
- return new Promise(function (resolve, reject) {
541
+ removeRouteWaypoint(routeId, index) {
542
+ return new Promise((resolve, reject) => {
558
543
  // Set timeout
559
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
544
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
560
545
  // Remove route waypoint
561
- _this.chn.emit('remove:route:waypoint', { routeId: routeId, index: index }, function (error) {
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
- Controls.prototype.fitRouteBounds = function (routeId, margin) {
576
- var _this = this;
577
- return new Promise(function (resolve, reject) {
560
+ fitRouteBounds(routeId, margin) {
561
+ return new Promise((resolve, reject) => {
578
562
  // Set timeout
579
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
580
- _this.chn.emit('fit:route:bounds', { routeId: routeId, margin: margin }, function (error) {
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
- Controls.prototype.fitRoutesBounds = function (options) {
594
- var _this = this;
595
- return new Promise(function (resolve, reject) {
577
+ fitRoutesBounds(options) {
578
+ return new Promise((resolve, reject) => {
596
579
  // Set timeout
597
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
598
- _this.chn.emit('fit:routes:bounds', options, function (error) {
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
- Controls.prototype.setWaypointCaption = function (routeId, id, caption) {
614
- var _this = this;
615
- return new Promise(function (resolve, reject) {
596
+ setWaypointCaption(routeId, id, caption) {
597
+ return new Promise((resolve, reject) => {
616
598
  // Set timeout
617
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
599
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
618
600
  // Set waypoint caption
619
- _this.chn.emit('set:waypoint:caption', { routeId: routeId, id: id, caption: caption }, function (error) {
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
- Controls.prototype.updateWaypointCaption = function (routeId, id, caption) {
635
- var _this = this;
636
- return new Promise(function (resolve, reject) {
616
+ updateWaypointCaption(routeId, id, caption) {
617
+ return new Promise((resolve, reject) => {
637
618
  // Set timeout
638
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
619
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
639
620
  // Update waypoint caption
640
- _this.chn.emit('update:waypoint:caption', { routeId: routeId, id: id, caption: caption }, function (error) {
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
- Controls.prototype.removeWaypointCaption = function (routeId, id) {
655
- var _this = this;
656
- return new Promise(function (resolve, reject) {
635
+ removeWaypointCaption(routeId, id) {
636
+ return new Promise((resolve, reject) => {
657
637
  // Set timeout
658
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
638
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
659
639
  // Remove waypoint caption
660
- _this.chn.emit('remove:waypoint:caption', { routeId: routeId, id: id }, function (error) {
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
- Controls.prototype.mountNavigation = function (routeId) {
674
- var _this = this;
675
- return new Promise(function (resolve, reject) {
653
+ mountNavigation(routeId) {
654
+ return new Promise((resolve, reject) => {
676
655
  // Set timeout
677
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
656
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
678
657
  // Mount navigation
679
- _this.chn.emit('mount:navigation', routeId, function (error) {
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
- Controls.prototype.unmountNavigation = function () {
691
- var _this = this;
692
- return new Promise(function (resolve, reject) {
669
+ unmountNavigation() {
670
+ return new Promise((resolve, reject) => {
693
671
  // Set timeout
694
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
672
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
695
673
  // Unmount navigation
696
- _this.chn.emit('unmount:navigation', function (error) {
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
- Controls.prototype.loadNavigation = function () {
708
- var _this = this;
709
- return new Promise(function (resolve, reject) {
685
+ loadNavigation() {
686
+ return new Promise((resolve, reject) => {
710
687
  // Set timeout
711
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
688
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
712
689
  // Load navigation
713
- _this.chn.emit('load:navigation', function (error) {
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
- Controls.prototype.setInitialNavigationPosition = function (position) {
727
- var _this = this;
728
- return new Promise(function (resolve, reject) {
703
+ setInitialNavigationPosition(position) {
704
+ return new Promise((resolve, reject) => {
729
705
  // Set timeout
730
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
706
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
731
707
  // Set initial navigation position
732
- _this.chn.emit('initial:navigation:position', position, function (error) {
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
- Controls.prototype.navigate = function (position) {
746
- var _this = this;
747
- return new Promise(function (resolve, reject) {
721
+ navigate(position) {
722
+ return new Promise((resolve, reject) => {
748
723
  // Set timeout
749
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
724
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
750
725
  // Navigate
751
- _this.chn.emit('navigate:navigation:direction', position, function (error) {
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
- Controls.prototype.casting = function (routeId, direction, position, options) {
768
- var _this = this;
769
- return new Promise(function (resolve, reject) {
742
+ casting(routeId, direction, position, options) {
743
+ return new Promise((resolve, reject) => {
770
744
  // Set timeout
771
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
745
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
772
746
  // Casting navigation direction
773
- _this.chn.emit('casting:navigation:direction', { routeId: routeId, direction: direction, position: position, options: options }, function (error) {
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
- Controls.prototype.dismissNavigation = function () {
785
- var _this = this;
786
- return new Promise(function (resolve, reject) {
758
+ dismissNavigation() {
759
+ return new Promise((resolve, reject) => {
787
760
  // Set timeout
788
- var timeout = setTimeout(function () { return reject(FUNCTION_EVENT_TIMEOUT_MESSAGE); }, FUNCTION_EVENT_TIMEOUT);
761
+ const timeout = setTimeout(() => reject(FUNCTION_EVENT_TIMEOUT_MESSAGE), FUNCTION_EVENT_TIMEOUT);
789
762
  // Dismiss navigation
790
- _this.chn.emit('dismiss:navigation', function (error) {
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
- return Controls;
799
- }());
770
+ }
771
+ }
800
772
  exports.default = Controls;
801
773
  //# sourceMappingURL=Controls.js.map