@itwin/map-layers 4.0.0-dev.4 → 4.0.0-dev.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +21 -5
  2. package/lib/cjs/MapLayerPreferences.js +1 -2
  3. package/lib/cjs/MapLayerPreferences.js.map +1 -1
  4. package/lib/cjs/mapLayers.js +10 -12
  5. package/lib/cjs/mapLayers.js.map +1 -1
  6. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +1 -2
  7. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  8. package/lib/cjs/ui/MapFeatureInfoTool.d.ts.map +1 -1
  9. package/lib/cjs/ui/MapFeatureInfoTool.js +1 -1
  10. package/lib/cjs/ui/MapFeatureInfoTool.js.map +1 -1
  11. package/lib/cjs/ui/MapLayersUiItemsProvider.js +1 -1
  12. package/lib/cjs/ui/MapLayersUiItemsProvider.js.map +1 -1
  13. package/lib/cjs/ui/widget/AttachLayerPopupButton.js +20 -23
  14. package/lib/cjs/ui/widget/AttachLayerPopupButton.js.map +1 -1
  15. package/lib/cjs/ui/widget/BasemapPanel.js +4 -4
  16. package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
  17. package/lib/cjs/ui/widget/ConfirmMessageDialog.js +4 -7
  18. package/lib/cjs/ui/widget/ConfirmMessageDialog.js.map +1 -1
  19. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js +3 -4
  20. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  21. package/lib/cjs/ui/widget/FeatureInfoWidget.js +10 -16
  22. package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
  23. package/lib/cjs/ui/widget/MapLayerDroppable.js +4 -7
  24. package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
  25. package/lib/cjs/ui/widget/MapLayerManager.js +17 -19
  26. package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
  27. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js +2 -3
  28. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  29. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js +2 -2
  30. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  31. package/lib/cjs/ui/widget/MapLayersWidget.js +4 -4
  32. package/lib/cjs/ui/widget/MapLayersWidget.js.map +1 -1
  33. package/lib/cjs/ui/widget/MapUrlDialog.d.ts.map +1 -1
  34. package/lib/cjs/ui/widget/MapUrlDialog.js +35 -32
  35. package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
  36. package/lib/cjs/ui/widget/SelectMapFormat.js +7 -12
  37. package/lib/cjs/ui/widget/SelectMapFormat.js.map +1 -1
  38. package/lib/cjs/ui/widget/SubLayersDataProvider.js +4 -5
  39. package/lib/cjs/ui/widget/SubLayersDataProvider.js.map +1 -1
  40. package/lib/cjs/ui/widget/SubLayersTree.js +28 -34
  41. package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
  42. package/lib/esm/MapLayerPreferences.js +1 -2
  43. package/lib/esm/MapLayerPreferences.js.map +1 -1
  44. package/lib/esm/mapLayers.js +10 -12
  45. package/lib/esm/mapLayers.js.map +1 -1
  46. package/lib/esm/ui/FeatureInfoUiItemsProvider.js +1 -2
  47. package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  48. package/lib/esm/ui/MapFeatureInfoTool.d.ts.map +1 -1
  49. package/lib/esm/ui/MapFeatureInfoTool.js +2 -2
  50. package/lib/esm/ui/MapFeatureInfoTool.js.map +1 -1
  51. package/lib/esm/ui/MapLayersUiItemsProvider.js +1 -1
  52. package/lib/esm/ui/MapLayersUiItemsProvider.js.map +1 -1
  53. package/lib/esm/ui/widget/AttachLayerPopupButton.js +21 -24
  54. package/lib/esm/ui/widget/AttachLayerPopupButton.js.map +1 -1
  55. package/lib/esm/ui/widget/BasemapPanel.js +5 -5
  56. package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
  57. package/lib/esm/ui/widget/ConfirmMessageDialog.js +4 -7
  58. package/lib/esm/ui/widget/ConfirmMessageDialog.js.map +1 -1
  59. package/lib/esm/ui/widget/FeatureInfoDataProvider.js +3 -4
  60. package/lib/esm/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  61. package/lib/esm/ui/widget/FeatureInfoWidget.js +10 -16
  62. package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
  63. package/lib/esm/ui/widget/MapLayerDroppable.js +5 -8
  64. package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
  65. package/lib/esm/ui/widget/MapLayerManager.js +17 -19
  66. package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
  67. package/lib/esm/ui/widget/MapLayerSettingsMenu.js +2 -3
  68. package/lib/esm/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  69. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js +2 -2
  70. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  71. package/lib/esm/ui/widget/MapLayersWidget.js +4 -4
  72. package/lib/esm/ui/widget/MapLayersWidget.js.map +1 -1
  73. package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
  74. package/lib/esm/ui/widget/MapUrlDialog.js +36 -33
  75. package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
  76. package/lib/esm/ui/widget/SelectMapFormat.js +7 -12
  77. package/lib/esm/ui/widget/SelectMapFormat.js.map +1 -1
  78. package/lib/esm/ui/widget/SubLayersDataProvider.js +4 -5
  79. package/lib/esm/ui/widget/SubLayersDataProvider.js.map +1 -1
  80. package/lib/esm/ui/widget/SubLayersTree.js +28 -34
  81. package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
  82. package/package.json +27 -27
@@ -26,34 +26,30 @@ exports.MAP_TYPES = {
26
26
  };
27
27
  // eslint-disable-next-line @typescript-eslint/naming-convention
