@esri/solutions-components 0.6.37 → 0.6.38

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. package/dist/cjs/calcite-alert_3.cjs.entry.js +1 -1
  2. package/dist/cjs/calcite-combobox_6.cjs.entry.js +1 -1
  3. package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +2 -2
  4. package/dist/cjs/card-manager_3.cjs.entry.js +4 -3
  5. package/dist/cjs/{downloadUtils-37d9aaf3.js → downloadUtils-d8e48fbd.js} +55 -12
  6. package/dist/cjs/{index.es-d1d9b140.js → index.es-6159eedc.js} +4 -3
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/map-select-tools_3.cjs.entry.js +4 -3
  9. package/dist/cjs/{mapViewUtils-96172223.js → mapViewUtils-f7bbc35b.js} +5 -2
  10. package/dist/cjs/public-notification.cjs.entry.js +5 -4
  11. package/dist/cjs/{clean-url-d5326abb.js → restHelpersGet-c94617cf.js} +398 -0
  12. package/dist/cjs/solution-configuration.cjs.entry.js +565 -565
  13. package/dist/cjs/solution-contents_3.cjs.entry.js +2 -2
  14. package/dist/cjs/{solution-store-714601a2.js → solution-store-b40c2f46.js} +19 -383
  15. package/dist/cjs/solutions-components.cjs.js +1 -1
  16. package/dist/collection/components/public-notification/public-notification.js +6 -5
  17. package/dist/collection/utils/downloadUtils.js +50 -8
  18. package/dist/collection/utils/downloadUtils.ts +62 -9
  19. package/dist/collection/utils/queryUtils.js +5 -2
  20. package/dist/collection/utils/queryUtils.ts +4 -2
  21. package/dist/components/downloadUtils.js +51 -8
  22. package/dist/components/public-notification.js +2 -2
  23. package/dist/components/queryUtils.js +5 -2
  24. package/dist/components/{clean-url.js → restHelpersGet.js} +392 -1
  25. package/dist/components/solution-configuration.js +552 -552
  26. package/dist/components/solution-store.js +2 -365
  27. package/dist/esm/calcite-alert_3.entry.js +1 -1
  28. package/dist/esm/calcite-combobox_6.entry.js +1 -1
  29. package/dist/esm/calcite-shell-panel_14.entry.js +2 -2
  30. package/dist/esm/card-manager_3.entry.js +4 -3
  31. package/dist/esm/{downloadUtils-76379e4a.js → downloadUtils-d41ecba9.js} +53 -10
  32. package/dist/esm/{index.es-0d134a52.js → index.es-b226bf47.js} +4 -3
  33. package/dist/esm/loader.js +1 -1
  34. package/dist/esm/map-select-tools_3.entry.js +4 -3
  35. package/dist/esm/{mapViewUtils-08f6cfce.js → mapViewUtils-1e2befd7.js} +5 -2
  36. package/dist/esm/public-notification.entry.js +5 -4
  37. package/dist/esm/{clean-url-bce022e6.js → restHelpersGet-a5ec2192.js} +392 -1
  38. package/dist/esm/solution-configuration.entry.js +552 -552
  39. package/dist/esm/solution-contents_3.entry.js +2 -2
  40. package/dist/esm/{solution-store-3ee6c7a3.js → solution-store-17bb0a75.js} +2 -365
  41. package/dist/esm/solutions-components.js +1 -1
  42. package/dist/solutions-components/{p-9800e602.entry.js → p-091120c5.entry.js} +1 -1
  43. package/dist/solutions-components/p-1b14b687.entry.js +6 -0
  44. package/dist/solutions-components/p-20e627ed.entry.js +6 -0
  45. package/dist/solutions-components/{p-646e983f.entry.js → p-2d143359.entry.js} +1 -1
  46. package/dist/solutions-components/{p-ac7332b3.entry.js → p-40e95e2b.entry.js} +1 -1
  47. package/dist/solutions-components/p-420e1585.entry.js +36 -0
  48. package/dist/solutions-components/p-4807b2a1.js +36 -0
  49. package/dist/solutions-components/p-56a3b81e.entry.js +6 -0
  50. package/dist/solutions-components/p-5856dc4f.js +66 -0
  51. package/dist/solutions-components/p-89b4b401.js +145 -0
  52. package/dist/solutions-components/{p-4ecad91c.entry.js → p-973625f8.entry.js} +1 -1
  53. package/dist/solutions-components/{p-03130804.js → p-9ecb5d66.js} +1 -1
  54. package/dist/solutions-components/{p-b02eb8f4.js → p-a8661f1f.js} +30 -30
  55. package/dist/solutions-components/solutions-components.esm.js +1 -1
  56. package/dist/solutions-components/utils/downloadUtils.ts +62 -9
  57. package/dist/solutions-components/utils/queryUtils.ts +4 -2
  58. package/dist/types/components/public-notification/public-notification.d.ts +1 -1
  59. package/dist/types/components.d.ts +2 -2
  60. package/package.json +1 -1
  61. package/dist/esm/polyfills/core-js.js +0 -11
  62. package/dist/esm/polyfills/dom.js +0 -79
  63. package/dist/esm/polyfills/es5-html-element.js +0 -1
  64. package/dist/esm/polyfills/index.js +0 -34
  65. package/dist/esm/polyfills/system.js +0 -6
  66. package/dist/solutions-components/p-13b21d19.entry.js +0 -36
  67. package/dist/solutions-components/p-15070568.js +0 -36
  68. package/dist/solutions-components/p-81a0c88f.entry.js +0 -6
  69. package/dist/solutions-components/p-b7804687.entry.js +0 -6
  70. package/dist/solutions-components/p-d0544f24.js +0 -192
  71. package/dist/solutions-components/p-eba875d9.entry.js +0 -6
  72. package/dist/solutions-components/p-ecc95259.js +0 -20
