@esri/solutions-components 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (530) hide show
  1. package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +16 -6
  2. package/dist/cjs/calcite-shell-panel_14.cjs.entry.js.map +1 -1
  3. package/dist/cjs/solution-configuration.cjs.entry.js +10 -3
  4. package/dist/cjs/solution-configuration.cjs.entry.js.map +1 -1
  5. package/dist/cjs/solution-contents_3.cjs.entry.js +3 -1
  6. package/dist/cjs/solution-contents_3.cjs.entry.js.map +1 -1
  7. package/dist/cjs/{solution-store-e2fc11ac.js → solution-store-893499a5.js} +3 -1
  8. package/dist/cjs/solution-store-893499a5.js.map +1 -0
  9. package/dist/collection/components/solution-configuration/solution-configuration.js +9 -2
  10. package/dist/collection/components/solution-configuration/solution-configuration.js.map +1 -1
  11. package/dist/collection/components/solution-item/solution-item.js +2 -0
  12. package/dist/collection/components/solution-item/solution-item.js.map +1 -1
  13. package/dist/collection/components/solution-item-details/solution-item-details.js +15 -5
  14. package/dist/collection/components/solution-item-details/solution-item-details.js.map +1 -1
  15. package/dist/collection/utils/solution-store.js +2 -0
  16. package/dist/collection/utils/solution-store.js.map +1 -1
  17. package/dist/collection/utils/solution-store.ts +2 -0
  18. package/dist/esm/calcite-shell-panel_14.entry.js +16 -6
  19. package/dist/esm/calcite-shell-panel_14.entry.js.map +1 -1
  20. package/dist/esm/solution-configuration.entry.js +10 -3
  21. package/dist/esm/solution-configuration.entry.js.map +1 -1
  22. package/dist/esm/solution-contents_3.entry.js +3 -1
  23. package/dist/esm/solution-contents_3.entry.js.map +1 -1
  24. package/dist/esm/{solution-store-b3c65467.js → solution-store-0c58c852.js} +3 -1
  25. package/dist/esm/solution-store-0c58c852.js.map +1 -0
  26. package/dist/solutions-components/{p-b25f6ebe.js → p-659edb14.js} +3 -1
  27. package/dist/solutions-components/p-659edb14.js.map +1 -0
  28. package/dist/solutions-components/{p-638738f2.entry.js → p-77c75f3a.entry.js} +4 -2
  29. package/dist/solutions-components/p-77c75f3a.entry.js.map +1 -0
  30. package/dist/solutions-components/{p-7e8985f2.entry.js → p-90629c1d.entry.js} +11 -4
  31. package/dist/solutions-components/p-90629c1d.entry.js.map +1 -0
  32. package/dist/solutions-components/{p-542189bc.entry.js → p-984cb687.entry.js} +17 -7
  33. package/dist/solutions-components/p-984cb687.entry.js.map +1 -0
  34. package/dist/solutions-components/solutions-components.esm.js +1 -1
  35. package/dist/solutions-components/utils/solution-store.ts +2 -0
  36. package/dist/solutions-components_commit.txt +9 -6
  37. package/dist/types/components/solution-item-details/solution-item-details.d.ts +2 -1
  38. package/package.json +1 -1
  39. package/dist/cjs/solution-store-e2fc11ac.js.map +0 -1
  40. package/dist/components/ExpandToggle.js +0 -112
  41. package/dist/components/ExpandToggle.js.map +0 -1
  42. package/dist/components/Heading.js +0 -24
  43. package/dist/components/Heading.js.map +0 -1
  44. package/dist/components/_commonjsHelpers.js +0 -24
  45. package/dist/components/_commonjsHelpers.js.map +0 -1
  46. package/dist/components/action-bar.js +0 -278
  47. package/dist/components/action-bar.js.map +0 -1
  48. package/dist/components/action-group.js +0 -151
  49. package/dist/components/action-group.js.map +0 -1
  50. package/dist/components/action-menu.js +0 -358
  51. package/dist/components/action-menu.js.map +0 -1
  52. package/dist/components/action.js +0 -216
  53. package/dist/components/action.js.map +0 -1
  54. package/dist/components/array.js +0 -17
  55. package/dist/components/array.js.map +0 -1
  56. package/dist/components/buffer-tools.d.ts +0 -11
  57. package/dist/components/buffer-tools.js +0 -13
  58. package/dist/components/buffer-tools.js.map +0 -1
  59. package/dist/components/buffer-tools2.js +0 -256
  60. package/dist/components/buffer-tools2.js.map +0 -1
  61. package/dist/components/button.js +0 -265
  62. package/dist/components/button.js.map +0 -1
  63. package/dist/components/calcite-accordion-item.js +0 -246
  64. package/dist/components/calcite-accordion-item.js.map +0 -1
  65. package/dist/components/calcite-accordion.js +0 -182
  66. package/dist/components/calcite-accordion.js.map +0 -1
  67. package/dist/components/calcite-action-bar.js +0 -13
  68. package/dist/components/calcite-action-bar.js.map +0 -1
  69. package/dist/components/calcite-action-group.js +0 -13
  70. package/dist/components/calcite-action-group.js.map +0 -1
  71. package/dist/components/calcite-action-menu.js +0 -13
  72. package/dist/components/calcite-action-menu.js.map +0 -1
  73. package/dist/components/calcite-action-pad.js +0 -199
  74. package/dist/components/calcite-action-pad.js.map +0 -1
  75. package/dist/components/calcite-action.js +0 -13
  76. package/dist/components/calcite-action.js.map +0 -1
  77. package/dist/components/calcite-alert.js +0 -299
  78. package/dist/components/calcite-alert.js.map +0 -1
  79. package/dist/components/calcite-avatar.js +0 -184
  80. package/dist/components/calcite-avatar.js.map +0 -1
  81. package/dist/components/calcite-block-section.js +0 -157
  82. package/dist/components/calcite-block-section.js.map +0 -1
  83. package/dist/components/calcite-block.js +0 -277
  84. package/dist/components/calcite-block.js.map +0 -1
  85. package/dist/components/calcite-button.js +0 -13
  86. package/dist/components/calcite-button.js.map +0 -1
  87. package/dist/components/calcite-card.js +0 -189
  88. package/dist/components/calcite-card.js.map +0 -1
  89. package/dist/components/calcite-checkbox.js +0 -13
  90. package/dist/components/calcite-checkbox.js.map +0 -1
  91. package/dist/components/calcite-chip.js +0 -13
  92. package/dist/components/calcite-chip.js.map +0 -1
  93. package/dist/components/calcite-color-picker-hex-input.js +0 -13
  94. package/dist/components/calcite-color-picker-hex-input.js.map +0 -1
  95. package/dist/components/calcite-color-picker-swatch.js +0 -13
  96. package/dist/components/calcite-color-picker-swatch.js.map +0 -1
  97. package/dist/components/calcite-color-picker.js +0 -1038
  98. package/dist/components/calcite-color-picker.js.map +0 -1
  99. package/dist/components/calcite-combobox-item-group.js +0 -77
  100. package/dist/components/calcite-combobox-item-group.js.map +0 -1
  101. package/dist/components/calcite-combobox-item.js +0 -13
  102. package/dist/components/calcite-combobox-item.js.map +0 -1
  103. package/dist/components/calcite-combobox.js +0 -13
  104. package/dist/components/calcite-combobox.js.map +0 -1
  105. package/dist/components/calcite-date-picker-day.js +0 -13
  106. package/dist/components/calcite-date-picker-day.js.map +0 -1
  107. package/dist/components/calcite-date-picker-month-header.js +0 -13
  108. package/dist/components/calcite-date-picker-month-header.js.map +0 -1
  109. package/dist/components/calcite-date-picker-month.js +0 -13
  110. package/dist/components/calcite-date-picker-month.js.map +0 -1
  111. package/dist/components/calcite-date-picker.js +0 -13
  112. package/dist/components/calcite-date-picker.js.map +0 -1
  113. package/dist/components/calcite-dropdown-group.js +0 -101
  114. package/dist/components/calcite-dropdown-group.js.map +0 -1
  115. package/dist/components/calcite-dropdown-item.js +0 -237
  116. package/dist/components/calcite-dropdown-item.js.map +0 -1
  117. package/dist/components/calcite-dropdown.js +0 -13
  118. package/dist/components/calcite-dropdown.js.map +0 -1
  119. package/dist/components/calcite-fab.js +0 -146
  120. package/dist/components/calcite-fab.js.map +0 -1
  121. package/dist/components/calcite-filter.js +0 -197
  122. package/dist/components/calcite-filter.js.map +0 -1
  123. package/dist/components/calcite-flow-item.js +0 -245
  124. package/dist/components/calcite-flow-item.js.map +0 -1
  125. package/dist/components/calcite-flow.js +0 -149
  126. package/dist/components/calcite-flow.js.map +0 -1
  127. package/dist/components/calcite-graph.js +0 -13
  128. package/dist/components/calcite-graph.js.map +0 -1
  129. package/dist/components/calcite-handle.js +0 -13
  130. package/dist/components/calcite-handle.js.map +0 -1
  131. package/dist/components/calcite-icon.js +0 -13
  132. package/dist/components/calcite-icon.js.map +0 -1
  133. package/dist/components/calcite-inline-editable.js +0 -296
  134. package/dist/components/calcite-inline-editable.js.map +0 -1
  135. package/dist/components/calcite-input-date-picker.js +0 -715
  136. package/dist/components/calcite-input-date-picker.js.map +0 -1
  137. package/dist/components/calcite-input-message.js +0 -13
  138. package/dist/components/calcite-input-message.js.map +0 -1
  139. package/dist/components/calcite-input-number.js +0 -639
  140. package/dist/components/calcite-input-number.js.map +0 -1
  141. package/dist/components/calcite-input-text.js +0 -402
  142. package/dist/components/calcite-input-text.js.map +0 -1
  143. package/dist/components/calcite-input-time-picker.js +0 -436
  144. package/dist/components/calcite-input-time-picker.js.map +0 -1
  145. package/dist/components/calcite-input.js +0 -13
  146. package/dist/components/calcite-input.js.map +0 -1
  147. package/dist/components/calcite-label.js +0 -13
  148. package/dist/components/calcite-label.js.map +0 -1
  149. package/dist/components/calcite-link.js +0 -13
  150. package/dist/components/calcite-link.js.map +0 -1
  151. package/dist/components/calcite-list-item-group.js +0 -67
  152. package/dist/components/calcite-list-item-group.js.map +0 -1
  153. package/dist/components/calcite-list-item.js +0 -13
  154. package/dist/components/calcite-list-item.js.map +0 -1
  155. package/dist/components/calcite-list.js +0 -13
  156. package/dist/components/calcite-list.js.map +0 -1
  157. package/dist/components/calcite-loader.js +0 -13
  158. package/dist/components/calcite-loader.js.map +0 -1
  159. package/dist/components/calcite-modal.js +0 -500
  160. package/dist/components/calcite-modal.js.map +0 -1
  161. package/dist/components/calcite-notice.js +0 -13
  162. package/dist/components/calcite-notice.js.map +0 -1
  163. package/dist/components/calcite-option-group.js +0 -66
  164. package/dist/components/calcite-option-group.js.map +0 -1
  165. package/dist/components/calcite-option.js +0 -13
  166. package/dist/components/calcite-option.js.map +0 -1
  167. package/dist/components/calcite-pagination.js +0 -260
  168. package/dist/components/calcite-pagination.js.map +0 -1
  169. package/dist/components/calcite-panel.js +0 -13
  170. package/dist/components/calcite-panel.js.map +0 -1
  171. package/dist/components/calcite-pick-list-group.js +0 -76
  172. package/dist/components/calcite-pick-list-group.js.map +0 -1
  173. package/dist/components/calcite-pick-list-item.js +0 -13
  174. package/dist/components/calcite-pick-list-item.js.map +0 -1
  175. package/dist/components/calcite-pick-list.js +0 -175
  176. package/dist/components/calcite-pick-list.js.map +0 -1
  177. package/dist/components/calcite-popover-manager.js +0 -96
  178. package/dist/components/calcite-popover-manager.js.map +0 -1
  179. package/dist/components/calcite-popover.js +0 -13
  180. package/dist/components/calcite-popover.js.map +0 -1
  181. package/dist/components/calcite-progress.js +0 -13
  182. package/dist/components/calcite-progress.js.map +0 -1
  183. package/dist/components/calcite-radio-button-group.js +0 -134
  184. package/dist/components/calcite-radio-button-group.js.map +0 -1
  185. package/dist/components/calcite-radio-button.js +0 -312
  186. package/dist/components/calcite-radio-button.js.map +0 -1
  187. package/dist/components/calcite-radio-group-item.js +0 -13
  188. package/dist/components/calcite-radio-group-item.js.map +0 -1
  189. package/dist/components/calcite-radio-group.js +0 -13
  190. package/dist/components/calcite-radio-group.js.map +0 -1
  191. package/dist/components/calcite-rating.js +0 -203
  192. package/dist/components/calcite-rating.js.map +0 -1
  193. package/dist/components/calcite-scrim.js +0 -13
  194. package/dist/components/calcite-scrim.js.map +0 -1
  195. package/dist/components/calcite-select.js +0 -13
  196. package/dist/components/calcite-select.js.map +0 -1
  197. package/dist/components/calcite-shell-center-row.js +0 -102
  198. package/dist/components/calcite-shell-center-row.js.map +0 -1
  199. package/dist/components/calcite-shell-panel.js +0 -13
  200. package/dist/components/calcite-shell-panel.js.map +0 -1
  201. package/dist/components/calcite-shell.js +0 -13
  202. package/dist/components/calcite-shell.js.map +0 -1
  203. package/dist/components/calcite-slider.js +0 -13
  204. package/dist/components/calcite-slider.js.map +0 -1
  205. package/dist/components/calcite-sortable-list.js +0 -204
  206. package/dist/components/calcite-sortable-list.js.map +0 -1
  207. package/dist/components/calcite-split-button.js +0 -170
  208. package/dist/components/calcite-split-button.js.map +0 -1
  209. package/dist/components/calcite-stepper-item.js +0 -273
  210. package/dist/components/calcite-stepper-item.js.map +0 -1
  211. package/dist/components/calcite-stepper.js +0 -258
  212. package/dist/components/calcite-stepper.js.map +0 -1
  213. package/dist/components/calcite-switch.js +0 -13
  214. package/dist/components/calcite-switch.js.map +0 -1
  215. package/dist/components/calcite-tab-nav.js +0 -13
  216. package/dist/components/calcite-tab-nav.js.map +0 -1
  217. package/dist/components/calcite-tab-title.js +0 -13
  218. package/dist/components/calcite-tab-title.js.map +0 -1
  219. package/dist/components/calcite-tab.js +0 -13
  220. package/dist/components/calcite-tab.js.map +0 -1
  221. package/dist/components/calcite-tabs.js +0 -13
  222. package/dist/components/calcite-tabs.js.map +0 -1
  223. package/dist/components/calcite-tile-select-group.js +0 -67
  224. package/dist/components/calcite-tile-select-group.js.map +0 -1
  225. package/dist/components/calcite-tile-select.js +0 -268
  226. package/dist/components/calcite-tile-select.js.map +0 -1
  227. package/dist/components/calcite-tile.js +0 -13
  228. package/dist/components/calcite-tile.js.map +0 -1
  229. package/dist/components/calcite-time-picker.js +0 -13
  230. package/dist/components/calcite-time-picker.js.map +0 -1
  231. package/dist/components/calcite-tip-group.js +0 -43
  232. package/dist/components/calcite-tip-group.js.map +0 -1
  233. package/dist/components/calcite-tip-manager.js +0 -225
  234. package/dist/components/calcite-tip-manager.js.map +0 -1
  235. package/dist/components/calcite-tip.js +0 -164
  236. package/dist/components/calcite-tip.js.map +0 -1
  237. package/dist/components/calcite-tooltip-manager.js +0 -59
  238. package/dist/components/calcite-tooltip-manager.js.map +0 -1
  239. package/dist/components/calcite-tooltip.js +0 -13
  240. package/dist/components/calcite-tooltip.js.map +0 -1
  241. package/dist/components/calcite-tree-item.js +0 -13
  242. package/dist/components/calcite-tree-item.js.map +0 -1
  243. package/dist/components/calcite-tree.js +0 -13
  244. package/dist/components/calcite-tree.js.map +0 -1
  245. package/dist/components/calcite-value-list-item.js +0 -13
  246. package/dist/components/calcite-value-list-item.js.map +0 -1
  247. package/dist/components/calcite-value-list.js +0 -13
  248. package/dist/components/calcite-value-list.js.map +0 -1
  249. package/dist/components/check-list.d.ts +0 -11
  250. package/dist/components/check-list.js +0 -13
  251. package/dist/components/check-list.js.map +0 -1
  252. package/dist/components/check-list2.js +0 -128
  253. package/dist/components/check-list2.js.map +0 -1
  254. package/dist/components/checkbox.js +0 -167
  255. package/dist/components/checkbox.js.map +0 -1
  256. package/dist/components/chip.js +0 -172
  257. package/dist/components/chip.js.map +0 -1
  258. package/dist/components/color-picker-hex-input.js +0 -365
  259. package/dist/components/color-picker-hex-input.js.map +0 -1
  260. package/dist/components/color-picker-swatch.js +0 -2036
  261. package/dist/components/color-picker-swatch.js.map +0 -1
  262. package/dist/components/combobox-item.js +0 -184
  263. package/dist/components/combobox-item.js.map +0 -1
  264. package/dist/components/combobox.js +0 -914
  265. package/dist/components/combobox.js.map +0 -1
  266. package/dist/components/conditionalSlot.js +0 -52
  267. package/dist/components/conditionalSlot.js.map +0 -1
  268. package/dist/components/config-buffer-tools.d.ts +0 -11
  269. package/dist/components/config-buffer-tools.js +0 -185
  270. package/dist/components/config-buffer-tools.js.map +0 -1
  271. package/dist/components/config-draw-tools.d.ts +0 -11
  272. package/dist/components/config-draw-tools.js +0 -124
  273. package/dist/components/config-draw-tools.js.map +0 -1
  274. package/dist/components/config-layer-picker.d.ts +0 -11
  275. package/dist/components/config-layer-picker.js +0 -148
  276. package/dist/components/config-layer-picker.js.map +0 -1
  277. package/dist/components/config-pdf-download.d.ts +0 -11
  278. package/dist/components/config-pdf-download.js +0 -157
  279. package/dist/components/config-pdf-download.js.map +0 -1
  280. package/dist/components/date-picker-day.js +0 -113
  281. package/dist/components/date-picker-day.js.map +0 -1
  282. package/dist/components/date-picker-month-header.js +0 -226
  283. package/dist/components/date-picker-month-header.js.map +0 -1
  284. package/dist/components/date-picker-month.js +0 -346
  285. package/dist/components/date-picker-month.js.map +0 -1
  286. package/dist/components/date-picker.js +0 -577
  287. package/dist/components/date-picker.js.map +0 -1
  288. package/dist/components/date.js +0 -182
  289. package/dist/components/date.js.map +0 -1
  290. package/dist/components/debounce.js +0 -489
  291. package/dist/components/debounce.js.map +0 -1
  292. package/dist/components/dom.js +0 -233
  293. package/dist/components/dom.js.map +0 -1
  294. package/dist/components/dropdown.js +0 -507
  295. package/dist/components/dropdown.js.map +0 -1
  296. package/dist/components/filter.js +0 -765
  297. package/dist/components/filter.js.map +0 -1
  298. package/dist/components/floating-ui.js +0 -1787
  299. package/dist/components/floating-ui.js.map +0 -1
  300. package/dist/components/form.js +0 -230
  301. package/dist/components/form.js.map +0 -1
  302. package/dist/components/graph.js +0 -256
  303. package/dist/components/graph.js.map +0 -1
  304. package/dist/components/guid.js +0 -26
  305. package/dist/components/guid.js.map +0 -1
  306. package/dist/components/handle.js +0 -121
  307. package/dist/components/handle.js.map +0 -1
  308. package/dist/components/icon.js +0 -204
  309. package/dist/components/icon.js.map +0 -1
  310. package/dist/components/index.d.ts +0 -48
  311. package/dist/components/index.js +0 -190
  312. package/dist/components/index.js.map +0 -1
  313. package/dist/components/index2.js +0 -201
  314. package/dist/components/index2.js.map +0 -1
  315. package/dist/components/input-message.js +0 -103
  316. package/dist/components/input-message.js.map +0 -1
  317. package/dist/components/input.js +0 -742
  318. package/dist/components/input.js.map +0 -1
  319. package/dist/components/interactive.js +0 -53
  320. package/dist/components/interactive.js.map +0 -1
  321. package/dist/components/interfaces.js +0 -21
  322. package/dist/components/interfaces.js.map +0 -1
  323. package/dist/components/interfaces2.js +0 -23
  324. package/dist/components/interfaces2.js.map +0 -1
  325. package/dist/components/interfaces3.js +0 -72
  326. package/dist/components/interfaces3.js.map +0 -1
  327. package/dist/components/json-editor.d.ts +0 -11
  328. package/dist/components/json-editor.js +0 -13
  329. package/dist/components/json-editor.js.map +0 -1
  330. package/dist/components/json-editor2.js +0 -443
  331. package/dist/components/json-editor2.js.map +0 -1
  332. package/dist/components/key.js +0 -18
  333. package/dist/components/key.js.map +0 -1
  334. package/dist/components/label.js +0 -108
  335. package/dist/components/label.js.map +0 -1
  336. package/dist/components/label2.js +0 -133
  337. package/dist/components/label2.js.map +0 -1
  338. package/dist/components/labelFormats.js +0 -212
  339. package/dist/components/labelFormats.js.map +0 -1
  340. package/dist/components/link.js +0 -125
  341. package/dist/components/link.js.map +0 -1
  342. package/dist/components/list-item.js +0 -151
  343. package/dist/components/list-item.js.map +0 -1
  344. package/dist/components/list.js +0 -85
  345. package/dist/components/list.js.map +0 -1
  346. package/dist/components/loadModules.js +0 -30
  347. package/dist/components/loadModules.js.map +0 -1
  348. package/dist/components/loader.js +0 -118
  349. package/dist/components/loader.js.map +0 -1
  350. package/dist/components/locale.js +0 -414
  351. package/dist/components/locale.js.map +0 -1
  352. package/dist/components/locale2.js +0 -415
  353. package/dist/components/locale2.js.map +0 -1
  354. package/dist/components/map-draw-tools.d.ts +0 -11
  355. package/dist/components/map-draw-tools.js +0 -13
  356. package/dist/components/map-draw-tools.js.map +0 -1
  357. package/dist/components/map-draw-tools2.js +0 -230
  358. package/dist/components/map-draw-tools2.js.map +0 -1
  359. package/dist/components/map-layer-picker.d.ts +0 -11
  360. package/dist/components/map-layer-picker.js +0 -13
  361. package/dist/components/map-layer-picker.js.map +0 -1
  362. package/dist/components/map-layer-picker2.js +0 -190
  363. package/dist/components/map-layer-picker2.js.map +0 -1
  364. package/dist/components/map-search.d.ts +0 -11
  365. package/dist/components/map-search.js +0 -157
  366. package/dist/components/map-search.js.map +0 -1
  367. package/dist/components/map-select-tools.d.ts +0 -11
  368. package/dist/components/map-select-tools.js +0 -13
  369. package/dist/components/map-select-tools.js.map +0 -1
  370. package/dist/components/map-select-tools2.js +0 -555
  371. package/dist/components/map-select-tools2.js.map +0 -1
  372. package/dist/components/mapViewUtils.js +0 -131
  373. package/dist/components/mapViewUtils.js.map +0 -1
  374. package/dist/components/math.js +0 -26
  375. package/dist/components/math.js.map +0 -1
  376. package/dist/components/nonChromiumPlatformUtils.js +0 -505
  377. package/dist/components/nonChromiumPlatformUtils.js.map +0 -1
  378. package/dist/components/notice.js +0 -194
  379. package/dist/components/notice.js.map +0 -1
  380. package/dist/components/observers.js +0 -58
  381. package/dist/components/observers.js.map +0 -1
  382. package/dist/components/openCloseComponent.js +0 -58
  383. package/dist/components/openCloseComponent.js.map +0 -1
  384. package/dist/components/option.js +0 -111
  385. package/dist/components/option.js.map +0 -1
  386. package/dist/components/panel.js +0 -461
  387. package/dist/components/panel.js.map +0 -1
  388. package/dist/components/pdf-download.d.ts +0 -11
  389. package/dist/components/pdf-download.js +0 -13
  390. package/dist/components/pdf-download.js.map +0 -1
  391. package/dist/components/pdf-download2.js +0 -243
  392. package/dist/components/pdf-download2.js.map +0 -1
  393. package/dist/components/pick-list-item.js +0 -257
  394. package/dist/components/pick-list-item.js.map +0 -1
  395. package/dist/components/popover.js +0 -502
  396. package/dist/components/popover.js.map +0 -1
  397. package/dist/components/progress.js +0 -62
  398. package/dist/components/progress.js.map +0 -1
  399. package/dist/components/public-notification.d.ts +0 -11
  400. package/dist/components/public-notification.js +0 -784
  401. package/dist/components/public-notification.js.map +0 -1
  402. package/dist/components/publicNotificationStore.js +0 -40
  403. package/dist/components/publicNotificationStore.js.map +0 -1
  404. package/dist/components/queryUtils.js +0 -163
  405. package/dist/components/queryUtils.js.map +0 -1
  406. package/dist/components/radio-group-item.js +0 -103
  407. package/dist/components/radio-group-item.js.map +0 -1
  408. package/dist/components/radio-group.js +0 -237
  409. package/dist/components/radio-group.js.map +0 -1
  410. package/dist/components/refine-selection-tools.d.ts +0 -11
  411. package/dist/components/refine-selection-tools.js +0 -13
  412. package/dist/components/refine-selection-tools.js.map +0 -1
  413. package/dist/components/refine-selection-tools2.js +0 -500
  414. package/dist/components/refine-selection-tools2.js.map +0 -1
  415. package/dist/components/refine-selection.d.ts +0 -11
  416. package/dist/components/refine-selection.js +0 -13
  417. package/dist/components/refine-selection.js.map +0 -1
  418. package/dist/components/refine-selection2.js +0 -369
  419. package/dist/components/refine-selection2.js.map +0 -1
  420. package/dist/components/resources.js +0 -26
  421. package/dist/components/resources.js.map +0 -1
  422. package/dist/components/resources2.js +0 -23
  423. package/dist/components/resources2.js.map +0 -1
  424. package/dist/components/resources3.js +0 -40
  425. package/dist/components/resources3.js.map +0 -1
  426. package/dist/components/scrim.js +0 -85
  427. package/dist/components/scrim.js.map +0 -1
  428. package/dist/components/select.js +0 -261
  429. package/dist/components/select.js.map +0 -1
  430. package/dist/components/shared-list-render.js +0 -321
  431. package/dist/components/shared-list-render.js.map +0 -1
  432. package/dist/components/shell-panel.js +0 -283
  433. package/dist/components/shell-panel.js.map +0 -1
  434. package/dist/components/shell.js +0 -123
  435. package/dist/components/shell.js.map +0 -1
  436. package/dist/components/slider.js +0 -898
  437. package/dist/components/slider.js.map +0 -1
  438. package/dist/components/solution-configuration.d.ts +0 -11
  439. package/dist/components/solution-configuration.js +0 -2225
  440. package/dist/components/solution-configuration.js.map +0 -1
  441. package/dist/components/solution-contents.d.ts +0 -11
  442. package/dist/components/solution-contents.js +0 -13
  443. package/dist/components/solution-contents.js.map +0 -1
  444. package/dist/components/solution-contents2.js +0 -130
  445. package/dist/components/solution-contents2.js.map +0 -1
  446. package/dist/components/solution-item-details.d.ts +0 -11
  447. package/dist/components/solution-item-details.js +0 -13
  448. package/dist/components/solution-item-details.js.map +0 -1
  449. package/dist/components/solution-item-details2.js +0 -236
  450. package/dist/components/solution-item-details2.js.map +0 -1
  451. package/dist/components/solution-item-icon.d.ts +0 -11
  452. package/dist/components/solution-item-icon.js +0 -13
  453. package/dist/components/solution-item-icon.js.map +0 -1
  454. package/dist/components/solution-item-icon2.js +0 -344
  455. package/dist/components/solution-item-icon2.js.map +0 -1
  456. package/dist/components/solution-item-sharing.d.ts +0 -11
  457. package/dist/components/solution-item-sharing.js +0 -13
  458. package/dist/components/solution-item-sharing.js.map +0 -1
  459. package/dist/components/solution-item-sharing2.js +0 -169
  460. package/dist/components/solution-item-sharing2.js.map +0 -1
  461. package/dist/components/solution-item.d.ts +0 -11
  462. package/dist/components/solution-item.js +0 -13
  463. package/dist/components/solution-item.js.map +0 -1
  464. package/dist/components/solution-item2.js +0 -317
  465. package/dist/components/solution-item2.js.map +0 -1
  466. package/dist/components/solution-organization-variables.d.ts +0 -11
  467. package/dist/components/solution-organization-variables.js +0 -13
  468. package/dist/components/solution-organization-variables.js.map +0 -1
  469. package/dist/components/solution-organization-variables2.js +0 -134
  470. package/dist/components/solution-organization-variables2.js.map +0 -1
  471. package/dist/components/solution-resource-item.d.ts +0 -11
  472. package/dist/components/solution-resource-item.js +0 -13
  473. package/dist/components/solution-resource-item.js.map +0 -1
  474. package/dist/components/solution-resource-item2.js +0 -358
  475. package/dist/components/solution-resource-item2.js.map +0 -1
  476. package/dist/components/solution-spatial-ref.d.ts +0 -11
  477. package/dist/components/solution-spatial-ref.js +0 -13
  478. package/dist/components/solution-spatial-ref.js.map +0 -1
  479. package/dist/components/solution-spatial-ref2.js +0 -21448
  480. package/dist/components/solution-spatial-ref2.js.map +0 -1
  481. package/dist/components/solution-store.js +0 -4094
  482. package/dist/components/solution-store.js.map +0 -1
  483. package/dist/components/solution-template-data.d.ts +0 -11
  484. package/dist/components/solution-template-data.js +0 -13
  485. package/dist/components/solution-template-data.js.map +0 -1
  486. package/dist/components/solution-template-data2.js +0 -235
  487. package/dist/components/solution-template-data2.js.map +0 -1
  488. package/dist/components/solution-variables.d.ts +0 -11
  489. package/dist/components/solution-variables.js +0 -13
  490. package/dist/components/solution-variables.js.map +0 -1
  491. package/dist/components/solution-variables2.js +0 -152
  492. package/dist/components/solution-variables2.js.map +0 -1
  493. package/dist/components/sortable.esm.js +0 -3028
  494. package/dist/components/sortable.esm.js.map +0 -1
  495. package/dist/components/store-manager.d.ts +0 -11
  496. package/dist/components/store-manager.js +0 -85
  497. package/dist/components/store-manager.js.map +0 -1
  498. package/dist/components/switch.js +0 -141
  499. package/dist/components/switch.js.map +0 -1
  500. package/dist/components/tab-nav.js +0 -243
  501. package/dist/components/tab-nav.js.map +0 -1
  502. package/dist/components/tab-title.js +0 -278
  503. package/dist/components/tab-title.js.map +0 -1
  504. package/dist/components/tab.js +0 -156
  505. package/dist/components/tab.js.map +0 -1
  506. package/dist/components/tabs.js +0 -190
  507. package/dist/components/tabs.js.map +0 -1
  508. package/dist/components/tile.js +0 -131
  509. package/dist/components/tile.js.map +0 -1
  510. package/dist/components/time-picker.js +0 -945
  511. package/dist/components/time-picker.js.map +0 -1
  512. package/dist/components/tooltip.js +0 -401
  513. package/dist/components/tooltip.js.map +0 -1
  514. package/dist/components/tree-item.js +0 -296
  515. package/dist/components/tree-item.js.map +0 -1
  516. package/dist/components/tree.js +0 -329
  517. package/dist/components/tree.js.map +0 -1
  518. package/dist/components/utils.js +0 -121
  519. package/dist/components/utils.js.map +0 -1
  520. package/dist/components/utils2.js +0 -53
  521. package/dist/components/utils2.js.map +0 -1
  522. package/dist/components/value-list-item.js +0 -206
  523. package/dist/components/value-list-item.js.map +0 -1
  524. package/dist/components/value-list.js +0 -335
  525. package/dist/components/value-list.js.map +0 -1
  526. package/dist/esm/solution-store-b3c65467.js.map +0 -1
  527. package/dist/solutions-components/p-542189bc.entry.js.map +0 -1
  528. package/dist/solutions-components/p-638738f2.entry.js.map +0 -1
  529. package/dist/solutions-components/p-7e8985f2.entry.js.map +0 -1
  530. package/dist/solutions-components/p-b25f6ebe.js.map +0 -1