28
28
  function MapUrlDialog(props) {
29
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
30
29
  const { isOverlay, onOkResult, mapTypesOptions } = props;
31
30
  const getMapUrlFromProps = React.useCallback(() => {
32
- var _a;
33
31
  if (props.mapLayerSourceToEdit) {
34
32
  return props.mapLayerSourceToEdit.url;
35
33
  }
36
- else if ((_a = props.layerRequiringCredentials) === null || _a === void 0 ? void 0 : _a.url) {
34
+ else if (props.layerRequiringCredentials?.url) {
37
35
  return props.layerRequiringCredentials.url;
38
36
  }
39
37
  return "";
40
38
  }, [props.layerRequiringCredentials, props.mapLayerSourceToEdit]);
41
39
  const getMapNameFromProps = React.useCallback(() => {
42
- var _a;
43
40
  if (props.mapLayerSourceToEdit) {
44
41
  return props.mapLayerSourceToEdit.name;
45
42
  }
46
- else if ((_a = props.layerRequiringCredentials) === null || _a === void 0 ? void 0 : _a.name) {
43
+ else if (props.layerRequiringCredentials?.name) {
47
44
  return props.layerRequiringCredentials.name;
48
45
  }
49
46
  return "";
50
47
  }, [props.layerRequiringCredentials, props.mapLayerSourceToEdit]);
51
48
  const getFormatFromProps = React.useCallback(() => {
52
- var _a;
53
49
  if (props.mapLayerSourceToEdit) {
54
50
  return props.mapLayerSourceToEdit.formatId;
55
51
  }
56
- else if ((_a = props.layerRequiringCredentials) === null || _a === void 0 ? void 0 : _a.formatId) {
52
+ else if (props.layerRequiringCredentials?.formatId) {
57
53
  return props.layerRequiringCredentials.formatId;
58
54
  }
59
55
  return undefined;
@@ -93,7 +89,7 @@ function MapUrlDialog(props) {
93
89
  const [onOauthProcessEnd] = React.useState(new core_bentley_1.BeEvent());
94
90
  const [accessClient, setAccessClient] = React.useState();
95
91
  const [isAccessClientInitialized, setAccessClientInitialized] = React.useState(false);
96
- const [mapType, setMapType] = React.useState((_a = getFormatFromProps()) !== null && _a !== void 0 ? _a : "ArcGIS");
92
+ const [mapType, setMapType] = React.useState(getFormatFromProps() ?? "ArcGIS");
97
93
  // 'isMounted' is used to prevent any async operation once the hook has been
98
94
  // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.
99
95
  const isMounted = React.useRef(false);
@@ -103,20 +99,19 @@ function MapUrlDialog(props) {
103
99
  isMounted.current = false;
104
100
  };
105
101
  }, []);
106
- const [isSettingsStorageAvailable] = React.useState(mapLayers_1.MapLayersUI.iTwinConfig && ((_c = (_b = props === null || props === void 0 ? void 0 : props.activeViewport) === null || _b === void 0 ? void 0 : _b.iModel) === null || _c === void 0 ? void 0 : _c.iTwinId));
107
- const [hasImodelContext] = React.useState(((_e = (_d = props === null || props === void 0 ? void 0 : props.activeViewport) === null || _d === void 0 ? void 0 : _d.iModel) === null || _e === void 0 ? void 0 : _e.iTwinId) !== undefined
102
+ const [isSettingsStorageAvailable] = React.useState(mapLayers_1.MapLayersUI.iTwinConfig && props?.activeViewport?.iModel?.iTwinId);
103
+ const [hasImodelContext] = React.useState(props?.activeViewport?.iModel?.iTwinId !== undefined
108
104
  && props.activeViewport.iModel.iTwinId !== core_bentley_1.Guid.empty
109
- && ((_g = (_f = props === null || props === void 0 ? void 0 : props.activeViewport) === null || _f === void 0 ? void 0 : _f.iModel) === null || _g === void 0 ? void 0 : _g.iModelId) !== undefined
110
- && (props === null || props === void 0 ? void 0 : props.activeViewport.iModel.iModelId) !== core_bentley_1.Guid.empty);
105
+ && props?.activeViewport?.iModel?.iModelId !== undefined
106
+ && props?.activeViewport.iModel.iModelId !== core_bentley_1.Guid.empty);
111
107
  // Even though the settings storage is available,
112
108
  // we don't always want to enable it in the UI.
113
109
  const [settingsStorageDisabled] = React.useState(!isSettingsStorageAvailable || props.mapLayerSourceToEdit !== undefined || props.layerRequiringCredentials !== undefined);
114
110
  const [layerRequiringCredentialsIdx] = React.useState(() => {
115
- var _a;
116
111
  if (props.layerRequiringCredentials === undefined || !props.layerRequiringCredentials.name || !props.layerRequiringCredentials.url) {
117
112
  return undefined;
118
113
  }
119
- const indexInDisplayStyle = (_a = props.activeViewport) === null || _a === void 0 ? void 0 : _a.displayStyle.findMapLayerIndexByNameAndSource(props.layerRequiringCredentials.name, props.layerRequiringCredentials.url, isOverlay);
114
+ const indexInDisplayStyle = props.activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(props.layerRequiringCredentials.name, props.layerRequiringCredentials.url, isOverlay);
120
115
  if (indexInDisplayStyle === undefined || indexInDisplayStyle < 0) {
121
116
  return undefined;
122
117
  }
@@ -129,7 +124,7 @@ function MapUrlDialog(props) {
129
124
  props.onCancelResult();
130
125
  return;
131
126
  }
132
- appui_react_1.ModalDialogManager.closeDialog();
127
+ appui_react_1.UiFramework.dialogs.modal.close();
133
128
  }, [props]);
134
129
  const onUsernameChange = React.useCallback((event) => {
135
130
  setUserName(event.target.value);
@@ -176,7 +171,7 @@ function MapUrlDialog(props) {
176
171
  return sourceRequireAuth || invalidCredentials;
177
172
  }, [accessClient, invalidCredentialsProvided]);
178
173
  const updateAttachedLayer = React.useCallback(async (source, validation) => {
179
- const vp = props === null || props === void 0 ? void 0 : props.activeViewport;
174
+ const vp = props?.activeViewport;
180
175
  if (vp === undefined || source === undefined || layerRequiringCredentialsIdx === undefined) {
181
176
  const error = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachMissingViewOrSource");
182
177
  const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachError", { error, sourceUrl: source.url });
@@ -191,7 +186,7 @@ function MapUrlDialog(props) {
191
186
  // Either initial attach/initialize failed or the layer failed to load at least one tile
192
187
  // because of an invalid token; in both cases tile tree needs to be fully reset
193
188
  const provider = vp.getMapLayerImageryProvider(layerRequiringCredentialsIdx, isOverlay);
194
- provider === null || provider === void 0 ? void 0 : provider.resetStatus();
189
+ provider?.resetStatus();
195
190
  vp.resetMapLayer(layerRequiringCredentialsIdx, isOverlay);
196
191
  vp.invalidateRenderPlan();
197
192
  // This handler will close the layer source handler, and therefore the MapUrl dialog.
@@ -201,7 +196,7 @@ function MapUrlDialog(props) {
201
196
  }, [isOverlay, layerRequiringCredentialsIdx, onOkResult, props.activeViewport]);
202
197
  // Returns true if no further input is needed from end-user.
203
198
  const doAttach = React.useCallback(async (source, validation) => {
204
- const vp = props === null || props === void 0 ? void 0 : props.activeViewport;
199
+ const vp = props?.activeViewport;
205
200
  if (vp === undefined || source === undefined) {
206
201
  const error = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachMissingViewOrSource");
207
202
  const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Messages.MapLayerAttachError", { error, sourceUrl: source.url });
@@ -216,7 +211,13 @@ function MapUrlDialog(props) {
216
211
  core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, msgError));
217
212
  }
218
213
  }
219
- const settings = source.toLayerSettings(validation.subLayers);
214
+ // Some sources have a single non-visible sub-layer (i.e. ArcGIS World Topo Map); to avoid having a layer with no content (and no way to change the sub-layer visibility)
215
+ // we force the sub-layer visibility to ON.
216
+ let subLayers = validation.subLayers;
217
+ if (validation.subLayers && validation.subLayers.length === 1 && validation.subLayers[0].visible === false) {
218
+ subLayers = [{ ...validation.subLayers[0], visible: true }];
219
+ }
220
+ const settings = source.toLayerSettings(subLayers);
220
221
  if (settings) {
221
222
  vp.displayStyle.attachMapLayer({ settings, isOverlay });
222
223
  const msg = core_frontend_1.IModelApp.localization.getLocalizedString("mapLayers:Messages.MapLayerAttached", { sourceName: source.name, sourceUrl: source.url });
@@ -232,7 +233,7 @@ function MapUrlDialog(props) {
232
233
  // don't call it if the dialog needs to remains open.
233
234
  onOkResult();
234
235
  return true;
235
- }, [hasImodelContext, isOverlay, onOkResult, props === null || props === void 0 ? void 0 : props.activeViewport, props.layerRequiringCredentials, settingsStorage, settingsStorageDisabled]);
236
+ }, [hasImodelContext, isOverlay, onOkResult, props?.activeViewport, props.layerRequiringCredentials, settingsStorage, settingsStorageDisabled]);
236
237
  // Validate the layer source and attempt to attach (or update) the layer.
237
238
  // Returns true if no further input is needed from end-user (i.e. close the dialog)
238
239
  const attemptAttachSource = React.useCallback(async (source) => {
@@ -298,7 +299,7 @@ function MapUrlDialog(props) {
298
299
  const handleOk = React.useCallback(() => {
299
300
  const source = createSource();
300
301
  if (source === undefined || props.mapLayerSourceToEdit) {
301
- appui_react_1.ModalDialogManager.closeDialog();
302
+ appui_react_1.UiFramework.dialogs.modal.close();
302
303
  onOkResult();
303
304
  if (source === undefined) {
304
305
  // Close the dialog and inform end user something went wrong.
@@ -311,13 +312,12 @@ function MapUrlDialog(props) {
311
312
  if (props.mapLayerSourceToEdit !== undefined) {
312
313
  const vp = props.activeViewport;
313
314
  void (async () => {
314
- var _a, _b;
315
- if (isSettingsStorageAvailable && ((_a = vp === null || vp === void 0 ? void 0 : vp.iModel) === null || _a === void 0 ? void 0 : _a.iTwinId)) {
315
+ if (isSettingsStorageAvailable && vp?.iModel?.iTwinId) {
316
316
  try {
317
- await MapLayerPreferences_1.MapLayerPreferences.replaceSource(props.mapLayerSourceToEdit, source, vp.iModel.iTwinId, vp === null || vp === void 0 ? void 0 : vp.iModel.iModelId);
317
+ await MapLayerPreferences_1.MapLayerPreferences.replaceSource(props.mapLayerSourceToEdit, source, vp.iModel.iTwinId, vp?.iModel.iModelId);
318
318
  }
319
319
  catch (err) {
320
- const errorMessage = core_frontend_1.IModelApp.localization.getLocalizedString("mapLayers:Messages.MapLayerEditError", { layerName: (_b = props.mapLayerSourceToEdit) === null || _b === void 0 ? void 0 : _b.name });
320
+ const errorMessage = core_frontend_1.IModelApp.localization.getLocalizedString("mapLayers:Messages.MapLayerEditError", { layerName: props.mapLayerSourceToEdit?.name });
321
321
  core_frontend_1.IModelApp.notifications.outputMessage(new core_frontend_1.NotifyMessageDetails(core_frontend_1.OutputMessagePriority.Error, errorMessage));
322
322
  return;
323
323
  }
@@ -337,13 +337,13 @@ function MapUrlDialog(props) {
337
337
  // In theory the modal dialog should always get closed by the parent
338
338
  // AttachLayerPanel's 'onOkResult' handler. We close it here just in case.
339
339
  if (closeDialog) {
340
- appui_react_1.ModalDialogManager.closeDialog();
340
+ appui_react_1.UiFramework.dialogs.modal.close();
341
341
  onOkResult();
342
342
  }
343
343
  }
344
344
  catch (_error) {
345
345
  onOkResult();
346
- appui_react_1.ModalDialogManager.closeDialog();
346
+ appui_react_1.UiFramework.dialogs.modal.close();
347
347
  }
348
348
  })();
349
349
  }, [createSource, props.mapLayerSourceToEdit, props.activeViewport, onOkResult, mapUrl, isSettingsStorageAvailable, attemptAttachSource]);
@@ -353,13 +353,13 @@ function MapUrlDialog(props) {
353
353
  };
354
354
  // Currently only arcgis support AccessClient
355
355
  const ac = core_frontend_1.IModelApp.mapLayerFormatRegistry.getAccessClient(exports.MAP_TYPES.arcGis);
356
- if (ac === null || ac === void 0 ? void 0 : ac.onOAuthProcessEnd) {
356
+ if (ac?.onOAuthProcessEnd) {
357
357
  setAccessClient(ac); // cache it, so we dont need to make another lookup;
358
358
  ac.onOAuthProcessEnd.addListener(handleOAuthProcessEnd);
359
359
  }
360
360
  setAccessClientInitialized(true);
361
361
  return () => {
362
- if (ac === null || ac === void 0 ? void 0 : ac.onOAuthProcessEnd) {
362
+ if (ac?.onOAuthProcessEnd) {
363
363
  ac.onOAuthProcessEnd.removeListener(handleOAuthProcessEnd);
364
364
  }
365
365
  setAccessClient(undefined);
@@ -381,8 +381,7 @@ function MapUrlDialog(props) {
381
381
  React.useEffect(() => {
382
382
  // Attach source asynchronously.
383
383
  void (async () => {
384
- var _a, _b;
385
- if (isAccessClientInitialized && ((_a = props.layerRequiringCredentials) === null || _a === void 0 ? void 0 : _a.url) !== undefined && ((_b = props.layerRequiringCredentials) === null || _b === void 0 ? void 0 : _b.name) !== undefined) {
384
+ if (isAccessClientInitialized && props.layerRequiringCredentials?.url !== undefined && props.layerRequiringCredentials?.name !== undefined) {
386
385
  try {
387
386
  const source = core_frontend_1.MapLayerSource.fromJSON({
388
387
  url: props.layerRequiringCredentials.url,
@@ -401,7 +400,11 @@ function MapUrlDialog(props) {
401
400
  catch (_error) { }
402
401
  }
403
402
  })();
404
- }, [isAccessClientInitialized, (_h = props.layerRequiringCredentials) === null || _h === void 0 ? void 0 : _h.formatId, (_j = props.layerRequiringCredentials) === null || _j === void 0 ? void 0 : _j.name, (_k = props.layerRequiringCredentials) === null || _k === void 0 ? void 0 : _k.url, updateAuthState]);
403
+ }, [isAccessClientInitialized,
404
+ props.layerRequiringCredentials?.formatId,
405
+ props.layerRequiringCredentials?.name,
406
+ props.layerRequiringCredentials?.url,
407
+ updateAuthState]);
405
408
  const dialogContainer = React.useRef(null);
406
409
  const readyToSave = React.useCallback(() => {
407
410
  const credentialsSet = !!userName && !!password;
@@ -1 +1 @@
1
- {"version":3,"file":"MapUrlDialog.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapUrlDialog.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,8BAA8B;;;AAE9B,0DAAqE;AACrE,oDAAwD;AACxD,wDAA0F;AAE1F,wDAE8B;AAC9B,kDAAsE;AACtE,+BAA+B;AAC/B,mEAAgE;AAChE,+CAA8C;AAE9C,+BAA6B;AAC7B,sDAAoD;AACpD,uDAAoD;AAEvC,QAAA,SAAS,GAAG;IACvB,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,aAAa,EAAE,eAAe;CAC/B,CAAC;AAeF,gEAAgE;AAChE,SAAgB,YAAY,CAAC,KAAwB;;IACnD,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC;IAEzD,MAAM,kBAAkB,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;;QAChD,IAAI,KAAK,CAAC,oBAAoB,EAAE;YAC9B,OAAO,KAAK,CAAC,oBAAoB,CAAC,GAAG,CAAC;SACvC;aAAM,IAAI,MAAA,KAAK,CAAC,yBAAyB,0CAAE,GAAG,EAAE;Y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pG,QAAQ,EAAE,kBAAkB,IAAI,gBAAgB,EAChD,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,eAAe,EAC3B,KAAK,EAAE,QAAQ,EACf,IAAI,EAAC,OAAO,GAAG,CAEhB;oBAIJ,0BAA0B;wBAC3B,6BAAK,KAAK,EAAE,uBAAuB,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,IAC7D,gBAAgB;4BACjB;gCACE,oBAAC,qBAAK,IAAC,QAAQ,EAAE,uBAAuB,EACtC,IAAI,EAAC,iBAAiB,EAAC,KAAK,EAAC,OAAO,EACpC,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,eAAe,KAAK,OAAO,EAC/D,QAAQ,EAAE,aAAa,GAAI;gCAC7B,oBAAC,qBAAK,IAAC,QAAQ,EAAE,uBAAuB,EACtC,IAAI,EAAC,iBAAiB,EAAC,KAAK,EAAC,OAAO,EACpC,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,eAAe,KAAK,OAAO,EAC/D,QAAQ,EAAE,aAAa,GAAI,CACzB,CACF,CACF,CACF;YAGL,oBAAoB,EAAE;YAGtB,CAAC,kBAAkB,IAAI,gBAAgB,CAAC;gBACvC,6BAAK,SAAS,EAAC,8BAA8B;oBAC3C,oBAAC,8BAAc,IAAC,aAAa,SAAG,CAC5B,CAED,CACJ,CACR,CAAC;AACJ,CAAC;AAnmBD,oCAmmBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n// cSpell:ignore Modeless WMTS\r\n\r\nimport { DialogButtonType, SpecialKey } from \"@itwin/appui-abstract\";\r\nimport { ModalDialogManager } from \"@itwin/appui-react\";\r\nimport { Button, Input, LabeledInput, ProgressLinear, Radio } from \"@itwin/itwinui-react\";\r\nimport { ImageMapLayerProps } from \"@itwin/core-common\";\r\nimport { IModelApp, MapLayerAccessClient, MapLayerSource,\r\n MapLayerSourceStatus, MapLayerSourceValidation, NotifyMessageDetails, OutputMessagePriority, ScreenViewport,\r\n} from \"@itwin/core-frontend\";\r\nimport { Dialog, Icon, useCrossOriginPopup } from \"@itwin/core-react\";\r\nimport * as React from \"react\";\r\nimport { MapLayerPreferences } from \"../../MapLayerPreferences\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\nimport { MapTypesOptions } from \"../Interfaces\";\r\nimport \"./MapUrlDialog.scss\";\r\nimport { BeEvent, Guid } from \"@itwin/core-bentley\";\r\nimport { SelectMapFormat } from \"./SelectMapFormat\";\r\n\r\nexport const MAP_TYPES = {\r\n wms: \"WMS\",\r\n arcGis: \"ArcGIS\",\r\n wmts: \"WMTS\",\r\n tileUrl: \"TileURL\",\r\n arcGisFeature: \"ArcGISFeature\",\r\n};\r\n\r\ninterface MapUrlDialogProps {\r\n activeViewport?: ScreenViewport;\r\n isOverlay: boolean;\r\n onOkResult: () => void;\r\n onCancelResult?: () => void;\r\n mapTypesOptions?: MapTypesOptions;\r\n\r\n // An optional layer definition can be provide to enable the edit mode\r\n layerRequiringCredentials?: ImageMapLayerProps;\r\n\r\n mapLayerSourceToEdit?: MapLayerSource;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function MapUrlDialog(props: MapUrlDialogProps) {\r\n const { isOverlay, onOkResult, mapTypesOptions } = props;\r\n\r\n const getMapUrlFromProps = React.useCallback(() => {\r\n if (props.mapLayerSourceToEdit) {\r\n return props.mapLayerSourceToEdit.url;\r\n } else if (props.layerRequiringCredentials?.url) {\r\n return props.layerRequiringCredentials.url;\r\n }\r\n return \"\";\r\n }, [props.layerRequiringCredentials, props.mapLayerSourceToEdit]);\r\n\r\n const getMapNameFromProps = React.useCallback(() => {\r\n if (props.mapLayerSourceToEdit) {\r\n return props.mapLayerSourceToEdit.name;\r\n } else if (props.layerRequiringCredentials?.name) {\r\n return props.layerRequiringCredentials.name;\r\n }\r\n return \"\";\r\n }, [props.layerRequiringCredentials, props.mapLayerSourceToEdit]);\r\n\r\n const getFormatFromProps = React.useCallback(() => {\r\n if (props.mapLayerSourceToEdit) {\r\n return props.mapLayerSourceToEdit.formatId;\r\n } else if (props.layerRequiringCredentials?.formatId) {\r\n return props.layerRequiringCredentials.formatId;\r\n }\r\n return undefined;\r\n }, [props.layerRequiringCredentials, props.mapLayerSourceToEdit]);\r\n\r\n const [dialogTitle] = React.useState(MapLayersUI.localization.getLocalizedString(props.layerRequiringCredentials || props.mapLayerSourceToEdit ? \"mapLayers:CustomAttach.EditCustomLayer\" : \"mapLayers:CustomAttach.AttachCustomLayer\"));\r\n const [typeLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.Type\"));\r\n const [nameLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.Name\"));\r\n const [nameInputPlaceHolder] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.NameInputPlaceHolder\"));\r\n const [urlLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.URL\"));\r\n const [urlInputPlaceHolder] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.UrlInputPlaceHolder\"));\r\n const [iTwinSettingsLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.StoreOnITwinSettings\"));\r\n const [modelSettingsLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.StoreOnModelSettings\"));\r\n const [missingCredentialsLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.MissingCredentials\"));\r\n const [invalidCredentialsLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.InvalidCredentials\"));\r\n const [externalLoginTitle] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLogin\"));\r\n const [externalLoginFailedMsg] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLoginFailed\"));\r\n const [externalLoginSucceededMsg] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLoginSucceeded\"));\r\n const [externalLoginWaitingMsg] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLoginWaiting\"));\r\n const [externalLoginTryAgainLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLoginTryAgain\"));\r\n const [serverRequireCredentials, setServerRequireCredentials] = React.useState(false);\r\n const [invalidCredentialsProvided, setInvalidCredentialsProvided] = React.useState(false);\r\n const [layerAttachPending, setLayerAttachPending] = React.useState(false);\r\n const [layerAuthPending, setLayerAuthPending] = React.useState(false);\r\n const [mapUrl, setMapUrl] = React.useState(getMapUrlFromProps());\r\n const [mapName, setMapName] = React.useState(getMapNameFromProps());\r\n const [userName, setUserName] = React.useState(\"\");\r\n const [password, setPassword] = React.useState(\"\");\r\n const [noSaveSettingsWarning] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.NoSaveSettingsWarning\"));\r\n const [passwordLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:AuthenticationInputs.Password\"));\r\n const [passwordRequiredLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:AuthenticationInputs.PasswordRequired\"));\r\n const [userNameLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:AuthenticationInputs.Username\"));\r\n const [userNameRequiredLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:AuthenticationInputs.UsernameRequired\"));\r\n const [settingsStorage, setSettingsStorageRadio] = React.useState(\"iTwin\");\r\n const [oauthProcessSucceeded, setOAuthProcessSucceeded] = React.useState<undefined|boolean>(undefined);\r\n const [showOauthPopup, setShowOauthPopup] = React.useState(false);\r\n const [externalLoginUrl, setExternalLoginUrl] = React.useState<string|undefined>();\r\n const [onOauthProcessEnd] = React.useState(new BeEvent());\r\n const [accessClient, setAccessClient] = React.useState<MapLayerAccessClient | undefined>();\r\n const [isAccessClientInitialized, setAccessClientInitialized] = React.useState(false);\r\n\r\n const [mapType, setMapType] = React.useState(getFormatFromProps() ?? \"ArcGIS\");\r\n\r\n // 'isMounted' is used to prevent any async operation once the hook has been\r\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n };\r\n }, []);\r\n\r\n const [isSettingsStorageAvailable] = React.useState(MapLayersUI.iTwinConfig && props?.activeViewport?.iModel?.iTwinId);\r\n const [hasImodelContext] = React.useState (\r\n props?.activeViewport?.iModel?.iTwinId !== undefined\r\n && props.activeViewport.iModel.iTwinId !== Guid.empty\r\n && props?.activeViewport?.iModel?.iModelId !== undefined\r\n && props?.activeViewport.iModel.iModelId !== Guid.empty);\r\n\r\n // Even though the settings storage is available,\r\n // we don't always want to enable it in the UI.\r\n const [settingsStorageDisabled] = React.useState(!isSettingsStorageAvailable || props.mapLayerSourceToEdit !== undefined || props.layerRequiringCredentials !== undefined);\r\n\r\n const [layerRequiringCredentialsIdx] = React.useState((): number | undefined => {\r\n if (props.layerRequiringCredentials === undefined || !props.layerRequiringCredentials.name || !props.layerRequiringCredentials.url) {\r\n return undefined;\r\n }\r\n\r\n const indexInDisplayStyle = props.activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(props.layerRequiringCredentials.name, props.layerRequiringCredentials.url, isOverlay);\r\n if (indexInDisplayStyle === undefined || indexInDisplayStyle < 0) {\r\n return undefined;\r\n } else {\r\n return indexInDisplayStyle;\r\n }\r\n });\r\n\r\n const handleCancel = React.useCallback(() => {\r\n if (props.onCancelResult) {\r\n props.onCancelResult();\r\n return;\r\n }\r\n ModalDialogManager.closeDialog();\r\n }, [props]);\r\n\r\n const onUsernameChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setUserName(event.target.value);\r\n if (invalidCredentialsProvided)\r\n setInvalidCredentialsProvided(false);\r\n }, [setUserName, invalidCredentialsProvided, setInvalidCredentialsProvided]);\r\n\r\n const onPasswordChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setPassword(event.target.value);\r\n if (invalidCredentialsProvided)\r\n setInvalidCredentialsProvided(false);\r\n }, [setPassword, invalidCredentialsProvided, setInvalidCredentialsProvided]);\r\n\r\n const handleArcGisLogin = React.useCallback(() => {\r\n setLayerAuthPending(true);\r\n setShowOauthPopup(true);\r\n if (oauthProcessSucceeded === false) {\r\n setOAuthProcessSucceeded(undefined);\r\n }\r\n\r\n }, [oauthProcessSucceeded]);\r\n\r\n // return true if authorization is needed\r\n const updateAuthState = React.useCallback(async (source: MapLayerSource, sourceValidation: MapLayerSourceValidation) => {\r\n const sourceRequireAuth = (sourceValidation.status === MapLayerSourceStatus.RequireAuth);\r\n const invalidCredentials = (sourceValidation.status === MapLayerSourceStatus.InvalidCredentials);\r\n if (sourceRequireAuth) {\r\n const settings = source.toLayerSettings();\r\n\r\n if (accessClient !== undefined && accessClient.getTokenServiceEndPoint !== undefined && settings !== undefined) {\r\n try {\r\n const tokenEndpoint = await accessClient.getTokenServiceEndPoint(settings.url);\r\n if (tokenEndpoint !== undefined) {\r\n const loginUrl = tokenEndpoint.getLoginUrl();\r\n setExternalLoginUrl(loginUrl);\r\n }\r\n\r\n } catch (_error){\r\n\r\n }\r\n }\r\n\r\n }\r\n setServerRequireCredentials(sourceRequireAuth || invalidCredentials);\r\n if (invalidCredentials) {\r\n setInvalidCredentialsProvided(true);\r\n } else if (invalidCredentialsProvided) {\r\n setInvalidCredentialsProvided(false); // flag reset\r\n }\r\n\r\n return sourceRequireAuth || invalidCredentials;\r\n }, [accessClient, invalidCredentialsProvided]);\r\n\r\n const updateAttachedLayer = React.useCallback(async (source: MapLayerSource, validation: MapLayerSourceValidation) => {\r\n const vp = props?.activeViewport;\r\n if (vp === undefined || source === undefined || layerRequiringCredentialsIdx === undefined) {\r\n const error = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachMissingViewOrSource\");\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error, sourceUrl: source.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n return true;\r\n }\r\n\r\n // Layer is already attached,\r\n vp.displayStyle.changeMapLayerProps({\r\n subLayers: validation.subLayers,\r\n }, layerRequiringCredentialsIdx, isOverlay);\r\n vp.displayStyle.changeMapLayerCredentials(layerRequiringCredentialsIdx, isOverlay, source.userName, source.password);\r\n\r\n // Either initial attach/initialize failed or the layer failed to load at least one tile\r\n // because of an invalid token; in both cases tile tree needs to be fully reset\r\n const provider = vp.getMapLayerImageryProvider(layerRequiringCredentialsIdx, isOverlay);\r\n provider?.resetStatus();\r\n vp.resetMapLayer(layerRequiringCredentialsIdx, isOverlay);\r\n vp.invalidateRenderPlan();\r\n\r\n // This handler will close the layer source handler, and therefore the MapUrl dialog.\r\n // don't call it if the dialog needs to remains open.\r\n onOkResult();\r\n\r\n return true;\r\n }, [isOverlay, layerRequiringCredentialsIdx, onOkResult, props.activeViewport]);\r\n\r\n // Returns true if no further input is needed from end-user.\r\n const doAttach = React.useCallback(async (source: MapLayerSource, validation: MapLayerSourceValidation): Promise<boolean> => {\r\n const vp = props?.activeViewport;\r\n if (vp === undefined || source === undefined) {\r\n const error = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachMissingViewOrSource\");\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error, sourceUrl: source.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n return true;\r\n }\r\n\r\n // Update service settings if storage is available and we are not prompting user for credentials\r\n if (!settingsStorageDisabled && !props.layerRequiringCredentials) {\r\n \tconst storeOnIModel = (hasImodelContext ? \"Model\" === settingsStorage : undefined);\r\n if (vp.iModel.iTwinId && !(await MapLayerPreferences.storeSource(source, vp.iModel.iTwinId, vp.iModel.iModelId, storeOnIModel))) {\r\n const msgError = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerPreferencesStoreFailed\");\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msgError));\r\n\t }\r\n }\r\n const settings = source.toLayerSettings(validation.subLayers);\r\n if (settings) {\r\n vp.displayStyle.attachMapLayer({settings, isOverlay});\r\n\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttached\", { sourceName: source.name, sourceUrl: source.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n } else {\r\n const msgError = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerLayerSettingsConversionError\");\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.MapLayerAttachError\", { error: msgError, sourceUrl: source.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n }\r\n\r\n vp.invalidateRenderPlan();\r\n\r\n // This handler will close the layer source handler, and therefore the MapUrl dialog.\r\n // don't call it if the dialog needs to remains open.\r\n onOkResult();\r\n\r\n return true;\r\n }, [hasImodelContext, isOverlay, onOkResult, props?.activeViewport, props.layerRequiringCredentials, settingsStorage, settingsStorageDisabled]);\r\n\r\n // Validate the layer source and attempt to attach (or update) the layer.\r\n // Returns true if no further input is needed from end-user (i.e. close the dialog)\r\n const attemptAttachSource = React.useCallback(async (source: MapLayerSource): Promise<boolean> => {\r\n try {\r\n const validation = await source.validateSource(true);\r\n\r\n if (validation.status === MapLayerSourceStatus.Valid) {\r\n if (layerRequiringCredentialsIdx === undefined ) {\r\n return await doAttach(source, validation);\r\n } else {\r\n return await updateAttachedLayer(source, validation);\r\n }\r\n } else if (validation.status === MapLayerSourceStatus.InvalidCoordinateSystem){\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.InvalidCoordinateSystem\");\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n return true;\r\n } else {\r\n const authNeeded = await updateAuthState(source, validation);\r\n if (authNeeded) {\r\n return false;\r\n } else {\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ValidationError\");\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, `${msg} ${source.url}`));\r\n return true;\r\n }\r\n }\r\n return false;\r\n } catch (error) {\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error, sourceUrl: source.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n return true;\r\n }\r\n\r\n }, [updateAuthState, doAttach, layerRequiringCredentialsIdx, updateAttachedLayer]);\r\n\r\n const onNameChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setMapName(event.target.value);\r\n }, [setMapName]);\r\n\r\n const onRadioChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setSettingsStorageRadio(event.target.value);\r\n }, [setSettingsStorageRadio]);\r\n\r\n const onUrlChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setMapUrl(event.target.value);\r\n }, [setMapUrl]);\r\n\r\n const createSource = React.useCallback(() => {\r\n let source: MapLayerSource | undefined;\r\n if (mapUrl && mapName) {\r\n source = MapLayerSource.fromJSON({\r\n url: mapUrl,\r\n name: mapName,\r\n formatId: mapType});\r\n\r\n // Set credentials separately since they are not part of JSON\r\n if (source) {\r\n source.userName = userName||undefined; // When there is no value, empty string is always returned, in this case force it to undefined,\r\n source.password = password||undefined;\r\n }\r\n\r\n }\r\n return source;\r\n }, [mapName, mapType, mapUrl, password, userName]);\r\n\r\n const handleOk = React.useCallback(() => {\r\n const source = createSource();\r\n if (source === undefined || props.mapLayerSourceToEdit) {\r\n\r\n ModalDialogManager.closeDialog();\r\n onOkResult();\r\n\r\n if (source === undefined) {\r\n // Close the dialog and inform end user something went wrong.\r\n const msgError = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerLayerSourceCreationFailed\");\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error: msgError, sourceUrl: mapUrl });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n return;\r\n }\r\n\r\n // Simply change the source definition in the setting service\r\n if (props.mapLayerSourceToEdit !== undefined) {\r\n const vp = props.activeViewport;\r\n void (async () => {\r\n if (isSettingsStorageAvailable && vp?.iModel?.iTwinId) {\r\n try {\r\n await MapLayerPreferences.replaceSource(props.mapLayerSourceToEdit!, source, vp.iModel.iTwinId, vp?.iModel.iModelId);\r\n } catch (err: any) {\r\n const errorMessage = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerEditError\", { layerName: props.mapLayerSourceToEdit?.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, errorMessage));\r\n return;\r\n }\r\n }\r\n })();\r\n return;\r\n }\r\n }\r\n\r\n setLayerAttachPending(true);\r\n\r\n // Attach source asynchronously.\r\n void (async () => {\r\n try {\r\n const closeDialog = await attemptAttachSource(source);\r\n if (isMounted.current) {\r\n setLayerAttachPending(false);\r\n }\r\n\r\n // In theory the modal dialog should always get closed by the parent\r\n // AttachLayerPanel's 'onOkResult' handler. We close it here just in case.\r\n if (closeDialog) {\r\n ModalDialogManager.closeDialog();\r\n onOkResult();\r\n }\r\n } catch (_error) {\r\n onOkResult();\r\n ModalDialogManager.closeDialog();\r\n }\r\n })();\r\n\r\n }, [createSource, props.mapLayerSourceToEdit, props.activeViewport, onOkResult, mapUrl, isSettingsStorageAvailable, attemptAttachSource]);\r\n\r\n React.useEffect(() => {\r\n const handleOAuthProcessEnd = (success: boolean, _state: any ) => {\r\n onOauthProcessEnd.raiseEvent(success, _state);\r\n };\r\n\r\n // Currently only arcgis support AccessClient\r\n\r\n const ac = IModelApp.mapLayerFormatRegistry.getAccessClient(MAP_TYPES.arcGis);\r\n if (ac?.onOAuthProcessEnd) {\r\n setAccessClient(ac); // cache it, so we dont need to make another lookup;\r\n ac.onOAuthProcessEnd.addListener(handleOAuthProcessEnd);\r\n }\r\n setAccessClientInitialized(true);\r\n return () => {\r\n if (ac?.onOAuthProcessEnd) {\r\n ac.onOAuthProcessEnd.removeListener(handleOAuthProcessEnd);\r\n }\r\n\r\n setAccessClient(undefined);\r\n setAccessClientInitialized(false);\r\n };\r\n }, [mapType, onOauthProcessEnd, setAccessClient]);\r\n\r\n // After a map type change, make sure the different Oauth states are reset.\r\n React.useEffect(() => {\r\n // Reset few states\r\n setServerRequireCredentials(false);\r\n setInvalidCredentialsProvided(false);\r\n setShowOauthPopup(false);\r\n setOAuthProcessSucceeded(undefined);\r\n setExternalLoginUrl(undefined);\r\n\r\n }, [mapType]);\r\n\r\n // The first time the dialog is loaded and we already know the layer requires auth. (i.e ImageryProvider already made an attempt)\r\n // makes a request to discover the authentification types and adjust UI accordingly (i.e. username/password fields, Oauth popup)\r\n // Without this effect, user would have to manually click the 'OK' button in order to trigger the layer connection.\r\n React.useEffect(() => {\r\n // Attach source asynchronously.\r\n void (async () => {\r\n if (isAccessClientInitialized && props.layerRequiringCredentials?.url !== undefined && props.layerRequiringCredentials?.name !== undefined) {\r\n try {\r\n const source = MapLayerSource.fromJSON({\r\n url: props.layerRequiringCredentials.url,\r\n name: props.layerRequiringCredentials.name,\r\n formatId: props.layerRequiringCredentials.formatId});\r\n\r\n if (source !== undefined) {\r\n setLayerAttachPending(true);\r\n const validation = await source.validateSource(true);\r\n if (isMounted.current) {\r\n setLayerAttachPending(false);\r\n }\r\n await updateAuthState(source, validation);\r\n }\r\n } catch (_error) {}\r\n }\r\n })();\r\n\r\n }, [isAccessClientInitialized,\r\n props.layerRequiringCredentials?.formatId,\r\n props.layerRequiringCredentials?.name,\r\n props.layerRequiringCredentials?.url,\r\n updateAuthState]);\r\n\r\n const dialogContainer = React.useRef<HTMLDivElement>(null);\r\n\r\n const readyToSave = React.useCallback(() => {\r\n const credentialsSet = !!userName && !!password;\r\n return (!!mapUrl && !!mapName)\r\n && !layerAttachPending\r\n && (!serverRequireCredentials || credentialsSet)\r\n && !invalidCredentialsProvided\r\n && (externalLoginUrl === undefined || (externalLoginUrl !== undefined && oauthProcessSucceeded));\r\n }, [userName, password, mapUrl, mapName, serverRequireCredentials, layerAttachPending, invalidCredentialsProvided, externalLoginUrl, oauthProcessSucceeded]);\r\n\r\n const buttonCluster = React.useMemo(() => [\r\n { type: DialogButtonType.OK, onClick: handleOk, disabled: !readyToSave() },\r\n { type: DialogButtonType.Cancel, onClick: handleCancel },\r\n ], [readyToSave, handleCancel, handleOk]);\r\n\r\n const handleOnKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLInputElement>) => {\r\n if (event.key === SpecialKey.Enter) {\r\n if (readyToSave())\r\n handleOk();\r\n }\r\n }, [handleOk, readyToSave]);\r\n\r\n // onOauthProcessEnd events handler\r\n React.useEffect(() => {\r\n const handleOauthProcess = (success: boolean, _state: any ) => {\r\n setLayerAuthPending(false);\r\n if (success) {\r\n setOAuthProcessSucceeded(true);\r\n setShowOauthPopup(false);\r\n setLayerAttachPending(false);\r\n handleOk(); // Add the layer the same way the user would do by clicking 'ok'\r\n } else {\r\n setShowOauthPopup(false);\r\n setLayerAttachPending(false);\r\n setOAuthProcessSucceeded(false);\r\n }\r\n };\r\n\r\n onOauthProcessEnd.addListener(handleOauthProcess);\r\n return () => {\r\n onOauthProcessEnd.removeListener(handleOauthProcess);\r\n };\r\n }, [handleOk, onOauthProcessEnd]);\r\n\r\n //\r\n // Monitors authentication method changes\r\n React.useEffect(() => {\r\n\r\n if (serverRequireCredentials && oauthProcessSucceeded === undefined && externalLoginUrl !== undefined) {\r\n handleArcGisLogin();\r\n }\r\n }, [oauthProcessSucceeded, externalLoginUrl, handleArcGisLogin, serverRequireCredentials]);\r\n\r\n // Monitors Oauth2 popup was closed\r\n const handleOAuthPopupClose = React.useCallback(() => {\r\n setShowOauthPopup(false);\r\n setLayerAuthPending(false);\r\n if (oauthProcessSucceeded === undefined)\r\n setOAuthProcessSucceeded(false); // indicates there was a failed attempt\r\n }, [oauthProcessSucceeded]);\r\n\r\n // Utility function to get warning message section\r\n function renderWarningMessage(): React.ReactNode {\r\n let node: React.ReactNode;\r\n let warningMessage: string|undefined;\r\n\r\n // Get the proper warning message\r\n if (showOauthPopup) {\r\n warningMessage = externalLoginWaitingMsg;\r\n } else if (oauthProcessSucceeded === false) {\r\n warningMessage = externalLoginFailedMsg;\r\n } else if (oauthProcessSucceeded === true) {\r\n warningMessage = externalLoginSucceededMsg;\r\n }else if (invalidCredentialsProvided) {\r\n warningMessage = invalidCredentialsLabel;\r\n } else if (serverRequireCredentials && (!userName || !password)) {\r\n warningMessage = missingCredentialsLabel;\r\n }\r\n\r\n // Sometimes we want to add an extra node, such as a button\r\n let extraNode: React.ReactNode;\r\n if (oauthProcessSucceeded === false) {\r\n extraNode = <div>\r\n <Button onClick={handleArcGisLogin}>{externalLoginTryAgainLabel}</Button>\r\n </div>;\r\n }\r\n\r\n if (warningMessage !== undefined) {\r\n return(\r\n <div className=\"map-layer-source-warnMessage\">\r\n <Icon className=\"map-layer-source-warnMessage-icon\" iconSpec=\"icon-status-warning\" />\r\n <span className=\"map-layer-source-warnMessage-label\">{warningMessage}</span >\r\n {extraNode}\r\n </div>);\r\n } else {\r\n return (<span className=\"map-layer-source-placeholder\">&nbsp;</span>);\r\n }\r\n return node;\r\n }\r\n\r\n // Use a hook to display the popup.\r\n // The display of the popup is controlled by the 'showOauthPopup' state variable.\r\n useCrossOriginPopup(showOauthPopup, externalLoginUrl, externalLoginTitle, 450, 450, handleOAuthPopupClose);\r\n return (\r\n <div ref={dialogContainer}>\r\n <Dialog\r\n className=\"map-layer-url-dialog\"\r\n title={dialogTitle}\r\n opened={true}\r\n resizable={true}\r\n movable={true}\r\n modal={true}\r\n buttonCluster={buttonCluster}\r\n onClose={handleCancel}\r\n onEscape={handleCancel}\r\n minHeight={120}\r\n maxWidth={600}\r\n titleStyle={{paddingLeft: \"10px\"}}\r\n footerStyle={{paddingBottom: \"10px\", paddingRight: \"10px\"}}\r\n trapFocus={false}\r\n >\r\n <div className=\"map-layer-url-dialog-content\">\r\n <div className=\"map-layer-source-url\">\r\n <span className=\"map-layer-source-label\">{typeLabel}</span>\r\n <SelectMapFormat\r\n value={mapType}\r\n disabled={props.layerRequiringCredentials !== undefined || props.mapLayerSourceToEdit !== undefined || layerAttachPending || layerAuthPending}\r\n onChange={setMapType}\r\n mapTypesOptions={mapTypesOptions}\r\n />\r\n <span className=\"map-layer-source-label\">{nameLabel}</span>\r\n <Input className=\"map-layer-source-input\" placeholder={nameInputPlaceHolder} onChange={onNameChange} value={mapName} disabled={props.layerRequiringCredentials !== undefined || layerAttachPending || layerAuthPending} />\r\n <span className=\"map-layer-source-label\">{urlLabel}</span>\r\n <Input className=\"map-layer-source-input\" placeholder={urlInputPlaceHolder} onKeyPress={handleOnKeyDown} onChange={onUrlChange} disabled={props.mapLayerSourceToEdit !== undefined || layerAttachPending || layerAuthPending} value={mapUrl} />\r\n {serverRequireCredentials\r\n && externalLoginUrl === undefined // external login is handled in popup\r\n && props.mapLayerSourceToEdit === undefined &&\r\n <>\r\n <span className=\"map-layer-source-label\">{userNameLabel}</span>\r\n <LabeledInput className=\"map-layer-source-input\"\r\n displayStyle=\"inline\"\r\n placeholder={serverRequireCredentials ? userNameRequiredLabel : userNameLabel}\r\n status={(!userName && serverRequireCredentials) || invalidCredentialsProvided ? \"warning\" : undefined}\r\n disabled={layerAttachPending || layerAuthPending}\r\n onChange={onUsernameChange}\r\n value={userName}\r\n size=\"small\" />\r\n\r\n <span className=\"map-layer-source-label\">{passwordLabel}</span>\r\n <LabeledInput className=\"map-layer-source-input\"\r\n\r\n displayStyle=\"inline\"\r\n type=\"password\" placeholder={serverRequireCredentials ? passwordRequiredLabel : passwordLabel}\r\n status={(!password && serverRequireCredentials) || invalidCredentialsProvided? \"warning\" : undefined}\r\n disabled={layerAttachPending || layerAuthPending}\r\n onChange={onPasswordChange}\r\n onKeyPress={handleOnKeyDown}\r\n value={password}\r\n size=\"small\" />\r\n\r\n </>\r\n }\r\n\r\n {/* Store settings options, not shown when editing a layer */}\r\n {isSettingsStorageAvailable &&\r\n <div title={settingsStorageDisabled ? noSaveSettingsWarning : \"\"}>\r\n {hasImodelContext &&\r\n <div>\r\n <Radio disabled={settingsStorageDisabled}\r\n name=\"settingsStorage\" value=\"iTwin\"\r\n label={iTwinSettingsLabel} checked={settingsStorage === \"iTwin\"}\r\n onChange={onRadioChange} />\r\n <Radio disabled={settingsStorageDisabled}\r\n name=\"settingsStorage\" value=\"Model\"\r\n label={modelSettingsLabel} checked={settingsStorage === \"Model\"}\r\n onChange={onRadioChange} />\r\n </div> }\r\n </div>}\r\n </div>\r\n </div>\r\n\r\n {/* Warning message */}\r\n {renderWarningMessage()}\r\n\r\n {/* Progress bar */}\r\n {(layerAttachPending || layerAuthPending) &&\r\n <div className=\"map-layer-source-progressBar\">\r\n <ProgressLinear indeterminate />\r\n </div>\r\n }\r\n </Dialog>\r\n </div >\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"MapUrlDialog.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapUrlDialog.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,8BAA8B;;;AAE9B,0DAAqE;AACrE,oDAAiD;AACjD,wDAA0F;AAE1F,wDAE8B;AAC9B,kDAAsE;AACtE,+BAA+B;AAC/B,mEAAgE;AAChE,+CAA8C;AAE9C,+BAA6B;AAC7B,sDAAoD;AACpD,uDAAoD;AAEvC,QAAA,SAAS,GAAG;IACvB,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,Q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AACJ,CAAC;AA1mBD,oCA0mBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n// cSpell:ignore Modeless WMTS\r\n\r\nimport { DialogButtonType, SpecialKey } from \"@itwin/appui-abstract\";\r\nimport { UiFramework } from \"@itwin/appui-react\";\r\nimport { Button, Input, LabeledInput, ProgressLinear, Radio } from \"@itwin/itwinui-react\";\r\nimport { ImageMapLayerProps } from \"@itwin/core-common\";\r\nimport { IModelApp, MapLayerAccessClient, MapLayerSource,\r\n MapLayerSourceStatus, MapLayerSourceValidation, NotifyMessageDetails, OutputMessagePriority, ScreenViewport,\r\n} from \"@itwin/core-frontend\";\r\nimport { Dialog, Icon, useCrossOriginPopup } from \"@itwin/core-react\";\r\nimport * as React from \"react\";\r\nimport { MapLayerPreferences } from \"../../MapLayerPreferences\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\nimport { MapTypesOptions } from \"../Interfaces\";\r\nimport \"./MapUrlDialog.scss\";\r\nimport { BeEvent, Guid } from \"@itwin/core-bentley\";\r\nimport { SelectMapFormat } from \"./SelectMapFormat\";\r\n\r\nexport const MAP_TYPES = {\r\n wms: \"WMS\",\r\n arcGis: \"ArcGIS\",\r\n wmts: \"WMTS\",\r\n tileUrl: \"TileURL\",\r\n arcGisFeature: \"ArcGISFeature\",\r\n};\r\n\r\ninterface MapUrlDialogProps {\r\n activeViewport?: ScreenViewport;\r\n isOverlay: boolean;\r\n onOkResult: () => void;\r\n onCancelResult?: () => void;\r\n mapTypesOptions?: MapTypesOptions;\r\n\r\n // An optional layer definition can be provide to enable the edit mode\r\n layerRequiringCredentials?: ImageMapLayerProps;\r\n\r\n mapLayerSourceToEdit?: MapLayerSource;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function MapUrlDialog(props: MapUrlDialogProps) {\r\n const { isOverlay, onOkResult, mapTypesOptions } = props;\r\n\r\n const getMapUrlFromProps = React.useCallback(() => {\r\n if (props.mapLayerSourceToEdit) {\r\n return props.mapLayerSourceToEdit.url;\r\n } else if (props.layerRequiringCredentials?.url) {\r\n return props.layerRequiringCredentials.url;\r\n }\r\n return \"\";\r\n }, [props.layerRequiringCredentials, props.mapLayerSourceToEdit]);\r\n\r\n const getMapNameFromProps = React.useCallback(() => {\r\n if (props.mapLayerSourceToEdit) {\r\n return props.mapLayerSourceToEdit.name;\r\n } else if (props.layerRequiringCredentials?.name) {\r\n return props.layerRequiringCredentials.name;\r\n }\r\n return \"\";\r\n }, [props.layerRequiringCredentials, props.mapLayerSourceToEdit]);\r\n\r\n const getFormatFromProps = React.useCallback(() => {\r\n if (props.mapLayerSourceToEdit) {\r\n return props.mapLayerSourceToEdit.formatId;\r\n } else if (props.layerRequiringCredentials?.formatId) {\r\n return props.layerRequiringCredentials.formatId;\r\n }\r\n return undefined;\r\n }, [props.layerRequiringCredentials, props.mapLayerSourceToEdit]);\r\n\r\n const [dialogTitle] = React.useState(MapLayersUI.localization.getLocalizedString(props.layerRequiringCredentials || props.mapLayerSourceToEdit ? \"mapLayers:CustomAttach.EditCustomLayer\" : \"mapLayers:CustomAttach.AttachCustomLayer\"));\r\n const [typeLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.Type\"));\r\n const [nameLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.Name\"));\r\n const [nameInputPlaceHolder] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.NameInputPlaceHolder\"));\r\n const [urlLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.URL\"));\r\n const [urlInputPlaceHolder] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.UrlInputPlaceHolder\"));\r\n const [iTwinSettingsLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.StoreOnITwinSettings\"));\r\n const [modelSettingsLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.StoreOnModelSettings\"));\r\n const [missingCredentialsLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.MissingCredentials\"));\r\n const [invalidCredentialsLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.InvalidCredentials\"));\r\n const [externalLoginTitle] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLogin\"));\r\n const [externalLoginFailedMsg] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLoginFailed\"));\r\n const [externalLoginSucceededMsg] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLoginSucceeded\"));\r\n const [externalLoginWaitingMsg] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLoginWaiting\"));\r\n const [externalLoginTryAgainLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLoginTryAgain\"));\r\n const [serverRequireCredentials, setServerRequireCredentials] = React.useState(false);\r\n const [invalidCredentialsProvided, setInvalidCredentialsProvided] = React.useState(false);\r\n const [layerAttachPending, setLayerAttachPending] = React.useState(false);\r\n const [layerAuthPending, setLayerAuthPending] = React.useState(false);\r\n const [mapUrl, setMapUrl] = React.useState(getMapUrlFromProps());\r\n const [mapName, setMapName] = React.useState(getMapNameFromProps());\r\n const [userName, setUserName] = React.useState(\"\");\r\n const [password, setPassword] = React.useState(\"\");\r\n const [noSaveSettingsWarning] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.NoSaveSettingsWarning\"));\r\n const [passwordLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:AuthenticationInputs.Password\"));\r\n const [passwordRequiredLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:AuthenticationInputs.PasswordRequired\"));\r\n const [userNameLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:AuthenticationInputs.Username\"));\r\n const [userNameRequiredLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:AuthenticationInputs.UsernameRequired\"));\r\n const [settingsStorage, setSettingsStorageRadio] = React.useState(\"iTwin\");\r\n const [oauthProcessSucceeded, setOAuthProcessSucceeded] = React.useState<undefined|boolean>(undefined);\r\n const [showOauthPopup, setShowOauthPopup] = React.useState(false);\r\n const [externalLoginUrl, setExternalLoginUrl] = React.useState<string|undefined>();\r\n const [onOauthProcessEnd] = React.useState(new BeEvent());\r\n const [accessClient, setAccessClient] = React.useState<MapLayerAccessClient | undefined>();\r\n const [isAccessClientInitialized, setAccessClientInitialized] = React.useState(false);\r\n\r\n const [mapType, setMapType] = React.useState(getFormatFromProps() ?? \"ArcGIS\");\r\n\r\n // 'isMounted' is used to prevent any async operation once the hook has been\r\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n };\r\n }, []);\r\n\r\n const [isSettingsStorageAvailable] = React.useState(MapLayersUI.iTwinConfig && props?.activeViewport?.iModel?.iTwinId);\r\n const [hasImodelContext] = React.useState (\r\n props?.activeViewport?.iModel?.iTwinId !== undefined\r\n && props.activeViewport.iModel.iTwinId !== Guid.empty\r\n && props?.activeViewport?.iModel?.iModelId !== undefined\r\n && props?.activeViewport.iModel.iModelId !== Guid.empty);\r\n\r\n // Even though the settings storage is available,\r\n // we don't always want to enable it in the UI.\r\n const [settingsStorageDisabled] = React.useState(!isSettingsStorageAvailable || props.mapLayerSourceToEdit !== undefined || props.layerRequiringCredentials !== undefined);\r\n\r\n const [layerRequiringCredentialsIdx] = React.useState((): number | undefined => {\r\n if (props.layerRequiringCredentials === undefined || !props.layerRequiringCredentials.name || !props.layerRequiringCredentials.url) {\r\n return undefined;\r\n }\r\n\r\n const indexInDisplayStyle = props.activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(props.layerRequiringCredentials.name, props.layerRequiringCredentials.url, isOverlay);\r\n if (indexInDisplayStyle === undefined || indexInDisplayStyle < 0) {\r\n return undefined;\r\n } else {\r\n return indexInDisplayStyle;\r\n }\r\n });\r\n\r\n const handleCancel = React.useCallback(() => {\r\n if (props.onCancelResult) {\r\n props.onCancelResult();\r\n return;\r\n }\r\n UiFramework.dialogs.modal.close();\r\n }, [props]);\r\n\r\n const onUsernameChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setUserName(event.target.value);\r\n if (invalidCredentialsProvided)\r\n setInvalidCredentialsProvided(false);\r\n }, [setUserName, invalidCredentialsProvided, setInvalidCredentialsProvided]);\r\n\r\n const onPasswordChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setPassword(event.target.value);\r\n if (invalidCredentialsProvided)\r\n setInvalidCredentialsProvided(false);\r\n }, [setPassword, invalidCredentialsProvided, setInvalidCredentialsProvided]);\r\n\r\n const handleArcGisLogin = React.useCallback(() => {\r\n setLayerAuthPending(true);\r\n setShowOauthPopup(true);\r\n if (oauthProcessSucceeded === false) {\r\n setOAuthProcessSucceeded(undefined);\r\n }\r\n\r\n }, [oauthProcessSucceeded]);\r\n\r\n // return true if authorization is needed\r\n const updateAuthState = React.useCallback(async (source: MapLayerSource, sourceValidation: MapLayerSourceValidation) => {\r\n const sourceRequireAuth = (sourceValidation.status === MapLayerSourceStatus.RequireAuth);\r\n const invalidCredentials = (sourceValidation.status === MapLayerSourceStatus.InvalidCredentials);\r\n if (sourceRequireAuth) {\r\n const settings = source.toLayerSettings();\r\n\r\n if (accessClient !== undefined && accessClient.getTokenServiceEndPoint !== undefined && settings !== undefined) {\r\n try {\r\n const tokenEndpoint = await accessClient.getTokenServiceEndPoint(settings.url);\r\n if (tokenEndpoint !== undefined) {\r\n const loginUrl = tokenEndpoint.getLoginUrl();\r\n setExternalLoginUrl(loginUrl);\r\n }\r\n\r\n } catch (_error){\r\n\r\n }\r\n }\r\n\r\n }\r\n setServerRequireCredentials(sourceRequireAuth || invalidCredentials);\r\n if (invalidCredentials) {\r\n setInvalidCredentialsProvided(true);\r\n } else if (invalidCredentialsProvided) {\r\n setInvalidCredentialsProvided(false); // flag reset\r\n }\r\n\r\n return sourceRequireAuth || invalidCredentials;\r\n }, [accessClient, invalidCredentialsProvided]);\r\n\r\n const updateAttachedLayer = React.useCallback(async (source: MapLayerSource, validation: MapLayerSourceValidation) => {\r\n const vp = props?.activeViewport;\r\n if (vp === undefined || source === undefined || layerRequiringCredentialsIdx === undefined) {\r\n const error = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachMissingViewOrSource\");\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error, sourceUrl: source.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n return true;\r\n }\r\n\r\n // Layer is already attached,\r\n vp.displayStyle.changeMapLayerProps({\r\n subLayers: validation.subLayers,\r\n }, layerRequiringCredentialsIdx, isOverlay);\r\n vp.displayStyle.changeMapLayerCredentials(layerRequiringCredentialsIdx, isOverlay, source.userName, source.password);\r\n\r\n // Either initial attach/initialize failed or the layer failed to load at least one tile\r\n // because of an invalid token; in both cases tile tree needs to be fully reset\r\n const provider = vp.getMapLayerImageryProvider(layerRequiringCredentialsIdx, isOverlay);\r\n provider?.resetStatus();\r\n vp.resetMapLayer(layerRequiringCredentialsIdx, isOverlay);\r\n vp.invalidateRenderPlan();\r\n\r\n // This handler will close the layer source handler, and therefore the MapUrl dialog.\r\n // don't call it if the dialog needs to remains open.\r\n onOkResult();\r\n\r\n return true;\r\n }, [isOverlay, layerRequiringCredentialsIdx, onOkResult, props.activeViewport]);\r\n\r\n // Returns true if no further input is needed from end-user.\r\n const doAttach = React.useCallback(async (source: MapLayerSource, validation: MapLayerSourceValidation): Promise<boolean> => {\r\n const vp = props?.activeViewport;\r\n if (vp === undefined || source === undefined) {\r\n const error = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachMissingViewOrSource\");\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error, sourceUrl: source.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n return true;\r\n }\r\n\r\n // Update service settings if storage is available and we are not prompting user for credentials\r\n if (!settingsStorageDisabled && !props.layerRequiringCredentials) {\r\n \tconst storeOnIModel = (hasImodelContext ? \"Model\" === settingsStorage : undefined);\r\n if (vp.iModel.iTwinId && !(await MapLayerPreferences.storeSource(source, vp.iModel.iTwinId, vp.iModel.iModelId, storeOnIModel))) {\r\n const msgError = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerPreferencesStoreFailed\");\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msgError));\r\n\t }\r\n }\r\n\r\n // Some sources have a single non-visible sub-layer (i.e. ArcGIS World Topo Map); to avoid having a layer with no content (and no way to change the sub-layer visibility)\r\n // we force the sub-layer visibility to ON.\r\n let subLayers = validation.subLayers;\r\n if (validation.subLayers && validation.subLayers.length === 1 && validation.subLayers[0].visible === false) {\r\n subLayers = [{...validation.subLayers[0], visible: true}];\r\n }\r\n const settings = source.toLayerSettings(subLayers);\r\n if (settings) {\r\n vp.displayStyle.attachMapLayer({settings, isOverlay});\r\n\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttached\", { sourceName: source.name, sourceUrl: source.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n } else {\r\n const msgError = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerLayerSettingsConversionError\");\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.MapLayerAttachError\", { error: msgError, sourceUrl: source.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n }\r\n\r\n vp.invalidateRenderPlan();\r\n\r\n // This handler will close the layer source handler, and therefore the MapUrl dialog.\r\n // don't call it if the dialog needs to remains open.\r\n onOkResult();\r\n\r\n return true;\r\n }, [hasImodelContext, isOverlay, onOkResult, props?.activeViewport, props.layerRequiringCredentials, settingsStorage, settingsStorageDisabled]);\r\n\r\n // Validate the layer source and attempt to attach (or update) the layer.\r\n // Returns true if no further input is needed from end-user (i.e. close the dialog)\r\n const attemptAttachSource = React.useCallback(async (source: MapLayerSource): Promise<boolean> => {\r\n try {\r\n const validation = await source.validateSource(true);\r\n\r\n if (validation.status === MapLayerSourceStatus.Valid) {\r\n if (layerRequiringCredentialsIdx === undefined ) {\r\n return await doAttach(source, validation);\r\n } else {\r\n return await updateAttachedLayer(source, validation);\r\n }\r\n } else if (validation.status === MapLayerSourceStatus.InvalidCoordinateSystem){\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.InvalidCoordinateSystem\");\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n return true;\r\n } else {\r\n const authNeeded = await updateAuthState(source, validation);\r\n if (authNeeded) {\r\n return false;\r\n } else {\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ValidationError\");\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, `${msg} ${source.url}`));\r\n return true;\r\n }\r\n }\r\n return false;\r\n } catch (error) {\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error, sourceUrl: source.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n return true;\r\n }\r\n\r\n }, [updateAuthState, doAttach, layerRequiringCredentialsIdx, updateAttachedLayer]);\r\n\r\n const onNameChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setMapName(event.target.value);\r\n }, [setMapName]);\r\n\r\n const onRadioChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setSettingsStorageRadio(event.target.value);\r\n }, [setSettingsStorageRadio]);\r\n\r\n const onUrlChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setMapUrl(event.target.value);\r\n }, [setMapUrl]);\r\n\r\n const createSource = React.useCallback(() => {\r\n let source: MapLayerSource | undefined;\r\n if (mapUrl && mapName) {\r\n source = MapLayerSource.fromJSON({\r\n url: mapUrl,\r\n name: mapName,\r\n formatId: mapType});\r\n\r\n // Set credentials separately since they are not part of JSON\r\n if (source) {\r\n source.userName = userName||undefined; // When there is no value, empty string is always returned, in this case force it to undefined,\r\n source.password = password||undefined;\r\n }\r\n\r\n }\r\n return source;\r\n }, [mapName, mapType, mapUrl, password, userName]);\r\n\r\n const handleOk = React.useCallback(() => {\r\n const source = createSource();\r\n if (source === undefined || props.mapLayerSourceToEdit) {\r\n\r\n UiFramework.dialogs.modal.close();\r\n onOkResult();\r\n\r\n if (source === undefined) {\r\n // Close the dialog and inform end user something went wrong.\r\n const msgError = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerLayerSourceCreationFailed\");\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error: msgError, sourceUrl: mapUrl });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n return;\r\n }\r\n\r\n // Simply change the source definition in the setting service\r\n if (props.mapLayerSourceToEdit !== undefined) {\r\n const vp = props.activeViewport;\r\n void (async () => {\r\n if (isSettingsStorageAvailable && vp?.iModel?.iTwinId) {\r\n try {\r\n await MapLayerPreferences.replaceSource(props.mapLayerSourceToEdit!, source, vp.iModel.iTwinId, vp?.iModel.iModelId);\r\n } catch (err: any) {\r\n const errorMessage = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerEditError\", { layerName: props.mapLayerSourceToEdit?.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, errorMessage));\r\n return;\r\n }\r\n }\r\n })();\r\n return;\r\n }\r\n }\r\n\r\n setLayerAttachPending(true);\r\n\r\n // Attach source asynchronously.\r\n void (async () => {\r\n try {\r\n const closeDialog = await attemptAttachSource(source);\r\n if (isMounted.current) {\r\n setLayerAttachPending(false);\r\n }\r\n\r\n // In theory the modal dialog should always get closed by the parent\r\n // AttachLayerPanel's 'onOkResult' handler. We close it here just in case.\r\n if (closeDialog) {\r\n UiFramework.dialogs.modal.close();\r\n onOkResult();\r\n }\r\n } catch (_error) {\r\n onOkResult();\r\n UiFramework.dialogs.modal.close();\r\n }\r\n })();\r\n\r\n }, [createSource, props.mapLayerSourceToEdit, props.activeViewport, onOkResult, mapUrl, isSettingsStorageAvailable, attemptAttachSource]);\r\n\r\n React.useEffect(() => {\r\n const handleOAuthProcessEnd = (success: boolean, _state: any ) => {\r\n onOauthProcessEnd.raiseEvent(success, _state);\r\n };\r\n\r\n // Currently only arcgis support AccessClient\r\n\r\n const ac = IModelApp.mapLayerFormatRegistry.getAccessClient(MAP_TYPES.arcGis);\r\n if (ac?.onOAuthProcessEnd) {\r\n setAccessClient(ac); // cache it, so we dont need to make another lookup;\r\n ac.onOAuthProcessEnd.addListener(handleOAuthProcessEnd);\r\n }\r\n setAccessClientInitialized(true);\r\n return () => {\r\n if (ac?.onOAuthProcessEnd) {\r\n ac.onOAuthProcessEnd.removeListener(handleOAuthProcessEnd);\r\n }\r\n\r\n setAccessClient(undefined);\r\n setAccessClientInitialized(false);\r\n };\r\n }, [mapType, onOauthProcessEnd, setAccessClient]);\r\n\r\n // After a map type change, make sure the different Oauth states are reset.\r\n React.useEffect(() => {\r\n // Reset few states\r\n setServerRequireCredentials(false);\r\n setInvalidCredentialsProvided(false);\r\n setShowOauthPopup(false);\r\n setOAuthProcessSucceeded(undefined);\r\n setExternalLoginUrl(undefined);\r\n\r\n }, [mapType]);\r\n\r\n // The first time the dialog is loaded and we already know the layer requires auth. (i.e ImageryProvider already made an attempt)\r\n // makes a request to discover the authentification types and adjust UI accordingly (i.e. username/password fields, Oauth popup)\r\n // Without this effect, user would have to manually click the 'OK' button in order to trigger the layer connection.\r\n React.useEffect(() => {\r\n // Attach source asynchronously.\r\n void (async () => {\r\n if (isAccessClientInitialized && props.layerRequiringCredentials?.url !== undefined && props.layerRequiringCredentials?.name !== undefined) {\r\n try {\r\n const source = MapLayerSource.fromJSON({\r\n url: props.layerRequiringCredentials.url,\r\n name: props.layerRequiringCredentials.name,\r\n formatId: props.layerRequiringCredentials.formatId});\r\n\r\n if (source !== undefined) {\r\n setLayerAttachPending(true);\r\n const validation = await source.validateSource(true);\r\n if (isMounted.current) {\r\n setLayerAttachPending(false);\r\n }\r\n await updateAuthState(source, validation);\r\n }\r\n } catch (_error) {}\r\n }\r\n })();\r\n\r\n }, [isAccessClientInitialized,\r\n props.layerRequiringCredentials?.formatId,\r\n props.layerRequiringCredentials?.name,\r\n props.layerRequiringCredentials?.url,\r\n updateAuthState]);\r\n\r\n const dialogContainer = React.useRef<HTMLDivElement>(null);\r\n\r\n const readyToSave = React.useCallback(() => {\r\n const credentialsSet = !!userName && !!password;\r\n return (!!mapUrl && !!mapName)\r\n && !layerAttachPending\r\n && (!serverRequireCredentials || credentialsSet)\r\n && !invalidCredentialsProvided\r\n && (externalLoginUrl === undefined || (externalLoginUrl !== undefined && oauthProcessSucceeded));\r\n }, [userName, password, mapUrl, mapName, serverRequireCredentials, layerAttachPending, invalidCredentialsProvided, externalLoginUrl, oauthProcessSucceeded]);\r\n\r\n const buttonCluster = React.useMemo(() => [\r\n { type: DialogButtonType.OK, onClick: handleOk, disabled: !readyToSave() },\r\n { type: DialogButtonType.Cancel, onClick: handleCancel },\r\n ], [readyToSave, handleCancel, handleOk]);\r\n\r\n const handleOnKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLInputElement>) => {\r\n if (event.key === SpecialKey.Enter) {\r\n if (readyToSave())\r\n handleOk();\r\n }\r\n }, [handleOk, readyToSave]);\r\n\r\n // onOauthProcessEnd events handler\r\n React.useEffect(() => {\r\n const handleOauthProcess = (success: boolean, _state: any ) => {\r\n setLayerAuthPending(false);\r\n if (success) {\r\n setOAuthProcessSucceeded(true);\r\n setShowOauthPopup(false);\r\n setLayerAttachPending(false);\r\n handleOk(); // Add the layer the same way the user would do by clicking 'ok'\r\n } else {\r\n setShowOauthPopup(false);\r\n setLayerAttachPending(false);\r\n setOAuthProcessSucceeded(false);\r\n }\r\n };\r\n\r\n onOauthProcessEnd.addListener(handleOauthProcess);\r\n return () => {\r\n onOauthProcessEnd.removeListener(handleOauthProcess);\r\n };\r\n }, [handleOk, onOauthProcessEnd]);\r\n\r\n //\r\n // Monitors authentication method changes\r\n React.useEffect(() => {\r\n\r\n if (serverRequireCredentials && oauthProcessSucceeded === undefined && externalLoginUrl !== undefined) {\r\n handleArcGisLogin();\r\n }\r\n }, [oauthProcessSucceeded, externalLoginUrl, handleArcGisLogin, serverRequireCredentials]);\r\n\r\n // Monitors Oauth2 popup was closed\r\n const handleOAuthPopupClose = React.useCallback(() => {\r\n setShowOauthPopup(false);\r\n setLayerAuthPending(false);\r\n if (oauthProcessSucceeded === undefined)\r\n setOAuthProcessSucceeded(false); // indicates there was a failed attempt\r\n }, [oauthProcessSucceeded]);\r\n\r\n // Utility function to get warning message section\r\n function renderWarningMessage(): React.ReactNode {\r\n let node: React.ReactNode;\r\n let warningMessage: string|undefined;\r\n\r\n // Get the proper warning message\r\n if (showOauthPopup) {\r\n warningMessage = externalLoginWaitingMsg;\r\n } else if (oauthProcessSucceeded === false) {\r\n warningMessage = externalLoginFailedMsg;\r\n } else if (oauthProcessSucceeded === true) {\r\n warningMessage = externalLoginSucceededMsg;\r\n }else if (invalidCredentialsProvided) {\r\n warningMessage = invalidCredentialsLabel;\r\n } else if (serverRequireCredentials && (!userName || !password)) {\r\n warningMessage = missingCredentialsLabel;\r\n }\r\n\r\n // Sometimes we want to add an extra node, such as a button\r\n let extraNode: React.ReactNode;\r\n if (oauthProcessSucceeded === false) {\r\n extraNode = <div>\r\n <Button onClick={handleArcGisLogin}>{externalLoginTryAgainLabel}</Button>\r\n </div>;\r\n }\r\n\r\n if (warningMessage !== undefined) {\r\n return(\r\n <div className=\"map-layer-source-warnMessage\">\r\n <Icon className=\"map-layer-source-warnMessage-icon\" iconSpec=\"icon-status-warning\" />\r\n <span className=\"map-layer-source-warnMessage-label\">{warningMessage}</span >\r\n {extraNode}\r\n </div>);\r\n } else {\r\n return (<span className=\"map-layer-source-placeholder\">&nbsp;</span>);\r\n }\r\n return node;\r\n }\r\n\r\n // Use a hook to display the popup.\r\n // The display of the popup is controlled by the 'showOauthPopup' state variable.\r\n useCrossOriginPopup(showOauthPopup, externalLoginUrl, externalLoginTitle, 450, 450, handleOAuthPopupClose);\r\n return (\r\n <div ref={dialogContainer}>\r\n <Dialog\r\n className=\"map-layer-url-dialog\"\r\n title={dialogTitle}\r\n opened={true}\r\n resizable={true}\r\n movable={true}\r\n modal={true}\r\n buttonCluster={buttonCluster}\r\n onClose={handleCancel}\r\n onEscape={handleCancel}\r\n minHeight={120}\r\n maxWidth={600}\r\n titleStyle={{paddingLeft: \"10px\"}}\r\n footerStyle={{paddingBottom: \"10px\", paddingRight: \"10px\"}}\r\n trapFocus={false}\r\n >\r\n <div className=\"map-layer-url-dialog-content\">\r\n <div className=\"map-layer-source-url\">\r\n <span className=\"map-layer-source-label\">{typeLabel}</span>\r\n <SelectMapFormat\r\n value={mapType}\r\n disabled={props.layerRequiringCredentials !== undefined || props.mapLayerSourceToEdit !== undefined || layerAttachPending || layerAuthPending}\r\n onChange={setMapType}\r\n mapTypesOptions={mapTypesOptions}\r\n />\r\n <span className=\"map-layer-source-label\">{nameLabel}</span>\r\n <Input className=\"map-layer-source-input\" placeholder={nameInputPlaceHolder} onChange={onNameChange} value={mapName} disabled={props.layerRequiringCredentials !== undefined || layerAttachPending || layerAuthPending} />\r\n <span className=\"map-layer-source-label\">{urlLabel}</span>\r\n <Input className=\"map-layer-source-input\" placeholder={urlInputPlaceHolder} onKeyPress={handleOnKeyDown} onChange={onUrlChange} disabled={props.mapLayerSourceToEdit !== undefined || layerAttachPending || layerAuthPending} value={mapUrl} />\r\n {serverRequireCredentials\r\n && externalLoginUrl === undefined // external login is handled in popup\r\n && props.mapLayerSourceToEdit === undefined &&\r\n <>\r\n <span className=\"map-layer-source-label\">{userNameLabel}</span>\r\n <LabeledInput className=\"map-layer-source-input\"\r\n displayStyle=\"inline\"\r\n placeholder={serverRequireCredentials ? userNameRequiredLabel : userNameLabel}\r\n status={(!userName && serverRequireCredentials) || invalidCredentialsProvided ? \"warning\" : undefined}\r\n disabled={layerAttachPending || layerAuthPending}\r\n onChange={onUsernameChange}\r\n value={userName}\r\n size=\"small\" />\r\n\r\n <span className=\"map-layer-source-label\">{passwordLabel}</span>\r\n <LabeledInput className=\"map-layer-source-input\"\r\n\r\n displayStyle=\"inline\"\r\n type=\"password\" placeholder={serverRequireCredentials ? passwordRequiredLabel : passwordLabel}\r\n status={(!password && serverRequireCredentials) || invalidCredentialsProvided? \"warning\" : undefined}\r\n disabled={layerAttachPending || layerAuthPending}\r\n onChange={onPasswordChange}\r\n onKeyPress={handleOnKeyDown}\r\n value={password}\r\n size=\"small\" />\r\n\r\n </>\r\n }\r\n\r\n {/* Store settings options, not shown when editing a layer */}\r\n {isSettingsStorageAvailable &&\r\n <div title={settingsStorageDisabled ? noSaveSettingsWarning : \"\"}>\r\n {hasImodelContext &&\r\n <div>\r\n <Radio disabled={settingsStorageDisabled}\r\n name=\"settingsStorage\" value=\"iTwin\"\r\n label={iTwinSettingsLabel} checked={settingsStorage === \"iTwin\"}\r\n onChange={onRadioChange} />\r\n <Radio disabled={settingsStorageDisabled}\r\n name=\"settingsStorage\" value=\"Model\"\r\n label={modelSettingsLabel} checked={settingsStorage === \"Model\"}\r\n onChange={onRadioChange} />\r\n </div> }\r\n </div>}\r\n </div>\r\n </div>\r\n\r\n {/* Warning message */}\r\n {renderWarningMessage()}\r\n\r\n {/* Progress bar */}\r\n {(layerAttachPending || layerAuthPending) &&\r\n <div className=\"map-layer-source-progressBar\">\r\n <ProgressLinear indeterminate />\r\n </div>\r\n }\r\n </Dialog>\r\n </div >\r\n );\r\n}\r\n"]}
@@ -25,17 +25,15 @@ exports.MAP_TYPES = {
25
25
  };
26
26
  // eslint-disable-next-line @typescript-eslint/naming-convention
27
27
  function SelectMapFormat(props) {
28
- var _a;
29
- const [mapFormat, setMapFormat] = React.useState((_a = props.value) !== null && _a !== void 0 ? _a : exports.MAP_TYPES.arcGis);
28
+ const [mapFormat, setMapFormat] = React.useState(props.value ?? exports.MAP_TYPES.arcGis);
30
29
  const [techPreviewTooltip] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.TechPreviewBadgeTooltip"));
31
30
  const [mapFormats] = React.useState(() => {
32
- var _a;
33
31
  const formats = [
34
32
  { value: exports.MAP_TYPES.arcGis, label: exports.MAP_TYPES.arcGis },
35
33
  { value: exports.MAP_TYPES.wms, label: exports.MAP_TYPES.wms },
36
34
  { value: exports.MAP_TYPES.wmts, label: exports.MAP_TYPES.wmts },
37
35
  ];
38
- if ((_a = props.mapTypesOptions) === null || _a === void 0 ? void 0 : _a.supportTileUrl)
36
+ if (props.mapTypesOptions?.supportTileUrl)
39
37
  formats.push({ value: exports.MAP_TYPES.tileUrl, label: exports.MAP_TYPES.tileUrl });
40
38
  if (core_frontend_1.IModelApp.mapLayerFormatRegistry.isRegistered(exports.MAP_TYPES.arcGisFeature))
41
39
  formats.push({ value: exports.MAP_TYPES.arcGisFeature, label: exports.MAP_TYPES.arcGisFeature, id: "techPreview" });
@@ -47,14 +45,11 @@ function SelectMapFormat(props) {
47
45
  props.onChange(value);
48
46
  }
49
47
  }, [props]);
50
- return (React.createElement(itwinui_react_1.Select, { className: "map-layer-source-select", options: mapFormats, value: mapFormat, disabled: props.disabled, onChange: handleOnChange, size: "small", itemRenderer: (option) => {
51
- var _a;
52
- return (React.createElement(itwinui_react_1.MenuItem, { badge: ((_a = option.id) === null || _a === void 0 ? void 0 : _a.includes("techPreview")) ?
53
- React.createElement("div", { title: techPreviewTooltip },
54
- React.createElement(itwinui_react_1.IconButton, { className: "map-layer-source-select-previewBadge", size: "small" },
55
- React.createElement(itwinui_icons_color_react_1.SvgTechnicalPreviewMini, null)))
56
- : undefined }, option.label));
57
- } }));
48
+ return (React.createElement(itwinui_react_1.Select, { className: "map-layer-source-select", options: mapFormats, value: mapFormat, disabled: props.disabled, onChange: handleOnChange, size: "small", itemRenderer: (option) => (React.createElement(itwinui_react_1.MenuItem, { badge: option.id?.includes("techPreview") ?
49
+ React.createElement("div", { title: techPreviewTooltip },
50
+ React.createElement(itwinui_react_1.IconButton, { className: "map-layer-source-select-previewBadge", size: "small" },
51
+ React.createElement(itwinui_icons_color_react_1.SvgTechnicalPreviewMini, null)))
52
+ : undefined }, option.label)) }));
58
53
  }
59
54
  exports.SelectMapFormat = SelectMapFormat;
60
55
  //# sourceMappingURL=SelectMapFormat.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectMapFormat.js","sourceRoot":"","sources":["../../../../src/ui/widget/SelectMapFormat.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,8BAA8B;;;AAE9B,wDAAkF;AAClF,+BAA+B;AAE/B,+BAA6B;AAC7B,gFAAyE;AACzE,+CAA8C;AAC9C,wDAAiD;AAEjD,QAAQ;AACR,wEAAwE;AACxE,4EAA4E;AAC5E,wDAAwD;AAC3C,QAAA,SAAS,GAAG;IACvB,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,aAAa,EAAE,eAAe;CAC/B,CAAC;AASF,gEAAgE;AAChE,SAAgB,eAAe,CAAC,KAA2B;;IAEzD,MAAM,CAAC,SA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QAAQ,CAAC,KAAK,CAAC,CAAC;SACvB;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,CAEL,oBAAC,sBAAM,IACL,SAAS,EAAC,yBAAyB,EACnC,OAAO,EAAE,UAAU,EACnB,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,QAAQ,EAAE,cAAc,EACxB,IAAI,EAAC,OAAO,EACZ,YAAY,EACV,CAAC,MAAM,EAAE,EAAE;;YAAC,OAAA,CACV,oBAAC,wBAAQ,IACP,KAAK,EAAE,CAAA,MAAA,MAAM,CAAC,EAAE,0CAAE,QAAQ,CAAC,aAAa,CAAC,EAAC,CAAC;oBACzC,6BAAK,KAAK,EAAE,kBAAkB;wBAC5B,oBAAC,0BAAU,IAAC,SAAS,EAAC,sCAAsC,EAAE,IAAI,EAAC,OAAO;4BACxE,oBAAC,mDAAuB,OAAG,CAChB,CACT;oBACN,CAAC,CAAC,SAAS,IACZ,MAAM,CAAC,KAAK,CACJ,CAAC,CAAA;SAAA,GAChB,CACH,CAAC;AACJ,CAAC;AAlDD,0CAkDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n// cSpell:ignore Modeless WMTS\r\n\r\nimport { IconButton, MenuItem, Select, SelectOption } from \"@itwin/itwinui-react\";\r\nimport * as React from \"react\";\r\nimport { MapTypesOptions } from \"../Interfaces\";\r\nimport \"./MapUrlDialog.scss\";\r\nimport {SvgTechnicalPreviewMini} from \"@itwin/itwinui-icons-color-react\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\nimport { IModelApp } from \"@itwin/core-frontend\";\r\n\r\n// TODO:\r\n// Remove this structure and iterate over the registry's active formats.\r\n// Still need a proper way to exclude some format, like we currently do with\r\n// 'TileUrl' without the need to hardcode any format Id.\r\nexport const MAP_TYPES = {\r\n wms: \"WMS\",\r\n arcGis: \"ArcGIS\",\r\n wmts: \"WMTS\",\r\n tileUrl: \"TileURL\",\r\n arcGisFeature: \"ArcGISFeature\",\r\n};\r\n\r\ninterface SelectMapFormatProps {\r\n value?: string;\r\n disabled?: boolean;\r\n mapTypesOptions?: MapTypesOptions;\r\n onChange?: (mapType: string) => void;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function SelectMapFormat(props: SelectMapFormatProps) {\r\n\r\n const [mapFormat, setMapFormat] = React.useState(props.value ?? MAP_TYPES.arcGis);\r\n const [techPreviewTooltip] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.TechPreviewBadgeTooltip\"));\r\n\r\n const [mapFormats] = React.useState((): SelectOption<string>[] => {\r\n const formats: SelectOption<string>[] = [\r\n { value: MAP_TYPES.arcGis, label: MAP_TYPES.arcGis },\r\n { value: MAP_TYPES.wms, label: MAP_TYPES.wms },\r\n { value: MAP_TYPES.wmts, label: MAP_TYPES.wmts },\r\n ];\r\n if (props.mapTypesOptions?.supportTileUrl)\r\n formats.push({ value: MAP_TYPES.tileUrl, label: MAP_TYPES.tileUrl });\r\n\r\n if (IModelApp.mapLayerFormatRegistry.isRegistered(MAP_TYPES.arcGisFeature))\r\n formats.push( { value: MAP_TYPES.arcGisFeature, label: MAP_TYPES.arcGisFeature, id:\"techPreview\" });\r\n\r\n return formats;\r\n });\r\n\r\n const handleOnChange = React.useCallback((value: string) => {\r\n setMapFormat(value);\r\n if (props.onChange) {\r\n props.onChange(value);\r\n }\r\n }, [props]);\r\n\r\n return (\r\n\r\n <Select\r\n className=\"map-layer-source-select\"\r\n options={mapFormats}\r\n value={mapFormat}\r\n disabled={props.disabled}\r\n onChange={handleOnChange}\r\n size=\"small\"\r\n itemRenderer={\r\n (option) => (\r\n <MenuItem\r\n badge={option.id?.includes(\"techPreview\") ?\r\n <div title={techPreviewTooltip}>\r\n <IconButton className=\"map-layer-source-select-previewBadge\" size=\"small\">\r\n <SvgTechnicalPreviewMini />\r\n </IconButton>\r\n </div>\r\n : undefined}>\r\n {option.label}\r\n </MenuItem>) }\r\n />\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"SelectMapFormat.js","sourceRoot":"","sources":["../../../../src/ui/widget/SelectMapFormat.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,8BAA8B;;;AAE9B,wDAAkF;AAClF,+BAA+B;AAE/B,+BAA6B;AAC7B,gFAAyE;AACzE,+CAA8C;AAC9C,wDAAiD;AAEjD,QAAQ;AACR,wEAAwE;AACxE,4EAA4E;AAC5E,wDAAwD;AAC3C,QAAA,SAAS,GAAG;IACvB,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,aAAa,EAAE,eAAe;CAC/B,CAAC;AASF,gEAAgE;AAChE,SAAgB,eAAe,CAAC,KAA2B;IAEzD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,IAAI,iBAAS,CAAC,MAAM,CAAC,CAAC;IAClF,MAAM,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,gDAAgD,CAAC,CAAC,CAAC;IAE3I,MAAM,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAA2B,EAAE;QAC/D,MAAM,OAAO,GAA2B;YACtC,EAAE,KAAK,EAAE,iBAAS,CAAC,MAAM,EAAS,KAAK,EAAE,iBAAS,CAAC,MAAM,EAAE;YAC3D,EAAE,KAAK,EAAE,iBAAS,CAAC,GAAG,EAAY,KAAK,EAAE,iBAAS,CAAC,GAAG,EAAE;YACxD,EAAE,KAAK,EAAE,iBAAS,CAAC,IAAI,EAAW,KAAK,EAAE,iBAAS,CAAC,IAAI,EA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,KAAK,CACJ,CAAC,GAChB,CACH,CAAC;AACJ,CAAC;AAlDD,0CAkDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n// cSpell:ignore Modeless WMTS\r\n\r\nimport { IconButton, MenuItem, Select, SelectOption } from \"@itwin/itwinui-react\";\r\nimport * as React from \"react\";\r\nimport { MapTypesOptions } from \"../Interfaces\";\r\nimport \"./MapUrlDialog.scss\";\r\nimport {SvgTechnicalPreviewMini} from \"@itwin/itwinui-icons-color-react\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\nimport { IModelApp } from \"@itwin/core-frontend\";\r\n\r\n// TODO:\r\n// Remove this structure and iterate over the registry's active formats.\r\n// Still need a proper way to exclude some format, like we currently do with\r\n// 'TileUrl' without the need to hardcode any format Id.\r\nexport const MAP_TYPES = {\r\n wms: \"WMS\",\r\n arcGis: \"ArcGIS\",\r\n wmts: \"WMTS\",\r\n tileUrl: \"TileURL\",\r\n arcGisFeature: \"ArcGISFeature\",\r\n};\r\n\r\ninterface SelectMapFormatProps {\r\n value?: string;\r\n disabled?: boolean;\r\n mapTypesOptions?: MapTypesOptions;\r\n onChange?: (mapType: string) => void;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function SelectMapFormat(props: SelectMapFormatProps) {\r\n\r\n const [mapFormat, setMapFormat] = React.useState(props.value ?? MAP_TYPES.arcGis);\r\n const [techPreviewTooltip] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.TechPreviewBadgeTooltip\"));\r\n\r\n const [mapFormats] = React.useState((): SelectOption<string>[] => {\r\n const formats: SelectOption<string>[] = [\r\n { value: MAP_TYPES.arcGis, label: MAP_TYPES.arcGis },\r\n { value: MAP_TYPES.wms, label: MAP_TYPES.wms },\r\n { value: MAP_TYPES.wmts, label: MAP_TYPES.wmts },\r\n ];\r\n if (props.mapTypesOptions?.supportTileUrl)\r\n formats.push({ value: MAP_TYPES.tileUrl, label: MAP_TYPES.tileUrl });\r\n\r\n if (IModelApp.mapLayerFormatRegistry.isRegistered(MAP_TYPES.arcGisFeature))\r\n formats.push( { value: MAP_TYPES.arcGisFeature, label: MAP_TYPES.arcGisFeature, id:\"techPreview\" });\r\n\r\n return formats;\r\n });\r\n\r\n const handleOnChange = React.useCallback((value: string) => {\r\n setMapFormat(value);\r\n if (props.onChange) {\r\n props.onChange(value);\r\n }\r\n }, [props]);\r\n\r\n return (\r\n\r\n <Select\r\n className=\"map-layer-source-select\"\r\n options={mapFormats}\r\n value={mapFormat}\r\n disabled={props.disabled}\r\n onChange={handleOnChange}\r\n size=\"small\"\r\n itemRenderer={\r\n (option) => (\r\n <MenuItem\r\n badge={option.id?.includes(\"techPreview\") ?\r\n <div title={techPreviewTooltip}>\r\n <IconButton className=\"map-layer-source-select-previewBadge\" size=\"small\">\r\n <SvgTechnicalPreviewMini />\r\n </IconButton>\r\n </div>\r\n : undefined}>\r\n {option.label}\r\n </MenuItem>) }\r\n />\r\n );\r\n}\r\n"]}
@@ -27,10 +27,9 @@ class SubLayersDataProvider {
27
27
  return undefined !== props.id ? `${props.id}` : props.name ? props.name : "no-id";
28
28
  }
29
29
  createNode(props, expanded, isCheckboxDisabled, icon) {
30
- var _a, _b;
31
30
  return {
32
31
  id: this.createId(props),
33
- label: appui_abstract_1.PropertyRecord.fromString((_b = (_a = props.title) !== null && _a !== void 0 ? _a : props.name) !== null && _b !== void 0 ? _b : "unknown"),
32
+ label: appui_abstract_1.PropertyRecord.fromString(props.title ?? props.name ?? "unknown"),
34
33
  hasChildren: !!props.children,
35
34
  isCheckboxVisible: true,
36
35
  checkBoxState: props.visible && !isCheckboxDisabled ? core_react_1.CheckBoxState.On : core_react_1.CheckBoxState.Off,
@@ -43,10 +42,10 @@ class SubLayersDataProvider {
43
42
  loadChildNodes(allSubLayers, parentId) {
44
43
  const filteredProps = allSubLayers.filter((props) => parentId === props.parent);
45
44
  if (filteredProps.length) {
46
- filteredProps === null || filteredProps === void 0 ? void 0 : filteredProps.sort((a, b) => (0, core_bentley_1.compareStringsOrUndefined)(a.title, b.title));
45
+ filteredProps?.sort((a, b) => (0, core_bentley_1.compareStringsOrUndefined)(a.title, b.title));
47
46
  const treeNodes = [];
48
47
  filteredProps.forEach((props) => {
49
- treeNodes.push(this.createNode(props, (!parentId && (props === null || props === void 0 ? void 0 : props.children) !== undefined) ? true : undefined, // expand root group only (i.e. not the entire tree),
48
+ treeNodes.push(this.createNode(props, (!parentId && props?.children !== undefined) ? true : undefined, // expand root group only (i.e. not the entire tree),
50
49
  undefined, SubLayersDataProvider.isUnnamedGroup(props) ? "icon-folder" : "icon-layers"));
51
50
  if (props.children)
52
51
  this.loadChildNodes(allSubLayers, props.id);
@@ -55,7 +54,7 @@ class SubLayersDataProvider {
55
54
  }
56
55
  }
57
56
  loadNodes(subLayerNodes) {
58
- subLayerNodes === null || subLayerNodes === void 0 ? void 0 : subLayerNodes.sort((a, b) => (0, core_bentley_1.compareStringsOrUndefined)(a.title, b.title));
57
+ subLayerNodes?.sort((a, b) => (0, core_bentley_1.compareStringsOrUndefined)(a.title, b.title));
59
58
  if (subLayerNodes) {
60
59
  this.loadChildNodes(subLayerNodes, undefined);
61
60
  }