@@ -4,14 +4,14 @@
4
4
  * http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
6
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-0740c914.js';
7
- import { s as state } from './solution-store-3ee6c7a3.js';
7
+ import { s as state } from './solution-store-17bb0a75.js';
8
8
  import { g as getLocaleComponentStrings } from './locale-6be4e8f0.js';
9
9
  import { n as nodeListToArray } from './common-e4a8e353.js';
10
10
  import './index-71d123d4.js';
11
11
  import './interfaces-7470d906.js';
12
12
  import './solution-resource-be35d35b.js';
13
13
  import './_commonjsHelpers-d5f9d613.js';
14
- import './clean-url-bce022e6.js';
14
+ import './restHelpersGet-a5ec2192.js';
15
15
 
16
16
  const solutionContentsCss = ".icon-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}";
17
17
 
@@ -6,7 +6,7 @@
6
6
  import { c as createStore } from './index-71d123d4.js';
7
7
  import { d as EUpdateType } from './interfaces-7470d906.js';
8
8
  import { E as EFileType, j as jszip_min, S as SolutionTemplateFormatVersion } from './solution-resource-be35d35b.js';
9
- import { c as cleanUrl, r as request } from './clean-url-bce022e6.js';
9
+ import { c as cleanUrl, r as request, b as blobToFile, d as checkUrlPathTermination, f as getThumbnailFile, h as getItemDataAsJson, a as getProp, s as setCreateProp } from './restHelpersGet-a5ec2192.js';
10
10
 
11
11
  /* Copyright (c) 2018-2019 Environmental Systems Research Institute, Inc.
12
12
  * Apache-2.0 */
@@ -265,369 +265,6 @@ function removeItemResource(requestOptions) {
265
265
  });
266
266
  }
267
267
 