@@ -1,2225 +0,0 @@
1
- /*!
2
- * Copyright 2022 Esri
3
- * Licensed under the Apache License, Version 2.0
4
- * http://www.apache.org/licenses/LICENSE-2.0
5
- */
6
- import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
7
- import { r as request, N as NODEJS_DEFAULT_REFERER_HEADER, c as cleanUrl, e as encodeQueryString, A as ArcGISAuthError, g as getProp, s as state } from './solution-store.js';
8
- import { g as getLocaleComponentStrings } from './locale.js';
9
- import { d as defineCustomElement$B } from './action.js';
10
- import { d as defineCustomElement$A } from './action-group.js';
11
- import { d as defineCustomElement$z } from './action-menu.js';
12
- import { d as defineCustomElement$y } from './button.js';
13
- import { d as defineCustomElement$x } from './checkbox.js';
14
- import { d as defineCustomElement$w } from './icon.js';
15
- import { d as defineCustomElement$v } from './input.js';
16
- import { d as defineCustomElement$u } from './label.js';
17
- import { d as defineCustomElement$t } from './loader.js';
18
- import { d as defineCustomElement$s } from './panel.js';
19
- import { d as defineCustomElement$r } from './pick-list-item.js';
20
- import { d as defineCustomElement$q } from './popover.js';
21
- import { d as defineCustomElement$p } from './progress.js';
22
- import { d as defineCustomElement$o } from './scrim.js';
23
- import { d as defineCustomElement$n } from './shell.js';
24
- import { d as defineCustomElement$m } from './shell-panel.js';
25
- import { d as defineCustomElement$l } from './switch.js';
26
- import { d as defineCustomElement$k } from './tab.js';
27
- import { d as defineCustomElement$j } from './tab-nav.js';
28
- import { d as defineCustomElement$i } from './tab-title.js';
29
- import { d as defineCustomElement$h } from './tabs.js';
30
- import { d as defineCustomElement$g } from './tree.js';
31
- import { d as defineCustomElement$f } from './tree-item.js';
32
- import { d as defineCustomElement$e } from './value-list.js';
33
- import { d as defineCustomElement$d } from './value-list-item.js';
34
- import { d as defineCustomElement$c } from './json-editor2.js';
35
- import { d as defineCustomElement$b } from './solution-contents2.js';
36
- import { d as defineCustomElement$a } from './solution-item2.js';
37
- import { d as defineCustomElement$9 } from './solution-item-details2.js';
38
- import { d as defineCustomElement$8 } from './solution-item-icon2.js';
39
- import { d as defineCustomElement$7 } from './solution-item-sharing2.js';
40
- import { d as defineCustomElement$6 } from './solution-organization-variables2.js';
41
- import { d as defineCustomElement$5 } from './solution-resource-item2.js';
42
- import { d as defineCustomElement$4 } from './solution-spatial-ref2.js';
43
- import { d as defineCustomElement$3 } from './solution-template-data2.js';
44
- import { d as defineCustomElement$2 } from './solution-variables2.js';
45
-
46
- /** @license
47
- * Copyright 2022 Esri
48
- *
49
- * Licensed under the Apache License, Version 2.0 (the "License");
50
- * you may not use this file except in compliance with the License.
51
- * You may obtain a copy of the License at
52
- *
53
- * http://www.apache.org/licenses/LICENSE-2.0
54
- *
55
- * Unless required by applicable law or agreed to in writing, software
56
- * distributed under the License is distributed on an "AS IS" BASIS,
57
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
58
- * See the License for the specific language governing permissions and
59
- * limitations under the License.
60
- */
61
- //--------------------------------------------------------------------------
62
- //
63
- // Public Functions
64
- //
65
- //--------------------------------------------------------------------------
66
- /**
67
- * Sort the solution items
68
- *
69
- * @param templates a list of item templates from the solution
70
- *
71
- * @returns a sorted list of solution items
72
- */
73
- function getInventoryItems(templates) {
74
- const hierarchy = getItemHierarchy(templates);
75
- const ids = hierarchy.reduce((prev, cur) => {
76
- prev.push(cur.id);
77
- return prev;
78
- }, []);
79
- return templates.reduce((prev, cur) => {
80
- if (ids.indexOf(cur.itemId) > -1) {
81
- const hierarchyItems = hierarchy.filter(hi => hi.id === cur.itemId);
82
- prev.push(_getItemFromTemplate(cur, templates, hierarchyItems[0].dependencies));
83
- }
84
- return prev;
85
- }, []);
86
- }
87
- /**
88
- * Create item hierarchy that will avoid issues from cylical dependencies
89
- *
90
- * @param templates a list of item templates from the solution
91
- *
92
- * @returns a hierarchy for item and item dependency display
93
- */
94
- function getItemHierarchy(templates) {
95
- const hierarchy = [];
96
- // Get the template specified by id out of a list of templates
97
- function getTemplateInSolution(templates, id) {
98
- const iTemplate = templates.findIndex((template) => id === template.itemId);
99
- return iTemplate >= 0 ? templates[iTemplate] : null;
100
- }
101
- // Hierarchically list the dependencies of specified node
102
- function traceItemId(id, accumulatedHierarchy, alreadyVisitedIds = []) {
103
- // Get the dependencies of the node
104
- const template = getTemplateInSolution(templates, id);
105
- /* istanbul ignore else */
106
- if (template) {
107
- const templateEntry = {
108
- id,
109
- dependencies: []
110
- };
111
- // Visit each dependency, but only if this template is not in the alreadyVisitedIds list to avoid infinite loops
112
- /* istanbul ignore else */
113
- if (alreadyVisitedIds.indexOf(id) < 0) {
114
- // Add dependency to alreadyVisitedIds list
115
- alreadyVisitedIds.push(id);
116
- template.dependencies.forEach((dependencyId) => {
117
- // Remove dependency from list of templates to visit in the top-level loop
118
- const iDependencyTemplate = templateItemIds.indexOf(dependencyId);
119
- /* istanbul ignore else */
120
- if (iDependencyTemplate >= 0) {
121
- templateItemIds.splice(iDependencyTemplate, 1);
122
- }
123
- traceItemId(dependencyId, templateEntry.dependencies, alreadyVisitedIds);
124
- });
125
- }
126
- accumulatedHierarchy.push(templateEntry);
127
- }
128
- }
129
- // Start with top-level nodes and add in the rest of the nodes to catch cycles without top-level nodes
130
- let templateItemIds = _getTopLevelItemIds(templates);
131
- const otherItems = templates
132
- .filter((template) => templateItemIds.indexOf(template.itemId) < 0) // only keep non-top-level nodes
133
- .sort((a, b) => b.dependencies.length - a.dependencies.length); // sort so that nodes with more dependencies come first--reduces stubs
134
- templateItemIds = templateItemIds.concat(otherItems.map((template) => template.itemId));
135
- // Step through the list of nodes; we'll also remove nodes as we visit them
136
- let itemId = templateItemIds.shift();
137
- while (typeof itemId !== "undefined") {
138
- traceItemId(itemId, hierarchy);
139
- itemId = templateItemIds.shift();
140
- }
141
- return hierarchy;
142
- }
143
- /**
144
- * Explore the solution item templates for variables we will allow users to insert at runtime
145
- *
146
- * @param templates a list of item templates from the solution
147
- * @param translations nls translation object
148
- *
149
- * @returns a list of variables from the solution item templates
150
- */
151
- function getSolutionVariables(templates, translations) {
152
- const vars = [];
153
- templates.forEach(t => {
154
- const item = {
155
- id: t.itemId,
156
- title: t.item.title || t.item.name,
157
- type: t.type,
158
- value: undefined,
159
- dependencies: [{
160
- id: t.itemId,
161
- title: translations.itemId,
162
- value: `{{${t.itemId}.itemId}}`,
163
- }]
164
- };
165
- if (t.item.url) {
166
- item.dependencies.push({
167
- id: t.itemId,
168
- title: translations.url,
169
- value: `{{${t.itemId}.url}}`,
170
- });
171
- }
172
- if (t.type === "Feature Service") {
173
- // TODO need to set source service name var...
174
- // TODO need to set soure service shape field name "{{d05b3cf1ffcb4a4fa677627dfb18609e.name}}.Shape"
175
- item.dependencies.push({
176
- id: t.itemId,
177
- title: translations.solutionExtent,
178
- value: `{{${t.itemId}.solutionExtent}}`,
179
- });
180
- _addLayersOrTables(t.properties.layers || [], item, t, translations);
181
- _addLayersOrTables(t.properties.tables || [], item, t, translations);
182
- }
183
- vars.push(item);
184
- });
185
- return vars;
186
- }
187
- /**
188
- * Set key organization variables we will allow users to insert at runtime
189
- *
190
- * @param translations nls translation object
191
- *
192
- * @returns a list of variables for the organization
193
- */
194
- function getOrganizationVariables(translations) {
195
- const orgVars = [{
196
- id: "",
197
- title: translations.geocodeUrl,
198
- value: "{{organization.helperServices.geocode:getDefaultLocatorURL}}"
199
- }, {
200
- id: "",
201
- title: translations.geometryUrl,
202
- value: "{{organization.helperServices.geometry.url}}"
203
- }, {
204
- id: "",
205
- title: translations.portalBaseUrl,
206
- value: "{{portalBaseUrl}}"
207
- }, {
208
- id: "",
209
- title: translations.routeUrl,
210
- value: "{{organization.helperServices.route.url}}"
211
- }, {
212
- id: "",
213
- title: translations.solutionItemExtent,
214
- value: "{{solutionItemExtent}}"
215
- }];
216
- return orgVars;
217
- }
218
- //--------------------------------------------------------------------------
219
- //
220
- // Private Functions
221
- //
222
- //--------------------------------------------------------------------------
223
- /**
224
- * Explore a solution item template for variables we will allow users to insert at runtime.
225
- * This function will update the item argument that is passed in with the var details.
226
- *
227
- * @param children a list of layers or tables from a template
228
- * @param item an object that store key details for a given variable
229
- * @param template one of the templates from the current solution
230
- * @param translations nls translations object
231
- *
232
- */
233
- function _addLayersOrTables(children, item, template, translations) {
234
- children.forEach(l => {
235
- const name = l.name && l.name.indexOf("||") > -1 ? l.name.split("||")[1].replace("}}", "").trim() : l.name;
236
- item.dependencies.push({
237
- id: template.itemId,
238
- title: `${name} (${translations.id})`,
239
- value: `{{${template.itemId}.layer${l.id}.id}}`,
240
- });
241
- item.dependencies.push({
242
- id: template.itemId,
243
- title: `${name} (${translations.name})`,
244
- value: `{{${template.itemId}.layer${l.id}.name||${name}}}`,
245
- });
246
- });
247
- }
248
- /**
249
- * Capture key details from the solution item template
250
- *
251
- * @param template one of the templates from the current solution
252
- * @param templates full list of templates
253
- * @param dependencies list of hierarchical dependencies
254
- *
255
- * @returns an IInventoryItem that is used by other components to work with this template
256
- */
257
- function _getItemFromTemplate(template, templates, dependencies) {
258
- return {
259
- id: template.itemId || "",
260
- title: template.item.title || "",
261
- dependencies: _getDependencies(dependencies, templates),
262
- type: template.item.type || "",
263
- typeKeywords: template.item.typeKeywords || [] /*,
264
- solutionItem: {
265
- itemId: template.itemId,
266
- itemDetails: _getItemDetails(template.item, template.type === "Group"),
267
- isResource: _getIsResource(template),
268
- data: template.data,
269
- properties: template.properties,
270
- type: template.type,
271
- groupDetails: _getGroupDetails(template, templates)
272
- }*/
273
- };
274
- }
275
- /**
276
- * Capture key details from the solution item template
277
- *
278
- * @param dependencies list of dependencies from a template
279
- * @param templates full list of templates
280
- *
281
- * @returns a list of IInventoryItem that are used by other components to work with the templates
282
- */
283
- function _getDependencies(dependencies, templates) {
284
- const dependencyItems = [];
285
- const depIds = dependencies.reduce((prev, cur) => {
286
- prev.push(cur.id);
287
- dependencyItems.push(cur);
288
- return prev;
289
- }, []);
290
- return templates.reduce((prev, curr) => {
291
- const i = depIds.indexOf(curr.itemId);
292
- if (i > -1) {
293
- prev.push(_getItemFromTemplate(curr, templates, dependencyItems[i].dependencies));
294
- }
295
- return prev;
296
- }, []);
297
- }
298
- /**
299
- * Capture the key item details for a given template
300
- *
301
- * @param item the templates item
302
- * @param isGroup boolean to indicate if the item is a group
303
- * @param itemId the item id of the template
304
- *
305
- * @returns a IItemDetails object for the current item
306
- */
307
- /*
308
- function _getItemDetails(
309
- item: any,
310
- isGroup: boolean
311
- ): IItemDetails {
312
- return {
313
- title: item.title || "",
314
- snippet: item.snippet || "",
315
- description: item.description || "",
316
- tags: item.tags || [],
317
- accessInformation: !isGroup ? item.accessInformation || "" : "",
318
- licenseInfo: !isGroup ? item.licenseInfo || "" : ""
319
- };
320
- }
321
- */
322
- /**
323
- * Capture the key item details for a given group template
324
- *
325
- * @param template one of the templates from the current solution
326
- * @param templates full list of templates
327
- *
328
- * @returns a list of IItemShare objects
329
- */
330
- /*
331
- function _getGroupDetails(
332
- template: any,
333
- templates: any[]
334
- ): IItemShare[] {
335
- return template.type === "Group" ? templates.reduce((prev, cur) => {
336
- if (cur.itemId !== template.itemId && cur.type !== "Group") {
337
- prev.push({
338
- id: cur.itemId,
339
- title: cur.item.name || cur.item.title,
340
- isShared: (cur.groups || []).indexOf(template.itemId) > -1,
341
- shareItem: (cur.groups || []).indexOf(template.itemId) > -1,
342
- type: cur.type,
343
- typeKeywords: cur.item.typeKeywords
344
- });
345
- }
346
- return prev;
347
- }, []) : [];
348
- }
349
- */
350
- /**
351
- * Used to understand if we are dealing with a binary object that will support upload/download
352
- *
353
- * @param template one of the templates from the current solution
354
- *
355
- * @returns true if this item supports upload/download
356
- */
357
- /*
358
- function _getIsResource(
359
- template: any
360
- ): boolean {
361
- return template.type !== "Group" && template.resources.some(r => r.indexOf("_info_thumbnail") < 0) &&
362
- (template.data === null || JSON.stringify(template.data) === "{}");
363
- }
364
- */
365
- /**
366
- * Sort the template ids based on their dependencies
367
- *
368
- * @param templates full list of templates
369
- *
370
- * @returns a list of Itop level item ids
371
- */
372
- function _getTopLevelItemIds(templates) {
373
- // Find the top-level nodes. Start with all nodes, then remove those that other nodes depend on
374
- const topLevelItemCandidateIds = templates.map((template) => template.itemId);
375
- templates.forEach((template) => {
376
- (template.dependencies || []).forEach((dependencyId) => {
377
- const iNode = topLevelItemCandidateIds.indexOf(dependencyId);
378
- if (iNode >= 0) {
379
- // Node is somebody's dependency, so remove the node from the list of top-level nodes
380
- // If iNode == -1, then it's a shared dependency and it has already been removed
381
- topLevelItemCandidateIds.splice(iNode, 1);
382
- }
383
- });
384
- });
385
- return topLevelItemCandidateIds;
386
- }
387
-
388
- /* Copyright (c) 2017-2020 Environmental Systems Research Institute, Inc.
389
- * Apache-2.0 */
390
- function decodeParam(param) {
391
- var _a = param.split("="), key = _a[0], value = _a[1];
392
- return { key: decodeURIComponent(key), value: decodeURIComponent(value) };
393
- }
394
- /**
395
- * Decodes the passed query string as an object.
396
- *
397
- * @param query A string to be decoded.
398
- * @returns A decoded query param object.
399
- */
400
- function decodeQueryString(query) {
401
- return query
402
- .replace(/^#/, "")
403
- .split("&")
404
- .reduce(function (acc, entry) {
405
- var _a = decodeParam(entry), key = _a.key, value = _a.value;
406
- acc[key] = value;
407
- return acc;
408
- }, {});
409
- }
410
-
411
- /*! *****************************************************************************
412
- Copyright (c) Microsoft Corporation.
413
-
414
- Permission to use, copy, modify, and/or distribute this software for any
415
- purpose with or without fee is hereby granted.
416
-
417
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
418
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
419
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
420
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
421
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
422
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
423
- PERFORMANCE OF THIS SOFTWARE.
424
- ***************************************************************************** */
425
-
426
- var __assign = function() {
427
- __assign = Object.assign || function __assign(t) {
428
- for (var s, i = 1, n = arguments.length; i < n; i++) {
429
- s = arguments[i];
430
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
431
- }
432
- return t;
433
- };
434
- return __assign.apply(this, arguments);
435
- };
436
-
437
- /* Copyright (c) 2017 Environmental Systems Research Institute, Inc.
438
- * Apache-2.0 */
439
- function fetchToken(url, requestOptions) {
440
- var options = requestOptions;
441
- // we generate a response, so we can't return the raw response
442
- options.rawResponse = false;
443
- return request(url, options).then(function (response) {
444
- var r = {
445
- token: response.access_token,
446
- username: response.username,
447
- expires: new Date(
448
- // convert seconds in response to milliseconds and add the value to the current time to calculate a static expiration timestamp
449
- Date.now() + (response.expires_in * 1000 - 1000)),
450
- ssl: response.ssl === true
451
- };
452
- if (response.refresh_token) {
453
- r.refreshToken = response.refresh_token;
454
- }
455
- return r;
456
- });
457
- }
458
-
459
- /* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc.
460
- * Apache-2.0 */
461
- function generateToken(url, requestOptions) {
462
- var options = requestOptions;
463
- /* istanbul ignore else */
464
- if (typeof window !== "undefined" &&
465
- window.location &&
466
- window.location.host) {
467
- options.params.referer = window.location.host;
468
- }
469
- else {
470
- options.params.referer = NODEJS_DEFAULT_REFERER_HEADER;
471
- }
472
- return request(url, options);
473
- }
474
-
475
- /**
476
- * Used to test if a URL is an ArcGIS Online URL
477
- */
478
- var arcgisOnlineUrlRegex = /^https?:\/\/(\S+)\.arcgis\.com.+/;
479
- function isOnline(url) {
480
- return arcgisOnlineUrlRegex.test(url);
481
- }
482
- function normalizeOnlinePortalUrl(portalUrl) {
483
- if (!arcgisOnlineUrlRegex.test(portalUrl)) {
484
- return portalUrl;
485
- }
486
- switch (getOnlineEnvironment(portalUrl)) {
487
- case "dev":
488
- return "https://devext.arcgis.com/sharing/rest";
489
- case "qa":
490
- return "https://qaext.arcgis.com/sharing/rest";
491
- default:
492
- return "https://www.arcgis.com/sharing/rest";
493
- }
494
- }
495
- function getOnlineEnvironment(url) {
496
- if (!arcgisOnlineUrlRegex.test(url)) {
497
- return null;
498
- }
499
- var match = url.match(arcgisOnlineUrlRegex);
500
- var subdomain = match[1].split(".").pop();
501
- if (subdomain.includes("dev")) {
502
- return "dev";
503
- }
504
- if (subdomain.includes("qa")) {
505
- return "qa";
506
- }
507
- return "production";
508
- }
509
- function isFederated(owningSystemUrl, portalUrl) {
510
- var normalizedPortalUrl = cleanUrl(normalizeOnlinePortalUrl(portalUrl)).replace(/https?:\/\//, "");
511
- var normalizedOwningSystemUrl = cleanUrl(owningSystemUrl).replace(/https?:\/\//, "");
512
- return new RegExp(normalizedOwningSystemUrl, "i").test(normalizedPortalUrl);
513
- }
514
- function canUseOnlineToken(portalUrl, requestUrl) {
515
- var portalIsOnline = isOnline(portalUrl);
516
- var requestIsOnline = isOnline(requestUrl);
517
- var portalEnv = getOnlineEnvironment(portalUrl);
518
- var requestEnv = getOnlineEnvironment(requestUrl);
519
- if (portalIsOnline && requestIsOnline && portalEnv === requestEnv) {
520
- return true;
521
- }
522
- return false;
523
- }
524
-
525
- /* Copyright (c) 2018-2020 Environmental Systems Research Institute, Inc.
526
- * Apache-2.0 */
527
- /**
528
- * Validates that the user has access to the application
529
- * and if they user should be presented a "View Only" mode
530
- *
531
- * This is only needed/valid for Esri applications that are "licensed"
532
- * and shipped in ArcGIS Online or ArcGIS Enterprise. Most custom applications
533
- * should not need or use this.
534
- *
535
- * ```js
536
- * import { validateAppAccess } from '@esri/arcgis-rest-auth';
537
- *
538
- * return validateAppAccess('your-token', 'theClientId')
539
- * .then((result) => {
540
- * if (!result.value) {
541
- * // redirect or show some other ui
542
- * } else {
543
- * if (result.viewOnlyUserTypeApp) {
544
- * // use this to inform your app to show a "View Only" mode
545
- * }
546
- * }
547
- * })
548
- * .catch((err) => {
549
- * // two possible errors
550
- * // invalid clientId: {"error":{"code":400,"messageCode":"GWM_0007","message":"Invalid request","details":[]}}
551
- * // invalid token: {"error":{"code":498,"message":"Invalid token.","details":[]}}
552
- * })
553
- * ```
554
- *
555
- * Note: This is only usable by Esri applications hosted on *arcgis.com, *esri.com or within
556
- * an ArcGIS Enterprise installation. Custom applications can not use this.
557
- *
558
- * @param token platform token
559
- * @param clientId application client id
560
- * @param portal Optional
561
- */
562
- function validateAppAccess(token, clientId, portal) {
563
- if (portal === void 0) { portal = "https://www.arcgis.com/sharing/rest"; }
564
- var url = portal + "/oauth2/validateAppAccess";
565
- var ro = {
566
- method: "POST",
567
- params: {
568
- f: "json",
569
- client_id: clientId,
570
- token: token,
571
- },
572
- };
573
- return request(url, ro);
574
- }
575
-
576
- /* Copyright (c) 2017-2019 Environmental Systems Research Institute, Inc.
577
- * Apache-2.0 */
578
- function defer() {
579
- var deferred = {
580
- promise: null,
581
- resolve: null,
582
- reject: null,
583
- };
584
- deferred.promise = new Promise(function (resolve, reject) {
585
- deferred.resolve = resolve;
586
- deferred.reject = reject;
587
- });
588
- return deferred;
589
- }
590
- /**
591
- * ```js
592
- * import { UserSession } from '@esri/arcgis-rest-auth';
593
- * UserSession.beginOAuth2({
594
- * // register an app of your own to create a unique clientId
595
- * clientId: "abc123",
596
- * redirectUri: 'https://yourapp.com/authenticate.html'
597
- * })
598
- * .then(session)
599
- * // or
600
- * new UserSession({
601
- * username: "jsmith",
602
- * password: "123456"
603
- * })
604
- * // or
605
- * UserSession.deserialize(cache)
606
- * ```
607
- * Used to authenticate both ArcGIS Online and ArcGIS Enterprise users. `UserSession` includes helper methods for [OAuth 2.0](/arcgis-rest-js/guides/browser-authentication/) in both browser and server applications.
608
- */
609
- var UserSession = /** @class */ (function () {
610
- function UserSession(options) {
611
- this.clientId = options.clientId;
612
- this._refreshToken = options.refreshToken;
613
- this._refreshTokenExpires = options.refreshTokenExpires;
614
- this.username = options.username;
615
- this.password = options.password;
616
- this._token = options.token;
617
- this._tokenExpires = options.tokenExpires;
618
- this.portal = options.portal
619
- ? cleanUrl(options.portal)
620
- : "https://www.arcgis.com/sharing/rest";
621
- this.ssl = options.ssl;
622
- this.provider = options.provider || "arcgis";
623
- this.tokenDuration = options.tokenDuration || 20160;
624
- this.redirectUri = options.redirectUri;
625
- this.refreshTokenTTL = options.refreshTokenTTL || 20160;
626
- this.server = options.server;
627
- this.federatedServers = {};
628
- this.trustedDomains = [];
629
- // if a non-federated server was passed explicitly, it should be trusted.
630
- if (options.server) {
631
- // if the url includes more than '/arcgis/', trim the rest
632
- var root = this.getServerRootUrl(options.server);
633
- this.federatedServers[root] = {
634
- token: options.token,
635
- expires: options.tokenExpires,
636
- };
637
- }
638
- this._pendingTokenRequests = {};
639
- }
640
- Object.defineProperty(UserSession.prototype, "token", {
641
- /**
642
- * The current ArcGIS Online or ArcGIS Enterprise `token`.
643
- */
644
- get: function () {
645
- return this._token;
646
- },
647
- enumerable: false,
648
- configurable: true
649
- });
650
- Object.defineProperty(UserSession.prototype, "tokenExpires", {
651
- /**
652
- * The expiration time of the current `token`.
653
- */
654
- get: function () {
655
- return this._tokenExpires;
656
- },
657
- enumerable: false,
658
- configurable: true
659
- });
660
- Object.defineProperty(UserSession.prototype, "refreshToken", {
661
- /**
662
- * The current token to ArcGIS Online or ArcGIS Enterprise.
663
- */
664
- get: function () {
665
- return this._refreshToken;
666
- },
667
- enumerable: false,
668
- configurable: true
669
- });
670
- Object.defineProperty(UserSession.prototype, "refreshTokenExpires", {
671
- /**
672
- * The expiration time of the current `refreshToken`.
673
- */
674
- get: function () {
675
- return this._refreshTokenExpires;
676
- },
677
- enumerable: false,
678
- configurable: true
679
- });
680
- Object.defineProperty(UserSession.prototype, "trustedServers", {
681
- /**
682
- * Deprecated, use `federatedServers` instead.
683
- *
684
- * @deprecated
685
- */
686
- get: function () {
687
- console.log("DEPRECATED: use federatedServers instead");
688
- return this.federatedServers;
689
- },
690
- enumerable: false,
691
- configurable: true
692
- });
693
- /**
694
- * Begins a new browser-based OAuth 2.0 sign in. If `options.popup` is `true` the
695
- * authentication window will open in a new tab/window and the function will return
696
- * Promise&lt;UserSession&gt;. Otherwise, the user will be redirected to the
697
- * authorization page in their current tab/window and the function will return `undefined`.
698
- *
699
- * @browserOnly
700
- */
701
- /* istanbul ignore next */
702
- UserSession.beginOAuth2 = function (options, win) {
703
- if (win === void 0) { win = window; }
704
- if (options.duration) {
705
- console.log("DEPRECATED: 'duration' is deprecated - use 'expiration' instead");
706
- }
707
- var _a = __assign({
708
- portal: "https://www.arcgis.com/sharing/rest",
709
- provider: "arcgis",
710
- expiration: 20160,
711
- popup: true,
712
- popupWindowFeatures: "height=400,width=600,menubar=no,location=yes,resizable=yes,scrollbars=yes,status=yes",
713
- state: options.clientId,
714
- locale: "",
715
- }, options), portal = _a.portal, provider = _a.provider, clientId = _a.clientId, expiration = _a.expiration, redirectUri = _a.redirectUri, popup = _a.popup, popupWindowFeatures = _a.popupWindowFeatures, state = _a.state, locale = _a.locale, params = _a.params;
716
- var url;
717
- if (provider === "arcgis") {
718
- url = portal + "/oauth2/authorize?client_id=" + clientId + "&response_type=token&expiration=" + (options.duration || expiration) + "&redirect_uri=" + encodeURIComponent(redirectUri) + "&state=" + state + "&locale=" + locale;
719
- }
720
- else {
721
- url = portal + "/oauth2/social/authorize?client_id=" + clientId + "&socialLoginProviderName=" + provider + "&autoAccountCreateForSocial=true&response_type=token&expiration=" + (options.duration || expiration) + "&redirect_uri=" + encodeURIComponent(redirectUri) + "&state=" + state + "&locale=" + locale;
722
- }
723
- // append additional params
724
- if (params) {
725
- url = url + "&" + encodeQueryString(params);
726
- }
727
- if (!popup) {
728
- win.location.href = url;
729
- return undefined;
730
- }
731
- var session = defer();
732
- win["__ESRI_REST_AUTH_HANDLER_" + clientId] = function (errorString, oauthInfoString) {
733
- if (errorString) {
734
- var error = JSON.parse(errorString);
735
- session.reject(new ArcGISAuthError(error.errorMessage, error.error));
736
- return;
737
- }
738
- if (oauthInfoString) {
739
- var oauthInfo = JSON.parse(oauthInfoString);
740
- session.resolve(new UserSession({
741
- clientId: clientId,
742
- portal: portal,
743
- ssl: oauthInfo.ssl,
744
- token: oauthInfo.token,
745
- tokenExpires: new Date(oauthInfo.expires),
746
- username: oauthInfo.username,
747
- }));
748
- }
749
- };
750
- win.open(url, "oauth-window", popupWindowFeatures);
751
- return session.promise;
752
- };
753
- /**
754
- * Completes a browser-based OAuth 2.0 sign in. If `options.popup` is `true` the user
755
- * will be returned to the previous window. Otherwise a new `UserSession`
756
- * will be returned. You must pass the same values for `options.popup` and
757
- * `options.portal` as you used in `beginOAuth2()`.
758
- *
759
- * @browserOnly
760
- */
761
- /* istanbul ignore next */
762
- UserSession.completeOAuth2 = function (options, win) {
763
- if (win === void 0) { win = window; }
764
- var _a = __assign({ portal: "https://www.arcgis.com/sharing/rest", popup: true }, options), portal = _a.portal, clientId = _a.clientId, popup = _a.popup;
765
- function completeSignIn(error, oauthInfo) {
766
- try {
767
- var handlerFn = void 0;
768
- var handlerFnName = "__ESRI_REST_AUTH_HANDLER_" + clientId;
769
- if (popup) {
770
- // Guard b/c IE does not support window.opener
771
- if (win.opener) {
772
- if (win.opener.parent && win.opener.parent[handlerFnName]) {
773
- handlerFn = win.opener.parent[handlerFnName];
774
- }
775
- else if (win.opener && win.opener[handlerFnName]) {
776
- // support pop-out oauth from within an iframe
777
- handlerFn = win.opener[handlerFnName];
778
- }
779
- }
780
- else {
781
- // IE
782
- if (win !== win.parent && win.parent && win.parent[handlerFnName]) {
783
- handlerFn = win.parent[handlerFnName];
784
- }
785
- }
786
- // if we have a handler fn, call it and close the window
787
- if (handlerFn) {
788
- handlerFn(error ? JSON.stringify(error) : undefined, JSON.stringify(oauthInfo));
789
- win.close();
790
- return undefined;
791
- }
792
- }
793
- }
794
- catch (e) {
795
- throw new ArcGISAuthError("Unable to complete authentication. It's possible you specified popup based oAuth2 but no handler from \"beginOAuth2()\" present. This generally happens because the \"popup\" option differs between \"beginOAuth2()\" and \"completeOAuth2()\".");
796
- }
797
- if (error) {
798
- throw new ArcGISAuthError(error.errorMessage, error.error);
799
- }
800
- return new UserSession({
801
- clientId: clientId,
802
- portal: portal,
803
- ssl: oauthInfo.ssl,
804
- token: oauthInfo.token,
805
- tokenExpires: oauthInfo.expires,
806
- username: oauthInfo.username,
807
- });
808
- }
809
- var params = decodeQueryString(win.location.hash);
810
- if (!params.access_token) {
811
- var error = void 0;
812
- var errorMessage = "Unknown error";
813
- if (params.error) {
814
- error = params.error;
815
- errorMessage = params.error_description;
816
- }
817
- return completeSignIn({ error: error, errorMessage: errorMessage });
818
- }
819
- var token = params.access_token;
820
- var expires = new Date(Date.now() + parseInt(params.expires_in, 10) * 1000 - 60 * 1000);
821
- var username = params.username;
822
- var ssl = params.ssl === "true";
823
- return completeSignIn(undefined, {
824
- token: token,
825
- expires: expires,
826
- ssl: ssl,
827
- username: username,
828
- });
829
- };
830
- /**
831
- * Request session information from the parent application
832
- *
833
- * When an application is embedded into another application via an IFrame, the embedded app can
834
- * use `window.postMessage` to request credentials from the host application. This function wraps
835
- * that behavior.
836
- *
837
- * The ArcGIS API for Javascript has this built into the Identity Manager as of the 4.19 release.
838
- *
839
- * Note: The parent application will not respond if the embedded app's origin is not:
840
- * - the same origin as the parent or *.arcgis.com (JSAPI)
841
- * - in the list of valid child origins (REST-JS)
842
- *
843
- *
844
- * @param parentOrigin origin of the parent frame. Passed into the embedded application as `parentOrigin` query param
845
- * @browserOnly
846
- */
847
- UserSession.fromParent = function (parentOrigin, win) {
848
- /* istanbul ignore next: must pass in a mockwindow for tests so we can't cover the other branch */
849
- if (!win && window) {
850
- win = window;
851
- }
852
- // Declare handler outside of promise scope so we can detach it
853
- var handler;
854
- // return a promise that will resolve when the handler receives
855
- // session information from the correct origin
856
- return new Promise(function (resolve, reject) {
857
- // create an event handler that just wraps the parentMessageHandler
858
- handler = function (event) {
859
- // ensure we only listen to events from the parent
860
- if (event.source === win.parent && event.data) {
861
- try {
862
- return resolve(UserSession.parentMessageHandler(event));
863
- }
864
- catch (err) {
865
- return reject(err);
866
- }
867
- }
868
- };
869
- // add listener
870
- win.addEventListener("message", handler, false);
871
- win.parent.postMessage({ type: "arcgis:auth:requestCredential" }, parentOrigin);
872
- }).then(function (session) {
873
- win.removeEventListener("message", handler, false);
874
- return session;
875
- });
876
- };
877
- /**
878
- * Begins a new server-based OAuth 2.0 sign in. This will redirect the user to
879
- * the ArcGIS Online or ArcGIS Enterprise authorization page.
880
- *
881
- * @nodeOnly
882
- */
883
- UserSession.authorize = function (options, response) {
884
- if (options.duration) {
885
- console.log("DEPRECATED: 'duration' is deprecated - use 'expiration' instead");
886
- }
887
- var _a = __assign({ portal: "https://arcgis.com/sharing/rest", expiration: 20160 }, options), portal = _a.portal, clientId = _a.clientId, expiration = _a.expiration, redirectUri = _a.redirectUri;
888
- response.writeHead(301, {
889
- Location: portal + "/oauth2/authorize?client_id=" + clientId + "&expiration=" + (options.duration || expiration) + "&response_type=code&redirect_uri=" + encodeURIComponent(redirectUri),
890
- });
891
- response.end();
892
- };
893
- /**
894
- * Completes the server-based OAuth 2.0 sign in process by exchanging the `authorizationCode`
895
- * for a `access_token`.
896
- *
897
- * @nodeOnly
898
- */
899
- UserSession.exchangeAuthorizationCode = function (options, authorizationCode) {
900
- var _a = __assign({
901
- portal: "https://www.arcgis.com/sharing/rest",
902
- refreshTokenTTL: 20160,
903
- }, options), portal = _a.portal, clientId = _a.clientId, redirectUri = _a.redirectUri, refreshTokenTTL = _a.refreshTokenTTL;
904
- return fetchToken(portal + "/oauth2/token", {
905
- params: {
906
- grant_type: "authorization_code",
907
- client_id: clientId,
908
- redirect_uri: redirectUri,
909
- code: authorizationCode,
910
- },
911
- }).then(function (response) {
912
- return new UserSession({
913
- clientId: clientId,
914
- portal: portal,
915
- ssl: response.ssl,
916
- redirectUri: redirectUri,
917
- refreshToken: response.refreshToken,
918
- refreshTokenTTL: refreshTokenTTL,
919
- refreshTokenExpires: new Date(Date.now() + (refreshTokenTTL - 1) * 60 * 1000),
920
- token: response.token,
921
- tokenExpires: response.expires,
922
- username: response.username,
923
- });
924
- });
925
- };
926
- UserSession.deserialize = function (str) {
927
- var options = JSON.parse(str);
928
- return new UserSession({
929
- clientId: options.clientId,
930
- refreshToken: options.refreshToken,
931
- refreshTokenExpires: new Date(options.refreshTokenExpires),
932
- username: options.username,
933
- password: options.password,
934
- token: options.token,
935
- tokenExpires: new Date(options.tokenExpires),
936
- portal: options.portal,
937
- ssl: options.ssl,
938
- tokenDuration: options.tokenDuration,
939
- redirectUri: options.redirectUri,
940
- refreshTokenTTL: options.refreshTokenTTL,
941
- });
942
- };
943
- /**
944
- * Translates authentication from the format used in the [ArcGIS API for JavaScript](https://developers.arcgis.com/javascript/).
945
- *
946
- * ```js
947
- * UserSession.fromCredential({
948
- * userId: "jsmith",
949
- * token: "secret"
950
- * });
951
- * ```
952
- *
953
- * @returns UserSession
954
- */
955
- UserSession.fromCredential = function (credential) {
956
- // At ArcGIS Online 9.1, credentials no longer include the ssl and expires properties
957
- // Here, we provide default values for them to cover this condition
958
- var ssl = typeof credential.ssl !== "undefined" ? credential.ssl : true;
959
- var expires = credential.expires || Date.now() + 7200000; /* 2 hours */
960
- return new UserSession({
961
- portal: credential.server.includes("sharing/rest")
962
- ? credential.server
963
- : credential.server + "/sharing/rest",
964
- ssl: ssl,
965
- token: credential.token,
966
- username: credential.userId,
967
- tokenExpires: new Date(expires),
968
- });
969
- };
970
- /**
971
- * Handle the response from the parent
972
- * @param event DOM Event
973
- */
974
- UserSession.parentMessageHandler = function (event) {
975
- if (event.data.type === "arcgis:auth:credential") {
976
- return UserSession.fromCredential(event.data.credential);
977
- }
978
- if (event.data.type === "arcgis:auth:error") {
979
- var err = new Error(event.data.error.message);
980
- err.name = event.data.error.name;
981
- throw err;
982
- }
983
- else {
984
- throw new Error("Unknown message type.");
985
- }
986
- };
987
- /**
988
- * Returns authentication in a format useable in the [ArcGIS API for JavaScript](https://developers.arcgis.com/javascript/).
989
- *
990
- * ```js
991
- * esriId.registerToken(session.toCredential());
992
- * ```
993
- *
994
- * @returns ICredential
995
- */
996
- UserSession.prototype.toCredential = function () {
997
- return {
998
- expires: this.tokenExpires.getTime(),
999
- server: this.portal,
1000
- ssl: this.ssl,
1001
- token: this.token,
1002
- userId: this.username,
1003
- };
1004
- };
1005
- /**
1006
- * Returns information about the currently logged in [user](https://developers.arcgis.com/rest/users-groups-and-items/user.htm). Subsequent calls will *not* result in additional web traffic.
1007
- *
1008
- * ```js
1009
- * session.getUser()
1010
- * .then(response => {
1011
- * console.log(response.role); // "org_admin"
1012
- * })
1013
- * ```
1014
- *
1015
- * @param requestOptions - Options for the request. NOTE: `rawResponse` is not supported by this operation.
1016
- * @returns A Promise that will resolve with the data from the response.
1017
- */
1018
- UserSession.prototype.getUser = function (requestOptions) {
1019
- var _this = this;
1020
- if (this._pendingUserRequest) {
1021
- return this._pendingUserRequest;
1022
- }
1023
- else if (this._user) {
1024
- return Promise.resolve(this._user);
1025
- }
1026
- else {
1027
- var url = this.portal + "/community/self";
1028
- var options = __assign(__assign({ httpMethod: "GET", authentication: this }, requestOptions), { rawResponse: false });
1029
- this._pendingUserRequest = request(url, options).then(function (response) {
1030
- _this._user = response;
1031
- _this._pendingUserRequest = null;
1032
- return response;
1033
- });
1034
- return this._pendingUserRequest;
1035
- }
1036
- };
1037
- /**
1038
- * Returns information about the currently logged in user's [portal](https://developers.arcgis.com/rest/users-groups-and-items/portal-self.htm). Subsequent calls will *not* result in additional web traffic.
1039
- *
1040
- * ```js
1041
- * session.getPortal()
1042
- * .then(response => {
1043
- * console.log(portal.name); // "City of ..."
1044
- * })
1045
- * ```
1046
- *
1047
- * @param requestOptions - Options for the request. NOTE: `rawResponse` is not supported by this operation.
1048
- * @returns A Promise that will resolve with the data from the response.
1049
- */
1050
- UserSession.prototype.getPortal = function (requestOptions) {
1051
- var _this = this;
1052
- if (this._pendingPortalRequest) {
1053
- return this._pendingPortalRequest;
1054
- }
1055
- else if (this._portalInfo) {
1056
- return Promise.resolve(this._portalInfo);
1057
- }
1058
- else {
1059
- var url = this.portal + "/portals/self";
1060
- var options = __assign(__assign({ httpMethod: "GET", authentication: this }, requestOptions), { rawResponse: false });
1061
- this._pendingPortalRequest = request(url, options).then(function (response) {
1062
- _this._portalInfo = response;
1063
- _this._pendingPortalRequest = null;
1064
- return response;
1065
- });
1066
- return this._pendingPortalRequest;
1067
- }
1068
- };
1069
- /**
1070
- * Returns the username for the currently logged in [user](https://developers.arcgis.com/rest/users-groups-and-items/user.htm). Subsequent calls will *not* result in additional web traffic. This is also used internally when a username is required for some requests but is not present in the options.
1071
- *
1072
- * * ```js
1073
- * session.getUsername()
1074
- * .then(response => {
1075
- * console.log(response); // "casey_jones"
1076
- * })
1077
- * ```
1078
- */
1079
- UserSession.prototype.getUsername = function () {
1080
- if (this.username) {
1081
- return Promise.resolve(this.username);
1082
- }
1083
- else if (this._user) {
1084
- return Promise.resolve(this._user.username);
1085
- }
1086
- else {
1087
- return this.getUser().then(function (user) {
1088
- return user.username;
1089
- });
1090
- }
1091
- };
1092
- /**
1093
- * Gets an appropriate token for the given URL. If `portal` is ArcGIS Online and
1094
- * the request is to an ArcGIS Online domain `token` will be used. If the request
1095
- * is to the current `portal` the current `token` will also be used. However if
1096
- * the request is to an unknown server we will validate the server with a request
1097
- * to our current `portal`.
1098
- */
1099
- UserSession.prototype.getToken = function (url, requestOptions) {
1100
- if (canUseOnlineToken(this.portal, url)) {
1101
- return this.getFreshToken(requestOptions);
1102
- }
1103
- else if (new RegExp(this.portal, "i").test(url)) {
1104
- return this.getFreshToken(requestOptions);
1105
- }
1106
- else {
1107
- return this.getTokenForServer(url, requestOptions);
1108
- }
1109
- };
1110
- /**
1111
- * Get application access information for the current user
1112
- * see `validateAppAccess` function for details
1113
- *
1114
- * @param clientId application client id
1115
- */
1116
- UserSession.prototype.validateAppAccess = function (clientId) {
1117
- return this.getToken(this.portal).then(function (token) {
1118
- return validateAppAccess(token, clientId);
1119
- });
1120
- };
1121
- UserSession.prototype.toJSON = function () {
1122
- return {
1123
- clientId: this.clientId,
1124
- refreshToken: this.refreshToken,
1125
- refreshTokenExpires: this.refreshTokenExpires,
1126
- username: this.username,
1127
- password: this.password,
1128
- token: this.token,
1129
- tokenExpires: this.tokenExpires,
1130
- portal: this.portal,
1131
- ssl: this.ssl,
1132
- tokenDuration: this.tokenDuration,
1133
- redirectUri: this.redirectUri,
1134
- refreshTokenTTL: this.refreshTokenTTL,
1135
- };
1136
- };
1137
- UserSession.prototype.serialize = function () {
1138
- return JSON.stringify(this);
1139
- };
1140
- /**
1141
- * For a "Host" app that embeds other platform apps via iframes, after authenticating the user
1142
- * and creating a UserSession, the app can then enable "post message" style authentication by calling
1143
- * this method.
1144
- *
1145
- * Internally this adds an event listener on window for the `message` event
1146
- *
1147
- * @param validChildOrigins Array of origins that are allowed to request authentication from the host app
1148
- */
1149
- UserSession.prototype.enablePostMessageAuth = function (validChildOrigins, win) {
1150
- /* istanbul ignore next: must pass in a mockwindow for tests so we can't cover the other branch */
1151
- if (!win && window) {
1152
- win = window;
1153
- }
1154
- this._hostHandler = this.createPostMessageHandler(validChildOrigins);
1155
- win.addEventListener("message", this._hostHandler, false);
1156
- };
1157
- /**
1158
- * For a "Host" app that has embedded other platform apps via iframes, when the host needs
1159
- * to transition routes, it should call `UserSession.disablePostMessageAuth()` to remove
1160
- * the event listener and prevent memory leaks
1161
- */
1162
- UserSession.prototype.disablePostMessageAuth = function (win) {
1163
- /* istanbul ignore next: must pass in a mockwindow for tests so we can't cover the other branch */
1164
- if (!win && window) {
1165
- win = window;
1166
- }
1167
- win.removeEventListener("message", this._hostHandler, false);
1168
- };
1169
- /**
1170
- * Manually refreshes the current `token` and `tokenExpires`.
1171
- */
1172
- UserSession.prototype.refreshSession = function (requestOptions) {
1173
- // make sure subsequent calls to getUser() don't returned cached metadata
1174
- this._user = null;
1175
- if (this.username && this.password) {
1176
- return this.refreshWithUsernameAndPassword(requestOptions);
1177
- }
1178
- if (this.clientId && this.refreshToken) {
1179
- return this.refreshWithRefreshToken();
1180
- }
1181
- return Promise.reject(new ArcGISAuthError("Unable to refresh token."));
1182
- };
1183
- /**
1184
- * Determines the root of the ArcGIS Server or Portal for a given URL.
1185
- *
1186
- * @param url the URl to determine the root url for.
1187
- */
1188
- UserSession.prototype.getServerRootUrl = function (url) {
1189
- var root = cleanUrl(url).split(/\/rest(\/admin)?\/services(?:\/|#|\?|$)/)[0];
1190
- var _a = root.match(/(https?:\/\/)(.+)/), protocol = _a[1], domainAndPath = _a[2];
1191
- var _b = domainAndPath.split("/"), domain = _b[0], path = _b.slice(1);
1192
- // only the domain is lowercased because in some cases an org id might be
1193
- // in the path which cannot be lowercased.
1194
- return "" + protocol + domain.toLowerCase() + "/" + path.join("/");
1195
- };
1196
- /**
1197
- * Returns the proper [`credentials`] option for `fetch` for a given domain.
1198
- * See [trusted server](https://enterprise.arcgis.com/en/portal/latest/administer/windows/configure-security.htm#ESRI_SECTION1_70CC159B3540440AB325BE5D89DBE94A).
1199
- * Used internally by underlying request methods to add support for specific security considerations.
1200
- *
1201
- * @param url The url of the request
1202
- * @returns "include" or "same-origin"
1203
- */
1204
- UserSession.prototype.getDomainCredentials = function (url) {
1205
- if (!this.trustedDomains || !this.trustedDomains.length) {
1206
- return "same-origin";
1207
- }
1208
- return this.trustedDomains.some(function (domainWithProtocol) {
1209
- return url.startsWith(domainWithProtocol);
1210
- })
1211
- ? "include"
1212
- : "same-origin";
1213
- };
1214
- /**
1215
- * Return a function that closes over the validOrigins array and
1216
- * can be used as an event handler for the `message` event
1217
- *
1218
- * @param validOrigins Array of valid origins
1219
- */
1220
- UserSession.prototype.createPostMessageHandler = function (validOrigins) {
1221
- var _this = this;
1222
- // return a function that closes over the validOrigins and
1223
- // has access to the credential
1224
- return function (event) {
1225
- // Verify that the origin is valid
1226
- // Note: do not use regex's here. validOrigins is an array so we're checking that the event's origin
1227
- // is in the array via exact match. More info about avoiding postMessage xss issues here
1228
- // https://jlajara.gitlab.io/web/2020/07/17/Dom_XSS_PostMessage_2.html#tipsbypasses-in-postmessage-vulnerabilities
1229
- var isValidOrigin = validOrigins.indexOf(event.origin) > -1;
1230
- // JSAPI handles this slightly differently - instead of checking a list, it will respond if
1231
- // event.origin === window.location.origin || event.origin.endsWith('.arcgis.com')
1232
- // For Hub, and to enable cross domain debugging with port's in urls, we are opting to
1233
- // use a list of valid origins
1234
- // Ensure the message type is something we want to handle
1235
- var isValidType = event.data.type === "arcgis:auth:requestCredential";
1236
- var isTokenValid = _this.tokenExpires.getTime() > Date.now();
1237
- if (isValidOrigin && isValidType) {
1238
- var msg = {};
1239
- if (isTokenValid) {
1240
- var credential = _this.toCredential();
1241
- // arcgis:auth:error with {name: "", message: ""}
1242
- // the following line allows us to conform to our spec without changing other depended-on functionality
1243
- // https://github.com/Esri/arcgis-rest-js/blob/master/packages/arcgis-rest-auth/post-message-auth-spec.md#arcgisauthcredential
1244
- credential.server = credential.server.replace("/sharing/rest", "");
1245
- msg = { type: "arcgis:auth:credential", credential: credential };
1246
- }
1247
- else {
1248
- // Return an error
1249
- msg = {
1250
- type: "arcgis:auth:error",
1251
- error: {
1252
- name: "tokenExpiredError",
1253
- message: "Session token was expired, and not returned to the child application",
1254
- },
1255
- };
1256
- }
1257
- event.source.postMessage(msg, event.origin);
1258
- }
1259
- };
1260
- };
1261
- /**
1262
- * Validates that a given URL is properly federated with our current `portal`.
1263
- * Attempts to use the internal `federatedServers` cache first.
1264
- */
1265
- UserSession.prototype.getTokenForServer = function (url, requestOptions) {
1266
- var _this = this;
1267
- // requests to /rest/services/ and /rest/admin/services/ are both valid
1268
- // Federated servers may have inconsistent casing, so lowerCase it
1269
- var root = this.getServerRootUrl(url);
1270
- var existingToken = this.federatedServers[root];
1271
- if (existingToken &&
1272
- existingToken.expires &&
1273
- existingToken.expires.getTime() > Date.now()) {
1274
- return Promise.resolve(existingToken.token);
1275
- }
1276
- if (this._pendingTokenRequests[root]) {
1277
- return this._pendingTokenRequests[root];
1278
- }
1279
- this._pendingTokenRequests[root] = this.fetchAuthorizedDomains().then(function () {
1280
- return request(root + "/rest/info", {
1281
- credentials: _this.getDomainCredentials(url),
1282
- })
1283
- .then(function (response) {
1284
- if (response.owningSystemUrl) {
1285
- /**
1286
- * if this server is not owned by this portal
1287
- * bail out with an error since we know we wont
1288
- * be able to generate a token
1289
- */
1290
- if (!isFederated(response.owningSystemUrl, _this.portal)) {
1291
- throw new ArcGISAuthError(url + " is not federated with " + _this.portal + ".", "NOT_FEDERATED");
1292
- }
1293
- else {
1294
- /**
1295
- * if the server is federated, use the relevant token endpoint.
1296
- */
1297
- return request(response.owningSystemUrl + "/sharing/rest/info", requestOptions);
1298
- }
1299
- }
1300
- else if (response.authInfo &&
1301
- _this.federatedServers[root] !== undefined) {
1302
- /**
1303
- * if its a stand-alone instance of ArcGIS Server that doesn't advertise
1304
- * federation, but the root server url is recognized, use its built in token endpoint.
1305
- */
1306
- return Promise.resolve({
1307
- authInfo: response.authInfo,
1308
- });
1309
- }
1310
- else {
1311
- throw new ArcGISAuthError(url + " is not federated with any portal and is not explicitly trusted.", "NOT_FEDERATED");
1312
- }
1313
- })
1314
- .then(function (response) {
1315
- return response.authInfo.tokenServicesUrl;
1316
- })
1317
- .then(function (tokenServicesUrl) {
1318
- // an expired token cant be used to generate a new token
1319
- if (_this.token && _this.tokenExpires.getTime() > Date.now()) {
1320
- return generateToken(tokenServicesUrl, {
1321
- params: {
1322
- token: _this.token,
1323
- serverUrl: url,
1324
- expiration: _this.tokenDuration,
1325
- client: "referer",
1326
- },
1327
- });
1328
- // generate an entirely fresh token if necessary
1329
- }
1330
- else {
1331
- return generateToken(tokenServicesUrl, {
1332
- params: {
1333
- username: _this.username,
1334
- password: _this.password,
1335
- expiration: _this.tokenDuration,
1336
- client: "referer",
1337
- },
1338
- }).then(function (response) {
1339
- _this._token = response.token;
1340
- _this._tokenExpires = new Date(response.expires);
1341
- return response;
1342
- });
1343
- }
1344
- })
1345
- .then(function (response) {
1346
- _this.federatedServers[root] = {
1347
- expires: new Date(response.expires),
1348
- token: response.token,
1349
- };
1350
- delete _this._pendingTokenRequests[root];
1351
- return response.token;
1352
- });
1353
- });
1354
- return this._pendingTokenRequests[root];
1355
- };
1356
- /**
1357
- * Returns an unexpired token for the current `portal`.
1358
- */
1359
- UserSession.prototype.getFreshToken = function (requestOptions) {
1360
- var _this = this;
1361
- if (this.token && !this.tokenExpires) {
1362
- return Promise.resolve(this.token);
1363
- }
1364
- if (this.token &&
1365
- this.tokenExpires &&
1366
- this.tokenExpires.getTime() > Date.now()) {
1367
- return Promise.resolve(this.token);
1368
- }
1369
- if (!this._pendingTokenRequests[this.portal]) {
1370
- this._pendingTokenRequests[this.portal] = this.refreshSession(requestOptions).then(function (session) {
1371
- _this._pendingTokenRequests[_this.portal] = null;
1372
- return session.token;
1373
- });
1374
- }
1375
- return this._pendingTokenRequests[this.portal];
1376
- };
1377
- /**
1378
- * Refreshes the current `token` and `tokenExpires` with `username` and
1379
- * `password`.
1380
- */
1381
- UserSession.prototype.refreshWithUsernameAndPassword = function (requestOptions) {
1382
- var _this = this;
1383
- var options = __assign({ params: {
1384
- username: this.username,
1385
- password: this.password,
1386
- expiration: this.tokenDuration,
1387
- } }, requestOptions);
1388
- return generateToken(this.portal + "/generateToken", options).then(function (response) {
1389
- _this._token = response.token;
1390
- _this._tokenExpires = new Date(response.expires);
1391
- return _this;
1392
- });
1393
- };
1394
- /**
1395
- * Refreshes the current `token` and `tokenExpires` with `refreshToken`.
1396
- */
1397
- UserSession.prototype.refreshWithRefreshToken = function (requestOptions) {
1398
- var _this = this;
1399
- if (this.refreshToken &&
1400
- this.refreshTokenExpires &&
1401
- this.refreshTokenExpires.getTime() < Date.now()) {
1402
- return this.refreshRefreshToken(requestOptions);
1403
- }
1404
- var options = __assign({ params: {
1405
- client_id: this.clientId,
1406
- refresh_token: this.refreshToken,
1407
- grant_type: "refresh_token",
1408
- } }, requestOptions);
1409
- return fetchToken(this.portal + "/oauth2/token", options).then(function (response) {
1410
- _this._token = response.token;
1411
- _this._tokenExpires = response.expires;
1412
- return _this;
1413
- });
1414
- };
1415
- /**
1416
- * Exchanges an unexpired `refreshToken` for a new one, also updates `token` and
1417
- * `tokenExpires`.
1418
- */
1419
- UserSession.prototype.refreshRefreshToken = function (requestOptions) {
1420
- var _this = this;
1421
- var options = __assign({ params: {
1422
- client_id: this.clientId,
1423
- refresh_token: this.refreshToken,
1424
- redirect_uri: this.redirectUri,
1425
- grant_type: "exchange_refresh_token",
1426
- } }, requestOptions);
1427
- return fetchToken(this.portal + "/oauth2/token", options).then(function (response) {
1428
- _this._token = response.token;
1429
- _this._tokenExpires = response.expires;
1430
- _this._refreshToken = response.refreshToken;
1431
- _this._refreshTokenExpires = new Date(Date.now() + (_this.refreshTokenTTL - 1) * 60 * 1000);
1432
- return _this;
1433
- });
1434
- };
1435
- /**
1436
- * ensures that the authorizedCrossOriginDomains are obtained from the portal and cached
1437
- * so we can check them later.
1438
- *
1439
- * @returns this
1440
- */
1441
- UserSession.prototype.fetchAuthorizedDomains = function () {
1442
- var _this = this;
1443
- // if this token is for a specific server or we don't have a portal
1444
- // don't get the portal info because we cant get the authorizedCrossOriginDomains
1445
- if (this.server || !this.portal) {
1446
- return Promise.resolve(this);
1447
- }
1448
- return this.getPortal().then(function (portalInfo) {
1449
- /**
1450
- * Specific domains can be configured as secure.esri.com or https://secure.esri.com this
1451
- * normalizes to https://secure.esri.com so we can use startsWith later.
1452
- */
1453
- if (portalInfo.authorizedCrossOriginDomains &&
1454
- portalInfo.authorizedCrossOriginDomains.length) {
1455
- _this.trustedDomains = portalInfo.authorizedCrossOriginDomains
1456
- .filter(function (d) { return !d.startsWith("http://"); })
1457
- .map(function (d) {
1458
- if (d.startsWith("https://")) {
1459
- return d;
1460
- }
1461
- else {
1462
- return "https://" + d;
1463
- }
1464
- });
1465
- }
1466
- return _this;
1467
- });
1468
- };
1469
- return UserSession;
1470
- }());
1471
-
1472
- const solutionConfigurationCss = ".configuration-container{position:relative;height:100%;width:100%}.configuration{position:absolute;top:0px;right:0px;bottom:0px;left:0px;display:flex;padding:0.5rem;border:1px #808080 solid}.config-tabs{width:100%}.config-tab{width:100%}.config-solution{position:absolute;top:3.5rem;right:-1px;bottom:-1px;left:-1px;display:flex;padding:0.5rem}.config-inventory{display:inline;max-width:-moz-min-content;max-width:min-content;flex-grow:0;overflow-y:auto}.config-inventory-hide{display:none;max-width:-moz-min-content;max-width:min-content;flex-grow:0;overflow-y:auto}.config-item{position:relative;display:inline;flex-grow:1;overflow-y:auto;-webkit-margin-start:0.5rem;margin-inline-start:0.5rem}solution-contents{position:relative;height:100%}solution-item{position:relative;height:100%}solution-spatial-ref{position:relative;height:100%;width:100%;overflow-y:auto}";
1473
-
1474
- const SolutionConfiguration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
1475
- //--------------------------------------------------------------------------
1476
- //
1477
- // Lifecycle
1478
- //
1479
- //--------------------------------------------------------------------------
1480
- constructor() {
1481
- super();
1482
- this.__registerHost();
1483
- this._solutionStoreHasChanges = false;
1484
- this._solutionEditorHasChanges = false;
1485
- this._solutionEditorHasErrors = false;
1486
- this._canSave = false;
1487
- this.authentication = new UserSession({});
1488
- this.solutionItemId = "";
1489
- this.showLoading = false;
1490
- this._currentEditItemId = "";
1491
- this._organizationVariables = "";
1492
- this._solutionContentsComponent = undefined;
1493
- this._solutionIsLoaded = false;
1494
- this._solutionVariables = "";
1495
- this._templateHierarchy = [];
1496
- this._translations = undefined;
1497
- this._treeOpen = true;
1498
- void this._loadSolution(this.solutionItemId);
1499
- window.addEventListener("solutionStoreHasChanges", (evt) => {
1500
- this._updateSaveability(this._solutionStoreHasChanges = evt.detail, this._solutionEditorHasChanges, this._solutionEditorHasErrors);
1501
- });
1502
- window.addEventListener("solutionEditorHasChanges", (evt) => {
1503
- this._updateSaveability(this._solutionStoreHasChanges, this._solutionEditorHasChanges = evt.detail, this._solutionEditorHasErrors);
1504
- });
1505
- window.addEventListener("solutionEditorHasErrors", (evt) => {
1506
- this._updateSaveability(this._solutionStoreHasChanges, this._solutionEditorHasChanges, this._solutionEditorHasErrors = evt.detail);
1507
- });
1508
- }
1509
- async valueWatchHandler() {
1510
- await this._loadSolution(this.solutionItemId);
1511
- }
1512
- /**
1513
- * StencilJS: Called once just after the component is first connected to the DOM.
1514
- *
1515
- * @returns Promise when complete
1516
- */
1517
- async componentWillLoad() {
1518
- return this._getTranslations();
1519
- }
1520
- /**
1521
- * Renders the component.
1522
- */
1523
- render() {
1524
- const wkid = getProp(state.getStoreInfo("spatialReferenceInfo"), "spatialReference");
1525
- const hasServices = state.getStoreInfo("featureServices").length > 0;
1526
- return (h(Host, null, !this._solutionIsLoaded
1527
- ? h("calcite-loader", { active: true, label: '' })
1528
- : null, h("div", { class: "configuration-container" }, h("div", { class: "configuration" }, h("calcite-tabs", { class: "config-tabs" }, h("calcite-tab-nav", { slot: "tab-nav" }, h("calcite-tab-title", null, this._translations.definitionTab), hasServices ?
1529
- h("calcite-tab-title", null, this._translations.spatialReferenceTab) :
1530
- null), h("calcite-tab", { active: true, class: "config-tab" }, h("div", { class: "config-solution" }, h("div", { class: this._treeOpen ? "config-inventory" : "config-inventory-hide" }, h("solution-contents", { id: "configInventory", key: `${this.solutionItemId}-contents`, ref: (el) => (this._solutionContentsComponent = el) })), h("calcite-button", { appearance: "transparent", class: "collapse-btn", "icon-start": this._treeOpen ? "chevrons-left" : "chevrons-right", id: "collapse-vars", onClick: () => this._toggleTree(), scale: "s", title: this._treeOpen ? this._translations.collapse : this._translations.expand }), h("div", { class: "config-item" }, h("solution-item", { authentication: this.authentication, "item-id": this._currentEditItemId, key: `${this.solutionItemId}-item`, "organization-variables": this._organizationVariables, "solution-item-id": this.solutionItemId, "solution-variables": this._solutionVariables })))), hasServices
1531
- ? h("calcite-tab", { class: "config-tab" }, h("div", { class: "config-solution" }, h("solution-spatial-ref", { defaultWkid: wkid, id: "configure-solution-spatial-ref", key: `${this.solutionItemId}-spatial-ref`, locked: !wkid, services: state.getStoreInfo("featureServices").map(fs => fs.name) })))
1532
- : null)))));
1533
- }
1534
- //--------------------------------------------------------------------------
1535
- //
1536
- // Event Listeners
1537
- //
1538
- //--------------------------------------------------------------------------
1539
- _solutionItemSelected(event) {
1540
- this._currentEditItemId = event.detail;
1541
- }
1542
- //--------------------------------------------------------------------------
1543
- //
1544
- // Events
1545
- //
1546
- //--------------------------------------------------------------------------
1547
- //--------------------------------------------------------------------------
1548
- //
1549
- // Public Methods (async)
1550
- //
1551
- //--------------------------------------------------------------------------
1552
- /*
1553
- @Method()
1554
- async getEditModels(): Promise<ISolutionItems> {
1555
- return Promise.resolve(state.items);
1556
- }
1557
- */
1558
- async getSpatialReferenceInfo() {
1559
- return Promise.resolve(state.getStoreInfo("spatialReferenceInfo"));
1560
- }
1561
- /*
1562
- @Method()
1563
- async getSourceTemplates(): Promise<any> {
1564
- return Promise.resolve(this._templates);
1565
- }
1566
- */
1567
- async saveSolution() {
1568
- this._solutionIsLoaded = false;
1569
- await state.saveSolution();
1570
- this._solutionIsLoaded = true;
1571
- this.solutionItemId = null;
1572
- }
1573
- async unloadSolution() {
1574
- this.solutionItemId = null;
1575
- }
1576
- //--------------------------------------------------------------------------
1577
- //
1578
- // Private Methods
1579
- //
1580
- //--------------------------------------------------------------------------
1581
- /**
1582
- * Update the store with the initial values
1583
- *
1584
- * @param templates the solution items templates
1585
- * @param isReset (defaults to false) indicates if we are resetting the controls after save
1586
- */
1587
- /*
1588
- protected _initState(
1589
- templates: any[],
1590
- isReset = false
1591
- ): Promise<any> {
1592
- return new Promise((resolve, reject) => {
1593
- if (isReset) {
1594
- // clear models and state so we can refresh after save
1595
- this.modelsSet = false;
1596
- state.reset();
1597
- }
1598
- getModels(templates, this.authentication, this.solutionItemId).then(models => {
1599
- state.models = models;
1600
-
1601
- state.featureServices = getFeatureServices(templates);
1602
- state.getStoreInfo("spatialReferenceInfo") = getSpatialReferenceInfo(state.featureServices, this._sourceItemData);
1603
-
1604
- if (isReset) {
1605
- // reset for undo/redo stack and diff editor tracking
1606
- const jsonEditors = Array.from(this.el.getElementsByTagName("json-editor"));
1607
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
1608
- jsonEditors.forEach(e => void e.reset());
1609
- }
1610
-
1611
- this.modelsSet = true;
1612
- resolve(true);
1613
- }, () => reject);
1614
- });
1615
- }
1616
- */
1617
- /**
1618
- * Set Props with the initial values
1619
- *
1620
- * @protected
1621
- */
1622
- _initProps() {
1623
- const solutionData = state.getStoreInfo("solutionData");
1624
- this._solutionVariables = JSON.stringify(getSolutionVariables(solutionData.templates, this._translations));
1625
- this._organizationVariables = JSON.stringify(getOrganizationVariables(this._translations));
1626
- this._templateHierarchy = [...getInventoryItems(solutionData.templates)];
1627
- if (this._solutionContentsComponent) {
1628
- this._solutionContentsComponent.templateHierarchy = this._templateHierarchy;
1629
- }
1630
- let firstItem;
1631
- if (this._templateHierarchy.length > 0) {
1632
- // Start with the first item in the contents
1633
- firstItem = state.getItemInfo(this._templateHierarchy[0].id);
1634
- }
1635
- this._currentEditItemId = firstItem ? firstItem.itemId : "";
1636
- }
1637
- /**
1638
- * Loads a solution.
1639
- *
1640
- * @param solutionItemId AGO id of solution to load
1641
- *
1642
- * @returns Resolved promise when task is done
1643
- *
1644
- * @protected
1645
- */
1646
- async _loadSolution(solutionItemId) {
1647
- if (solutionItemId) {
1648
- this._solutionIsLoaded = false;
1649
- await state.loadSolution(solutionItemId, this.authentication);
1650
- this._initProps();
1651
- this._solutionIsLoaded = true;
1652
- }
1653
- else {
1654
- this._reset();
1655
- }
1656
- return Promise.resolve();
1657
- }
1658
- /**
1659
- * Resets internal variables.
1660
- *
1661
- * @protected
1662
- */
1663
- _reset() {
1664
- this._currentEditItemId = "";
1665
- this._organizationVariables = "";
1666
- this._solutionVariables = "";
1667
- this._templateHierarchy = [];
1668
- }
1669
- /**
1670
- * Toggle _treeOpen prop to show/hide content tree.
1671
- *
1672
- * @protected
1673
- */
1674
- _toggleTree() {
1675
- this._treeOpen = !this._treeOpen;
1676
- }
1677
- /**
1678
- * Dispatches an event indicating if the configuration is saveable or not. It's not saveable if there are no
1679
- * changes or if there's an error in the JSON editor.
1680
- *
1681
- * @param solutionStoreHasChanges Are there changes in the configuration editor's internal store?
1682
- * @param solutionEditorHasChanges Are there changes in the configuration editor's JSON editor?
1683
- * @param solutionEditorHasErrors Are there errors in the configuration editor's JSON editor?
1684
- *
1685
- * @protected
1686
- */
1687
- _updateSaveability(solutionStoreHasChanges, solutionEditorHasChanges, solutionEditorHasErrors) {
1688
- const updateSaveability = (solutionStoreHasChanges || solutionEditorHasChanges) && !solutionEditorHasErrors;
1689
- if (this._canSave !== updateSaveability) {
1690
- window.dispatchEvent(new CustomEvent("solutionCanSave", {
1691
- detail: updateSaveability,
1692
- bubbles: true,
1693
- cancelable: false,
1694
- composed: true
1695
- }));
1696
- }
1697
- this._canSave = updateSaveability;
1698
- }
1699
- /**
1700
- * Save all edits from the current configuration
1701
- *
1702
- * @returns a response that will indicate success or failure and any associated messages
1703
- */
1704
- /*
1705
- protected async _save() {
1706
- const templateUpdates = await this._updateTemplates();
1707
- const data = this._setSrInfo(templateUpdates.templates);
1708
- return templateUpdates.errors.length === 0 ? save(
1709
- this.solutionItemId,
1710
- data,
1711
- state.models,
1712
- this.authentication,
1713
- this._translations
1714
- ).then(saveResult => {
1715
- // need to trigger re-render...and re-fetch
1716
- this._fetchData = true;
1717
- this.modelsSet = false;
1718
- return Promise.resolve(saveResult)
1719
- }).catch(e => Promise.reject(e)) : Promise.reject({
1720
- success: false,
1721
- message: `The following templates have errors: ${templateUpdates.errors.join(", ")}`
1722
- } as IResponse);
1723
- }
1724
- */
1725
- /**
1726
- * Update the solutions templates based on the stored changes
1727
- *
1728
- * @returns an object that contains the updated templates as well as any errors that were found
1729
- */
1730
- /*
1731
- protected async _updateTemplates(): Promise<IUpdateTemplateResponse> {
1732
- const errors = [];
1733
- const models = await this.getEditModels();
1734
- let templates = this._updateGroupDependencies(models, this._templates);
1735
- Object.keys(models).forEach(k => {
1736
- const m = models[k];
1737
- templates = templates.map(t => {
1738
- if (t.itemId === m.itemId) {
1739
- this._setItem(t, m);
1740
- const hasDataError = this._setData(t, m);
1741
- const hasPropError = this._setProps(t, m);
1742
- if (hasDataError || hasPropError) {
1743
- errors.push(m.itemId);
1744
- }
1745
- }
1746
- return t;
1747
- });
1748
- });
1749
- errors.concat(window.monaco.editor.getModelMarkers({}));
1750
- return Promise.resolve({
1751
- templates,
1752
- errors
1753
- });
1754
- }
1755
- */
1756
- /**
1757
- * Review all models and store itemIds that should be added or removed from group dependencies
1758
- *
1759
- * @param models the corresponding models for the current templates
1760
- *
1761
- * @returns group info (an object with keys of groupIds and
1762
- * arrays of itemIds that should be added or removed from group dependencies)
1763
- */
1764
- /*
1765
- protected _getGroupInfo(
1766
- models: any
1767
- ): any {
1768
- const groupInfo = {}
1769
- Object.keys(models).forEach(k => {
1770
- const m = models[k];
1771
- if (m.shareInfo) {
1772
- const groupId = m.shareInfo.groupId;
1773
- const type = m.shareInfo.shared ? "share" : "unshare";
1774
- if (groupInfo[groupId]) {
1775
- groupInfo[groupId][type].push(m.itemId);
1776
- } else {
1777
- groupInfo[groupId] = {};
1778
- groupInfo[groupId][type] = [m.itemId];
1779
- if (m.shareInfo.shared) {
1780
- groupInfo[groupId]["unshare"] = [];
1781
- } else {
1782
- groupInfo[groupId]["share"] = [];
1783
- }
1784
- }
1785
- }
1786
- });
1787
- return groupInfo;
1788
- }
1789
- */
1790
- /**
1791
- * Updates group dependency arrays by adding or removing itemIds
1792
- *
1793
- * @param templates the current templates to update
1794
- * @param models the corresponding models for the current templates
1795
- *
1796
- * @returns updated templates array
1797
- */
1798
- /*
1799
- protected _updateGroupDependencies(
1800
- models: any,
1801
- templates: any[]
1802
- ): any[] {
1803
- const groupInfo = this._getGroupInfo(models);
1804
- Object.keys(groupInfo).forEach(k => {
1805
- templates.some(t => {
1806
- if (t.itemId === k) {
1807
- // add share items as deps
1808
- groupInfo[k].share.forEach(s => {
1809
- if (t.dependencies.indexOf(s) < 0) {
1810
- t.dependencies.push(s);
1811
- }
1812
- });
1813
-
1814
- // remove unshare items from deps
1815
- groupInfo[k].unshare.forEach(s => {
1816
- const index = t.dependencies.indexOf(s);
1817
- if (index > -1) {
1818
- t.dependencies.splice(index, 1);
1819
- }
1820
- });
1821
- return true;
1822
- } else {
1823
- return false;
1824
- }
1825
- })
1826
- })
1827
- return templates;
1828
- }
1829
- */
1830
- /**
1831
- * Add group IDs to items that should be shared
1832
- * This function will update the provided template when shareInfo is available
1833
- *
1834
- * @param template the current template to update
1835
- * @param shareInfo the corresponding shareInfo from the model for the current template
1836
- *
1837
- */
1838
- /*
1839
- protected _updateItemGroups(
1840
- template: any,
1841
- shareInfo: any
1842
- ): void {
1843
- if (shareInfo) {
1844
- const groupIndex = template.groups.indexOf(shareInfo.groupId);
1845
- if (groupIndex < 0 && shareInfo.shared) {
1846
- template.groups.push(shareInfo.groupId);
1847
- }
1848
- if (groupIndex > -1 && !shareInfo.shared) {
1849
- template.groups.splice(groupIndex, 1);
1850
- }
1851
- }
1852
- }
1853
- */
1854
- /**
1855
- * Set a templates data property with changes from the models
1856
- *
1857
- * @param template the current template to update
1858
- * @param model the corresponding model for the current template (stores any user changes)
1859
- *
1860
- * @returns a boolean that indicates if any errors were detected
1861
- */
1862
- /*
1863
- protected _setData(
1864
- template: any,
1865
- model: any
1866
- ): boolean {
1867
- return this._setTemplateProp(
1868
- template,
1869
- model.dataOriginalValue,
1870
- model.dataCurrentValue,
1871
- "data"
1872
- );
1873
- }
1874
- */
1875
- /**
1876
- * Set a templates properties property with changes from the models
1877
- *
1878
- * @param template the current template to update
1879
- * @param model the corresponding model for the current template (stores any user changes)
1880
- *
1881
- * @returns a boolean that indicates if any errors were detected
1882
- */
1883
- /*
1884
- protected _setProps(
1885
- template: any,
1886
- model: any
1887
- ): boolean {
1888
- return this._setTemplateProp(
1889
- template,
1890
- model.propsOriginalValue,
1891
- model.propsCurrentValue,
1892
- "properties"
1893
- );
1894
- }
1895
- */
1896
- /**
1897
- * Generic function used to set properties or data property on a given template
1898
- *
1899
- * @param template the current template to update
1900
- * @param originValue the original value from the solution template
1901
- * @param modelValue the current value from the model (will contain any edits that have been made)
1902
- * @param path the path to the property we should update if any changes are found
1903
- *
1904
- * @returns a boolean that indicates if any errors were detected
1905
- */
1906
- /*
1907
- protected _setTemplateProp(
1908
- template: any,
1909
- originValue: any,
1910
- modelValue: any,
1911
- path: string
1912
- ): boolean {
1913
- let hasError = false;
1914
- try {
1915
- const _originValue = JSON.parse(originValue);
1916
- const _modelValue = JSON.parse(modelValue);
1917
-
1918
- if (_originValue && _modelValue && (JSON.stringify(_originValue) !== JSON.stringify(_modelValue))) {
1919
- setProp(template, path, _modelValue);
1920
- }
1921
- } catch (e) {
1922
- console.error(e);
1923
- hasError = true;
1924
- }
1925
- return hasError;
1926
- }
1927
- */
1928
- /**
1929
- * Set a templates item property with changes from the models
1930
- *
1931
- * @param template the current template to update
1932
- * @param model the corresponding model for the current template (stores any user changes)
1933
- *
1934
- * This function will update the template argument when edits are found
1935
- */
1936
- /*
1937
- protected _setItem(
1938
- template: any,
1939
- model: any
1940
- ): void {
1941
- this._updateItemGroups(template, model.shareInfo);
1942
- if (model.updateItemValues && Object.keys(model.updateItemValues).length > 0) {
1943
- Object.keys(model.updateItemValues).forEach(k => {
1944
- template.item[k] = model.updateItemValues[k];
1945
- });
1946
- }
1947
- }
1948
- */
1949
- /**
1950
- * Set spatial reference info in the solutions data
1951
- *
1952
- * @param templates a list of item templates from the solution
1953
- *
1954
- * @returns a cloned copy of the solutions data that has been updated with spatial reference info
1955
- *
1956
- */
1957
- /*
1958
- protected _setSrInfo(
1959
- templates: any[]
1960
- ): any {
1961
- const srInfo: any = state.getStoreInfo("spatialReferenceInfo");
1962
-
1963
- const serviceEnabled = typeof srInfo?.services === "undefined" ?
1964
- false : Object.keys(srInfo.services).some(k => srInfo.services[k]);
1965
-
1966
- const data = cloneObject(this._sourceItemData);
1967
- data.templates = templates;
1968
- if (srInfo && srInfo.enabled && serviceEnabled) {
1969
- const wkid = srInfo.spatialReference.wkid.toString();
1970
-
1971
- const wkidParam = {
1972
- "label": "Spatial Reference",
1973
- "default": wkid,
1974
- "valueType": "spatialReference",
1975
- "attributes": {
1976
- "required": "true"
1977
- }
1978
- };
1979
-
1980
- const params = getProp(data, "params");
1981
- const hasWkid = params && params.wkid;
1982
- setCreateProp(
1983
- data,
1984
- hasWkid ? "params.wkid.default" : "params.wkid",
1985
- hasWkid ? wkid : params ? wkidParam : wkid
1986
- );
1987
- } else if (!srInfo.enabled) {
1988
- if (getProp(data, "params.wkid")) {
1989
- delete (data.params.wkid);
1990
- }
1991
- }
1992
- return data;
1993
- }
1994
- */
1995
- /**
1996
- * Fetches the component's translations
1997
- *
1998
- * @protected
1999
- */
2000
- async _getTranslations() {
2001
- const translations = await getLocaleComponentStrings(this.el);
2002
- this._translations = translations[0];
2003
- }
2004
- get el() { return this; }
2005
- static get watchers() { return {
2006
- "solutionItemId": ["valueWatchHandler"]
2007
- }; }
2008
- static get style() { return solutionConfigurationCss; }
2009
- }, [0, "solution-configuration", {
2010
- "authentication": [1040],
2011
- "solutionItemId": [1537, "solution-item-id"],
2012
- "showLoading": [1540, "show-loading"],
2013
- "_currentEditItemId": [32],
2014
- "_organizationVariables": [32],
2015
- "_solutionContentsComponent": [32],
2016
- "_solutionIsLoaded": [32],
2017
- "_solutionVariables": [32],
2018
- "_templateHierarchy": [32],
2019
- "_translations": [32],
2020
- "_treeOpen": [32],
2021
- "getSpatialReferenceInfo": [64],
2022
- "saveSolution": [64],
2023
- "unloadSolution": [64]
2024
- }, [[8, "solutionItemSelected", "_solutionItemSelected"]]]);
2025
- function defineCustomElement$1() {
2026
- if (typeof customElements === "undefined") {
2027
- return;
2028
- }
2029
- const components = ["solution-configuration", "calcite-action", "calcite-action-group", "calcite-action-menu", "calcite-button", "calcite-checkbox", "calcite-icon", "calcite-input", "calcite-label", "calcite-loader", "calcite-panel", "calcite-pick-list-item", "calcite-popover", "calcite-progress", "calcite-scrim", "calcite-shell", "calcite-shell-panel", "calcite-switch", "calcite-tab", "calcite-tab-nav", "calcite-tab-title", "calcite-tabs", "calcite-tree", "calcite-tree-item", "calcite-value-list", "calcite-value-list-item", "json-editor", "solution-contents", "solution-item", "solution-item-details", "solution-item-icon", "solution-item-sharing", "solution-organization-variables", "solution-resource-item", "solution-spatial-ref", "solution-template-data", "solution-variables"];
2030
- components.forEach(tagName => { switch (tagName) {
2031
- case "solution-configuration":
2032
- if (!customElements.get(tagName)) {
2033
- customElements.define(tagName, SolutionConfiguration$1);
2034
- }
2035
- break;
2036
- case "calcite-action":
2037
- if (!customElements.get(tagName)) {
2038
- defineCustomElement$B();
2039
- }
2040
- break;
2041
- case "calcite-action-group":
2042
- if (!customElements.get(tagName)) {
2043
- defineCustomElement$A();
2044
- }
2045
- break;
2046
- case "calcite-action-menu":
2047
- if (!customElements.get(tagName)) {
2048
- defineCustomElement$z();
2049
- }
2050
- break;
2051
- case "calcite-button":
2052
- if (!customElements.get(tagName)) {
2053
- defineCustomElement$y();
2054
- }
2055
- break;
2056
- case "calcite-checkbox":
2057
- if (!customElements.get(tagName)) {
2058
- defineCustomElement$x();
2059
- }
2060
- break;
2061
- case "calcite-icon":
2062
- if (!customElements.get(tagName)) {
2063
- defineCustomElement$w();
2064
- }
2065
- break;
2066
- case "calcite-input":
2067
- if (!customElements.get(tagName)) {
2068
- defineCustomElement$v();
2069
- }
2070
- break;
2071
- case "calcite-label":
2072
- if (!customElements.get(tagName)) {
2073
- defineCustomElement$u();
2074
- }
2075
- break;
2076
- case "calcite-loader":
2077
- if (!customElements.get(tagName)) {
2078
- defineCustomElement$t();
2079
- }
2080
- break;
2081
- case "calcite-panel":
2082
- if (!customElements.get(tagName)) {
2083
- defineCustomElement$s();
2084
- }
2085
- break;
2086
- case "calcite-pick-list-item":
2087
- if (!customElements.get(tagName)) {
2088
- defineCustomElement$r();
2089
- }
2090
- break;
2091
- case "calcite-popover":
2092
- if (!customElements.get(tagName)) {
2093
- defineCustomElement$q();
2094
- }
2095
- break;
2096
- case "calcite-progress":
2097
- if (!customElements.get(tagName)) {
2098
- defineCustomElement$p();
2099
- }
2100
- break;
2101
- case "calcite-scrim":
2102
- if (!customElements.get(tagName)) {
2103
- defineCustomElement$o();
2104
- }
2105
- break;
2106
- case "calcite-shell":
2107
- if (!customElements.get(tagName)) {
2108
- defineCustomElement$n();
2109
- }
2110
- break;
2111
- case "calcite-shell-panel":
2112
- if (!customElements.get(tagName)) {
2113
- defineCustomElement$m();
2114
- }
2115
- break;
2116
- case "calcite-switch":
2117
- if (!customElements.get(tagName)) {
2118
- defineCustomElement$l();
2119
- }
2120
- break;
2121
- case "calcite-tab":
2122
- if (!customElements.get(tagName)) {
2123
- defineCustomElement$k();
2124
- }
2125
- break;
2126
- case "calcite-tab-nav":
2127
- if (!customElements.get(tagName)) {
2128
- defineCustomElement$j();
2129
- }
2130
- break;
2131
- case "calcite-tab-title":
2132
- if (!customElements.get(tagName)) {
2133
- defineCustomElement$i();
2134
- }
2135
- break;
2136
- case "calcite-tabs":
2137
- if (!customElements.get(tagName)) {
2138
- defineCustomElement$h();
2139
- }
2140
- break;
2141
- case "calcite-tree":
2142
- if (!customElements.get(tagName)) {
2143
- defineCustomElement$g();
2144
- }
2145
- break;
2146
- case "calcite-tree-item":
2147
- if (!customElements.get(tagName)) {
2148
- defineCustomElement$f();
2149
- }
2150
- break;
2151
- case "calcite-value-list":
2152
- if (!customElements.get(tagName)) {
2153
- defineCustomElement$e();
2154
- }
2155
- break;
2156
- case "calcite-value-list-item":
2157
- if (!customElements.get(tagName)) {
2158
- defineCustomElement$d();
2159
- }
2160
- break;
2161
- case "json-editor":
2162
- if (!customElements.get(tagName)) {
2163
- defineCustomElement$c();
2164
- }
2165
- break;
2166
- case "solution-contents":
2167
- if (!customElements.get(tagName)) {
2168
- defineCustomElement$b();
2169
- }
2170
- break;
2171
- case "solution-item":
2172
- if (!customElements.get(tagName)) {
2173
- defineCustomElement$a();
2174
- }
2175
- break;
2176
- case "solution-item-details":
2177
- if (!customElements.get(tagName)) {
2178
- defineCustomElement$9();
2179
- }
2180
- break;
2181
- case "solution-item-icon":
2182
- if (!customElements.get(tagName)) {
2183
- defineCustomElement$8();
2184
- }
2185
- break;
2186
- case "solution-item-sharing":
2187
- if (!customElements.get(tagName)) {
2188
- defineCustomElement$7();
2189
- }
2190
- break;
2191
- case "solution-organization-variables":
2192
- if (!customElements.get(tagName)) {
2193
- defineCustomElement$6();
2194
- }
2195
- break;
2196
- case "solution-resource-item":
2197
- if (!customElements.get(tagName)) {
2198
- defineCustomElement$5();
2199
- }
2200
- break;
2201
- case "solution-spatial-ref":
2202
- if (!customElements.get(tagName)) {
2203
- defineCustomElement$4();
2204
- }
2205
- break;
2206
- case "solution-template-data":
2207
- if (!customElements.get(tagName)) {
2208
- defineCustomElement$3();
2209
- }
2210
- break;
2211
- case "solution-variables":
2212
- if (!customElements.get(tagName)) {
2213
- defineCustomElement$2();
2214
- }
2215
- break;
2216
- } });
2217
- }
2218
- defineCustomElement$1();
2219
-
2220
- const SolutionConfiguration = SolutionConfiguration$1;
2221
- const defineCustomElement = defineCustomElement$1;
2222
-
2223
- export { SolutionConfiguration, defineCustomElement };
2224
-
2225
- //# sourceMappingURL=solution-configuration.js.map