@esri/solutions-components 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (531) 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 +1095 -4
  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-f0547fe7.js → solution-store-893499a5.js} +8 -1
  8. package/dist/cjs/solution-store-893499a5.js.map +1 -0
  9. package/dist/collection/components/solution-configuration/solution-configuration.js +14 -11
  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 +1095 -4
  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-c1f6173a.js → solution-store-0c58c852.js} +4 -2
  25. package/dist/esm/solution-store-0c58c852.js.map +1 -0
  26. package/dist/solutions-components/{p-065830b8.js → p-659edb14.js} +4 -2
  27. package/dist/solutions-components/p-659edb14.js.map +1 -0
  28. package/dist/solutions-components/{p-ee9be0ef.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-90629c1d.entry.js +1986 -0
  31. package/dist/solutions-components/p-90629c1d.entry.js.map +1 -0
  32. package/dist/solutions-components/{p-0e7a0839.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 -7
  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-f0547fe7.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 -1141
  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-c1f6173a.js.map +0 -1
  527. package/dist/solutions-components/p-065830b8.js.map +0 -1
  528. package/dist/solutions-components/p-0e7a0839.entry.js.map +0 -1
  529. package/dist/solutions-components/p-401541a5.entry.js +0 -895
  530. package/dist/solutions-components/p-401541a5.entry.js.map +0 -1
  531. package/dist/solutions-components/p-ee9be0ef.entry.js.map +0 -1
@@ -4,7 +4,7 @@
4
4
  * http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
6
  import { r as registerInstance, h, H as Host, g as getElement } from './index-15022d11.js';
7
- import { g as getProp, s as state } from './solution-store-c1f6173a.js';
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-0c58c852.js';
8
8
  import { g as getLocaleComponentStrings } from './locale-0e10d7e5.js';
9
9
  import './index-9c882a6e.js';
10
10
  import './interfaces-e2a2064d.js';
@@ -352,6 +352,1090 @@ function _getTopLevelItemIds(templates) {
352
352
  return topLevelItemCandidateIds;
353
353
  }
354
354
 
355
+ /* Copyright (c) 2017-2020 Environmental Systems Research Institute, Inc.
356
+ * Apache-2.0 */
357
+ function decodeParam(param) {
358
+ var _a = param.split("="), key = _a[0], value = _a[1];
359
+ return { key: decodeURIComponent(key), value: decodeURIComponent(value) };
360
+ }
361
+ /**
362
+ * Decodes the passed query string as an object.
363
+ *
364
+ * @param query A string to be decoded.
365
+ * @returns A decoded query param object.
366
+ */
367
+ function decodeQueryString(query) {
368
+ return query
369
+ .replace(/^#/, "")
370
+ .split("&")
371
+ .reduce(function (acc, entry) {
372
+ var _a = decodeParam(entry), key = _a.key, value = _a.value;
373
+ acc[key] = value;
374
+ return acc;
375
+ }, {});
376
+ }
377
+
378
+ /*! *****************************************************************************
379
+ Copyright (c) Microsoft Corporation.
380
+
381
+ Permission to use, copy, modify, and/or distribute this software for any
382
+ purpose with or without fee is hereby granted.
383
+
384
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
385
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
386
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
387
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
388
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
389
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
390
+ PERFORMANCE OF THIS SOFTWARE.
391
+ ***************************************************************************** */
392
+
393
+ var __assign = function() {
394
+ __assign = Object.assign || function __assign(t) {
395
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
396
+ s = arguments[i];
397
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
398
+ }
399
+ return t;
400
+ };
401
+ return __assign.apply(this, arguments);
402
+ };
403
+
404
+ /* Copyright (c) 2017 Environmental Systems Research Institute, Inc.
405
+ * Apache-2.0 */
406
+ function fetchToken(url, requestOptions) {
407
+ var options = requestOptions;
408
+ // we generate a response, so we can't return the raw response
409
+ options.rawResponse = false;
410
+ return request(url, options).then(function (response) {
411
+ var r = {
412
+ token: response.access_token,
413
+ username: response.username,
414
+ expires: new Date(
415
+ // convert seconds in response to milliseconds and add the value to the current time to calculate a static expiration timestamp
416
+ Date.now() + (response.expires_in * 1000 - 1000)),
417
+ ssl: response.ssl === true
418
+ };
419
+ if (response.refresh_token) {
420
+ r.refreshToken = response.refresh_token;
421
+ }
422
+ return r;
423
+ });
424
+ }
425
+
426
+ /* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc.
427
+ * Apache-2.0 */
428
+ function generateToken(url, requestOptions) {
429
+ var options = requestOptions;
430
+ /* istanbul ignore else */
431
+ if (typeof window !== "undefined" &&
432
+ window.location &&
433
+ window.location.host) {
434
+ options.params.referer = window.location.host;
435
+ }
436
+ else {
437
+ options.params.referer = NODEJS_DEFAULT_REFERER_HEADER;
438
+ }
439
+ return request(url, options);
440
+ }
441
+
442
+ /**
443
+ * Used to test if a URL is an ArcGIS Online URL
444
+ */
445
+ var arcgisOnlineUrlRegex = /^https?:\/\/(\S+)\.arcgis\.com.+/;
446
+ function isOnline(url) {
447
+ return arcgisOnlineUrlRegex.test(url);
448
+ }
449
+ function normalizeOnlinePortalUrl(portalUrl) {
450
+ if (!arcgisOnlineUrlRegex.test(portalUrl)) {
451
+ return portalUrl;
452
+ }
453
+ switch (getOnlineEnvironment(portalUrl)) {
454
+ case "dev":
455
+ return "https://devext.arcgis.com/sharing/rest";
456
+ case "qa":
457
+ return "https://qaext.arcgis.com/sharing/rest";
458
+ default:
459
+ return "https://www.arcgis.com/sharing/rest";
460
+ }
461
+ }
462
+ function getOnlineEnvironment(url) {
463
+ if (!arcgisOnlineUrlRegex.test(url)) {
464
+ return null;
465
+ }
466
+ var match = url.match(arcgisOnlineUrlRegex);
467
+ var subdomain = match[1].split(".").pop();
468
+ if (subdomain.includes("dev")) {
469
+ return "dev";
470
+ }
471
+ if (subdomain.includes("qa")) {
472
+ return "qa";
473
+ }
474
+ return "production";
475
+ }
476
+ function isFederated(owningSystemUrl, portalUrl) {
477
+ var normalizedPortalUrl = cleanUrl(normalizeOnlinePortalUrl(portalUrl)).replace(/https?:\/\//, "");
478
+ var normalizedOwningSystemUrl = cleanUrl(owningSystemUrl).replace(/https?:\/\//, "");
479
+ return new RegExp(normalizedOwningSystemUrl, "i").test(normalizedPortalUrl);
480
+ }
481
+ function canUseOnlineToken(portalUrl, requestUrl) {
482
+ var portalIsOnline = isOnline(portalUrl);
483
+ var requestIsOnline = isOnline(requestUrl);
484
+ var portalEnv = getOnlineEnvironment(portalUrl);
485
+ var requestEnv = getOnlineEnvironment(requestUrl);
486
+ if (portalIsOnline && requestIsOnline && portalEnv === requestEnv) {
487
+ return true;
488
+ }
489
+ return false;
490
+ }
491
+
492
+ /* Copyright (c) 2018-2020 Environmental Systems Research Institute, Inc.
493
+ * Apache-2.0 */
494
+ /**
495
+ * Validates that the user has access to the application
496
+ * and if they user should be presented a "View Only" mode
497
+ *
498
+ * This is only needed/valid for Esri applications that are "licensed"
499
+ * and shipped in ArcGIS Online or ArcGIS Enterprise. Most custom applications
500
+ * should not need or use this.
501
+ *
502
+ * ```js
503
+ * import { validateAppAccess } from '@esri/arcgis-rest-auth';
504
+ *
505
+ * return validateAppAccess('your-token', 'theClientId')
506
+ * .then((result) => {
507
+ * if (!result.value) {
508
+ * // redirect or show some other ui
509
+ * } else {
510
+ * if (result.viewOnlyUserTypeApp) {
511
+ * // use this to inform your app to show a "View Only" mode
512
+ * }
513
+ * }
514
+ * })
515
+ * .catch((err) => {
516
+ * // two possible errors
517
+ * // invalid clientId: {"error":{"code":400,"messageCode":"GWM_0007","message":"Invalid request","details":[]}}
518
+ * // invalid token: {"error":{"code":498,"message":"Invalid token.","details":[]}}
519
+ * })
520
+ * ```
521
+ *
522
+ * Note: This is only usable by Esri applications hosted on *arcgis.com, *esri.com or within
523
+ * an ArcGIS Enterprise installation. Custom applications can not use this.
524
+ *
525
+ * @param token platform token
526
+ * @param clientId application client id
527
+ * @param portal Optional
528
+ */
529
+ function validateAppAccess(token, clientId, portal) {
530
+ if (portal === void 0) { portal = "https://www.arcgis.com/sharing/rest"; }
531
+ var url = portal + "/oauth2/validateAppAccess";
532
+ var ro = {
533
+ method: "POST",
534
+ params: {
535
+ f: "json",
536
+ client_id: clientId,
537
+ token: token,
538
+ },
539
+ };
540
+ return request(url, ro);
541
+ }
542
+
543
+ /* Copyright (c) 2017-2019 Environmental Systems Research Institute, Inc.
544
+ * Apache-2.0 */
545
+ function defer() {
546
+ var deferred = {
547
+ promise: null,
548
+ resolve: null,
549
+ reject: null,
550
+ };
551
+ deferred.promise = new Promise(function (resolve, reject) {
552
+ deferred.resolve = resolve;
553
+ deferred.reject = reject;
554
+ });
555
+ return deferred;
556
+ }
557
+ /**
558
+ * ```js
559
+ * import { UserSession } from '@esri/arcgis-rest-auth';
560
+ * UserSession.beginOAuth2({
561
+ * // register an app of your own to create a unique clientId
562
+ * clientId: "abc123",
563
+ * redirectUri: 'https://yourapp.com/authenticate.html'
564
+ * })
565
+ * .then(session)
566
+ * // or
567
+ * new UserSession({
568
+ * username: "jsmith",
569
+ * password: "123456"
570
+ * })
571
+ * // or
572
+ * UserSession.deserialize(cache)
573
+ * ```
574
+ * 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.
575
+ */
576
+ var UserSession = /** @class */ (function () {
577
+ function UserSession(options) {
578
+ this.clientId = options.clientId;
579
+ this._refreshToken = options.refreshToken;
580
+ this._refreshTokenExpires = options.refreshTokenExpires;
581
+ this.username = options.username;
582
+ this.password = options.password;
583
+ this._token = options.token;
584
+ this._tokenExpires = options.tokenExpires;
585
+ this.portal = options.portal
586
+ ? cleanUrl(options.portal)
587
+ : "https://www.arcgis.com/sharing/rest";
588
+ this.ssl = options.ssl;
589
+ this.provider = options.provider || "arcgis";
590
+ this.tokenDuration = options.tokenDuration || 20160;
591
+ this.redirectUri = options.redirectUri;
592
+ this.refreshTokenTTL = options.refreshTokenTTL || 20160;
593
+ this.server = options.server;
594
+ this.federatedServers = {};
595
+ this.trustedDomains = [];
596
+ // if a non-federated server was passed explicitly, it should be trusted.
597
+ if (options.server) {
598
+ // if the url includes more than '/arcgis/', trim the rest
599
+ var root = this.getServerRootUrl(options.server);
600
+ this.federatedServers[root] = {
601
+ token: options.token,
602
+ expires: options.tokenExpires,
603
+ };
604
+ }
605
+ this._pendingTokenRequests = {};
606
+ }
607
+ Object.defineProperty(UserSession.prototype, "token", {
608
+ /**
609
+ * The current ArcGIS Online or ArcGIS Enterprise `token`.
610
+ */
611
+ get: function () {
612
+ return this._token;
613
+ },
614
+ enumerable: false,
615
+ configurable: true
616
+ });
617
+ Object.defineProperty(UserSession.prototype, "tokenExpires", {
618
+ /**
619
+ * The expiration time of the current `token`.
620
+ */
621
+ get: function () {
622
+ return this._tokenExpires;
623
+ },
624
+ enumerable: false,
625
+ configurable: true
626
+ });
627
+ Object.defineProperty(UserSession.prototype, "refreshToken", {
628
+ /**
629
+ * The current token to ArcGIS Online or ArcGIS Enterprise.
630
+ */
631
+ get: function () {
632
+ return this._refreshToken;
633
+ },
634
+ enumerable: false,
635
+ configurable: true
636
+ });
637
+ Object.defineProperty(UserSession.prototype, "refreshTokenExpires", {
638
+ /**
639
+ * The expiration time of the current `refreshToken`.
640
+ */
641
+ get: function () {
642
+ return this._refreshTokenExpires;
643
+ },
644
+ enumerable: false,
645
+ configurable: true
646
+ });
647
+ Object.defineProperty(UserSession.prototype, "trustedServers", {
648
+ /**
649
+ * Deprecated, use `federatedServers` instead.
650
+ *
651
+ * @deprecated
652
+ */
653
+ get: function () {
654
+ console.log("DEPRECATED: use federatedServers instead");
655
+ return this.federatedServers;
656
+ },
657
+ enumerable: false,
658
+ configurable: true
659
+ });
660
+ /**
661
+ * Begins a new browser-based OAuth 2.0 sign in. If `options.popup` is `true` the
662
+ * authentication window will open in a new tab/window and the function will return
663
+ * Promise&lt;UserSession&gt;. Otherwise, the user will be redirected to the
664
+ * authorization page in their current tab/window and the function will return `undefined`.
665
+ *
666
+ * @browserOnly
667
+ */
668
+ /* istanbul ignore next */
669
+ UserSession.beginOAuth2 = function (options, win) {
670
+ if (win === void 0) { win = window; }
671
+ if (options.duration) {
672
+ console.log("DEPRECATED: 'duration' is deprecated - use 'expiration' instead");
673
+ }
674
+ var _a = __assign({
675
+ portal: "https://www.arcgis.com/sharing/rest",
676
+ provider: "arcgis",
677
+ expiration: 20160,
678
+ popup: true,
679
+ popupWindowFeatures: "height=400,width=600,menubar=no,location=yes,resizable=yes,scrollbars=yes,status=yes",
680
+ state: options.clientId,
681
+ locale: "",
682
+ }, 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;
683
+ var url;
684
+ if (provider === "arcgis") {
685
+ url = portal + "/oauth2/authorize?client_id=" + clientId + "&response_type=token&expiration=" + (options.duration || expiration) + "&redirect_uri=" + encodeURIComponent(redirectUri) + "&state=" + state + "&locale=" + locale;
686
+ }
687
+ else {
688
+ 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;
689
+ }
690
+ // append additional params
691
+ if (params) {
692
+ url = url + "&" + encodeQueryString(params);
693
+ }
694
+ if (!popup) {
695
+ win.location.href = url;
696
+ return undefined;
697
+ }
698
+ var session = defer();
699
+ win["__ESRI_REST_AUTH_HANDLER_" + clientId] = function (errorString, oauthInfoString) {
700
+ if (errorString) {
701
+ var error = JSON.parse(errorString);
702
+ session.reject(new ArcGISAuthError(error.errorMessage, error.error));
703
+ return;
704
+ }
705
+ if (oauthInfoString) {
706
+ var oauthInfo = JSON.parse(oauthInfoString);
707
+ session.resolve(new UserSession({
708
+ clientId: clientId,
709
+ portal: portal,
710
+ ssl: oauthInfo.ssl,
711
+ token: oauthInfo.token,
712
+ tokenExpires: new Date(oauthInfo.expires),
713
+ username: oauthInfo.username,
714
+ }));
715
+ }
716
+ };
717
+ win.open(url, "oauth-window", popupWindowFeatures);
718
+ return session.promise;
719
+ };
720
+ /**
721
+ * Completes a browser-based OAuth 2.0 sign in. If `options.popup` is `true` the user
722
+ * will be returned to the previous window. Otherwise a new `UserSession`
723
+ * will be returned. You must pass the same values for `options.popup` and
724
+ * `options.portal` as you used in `beginOAuth2()`.
725
+ *
726
+ * @browserOnly
727
+ */
728
+ /* istanbul ignore next */
729
+ UserSession.completeOAuth2 = function (options, win) {
730
+ if (win === void 0) { win = window; }
731
+ var _a = __assign({ portal: "https://www.arcgis.com/sharing/rest", popup: true }, options), portal = _a.portal, clientId = _a.clientId, popup = _a.popup;
732
+ function completeSignIn(error, oauthInfo) {
733
+ try {
734
+ var handlerFn = void 0;
735
+ var handlerFnName = "__ESRI_REST_AUTH_HANDLER_" + clientId;
736
+ if (popup) {
737
+ // Guard b/c IE does not support window.opener
738
+ if (win.opener) {
739
+ if (win.opener.parent && win.opener.parent[handlerFnName]) {
740
+ handlerFn = win.opener.parent[handlerFnName];
741
+ }
742
+ else if (win.opener && win.opener[handlerFnName]) {
743
+ // support pop-out oauth from within an iframe
744
+ handlerFn = win.opener[handlerFnName];
745
+ }
746
+ }
747
+ else {
748
+ // IE
749
+ if (win !== win.parent && win.parent && win.parent[handlerFnName]) {
750
+ handlerFn = win.parent[handlerFnName];
751
+ }
752
+ }
753
+ // if we have a handler fn, call it and close the window
754
+ if (handlerFn) {
755
+ handlerFn(error ? JSON.stringify(error) : undefined, JSON.stringify(oauthInfo));
756
+ win.close();
757
+ return undefined;
758
+ }
759
+ }
760
+ }
761
+ catch (e) {
762
+ 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()\".");
763
+ }
764
+ if (error) {
765
+ throw new ArcGISAuthError(error.errorMessage, error.error);
766
+ }
767
+ return new UserSession({
768
+ clientId: clientId,
769
+ portal: portal,
770
+ ssl: oauthInfo.ssl,
771
+ token: oauthInfo.token,
772
+ tokenExpires: oauthInfo.expires,
773
+ username: oauthInfo.username,
774
+ });
775
+ }
776
+ var params = decodeQueryString(win.location.hash);
777
+ if (!params.access_token) {
778
+ var error = void 0;
779
+ var errorMessage = "Unknown error";
780
+ if (params.error) {
781
+ error = params.error;
782
+ errorMessage = params.error_description;
783
+ }
784
+ return completeSignIn({ error: error, errorMessage: errorMessage });
785
+ }
786
+ var token = params.access_token;
787
+ var expires = new Date(Date.now() + parseInt(params.expires_in, 10) * 1000 - 60 * 1000);
788
+ var username = params.username;
789
+ var ssl = params.ssl === "true";
790
+ return completeSignIn(undefined, {
791
+ token: token,
792
+ expires: expires,
793
+ ssl: ssl,
794
+ username: username,
795
+ });
796
+ };
797
+ /**
798
+ * Request session information from the parent application
799
+ *
800
+ * When an application is embedded into another application via an IFrame, the embedded app can
801
+ * use `window.postMessage` to request credentials from the host application. This function wraps
802
+ * that behavior.
803
+ *
804
+ * The ArcGIS API for Javascript has this built into the Identity Manager as of the 4.19 release.
805
+ *
806
+ * Note: The parent application will not respond if the embedded app's origin is not:
807
+ * - the same origin as the parent or *.arcgis.com (JSAPI)
808
+ * - in the list of valid child origins (REST-JS)
809
+ *
810
+ *
811
+ * @param parentOrigin origin of the parent frame. Passed into the embedded application as `parentOrigin` query param
812
+ * @browserOnly
813
+ */
814
+ UserSession.fromParent = function (parentOrigin, win) {
815
+ /* istanbul ignore next: must pass in a mockwindow for tests so we can't cover the other branch */
816
+ if (!win && window) {
817
+ win = window;
818
+ }
819
+ // Declare handler outside of promise scope so we can detach it
820
+ var handler;
821
+ // return a promise that will resolve when the handler receives
822
+ // session information from the correct origin
823
+ return new Promise(function (resolve, reject) {
824
+ // create an event handler that just wraps the parentMessageHandler
825
+ handler = function (event) {
826
+ // ensure we only listen to events from the parent
827
+ if (event.source === win.parent && event.data) {
828
+ try {
829
+ return resolve(UserSession.parentMessageHandler(event));
830
+ }
831
+ catch (err) {
832
+ return reject(err);
833
+ }
834
+ }
835
+ };
836
+ // add listener
837
+ win.addEventListener("message", handler, false);
838
+ win.parent.postMessage({ type: "arcgis:auth:requestCredential" }, parentOrigin);
839
+ }).then(function (session) {
840
+ win.removeEventListener("message", handler, false);
841
+ return session;
842
+ });
843
+ };
844
+ /**
845
+ * Begins a new server-based OAuth 2.0 sign in. This will redirect the user to
846
+ * the ArcGIS Online or ArcGIS Enterprise authorization page.
847
+ *
848
+ * @nodeOnly
849
+ */
850
+ UserSession.authorize = function (options, response) {
851
+ if (options.duration) {
852
+ console.log("DEPRECATED: 'duration' is deprecated - use 'expiration' instead");
853
+ }
854
+ var _a = __assign({ portal: "https://arcgis.com/sharing/rest", expiration: 20160 }, options), portal = _a.portal, clientId = _a.clientId, expiration = _a.expiration, redirectUri = _a.redirectUri;
855
+ response.writeHead(301, {
856
+ Location: portal + "/oauth2/authorize?client_id=" + clientId + "&expiration=" + (options.duration || expiration) + "&response_type=code&redirect_uri=" + encodeURIComponent(redirectUri),
857
+ });
858
+ response.end();
859
+ };
860
+ /**
861
+ * Completes the server-based OAuth 2.0 sign in process by exchanging the `authorizationCode`
862
+ * for a `access_token`.
863
+ *
864
+ * @nodeOnly
865
+ */
866
+ UserSession.exchangeAuthorizationCode = function (options, authorizationCode) {
867
+ var _a = __assign({
868
+ portal: "https://www.arcgis.com/sharing/rest",
869
+ refreshTokenTTL: 20160,
870
+ }, options), portal = _a.portal, clientId = _a.clientId, redirectUri = _a.redirectUri, refreshTokenTTL = _a.refreshTokenTTL;
871
+ return fetchToken(portal + "/oauth2/token", {
872
+ params: {
873
+ grant_type: "authorization_code",
874
+ client_id: clientId,
875
+ redirect_uri: redirectUri,
876
+ code: authorizationCode,
877
+ },
878
+ }).then(function (response) {
879
+ return new UserSession({
880
+ clientId: clientId,
881
+ portal: portal,
882
+ ssl: response.ssl,
883
+ redirectUri: redirectUri,
884
+ refreshToken: response.refreshToken,
885
+ refreshTokenTTL: refreshTokenTTL,
886
+ refreshTokenExpires: new Date(Date.now() + (refreshTokenTTL - 1) * 60 * 1000),
887
+ token: response.token,
888
+ tokenExpires: response.expires,
889
+ username: response.username,
890
+ });
891
+ });
892
+ };
893
+ UserSession.deserialize = function (str) {
894
+ var options = JSON.parse(str);
895
+ return new UserSession({
896
+ clientId: options.clientId,
897
+ refreshToken: options.refreshToken,
898
+ refreshTokenExpires: new Date(options.refreshTokenExpires),
899
+ username: options.username,
900
+ password: options.password,
901
+ token: options.token,
902
+ tokenExpires: new Date(options.tokenExpires),
903
+ portal: options.portal,
904
+ ssl: options.ssl,
905
+ tokenDuration: options.tokenDuration,
906
+ redirectUri: options.redirectUri,
907
+ refreshTokenTTL: options.refreshTokenTTL,
908
+ });
909
+ };
910
+ /**
911
+ * Translates authentication from the format used in the [ArcGIS API for JavaScript](https://developers.arcgis.com/javascript/).
912
+ *
913
+ * ```js
914
+ * UserSession.fromCredential({
915
+ * userId: "jsmith",
916
+ * token: "secret"
917
+ * });
918
+ * ```
919
+ *
920
+ * @returns UserSession
921
+ */
922
+ UserSession.fromCredential = function (credential) {
923
+ // At ArcGIS Online 9.1, credentials no longer include the ssl and expires properties
924
+ // Here, we provide default values for them to cover this condition
925
+ var ssl = typeof credential.ssl !== "undefined" ? credential.ssl : true;
926
+ var expires = credential.expires || Date.now() + 7200000; /* 2 hours */
927
+ return new UserSession({
928
+ portal: credential.server.includes("sharing/rest")
929
+ ? credential.server
930
+ : credential.server + "/sharing/rest",
931
+ ssl: ssl,
932
+ token: credential.token,
933
+ username: credential.userId,
934
+ tokenExpires: new Date(expires),
935
+ });
936
+ };
937
+ /**
938
+ * Handle the response from the parent
939
+ * @param event DOM Event
940
+ */
941
+ UserSession.parentMessageHandler = function (event) {
942
+ if (event.data.type === "arcgis:auth:credential") {
943
+ return UserSession.fromCredential(event.data.credential);
944
+ }
945
+ if (event.data.type === "arcgis:auth:error") {
946
+ var err = new Error(event.data.error.message);
947
+ err.name = event.data.error.name;
948
+ throw err;
949
+ }
950
+ else {
951
+ throw new Error("Unknown message type.");
952
+ }
953
+ };
954
+ /**
955
+ * Returns authentication in a format useable in the [ArcGIS API for JavaScript](https://developers.arcgis.com/javascript/).
956
+ *
957
+ * ```js
958
+ * esriId.registerToken(session.toCredential());
959
+ * ```
960
+ *
961
+ * @returns ICredential
962
+ */
963
+ UserSession.prototype.toCredential = function () {
964
+ return {
965
+ expires: this.tokenExpires.getTime(),
966
+ server: this.portal,
967
+ ssl: this.ssl,
968
+ token: this.token,
969
+ userId: this.username,
970
+ };
971
+ };
972
+ /**
973
+ * 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.
974
+ *
975
+ * ```js
976
+ * session.getUser()
977
+ * .then(response => {
978
+ * console.log(response.role); // "org_admin"
979
+ * })
980
+ * ```
981
+ *
982
+ * @param requestOptions - Options for the request. NOTE: `rawResponse` is not supported by this operation.
983
+ * @returns A Promise that will resolve with the data from the response.
984
+ */
985
+ UserSession.prototype.getUser = function (requestOptions) {
986
+ var _this = this;
987
+ if (this._pendingUserRequest) {
988
+ return this._pendingUserRequest;
989
+ }
990
+ else if (this._user) {
991
+ return Promise.resolve(this._user);
992
+ }
993
+ else {
994
+ var url = this.portal + "/community/self";
995
+ var options = __assign(__assign({ httpMethod: "GET", authentication: this }, requestOptions), { rawResponse: false });
996
+ this._pendingUserRequest = request(url, options).then(function (response) {
997
+ _this._user = response;
998
+ _this._pendingUserRequest = null;
999
+ return response;
1000
+ });
1001
+ return this._pendingUserRequest;
1002
+ }
1003
+ };
1004
+ /**
1005
+ * 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.
1006
+ *
1007
+ * ```js
1008
+ * session.getPortal()
1009
+ * .then(response => {
1010
+ * console.log(portal.name); // "City of ..."
1011
+ * })
1012
+ * ```
1013
+ *
1014
+ * @param requestOptions - Options for the request. NOTE: `rawResponse` is not supported by this operation.
1015
+ * @returns A Promise that will resolve with the data from the response.
1016
+ */
1017
+ UserSession.prototype.getPortal = function (requestOptions) {
1018
+ var _this = this;
1019
+ if (this._pendingPortalRequest) {
1020
+ return this._pendingPortalRequest;
1021
+ }
1022
+ else if (this._portalInfo) {
1023
+ return Promise.resolve(this._portalInfo);
1024
+ }
1025
+ else {
1026
+ var url = this.portal + "/portals/self";
1027
+ var options = __assign(__assign({ httpMethod: "GET", authentication: this }, requestOptions), { rawResponse: false });
1028
+ this._pendingPortalRequest = request(url, options).then(function (response) {
1029
+ _this._portalInfo = response;
1030
+ _this._pendingPortalRequest = null;
1031
+ return response;
1032
+ });
1033
+ return this._pendingPortalRequest;
1034
+ }
1035
+ };
1036
+ /**
1037
+ * 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.
1038
+ *
1039
+ * * ```js
1040
+ * session.getUsername()
1041
+ * .then(response => {
1042
+ * console.log(response); // "casey_jones"
1043
+ * })
1044
+ * ```
1045
+ */
1046
+ UserSession.prototype.getUsername = function () {
1047
+ if (this.username) {
1048
+ return Promise.resolve(this.username);
1049
+ }
1050
+ else if (this._user) {
1051
+ return Promise.resolve(this._user.username);
1052
+ }
1053
+ else {
1054
+ return this.getUser().then(function (user) {
1055
+ return user.username;
1056
+ });
1057
+ }
1058
+ };
1059
+ /**
1060
+ * Gets an appropriate token for the given URL. If `portal` is ArcGIS Online and
1061
+ * the request is to an ArcGIS Online domain `token` will be used. If the request
1062
+ * is to the current `portal` the current `token` will also be used. However if
1063
+ * the request is to an unknown server we will validate the server with a request
1064
+ * to our current `portal`.
1065
+ */
1066
+ UserSession.prototype.getToken = function (url, requestOptions) {
1067
+ if (canUseOnlineToken(this.portal, url)) {
1068
+ return this.getFreshToken(requestOptions);
1069
+ }
1070
+ else if (new RegExp(this.portal, "i").test(url)) {
1071
+ return this.getFreshToken(requestOptions);
1072
+ }
1073
+ else {
1074
+ return this.getTokenForServer(url, requestOptions);
1075
+ }
1076
+ };
1077
+ /**
1078
+ * Get application access information for the current user
1079
+ * see `validateAppAccess` function for details
1080
+ *
1081
+ * @param clientId application client id
1082
+ */
1083
+ UserSession.prototype.validateAppAccess = function (clientId) {
1084
+ return this.getToken(this.portal).then(function (token) {
1085
+ return validateAppAccess(token, clientId);
1086
+ });
1087
+ };
1088
+ UserSession.prototype.toJSON = function () {
1089
+ return {
1090
+ clientId: this.clientId,
1091
+ refreshToken: this.refreshToken,
1092
+ refreshTokenExpires: this.refreshTokenExpires,
1093
+ username: this.username,
1094
+ password: this.password,
1095
+ token: this.token,
1096
+ tokenExpires: this.tokenExpires,
1097
+ portal: this.portal,
1098
+ ssl: this.ssl,
1099
+ tokenDuration: this.tokenDuration,
1100
+ redirectUri: this.redirectUri,
1101
+ refreshTokenTTL: this.refreshTokenTTL,
1102
+ };
1103
+ };
1104
+ UserSession.prototype.serialize = function () {
1105
+ return JSON.stringify(this);
1106
+ };
1107
+ /**
1108
+ * For a "Host" app that embeds other platform apps via iframes, after authenticating the user
1109
+ * and creating a UserSession, the app can then enable "post message" style authentication by calling
1110
+ * this method.
1111
+ *
1112
+ * Internally this adds an event listener on window for the `message` event
1113
+ *
1114
+ * @param validChildOrigins Array of origins that are allowed to request authentication from the host app
1115
+ */
1116
+ UserSession.prototype.enablePostMessageAuth = function (validChildOrigins, win) {
1117
+ /* istanbul ignore next: must pass in a mockwindow for tests so we can't cover the other branch */
1118
+ if (!win && window) {
1119
+ win = window;
1120
+ }
1121
+ this._hostHandler = this.createPostMessageHandler(validChildOrigins);
1122
+ win.addEventListener("message", this._hostHandler, false);
1123
+ };
1124
+ /**
1125
+ * For a "Host" app that has embedded other platform apps via iframes, when the host needs
1126
+ * to transition routes, it should call `UserSession.disablePostMessageAuth()` to remove
1127
+ * the event listener and prevent memory leaks
1128
+ */
1129
+ UserSession.prototype.disablePostMessageAuth = function (win) {
1130
+ /* istanbul ignore next: must pass in a mockwindow for tests so we can't cover the other branch */
1131
+ if (!win && window) {
1132
+ win = window;
1133
+ }
1134
+ win.removeEventListener("message", this._hostHandler, false);
1135
+ };
1136
+ /**
1137
+ * Manually refreshes the current `token` and `tokenExpires`.
1138
+ */
1139
+ UserSession.prototype.refreshSession = function (requestOptions) {
1140
+ // make sure subsequent calls to getUser() don't returned cached metadata
1141
+ this._user = null;
1142
+ if (this.username && this.password) {
1143
+ return this.refreshWithUsernameAndPassword(requestOptions);
1144
+ }
1145
+ if (this.clientId && this.refreshToken) {
1146
+ return this.refreshWithRefreshToken();
1147
+ }
1148
+ return Promise.reject(new ArcGISAuthError("Unable to refresh token."));
1149
+ };
1150
+ /**
1151
+ * Determines the root of the ArcGIS Server or Portal for a given URL.
1152
+ *
1153
+ * @param url the URl to determine the root url for.
1154
+ */
1155
+ UserSession.prototype.getServerRootUrl = function (url) {
1156
+ var root = cleanUrl(url).split(/\/rest(\/admin)?\/services(?:\/|#|\?|$)/)[0];
1157
+ var _a = root.match(/(https?:\/\/)(.+)/), protocol = _a[1], domainAndPath = _a[2];
1158
+ var _b = domainAndPath.split("/"), domain = _b[0], path = _b.slice(1);
1159
+ // only the domain is lowercased because in some cases an org id might be
1160
+ // in the path which cannot be lowercased.
1161
+ return "" + protocol + domain.toLowerCase() + "/" + path.join("/");
1162
+ };
1163
+ /**
1164
+ * Returns the proper [`credentials`] option for `fetch` for a given domain.
1165
+ * See [trusted server](https://enterprise.arcgis.com/en/portal/latest/administer/windows/configure-security.htm#ESRI_SECTION1_70CC159B3540440AB325BE5D89DBE94A).
1166
+ * Used internally by underlying request methods to add support for specific security considerations.
1167
+ *
1168
+ * @param url The url of the request
1169
+ * @returns "include" or "same-origin"
1170
+ */
1171
+ UserSession.prototype.getDomainCredentials = function (url) {
1172
+ if (!this.trustedDomains || !this.trustedDomains.length) {
1173
+ return "same-origin";
1174
+ }
1175
+ return this.trustedDomains.some(function (domainWithProtocol) {
1176
+ return url.startsWith(domainWithProtocol);
1177
+ })
1178
+ ? "include"
1179
+ : "same-origin";
1180
+ };
1181
+ /**
1182
+ * Return a function that closes over the validOrigins array and
1183
+ * can be used as an event handler for the `message` event
1184
+ *
1185
+ * @param validOrigins Array of valid origins
1186
+ */
1187
+ UserSession.prototype.createPostMessageHandler = function (validOrigins) {
1188
+ var _this = this;
1189
+ // return a function that closes over the validOrigins and
1190
+ // has access to the credential
1191
+ return function (event) {
1192
+ // Verify that the origin is valid
1193
+ // Note: do not use regex's here. validOrigins is an array so we're checking that the event's origin
1194
+ // is in the array via exact match. More info about avoiding postMessage xss issues here
1195
+ // https://jlajara.gitlab.io/web/2020/07/17/Dom_XSS_PostMessage_2.html#tipsbypasses-in-postmessage-vulnerabilities
1196
+ var isValidOrigin = validOrigins.indexOf(event.origin) > -1;
1197
+ // JSAPI handles this slightly differently - instead of checking a list, it will respond if
1198
+ // event.origin === window.location.origin || event.origin.endsWith('.arcgis.com')
1199
+ // For Hub, and to enable cross domain debugging with port's in urls, we are opting to
1200
+ // use a list of valid origins
1201
+ // Ensure the message type is something we want to handle
1202
+ var isValidType = event.data.type === "arcgis:auth:requestCredential";
1203
+ var isTokenValid = _this.tokenExpires.getTime() > Date.now();
1204
+ if (isValidOrigin && isValidType) {
1205
+ var msg = {};
1206
+ if (isTokenValid) {
1207
+ var credential = _this.toCredential();
1208
+ // arcgis:auth:error with {name: "", message: ""}
1209
+ // the following line allows us to conform to our spec without changing other depended-on functionality
1210
+ // https://github.com/Esri/arcgis-rest-js/blob/master/packages/arcgis-rest-auth/post-message-auth-spec.md#arcgisauthcredential
1211
+ credential.server = credential.server.replace("/sharing/rest", "");
1212
+ msg = { type: "arcgis:auth:credential", credential: credential };
1213
+ }
1214
+ else {
1215
+ // Return an error
1216
+ msg = {
1217
+ type: "arcgis:auth:error",
1218
+ error: {
1219
+ name: "tokenExpiredError",
1220
+ message: "Session token was expired, and not returned to the child application",
1221
+ },
1222
+ };
1223
+ }
1224
+ event.source.postMessage(msg, event.origin);
1225
+ }
1226
+ };
1227
+ };
1228
+ /**
1229
+ * Validates that a given URL is properly federated with our current `portal`.
1230
+ * Attempts to use the internal `federatedServers` cache first.
1231
+ */
1232
+ UserSession.prototype.getTokenForServer = function (url, requestOptions) {
1233
+ var _this = this;
1234
+ // requests to /rest/services/ and /rest/admin/services/ are both valid
1235
+ // Federated servers may have inconsistent casing, so lowerCase it
1236
+ var root = this.getServerRootUrl(url);
1237
+ var existingToken = this.federatedServers[root];
1238
+ if (existingToken &&
1239
+ existingToken.expires &&
1240
+ existingToken.expires.getTime() > Date.now()) {
1241
+ return Promise.resolve(existingToken.token);
1242
+ }
1243
+ if (this._pendingTokenRequests[root]) {
1244
+ return this._pendingTokenRequests[root];
1245
+ }
1246
+ this._pendingTokenRequests[root] = this.fetchAuthorizedDomains().then(function () {
1247
+ return request(root + "/rest/info", {
1248
+ credentials: _this.getDomainCredentials(url),
1249
+ })
1250
+ .then(function (response) {
1251
+ if (response.owningSystemUrl) {
1252
+ /**
1253
+ * if this server is not owned by this portal
1254
+ * bail out with an error since we know we wont
1255
+ * be able to generate a token
1256
+ */
1257
+ if (!isFederated(response.owningSystemUrl, _this.portal)) {
1258
+ throw new ArcGISAuthError(url + " is not federated with " + _this.portal + ".", "NOT_FEDERATED");
1259
+ }
1260
+ else {
1261
+ /**
1262
+ * if the server is federated, use the relevant token endpoint.
1263
+ */
1264
+ return request(response.owningSystemUrl + "/sharing/rest/info", requestOptions);
1265
+ }
1266
+ }
1267
+ else if (response.authInfo &&
1268
+ _this.federatedServers[root] !== undefined) {
1269
+ /**
1270
+ * if its a stand-alone instance of ArcGIS Server that doesn't advertise
1271
+ * federation, but the root server url is recognized, use its built in token endpoint.
1272
+ */
1273
+ return Promise.resolve({
1274
+ authInfo: response.authInfo,
1275
+ });
1276
+ }
1277
+ else {
1278
+ throw new ArcGISAuthError(url + " is not federated with any portal and is not explicitly trusted.", "NOT_FEDERATED");
1279
+ }
1280
+ })
1281
+ .then(function (response) {
1282
+ return response.authInfo.tokenServicesUrl;
1283
+ })
1284
+ .then(function (tokenServicesUrl) {
1285
+ // an expired token cant be used to generate a new token
1286
+ if (_this.token && _this.tokenExpires.getTime() > Date.now()) {
1287
+ return generateToken(tokenServicesUrl, {
1288
+ params: {
1289
+ token: _this.token,
1290
+ serverUrl: url,
1291
+ expiration: _this.tokenDuration,
1292
+ client: "referer",
1293
+ },
1294
+ });
1295
+ // generate an entirely fresh token if necessary
1296
+ }
1297
+ else {
1298
+ return generateToken(tokenServicesUrl, {
1299
+ params: {
1300
+ username: _this.username,
1301
+ password: _this.password,
1302
+ expiration: _this.tokenDuration,
1303
+ client: "referer",
1304
+ },
1305
+ }).then(function (response) {
1306
+ _this._token = response.token;
1307
+ _this._tokenExpires = new Date(response.expires);
1308
+ return response;
1309
+ });
1310
+ }
1311
+ })
1312
+ .then(function (response) {
1313
+ _this.federatedServers[root] = {
1314
+ expires: new Date(response.expires),
1315
+ token: response.token,
1316
+ };
1317
+ delete _this._pendingTokenRequests[root];
1318
+ return response.token;
1319
+ });
1320
+ });
1321
+ return this._pendingTokenRequests[root];
1322
+ };
1323
+ /**
1324
+ * Returns an unexpired token for the current `portal`.
1325
+ */
1326
+ UserSession.prototype.getFreshToken = function (requestOptions) {
1327
+ var _this = this;
1328
+ if (this.token && !this.tokenExpires) {
1329
+ return Promise.resolve(this.token);
1330
+ }
1331
+ if (this.token &&
1332
+ this.tokenExpires &&
1333
+ this.tokenExpires.getTime() > Date.now()) {
1334
+ return Promise.resolve(this.token);
1335
+ }
1336
+ if (!this._pendingTokenRequests[this.portal]) {
1337
+ this._pendingTokenRequests[this.portal] = this.refreshSession(requestOptions).then(function (session) {
1338
+ _this._pendingTokenRequests[_this.portal] = null;
1339
+ return session.token;
1340
+ });
1341
+ }
1342
+ return this._pendingTokenRequests[this.portal];
1343
+ };
1344
+ /**
1345
+ * Refreshes the current `token` and `tokenExpires` with `username` and
1346
+ * `password`.
1347
+ */
1348
+ UserSession.prototype.refreshWithUsernameAndPassword = function (requestOptions) {
1349
+ var _this = this;
1350
+ var options = __assign({ params: {
1351
+ username: this.username,
1352
+ password: this.password,
1353
+ expiration: this.tokenDuration,
1354
+ } }, requestOptions);
1355
+ return generateToken(this.portal + "/generateToken", options).then(function (response) {
1356
+ _this._token = response.token;
1357
+ _this._tokenExpires = new Date(response.expires);
1358
+ return _this;
1359
+ });
1360
+ };
1361
+ /**
1362
+ * Refreshes the current `token` and `tokenExpires` with `refreshToken`.
1363
+ */
1364
+ UserSession.prototype.refreshWithRefreshToken = function (requestOptions) {
1365
+ var _this = this;
1366
+ if (this.refreshToken &&
1367
+ this.refreshTokenExpires &&
1368
+ this.refreshTokenExpires.getTime() < Date.now()) {
1369
+ return this.refreshRefreshToken(requestOptions);
1370
+ }
1371
+ var options = __assign({ params: {
1372
+ client_id: this.clientId,
1373
+ refresh_token: this.refreshToken,
1374
+ grant_type: "refresh_token",
1375
+ } }, requestOptions);
1376
+ return fetchToken(this.portal + "/oauth2/token", options).then(function (response) {
1377
+ _this._token = response.token;
1378
+ _this._tokenExpires = response.expires;
1379
+ return _this;
1380
+ });
1381
+ };
1382
+ /**
1383
+ * Exchanges an unexpired `refreshToken` for a new one, also updates `token` and
1384
+ * `tokenExpires`.
1385
+ */
1386
+ UserSession.prototype.refreshRefreshToken = function (requestOptions) {
1387
+ var _this = this;
1388
+ var options = __assign({ params: {
1389
+ client_id: this.clientId,
1390
+ refresh_token: this.refreshToken,
1391
+ redirect_uri: this.redirectUri,
1392
+ grant_type: "exchange_refresh_token",
1393
+ } }, requestOptions);
1394
+ return fetchToken(this.portal + "/oauth2/token", options).then(function (response) {
1395
+ _this._token = response.token;
1396
+ _this._tokenExpires = response.expires;
1397
+ _this._refreshToken = response.refreshToken;
1398
+ _this._refreshTokenExpires = new Date(Date.now() + (_this.refreshTokenTTL - 1) * 60 * 1000);
1399
+ return _this;
1400
+ });
1401
+ };
1402
+ /**
1403
+ * ensures that the authorizedCrossOriginDomains are obtained from the portal and cached
1404
+ * so we can check them later.
1405
+ *
1406
+ * @returns this
1407
+ */
1408
+ UserSession.prototype.fetchAuthorizedDomains = function () {
1409
+ var _this = this;
1410
+ // if this token is for a specific server or we don't have a portal
1411
+ // don't get the portal info because we cant get the authorizedCrossOriginDomains
1412
+ if (this.server || !this.portal) {
1413
+ return Promise.resolve(this);
1414
+ }
1415
+ return this.getPortal().then(function (portalInfo) {
1416
+ /**
1417
+ * Specific domains can be configured as secure.esri.com or https://secure.esri.com this
1418
+ * normalizes to https://secure.esri.com so we can use startsWith later.
1419
+ */
1420
+ if (portalInfo.authorizedCrossOriginDomains &&
1421
+ portalInfo.authorizedCrossOriginDomains.length) {
1422
+ _this.trustedDomains = portalInfo.authorizedCrossOriginDomains
1423
+ .filter(function (d) { return !d.startsWith("http://"); })
1424
+ .map(function (d) {
1425
+ if (d.startsWith("https://")) {
1426
+ return d;
1427
+ }
1428
+ else {
1429
+ return "https://" + d;
1430
+ }
1431
+ });
1432
+ }
1433
+ return _this;
1434
+ });
1435
+ };
1436
+ return UserSession;
1437
+ }());
1438
+
355
1439
  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}";
356
1440
 
357
1441
  const SolutionConfiguration = class {
@@ -366,7 +1450,7 @@ const SolutionConfiguration = class {
366
1450
  this._solutionEditorHasChanges = false;
367
1451
  this._solutionEditorHasErrors = false;
368
1452
  this._canSave = false;
369
- this.authentication = undefined;
1453
+ this.authentication = new UserSession({});
370
1454
  this.solutionItemId = "";
371
1455
  this.showLoading = false;
372
1456
  this._currentEditItemId = "";
@@ -389,6 +1473,7 @@ const SolutionConfiguration = class {
389
1473
  });
390
1474
  }
391
1475
  async valueWatchHandler() {
1476
+ console.log("update solution config " + this.solutionItemId); //???
392
1477
  await this._loadSolution(this.solutionItemId);
393
1478
  }
394
1479
  /**
@@ -403,8 +1488,12 @@ const SolutionConfiguration = class {
403
1488
  * Renders the component.
404
1489
  */
405
1490
  render() {
1491
+ console.log("render solution config " + this.solutionItemId); //???
406
1492
  const wkid = getProp(state.getStoreInfo("spatialReferenceInfo"), "spatialReference");
407
1493
  const hasServices = state.getStoreInfo("featureServices").length > 0;
1494
+ const solutionData = state.getStoreInfo("solutionData");
1495
+ this._solutionVariables = JSON.stringify(getSolutionVariables(solutionData.templates, this._translations));
1496
+ this._organizationVariables = JSON.stringify(getOrganizationVariables(this._translations));
408
1497
  return (h(Host, null, !this._solutionIsLoaded
409
1498
  ? h("calcite-loader", { active: true, label: '' })
410
1499
  : 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 ?
@@ -503,8 +1592,6 @@ const SolutionConfiguration = class {
503
1592
  */
504
1593
  _initProps() {
505
1594
  const solutionData = state.getStoreInfo("solutionData");
506
- this._solutionVariables = JSON.stringify(getSolutionVariables(solutionData.templates, this._translations));
507
- this._organizationVariables = JSON.stringify(getOrganizationVariables(this._translations));
508
1595
  this._templateHierarchy = [...getInventoryItems(solutionData.templates)];
509
1596
  if (this._solutionContentsComponent) {
510
1597
  this._solutionContentsComponent.templateHierarchy = this._templateHierarchy;
@@ -513,6 +1600,10 @@ const SolutionConfiguration = class {
513
1600
  if (this._templateHierarchy.length > 0) {
514
1601
  // Start with the first item in the contents
515
1602
  firstItem = state.getItemInfo(this._templateHierarchy[0].id);
1603
+ console.log("init with first item " + firstItem.itemId); //???
1604
+ }
1605
+ else {
1606
+ console.log("no initial first item"); //???
516
1607
  }
517
1608
  this._currentEditItemId = firstItem ? firstItem.itemId : "";
518
1609
  }