268
- /** @license
269
- * Copyright 2020 Esri
270
- *
271
- * Licensed under the Apache License, Version 2.0 (the "License");
272
- * you may not use this file except in compliance with the License.
273
- * You may obtain a copy of the License at
274
- *
275
- * http://www.apache.org/licenses/LICENSE-2.0
276
- *
277
- * Unless required by applicable law or agreed to in writing, software
278
- * distributed under the License is distributed on an "AS IS" BASIS,
279
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
280
- * See the License for the specific language governing permissions and
281
- * limitations under the License.
282
- */
283
- /**
284
- * Supplies the File constructor for Microsoft Legacy Edge.
285
- *
286
- * @param fileBits Contents for file
287
- * @param fileName Name for file
288
- * @param options Bucket of options, euch as `type` for the MIME type; defaults to empty string for `type`
289
- * @returns File or, for Microsoft Legacy Edge, Blob
290
- * @see https://developer.mozilla.org/en-US/docs/Web/API/File/File
291
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob
292
- */
293
- function new_File(fileBits, fileName, options) {
294
- let file;
295
- try {
296
- // Modern browser
297
- file = new File(fileBits, fileName, options);
298
- }
299
- catch (error) {
300
- // Microsoft Legacy Edge
301
- /* istanbul ignore next */
302
- file = (function () {
303
- if (typeof options === "undefined") {
304
- // Microsoft Legacy Edge fails in karma if options is not defined
305
- options = {
306
- type: ""
307
- };
308
- }
309
- const blob = new Blob(fileBits, options);
310
- blob.lastModified = new Date();
311
- blob.name = fileName;
312
- return blob;
313
- })();
314
- }
315
- return file;
316
- }
317
-
318
- /** @license
319
- * Copyright 2018 Esri
320
- *
321
- * Licensed under the Apache License, Version 2.0 (the "License");
322
- * you may not use this file except in compliance with the License.
323
- * You may obtain a copy of the License at
324
- *
325
- * http://www.apache.org/licenses/LICENSE-2.0
326
- *
327
- * Unless required by applicable law or agreed to in writing, software
328
- * distributed under the License is distributed on an "AS IS" BASIS,
329
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
330
- * See the License for the specific language governing permissions and
331
- * limitations under the License.
332
- */
333
- /**
334
- * Extracts JSON from a Blob.
335
- *
336
- * @param blob Blob to use as source
337
- * @returns A promise that will resolve with JSON or null
338
- */
339
- function blobToJson(blob) {
340
- return new Promise(resolve => {
341
- blobToText(blob).then(blobContents => {
342
- try {
343
- resolve(JSON.parse(blobContents));
344
- }
345
- catch (err) {
346
- resolve(null);
347
- }
348
- }, () => resolve(null));
349
- });
350
- }
351
- /**
352
- * Converts a Blob to a File.
353
- *
354
- * @param blob Blob to use as source
355
- * @param filename Name to use for file
356
- * @param mimeType MIME type to override blob's MIME type
357
- * @returns File created out of Blob and filename
358
- */
359
- function blobToFile(blob, filename, mimeType) {
360
- return blob
361
- ? new_File([blob], filename ? filename : "", {
362
- type: mimeType || blob.type
363
- })
364
- : null;
365
- }
366
- /**
367
- * Extracts text from a Blob.
368
- *
369
- * @param blob Blob to use as source
370
- * @returns A promise that will resolve with text read from blob
371
- */
372
- function blobToText(blob) {
373
- return new Promise(resolve => {
374
- const reader = new FileReader();
375
- reader.onload = function (evt) {
376
- // Disable needed because Node requires cast
377
- // tslint:disable-next-line: no-unnecessary-type-assertion
378
- const blobContents = evt.target.result;
379
- resolve(blobContents ? blobContents : ""); // not handling ArrayContents variant
380
- };
381
- reader.readAsText(blob);
382
- });
383
- }
384
- /**
385
- * Checks that a URL path ends with a slash.
386
- *
387
- * @param url URL to check
388
- * @returns URL, appended with slash if missing
389
- */
390
- function checkUrlPathTermination(url) {
391
- return url ? (url.endsWith("/") ? url : url + "/") : url;
392
- }
393
- /**
394
- * Gets a property out of a deeply nested object.
395
- * Does not handle anything but nested object graph
396
- *
397
- * @param obj Object to retrieve value from
398
- * @param path Path into an object, e.g., "data.values.webmap", where "data" is a top-level property
399
- * in obj
400
- * @returns Value at end of path
401
- */
402
- function getProp(obj, path) {
403
- return path.split(".").reduce(function (prev, curr) {
404
- /* istanbul ignore next no need to test undefined scenario */
405
- return prev ? prev[curr] : undefined;
406
- }, obj);
407
- }
408
- /**
409
- * Sets a deeply nested property of an object.
410
- * Creates the full path if it does not exist.
411
- *
412
- * @param obj Object to set value of
413
- * @param path Path into an object, e.g., "data.values.webmap", where "data" is a top-level property in obj
414
- * @param value The value to set at the end of the path
415
- */
416
- function setCreateProp(obj, path, value) {
417
- const pathParts = path.split(".");
418
- pathParts.reduce((a, b, c) => {
419
- if (c === pathParts.length - 1) {
420
- a[b] = value;
421
- return value;
422
- }
423
- else {
424
- if (!a[b]) {
425
- a[b] = {};
426
- }
427
- return a[b];
428
- }
429
- }, obj);
430
- }
431
-
432
- /**
433
- * Gets a Blob from a web site.
434
- *
435
- * @param url Address of Blob
436
- * @param authentication Credentials for the request
437
- * @param requestOptions - Options for the request, including parameters relevant to the endpoint.
438
- * @returns Promise that will resolve with Blob or an AGO-style JSON failure response
439
- */
440
- function getBlob(url, authentication, requestOptions = {}) {
441
- if (!url) {
442
- return Promise.reject("Url must be provided");
443
- }
444
- const blobRequestOptions = {
445
- authentication: authentication,
446
- rawResponse: true,
447
- ...requestOptions
448
- };
449
- return request(url, blobRequestOptions).then(response => {
450
- return response.blob();
451
- });
452
- }
453
-
454
- /** @license
455
- * Copyright 2018 Esri
456
- *
457
- * Licensed under the Apache License, Version 2.0 (the "License");
458
- * you may not use this file except in compliance with the License.
459
- * You may obtain a copy of the License at
460
- *
461
- * http://www.apache.org/licenses/LICENSE-2.0
462
- *
463
- * Unless required by applicable law or agreed to in writing, software
464
- * distributed under the License is distributed on an "AS IS" BASIS,
465
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
466
- * See the License for the specific language governing permissions and
467
- * limitations under the License.
468
- */
469
- // ------------------------------------------------------------------------------------------------------------------ //
470
- const ZIP_FILE_HEADER_SIGNATURE = "PK";
471
- /**
472
- * Gets a Blob from a web site and casts it as a file using the supplied name.
473
- *
474
- * @param url Address of Blob
475
- * @param filename Name to use for file
476
- * @param authentication Credentials for the request
477
- * @returns Promise that will resolve with a File, undefined if the Blob is null, or an AGO-style JSON failure response
478
- */
479
- function getBlobAsFile(url, filename, authentication, ignoreErrors = [], mimeType) {
480
- return new Promise((resolve, reject) => {
481
- // Get the blob from the URL
482
- getBlobCheckForError(url, authentication, ignoreErrors).then(blob => !blob ? resolve(null) : resolve(blobToFile(blob, filename, mimeType)), reject);
483
- });
484
- }
485
- /**
486
- * Gets a Blob from a web site and checks for a JSON error packet in the Blob.
487
- *
488
- * @param url Address of Blob
489
- * @param authentication Credentials for the request
490
- * @param ignoreErrors List of HTTP error codes that should be ignored
491
- * @returns Promise that will resolve with Blob or an AGO-REST JSON failure response
492
- */
493
- function getBlobCheckForError(url, authentication, ignoreErrors = []) {
494
- return new Promise((resolve, reject) => {
495
- // Get the blob from the URL
496
- getBlob(url, authentication).then(blob => {
497
- // Reclassify text/plain blobs as needed
498
- _fixTextBlobType(blob).then(adjustedBlob => {
499
- if (adjustedBlob.type === "application/json") {
500
- // Blob may be an error
501
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
502
- blobToJson(adjustedBlob).then((json) => {
503
- // Check for valid JSON with an error
504
- if (json?.error) {
505
- const code = json.error.code;
506
- if (code !== undefined && ignoreErrors.indexOf(code) >= 0) {
507
- resolve(null); // Error, but ignored
508
- }
509
- else {
510
- reject(json); // Other error; fail with error
511
- }
512
- }
513
- else {
514
- resolve(adjustedBlob);
515
- }
516
- });
517
- }
518
- else {
519
- resolve(adjustedBlob);
520
- }
521
- }, reject);
522
- }, reject);
523
- });
524
- }
525
- /**
526
- * Gets the data information of an AGO item in its JSON form.
527
- *
528
- * @param itemId Id of an item whose data information is sought
529
- * @param filename Name to use for file
530
- * @param authentication Credentials for the request to AGO
531
- * @returns Promise that will resolve with JSON, or an AGO-style JSON failure response
532
- */
533
- function getItemDataAsJson(itemId, authentication) {
534
- return new Promise(resolve => {
535
- getItemDataBlob(itemId, authentication).then(blob => resolve(blobToJson(blob)), () => resolve(null));
536
- });
537
- }
538
- /**
539
- * Gets the data information of an AGO item in its raw (Blob) form.
540
- *
541
- * @param itemId Id of an item whose data information is sought
542
- * @param authentication Credentials for the request to AGO
543
- * @returns A promise that will resolve with the data Blob or null if the item doesn't have a data section
544
- */
545
- function getItemDataBlob(itemId, authentication) {
546
- return new Promise(resolve => {
547
- const url = getItemDataBlobUrl(itemId, authentication);
548
- getBlobCheckForError(url, authentication, [400, 500]).then(blob => resolve(_fixTextBlobType(blob)), () => resolve(null));
549
- });
550
- }
551
- /**
552
- * Gets the URL to the data information of an AGO item in its raw (Blob) form.
553
- *
554
- * @param itemId Id of an item whose data information is sought
555
- * @param authentication Credentials for the request to AGO
556
- * @returns URL string
557
- */
558
- function getItemDataBlobUrl(itemId, authentication) {
559
- return `${getPortalSharingUrlFromAuth(authentication)}/content/items/${itemId}/data`;
560
- }
561
- /**
562
- * Extracts the portal sharing url from a supplied authentication.
563
- *
564
- * @param authentication Credentials for the request to AGO
565
- * @returns Portal sharing url to be used in API requests, defaulting to `https://www.arcgis.com/sharing/rest`
566
- */
567
- function getPortalSharingUrlFromAuth(authentication) {
568
- // If auth was passed, use that portal
569
- return getProp(authentication, "portal") || "https://www.arcgis.com/sharing/rest";
570
- }
571
- function getThumbnailFile(url, filename, authentication) {
572
- return new Promise(resolve => {
573
- getBlobAsFile(url, filename, authentication, [500]).then(resolve, () => resolve(null));
574
- });
575
- }
576
- // ------------------------------------------------------------------------------------------------------------------ //
577
- /**
578
- * Fixes the types of Blobs incorrectly typed as text/plain.
579
- *
580
- * @param blob Blob to check
581
- * @returns Promise resolving to original Blob, unless it's originally typed as text/plain but is
582
- * really JSON, ZIP, or XML
583
- * @private
584
- */
585
- function _fixTextBlobType(blob) {
586
- return new Promise((resolve, reject) => {
587
- if (blob &&
588
- blob.size > 0 &&
589
- (blob.type.startsWith("text/plain") ||
590
- blob.type.startsWith("application/json"))) {
591
- blobToText(blob).then(blobText => {
592
- // Convertible to JSON?
593
- try {
594
- JSON.parse(blobText);
595
- // Yes; reclassify as JSON
596
- resolve(new Blob([blob], { type: "application/json" }));
597
- }
598
- catch (ignored) {
599
- // Nope; test for ZIP file
600
- if (blobText.length > 4 &&
601
- blobText.substr(0, 4) === ZIP_FILE_HEADER_SIGNATURE) {
602
- // Yes; reclassify as ZIP
603
- resolve(new Blob([blob], { type: "application/zip" }));
604
- }
605
- else if (blobText.startsWith("<")) {
606
- // Reclassify as XML; since the blob started out as text/plain, it's more likely that is
607
- // meant to be human-readable, so we'll use text/xml instead of application/xml
608
- resolve(new Blob([blob], { type: "text/xml" }));
609
- }
610
- else {
611
- // Leave as text
612
- resolve(blob);
613
- }
614
- }
615
- },
616
- // Faulty blob
617
- reject);
618
- }
619
- else {
620
- // Empty or not typed as plain text, so simply return
621
- if (blob) {
622
- resolve(blob);
623
- }
624
- else {
625
- reject();
626
- }
627
- }
628
- });
629
- }
630
-
631
268
  /** @license
632
269
  * Copyright 2018 Esri
633
270
  *
@@ -1701,4 +1338,4 @@ class SolutionStore {
1701
1338
  }
1702
1339
  const state = SolutionStore.Store;
1703
1340
 
1704
- export { getProp as g, state as s };
1341
+ export { state as s };