@bigbinary/neeto-image-uploader-frontend 1.4.3 → 1.4.5

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.
package/dist/index.js CHANGED
@@ -20279,6 +20279,955 @@ var Video = function Video(_ref) {
20279
20279
  });
20280
20280
  };
20281
20281
 
20282
+ function cov_kp1klkct2() {
20283
+ var path = "/home/runner/work/neeto-image-uploader-nano/neeto-image-uploader-nano/app/javascript/src/hooks/useImageUpload.js";
20284
+ var hash = "11f32baea094320a6c8818ee9a1f0c8bfb4b1054";
20285
+ var global = new Function("return this")();
20286
+ var gcv = "__coverage__";
20287
+ var coverageData = {
20288
+ path: "/home/runner/work/neeto-image-uploader-nano/neeto-image-uploader-nano/app/javascript/src/hooks/useImageUpload.js",
20289
+ statementMap: {
20290
+ "0": {
20291
+ start: {
20292
+ line: 16,
20293
+ column: 23
20294
+ },
20295
+ end: {
20296
+ line: 117,
20297
+ column: 1
20298
+ }
20299
+ },
20300
+ "1": {
20301
+ start: {
20302
+ line: 17,
20303
+ column: 46
20304
+ },
20305
+ end: {
20306
+ line: 17,
20307
+ column: 57
20308
+ }
20309
+ },
20310
+ "2": {
20311
+ start: {
20312
+ line: 18,
20313
+ column: 40
20314
+ },
20315
+ end: {
20316
+ line: 18,
20317
+ column: 55
20318
+ }
20319
+ },
20320
+ "3": {
20321
+ start: {
20322
+ line: 19,
20323
+ column: 33
20324
+ },
20325
+ end: {
20326
+ line: 19,
20327
+ column: 102
20328
+ }
20329
+ },
20330
+ "4": {
20331
+ start: {
20332
+ line: 21,
20333
+ column: 33
20334
+ },
20335
+ end: {
20336
+ line: 21,
20337
+ column: 48
20338
+ }
20339
+ },
20340
+ "5": {
20341
+ start: {
20342
+ line: 23,
20343
+ column: 31
20344
+ },
20345
+ end: {
20346
+ line: 29,
20347
+ column: 3
20348
+ }
20349
+ },
20350
+ "6": {
20351
+ start: {
20352
+ line: 24,
20353
+ column: 4
20354
+ },
20355
+ end: {
20356
+ line: 27,
20357
+ column: 5
20358
+ }
20359
+ },
20360
+ "7": {
20361
+ start: {
20362
+ line: 25,
20363
+ column: 22
20364
+ },
20365
+ end: {
20366
+ line: 25,
20367
+ column: 61
20368
+ }
20369
+ },
20370
+ "8": {
20371
+ start: {
20372
+ line: 26,
20373
+ column: 6
20374
+ },
20375
+ end: {
20376
+ line: 26,
20377
+ column: 33
20378
+ }
20379
+ },
20380
+ "9": {
20381
+ start: {
20382
+ line: 28,
20383
+ column: 4
20384
+ },
20385
+ end: {
20386
+ line: 28,
20387
+ column: 56
20388
+ }
20389
+ },
20390
+ "10": {
20391
+ start: {
20392
+ line: 31,
20393
+ column: 28
20394
+ },
20395
+ end: {
20396
+ line: 58,
20397
+ column: 3
20398
+ }
20399
+ },
20400
+ "11": {
20401
+ start: {
20402
+ line: 32,
20403
+ column: 4
20404
+ },
20405
+ end: {
20406
+ line: 57,
20407
+ column: 5
20408
+ }
20409
+ },
20410
+ "12": {
20411
+ start: {
20412
+ line: 33,
20413
+ column: 6
20414
+ },
20415
+ end: {
20416
+ line: 33,
20417
+ column: 27
20418
+ }
20419
+ },
20420
+ "13": {
20421
+ start: {
20422
+ line: 34,
20423
+ column: 21
20424
+ },
20425
+ end: {
20426
+ line: 34,
20427
+ column: 66
20428
+ }
20429
+ },
20430
+ "14": {
20431
+ start: {
20432
+ line: 35,
20433
+ column: 6
20434
+ },
20435
+ end: {
20436
+ line: 52,
20437
+ column: 9
20438
+ }
20439
+ },
20440
+ "15": {
20441
+ start: {
20442
+ line: 36,
20443
+ column: 24
20444
+ },
20445
+ end: {
20446
+ line: 46,
20447
+ column: 9
20448
+ }
20449
+ },
20450
+ "16": {
20451
+ start: {
20452
+ line: 47,
20453
+ column: 8
20454
+ },
20455
+ end: {
20456
+ line: 47,
20457
+ column: 41
20458
+ }
20459
+ },
20460
+ "17": {
20461
+ start: {
20462
+ line: 49,
20463
+ column: 8
20464
+ },
20465
+ end: {
20466
+ line: 51,
20467
+ column: 10
20468
+ }
20469
+ },
20470
+ "18": {
20471
+ start: {
20472
+ line: 54,
20473
+ column: 6
20474
+ },
20475
+ end: {
20476
+ line: 54,
20477
+ column: 26
20478
+ }
20479
+ },
20480
+ "19": {
20481
+ start: {
20482
+ line: 56,
20483
+ column: 6
20484
+ },
20485
+ end: {
20486
+ line: 56,
20487
+ column: 28
20488
+ }
20489
+ },
20490
+ "20": {
20491
+ start: {
20492
+ line: 60,
20493
+ column: 27
20494
+ },
20495
+ end: {
20496
+ line: 97,
20497
+ column: 3
20498
+ }
20499
+ },
20500
+ "21": {
20501
+ start: {
20502
+ line: 61,
20503
+ column: 4
20504
+ },
20505
+ end: {
20506
+ line: 96,
20507
+ column: 5
20508
+ }
20509
+ },
20510
+ "22": {
20511
+ start: {
20512
+ line: 62,
20513
+ column: 23
20514
+ },
20515
+ end: {
20516
+ line: 66,
20517
+ column: 7
20518
+ }
20519
+ },
20520
+ "23": {
20521
+ start: {
20522
+ line: 67,
20523
+ column: 6
20524
+ },
20525
+ end: {
20526
+ line: 67,
20527
+ column: 27
20528
+ }
20529
+ },
20530
+ "24": {
20531
+ start: {
20532
+ line: 68,
20533
+ column: 20
20534
+ },
20535
+ end: {
20536
+ line: 77,
20537
+ column: 8
20538
+ }
20539
+ },
20540
+ "25": {
20541
+ start: {
20542
+ line: 79,
20543
+ column: 22
20544
+ },
20545
+ end: {
20546
+ line: 86,
20547
+ column: 7
20548
+ }
20549
+ },
20550
+ "26": {
20551
+ start: {
20552
+ line: 88,
20553
+ column: 6
20554
+ },
20555
+ end: {
20556
+ line: 91,
20557
+ column: 9
20558
+ }
20559
+ },
20560
+ "27": {
20561
+ start: {
20562
+ line: 93,
20563
+ column: 6
20564
+ },
20565
+ end: {
20566
+ line: 93,
20567
+ column: 26
20568
+ }
20569
+ },
20570
+ "28": {
20571
+ start: {
20572
+ line: 95,
20573
+ column: 6
20574
+ },
20575
+ end: {
20576
+ line: 95,
20577
+ column: 28
20578
+ }
20579
+ },
20580
+ "29": {
20581
+ start: {
20582
+ line: 99,
20583
+ column: 22
20584
+ },
20585
+ end: {
20586
+ line: 110,
20587
+ column: 3
20588
+ }
20589
+ },
20590
+ "30": {
20591
+ start: {
20592
+ line: 100,
20593
+ column: 4
20594
+ },
20595
+ end: {
20596
+ line: 100,
20597
+ column: 25
20598
+ }
20599
+ },
20600
+ "31": {
20601
+ start: {
20602
+ line: 101,
20603
+ column: 21
20604
+ },
20605
+ end: {
20606
+ line: 101,
20607
+ column: 30
20608
+ }
20609
+ },
20610
+ "32": {
20611
+ start: {
20612
+ line: 102,
20613
+ column: 24
20614
+ },
20615
+ end: {
20616
+ line: 102,
20617
+ column: 44
20618
+ }
20619
+ },
20620
+ "33": {
20621
+ start: {
20622
+ line: 103,
20623
+ column: 4
20624
+ },
20625
+ end: {
20626
+ line: 105,
20627
+ column: 7
20628
+ }
20629
+ },
20630
+ "34": {
20631
+ start: {
20632
+ line: 104,
20633
+ column: 6
20634
+ },
20635
+ end: {
20636
+ line: 104,
20637
+ column: 40
20638
+ }
20639
+ },
20640
+ "35": {
20641
+ start: {
20642
+ line: 107,
20643
+ column: 4
20644
+ },
20645
+ end: {
20646
+ line: 109,
20647
+ column: 68
20648
+ }
20649
+ },
20650
+ "36": {
20651
+ start: {
20652
+ line: 112,
20653
+ column: 2
20654
+ },
20655
+ end: {
20656
+ line: 116,
20657
+ column: 4
20658
+ }
20659
+ }
20660
+ },
20661
+ fnMap: {
20662
+ "0": {
20663
+ name: "(anonymous_0)",
20664
+ decl: {
20665
+ start: {
20666
+ line: 16,
20667
+ column: 23
20668
+ },
20669
+ end: {
20670
+ line: 16,
20671
+ column: 24
20672
+ }
20673
+ },
20674
+ loc: {
20675
+ start: {
20676
+ line: 16,
20677
+ column: 29
20678
+ },
20679
+ end: {
20680
+ line: 117,
20681
+ column: 1
20682
+ }
20683
+ },
20684
+ line: 16
20685
+ },
20686
+ "1": {
20687
+ name: "(anonymous_1)",
20688
+ decl: {
20689
+ start: {
20690
+ line: 23,
20691
+ column: 31
20692
+ },
20693
+ end: {
20694
+ line: 23,
20695
+ column: 32
20696
+ }
20697
+ },
20698
+ loc: {
20699
+ start: {
20700
+ line: 23,
20701
+ column: 48
20702
+ },
20703
+ end: {
20704
+ line: 29,
20705
+ column: 3
20706
+ }
20707
+ },
20708
+ line: 23
20709
+ },
20710
+ "2": {
20711
+ name: "(anonymous_2)",
20712
+ decl: {
20713
+ start: {
20714
+ line: 31,
20715
+ column: 28
20716
+ },
20717
+ end: {
20718
+ line: 31,
20719
+ column: 29
20720
+ }
20721
+ },
20722
+ loc: {
20723
+ start: {
20724
+ line: 31,
20725
+ column: 62
20726
+ },
20727
+ end: {
20728
+ line: 58,
20729
+ column: 3
20730
+ }
20731
+ },
20732
+ line: 31
20733
+ },
20734
+ "3": {
20735
+ name: "(anonymous_3)",
20736
+ decl: {
20737
+ start: {
20738
+ line: 35,
20739
+ column: 20
20740
+ },
20741
+ end: {
20742
+ line: 35,
20743
+ column: 21
20744
+ }
20745
+ },
20746
+ loc: {
20747
+ start: {
20748
+ line: 35,
20749
+ column: 33
20750
+ },
20751
+ end: {
20752
+ line: 52,
20753
+ column: 7
20754
+ }
20755
+ },
20756
+ line: 35
20757
+ },
20758
+ "4": {
20759
+ name: "(anonymous_4)",
20760
+ decl: {
20761
+ start: {
20762
+ line: 60,
20763
+ column: 27
20764
+ },
20765
+ end: {
20766
+ line: 60,
20767
+ column: 28
20768
+ }
20769
+ },
20770
+ loc: {
20771
+ start: {
20772
+ line: 60,
20773
+ column: 74
20774
+ },
20775
+ end: {
20776
+ line: 97,
20777
+ column: 3
20778
+ }
20779
+ },
20780
+ line: 60
20781
+ },
20782
+ "5": {
20783
+ name: "(anonymous_5)",
20784
+ decl: {
20785
+ start: {
20786
+ line: 99,
20787
+ column: 22
20788
+ },
20789
+ end: {
20790
+ line: 99,
20791
+ column: 23
20792
+ }
20793
+ },
20794
+ loc: {
20795
+ start: {
20796
+ line: 99,
20797
+ column: 56
20798
+ },
20799
+ end: {
20800
+ line: 110,
20801
+ column: 3
20802
+ }
20803
+ },
20804
+ line: 99
20805
+ },
20806
+ "6": {
20807
+ name: "(anonymous_6)",
20808
+ decl: {
20809
+ start: {
20810
+ line: 103,
20811
+ column: 52
20812
+ },
20813
+ end: {
20814
+ line: 103,
20815
+ column: 53
20816
+ }
20817
+ },
20818
+ loc: {
20819
+ start: {
20820
+ line: 103,
20821
+ column: 57
20822
+ },
20823
+ end: {
20824
+ line: 105,
20825
+ column: 5
20826
+ }
20827
+ },
20828
+ line: 103
20829
+ }
20830
+ },
20831
+ branchMap: {
20832
+ "0": {
20833
+ loc: {
20834
+ start: {
20835
+ line: 24,
20836
+ column: 4
20837
+ },
20838
+ end: {
20839
+ line: 27,
20840
+ column: 5
20841
+ }
20842
+ },
20843
+ type: "if",
20844
+ locations: [{
20845
+ start: {
20846
+ line: 24,
20847
+ column: 4
20848
+ },
20849
+ end: {
20850
+ line: 27,
20851
+ column: 5
20852
+ }
20853
+ }, {
20854
+ start: {
20855
+ line: undefined,
20856
+ column: undefined
20857
+ },
20858
+ end: {
20859
+ line: undefined,
20860
+ column: undefined
20861
+ }
20862
+ }],
20863
+ line: 24
20864
+ },
20865
+ "1": {
20866
+ loc: {
20867
+ start: {
20868
+ line: 28,
20869
+ column: 4
20870
+ },
20871
+ end: {
20872
+ line: 28,
20873
+ column: 55
20874
+ }
20875
+ },
20876
+ type: "binary-expr",
20877
+ locations: [{
20878
+ start: {
20879
+ line: 28,
20880
+ column: 4
20881
+ },
20882
+ end: {
20883
+ line: 28,
20884
+ column: 29
20885
+ }
20886
+ }, {
20887
+ start: {
20888
+ line: 28,
20889
+ column: 33
20890
+ },
20891
+ end: {
20892
+ line: 28,
20893
+ column: 55
20894
+ }
20895
+ }],
20896
+ line: 28
20897
+ },
20898
+ "2": {
20899
+ loc: {
20900
+ start: {
20901
+ line: 72,
20902
+ column: 16
20903
+ },
20904
+ end: {
20905
+ line: 72,
20906
+ column: 71
20907
+ }
20908
+ },
20909
+ type: "binary-expr",
20910
+ locations: [{
20911
+ start: {
20912
+ line: 72,
20913
+ column: 16
20914
+ },
20915
+ end: {
20916
+ line: 72,
20917
+ column: 43
20918
+ }
20919
+ }, {
20920
+ start: {
20921
+ line: 72,
20922
+ column: 47
20923
+ },
20924
+ end: {
20925
+ line: 72,
20926
+ column: 71
20927
+ }
20928
+ }],
20929
+ line: 72
20930
+ },
20931
+ "3": {
20932
+ loc: {
20933
+ start: {
20934
+ line: 107,
20935
+ column: 4
20936
+ },
20937
+ end: {
20938
+ line: 109,
20939
+ column: 67
20940
+ }
20941
+ },
20942
+ type: "cond-expr",
20943
+ locations: [{
20944
+ start: {
20945
+ line: 108,
20946
+ column: 8
20947
+ },
20948
+ end: {
20949
+ line: 108,
20950
+ column: 55
20951
+ }
20952
+ }, {
20953
+ start: {
20954
+ line: 109,
20955
+ column: 8
20956
+ },
20957
+ end: {
20958
+ line: 109,
20959
+ column: 67
20960
+ }
20961
+ }],
20962
+ line: 107
20963
+ }
20964
+ },
20965
+ s: {
20966
+ "0": 0,
20967
+ "1": 0,
20968
+ "2": 0,
20969
+ "3": 0,
20970
+ "4": 0,
20971
+ "5": 0,
20972
+ "6": 0,
20973
+ "7": 0,
20974
+ "8": 0,
20975
+ "9": 0,
20976
+ "10": 0,
20977
+ "11": 0,
20978
+ "12": 0,
20979
+ "13": 0,
20980
+ "14": 0,
20981
+ "15": 0,
20982
+ "16": 0,
20983
+ "17": 0,
20984
+ "18": 0,
20985
+ "19": 0,
20986
+ "20": 0,
20987
+ "21": 0,
20988
+ "22": 0,
20989
+ "23": 0,
20990
+ "24": 0,
20991
+ "25": 0,
20992
+ "26": 0,
20993
+ "27": 0,
20994
+ "28": 0,
20995
+ "29": 0,
20996
+ "30": 0,
20997
+ "31": 0,
20998
+ "32": 0,
20999
+ "33": 0,
21000
+ "34": 0,
21001
+ "35": 0,
21002
+ "36": 0
21003
+ },
21004
+ f: {
21005
+ "0": 0,
21006
+ "1": 0,
21007
+ "2": 0,
21008
+ "3": 0,
21009
+ "4": 0,
21010
+ "5": 0,
21011
+ "6": 0
21012
+ },
21013
+ b: {
21014
+ "0": [0, 0],
21015
+ "1": [0, 0],
21016
+ "2": [0, 0],
21017
+ "3": [0, 0]
21018
+ },
21019
+ _coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
21020
+ hash: "11f32baea094320a6c8818ee9a1f0c8bfb4b1054"
21021
+ };
21022
+ var coverage = global[gcv] || (global[gcv] = {});
21023
+ if (!coverage[path] || coverage[path].hash !== hash) {
21024
+ coverage[path] = coverageData;
21025
+ }
21026
+ var actualCoverage = coverage[path];
21027
+ {
21028
+ // @ts-ignore
21029
+ cov_kp1klkct2 = function () {
21030
+ return actualCoverage;
21031
+ };
21032
+ }
21033
+ return actualCoverage;
21034
+ }
21035
+ cov_kp1klkct2();
21036
+ cov_kp1klkct2().s[0]++;
21037
+ var useImageUpload = function useImageUpload() {
21038
+ cov_kp1klkct2().f[0]++;
21039
+ var _ref = (cov_kp1klkct2().s[1]++, useState(0)),
21040
+ _ref2 = _slicedToArray$2(_ref, 2),
21041
+ uploadProgress = _ref2[0],
21042
+ setUploadProgress = _ref2[1];
21043
+ var _ref3 = (cov_kp1klkct2().s[2]++, useState(false)),
21044
+ _ref4 = _slicedToArray$2(_ref3, 2),
21045
+ isUploading = _ref4[0],
21046
+ setIsUploading = _ref4[1];
21047
+ var authenticationEndpoint = (cov_kp1klkct2().s[3]++, "".concat(window.location.origin, "/neeto_image_uploader_engine/imagekit/auth"));
21048
+ var _ref5 = (cov_kp1klkct2().s[4]++, useCreateBlob()),
21049
+ createBlob = _ref5.mutate;
21050
+ cov_kp1klkct2().s[5]++;
21051
+ var handleUploadProgress = function handleUploadProgress(e, fileSize) {
21052
+ cov_kp1klkct2().f[1]++;
21053
+ cov_kp1klkct2().s[6]++;
21054
+ if (e.loaded <= fileSize) {
21055
+ cov_kp1klkct2().b[0][0]++;
21056
+ var percent = (cov_kp1klkct2().s[7]++, Math.round(e.loaded / fileSize * 100));
21057
+ cov_kp1klkct2().s[8]++;
21058
+ setUploadProgress(percent);
21059
+ } else {
21060
+ cov_kp1klkct2().b[0][1]++;
21061
+ }
21062
+ cov_kp1klkct2().s[9]++;
21063
+ (cov_kp1klkct2().b[1][0]++, equals(e.loaded, e.total)) && (cov_kp1klkct2().b[1][1]++, setUploadProgress(100));
21064
+ };
21065
+ cov_kp1klkct2().s[10]++;
21066
+ var developmentUpload = /*#__PURE__*/function () {
21067
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(file, onUploadComplete) {
21068
+ var upload;
21069
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
21070
+ while (1) switch (_context.prev = _context.next) {
21071
+ case 0:
21072
+ cov_kp1klkct2().f[2]++;
21073
+ cov_kp1klkct2().s[11]++;
21074
+ try {
21075
+ cov_kp1klkct2().s[12]++;
21076
+ setIsUploading(true);
21077
+ upload = (cov_kp1klkct2().s[13]++, new DirectUpload(file, "/api/direct_uploads"));
21078
+ cov_kp1klkct2().s[14]++;
21079
+ upload.create(function (_, blob) {
21080
+ cov_kp1klkct2().f[3]++;
21081
+ var payload = (cov_kp1klkct2().s[15]++, {
21082
+ id: blob.signed_id,
21083
+ payload: {
21084
+ metadata: {
21085
+ organizationKey: globalProps.organization.publicApiKey,
21086
+ url: blob.blob_url,
21087
+ height: 200,
21088
+ width: 200
21089
+ }
21090
+ }
21091
+ });
21092
+ cov_kp1klkct2().s[16]++;
21093
+ directUploadsApi.update(payload);
21094
+ cov_kp1klkct2().s[17]++;
21095
+ onUploadComplete(mergeRight(keysToCamelCase(blob), {
21096
+ url: blob.blob_url
21097
+ }));
21098
+ });
21099
+ } catch (error) {
21100
+ cov_kp1klkct2().s[18]++;
21101
+ Toastr.error(error);
21102
+ } finally {
21103
+ cov_kp1klkct2().s[19]++;
21104
+ setIsUploading(false);
21105
+ }
21106
+ case 3:
21107
+ case "end":
21108
+ return _context.stop();
21109
+ }
21110
+ }, _callee);
21111
+ }));
21112
+ return function developmentUpload(_x, _x2) {
21113
+ return _ref6.apply(this, arguments);
21114
+ };
21115
+ }();
21116
+ cov_kp1klkct2().s[20]++;
21117
+ var productionUpload = /*#__PURE__*/function () {
21118
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(file, XHRProgress, onUploadComplete) {
21119
+ var imagekit, image, payload;
21120
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
21121
+ while (1) switch (_context2.prev = _context2.next) {
21122
+ case 0:
21123
+ cov_kp1klkct2().f[4]++;
21124
+ cov_kp1klkct2().s[21]++;
21125
+ _context2.prev = 2;
21126
+ imagekit = (cov_kp1klkct2().s[22]++, new ImageKit(mergeRight(globalProps.imageKit, {
21127
+ authenticationEndpoint: authenticationEndpoint
21128
+ })));
21129
+ cov_kp1klkct2().s[23]++;
21130
+ setIsUploading(true);
21131
+ cov_kp1klkct2().s[24]++;
21132
+ _context2.next = 9;
21133
+ return imagekit.upload({
21134
+ xhr: XHRProgress,
21135
+ file: file,
21136
+ fileName: file.name,
21137
+ folder: (cov_kp1klkct2().b[2][0]++, globalProps.imageKit.folder) || (cov_kp1klkct2().b[2][1]++, IMAGE_KIT_DEFAULT_FOLDER),
21138
+ customMetadata: {
21139
+ organizationKey: globalProps.organization.publicApiKey,
21140
+ appName: globalProps.appName
21141
+ }
21142
+ });
21143
+ case 9:
21144
+ image = _context2.sent;
21145
+ payload = (cov_kp1klkct2().s[25]++, {
21146
+ filename: image.name,
21147
+ byte_size: image.size,
21148
+ content_type: image.fileType,
21149
+ checksum: image.fileId,
21150
+ metadata: image,
21151
+ service_name: "imagekitio"
21152
+ });
21153
+ cov_kp1klkct2().s[26]++;
21154
+ createBlob(payload, {
21155
+ onSuccess: onUploadComplete,
21156
+ onError: Toastr.error
21157
+ });
21158
+ _context2.next = 19;
21159
+ break;
21160
+ case 15:
21161
+ _context2.prev = 15;
21162
+ _context2.t0 = _context2["catch"](2);
21163
+ cov_kp1klkct2().s[27]++;
21164
+ Toastr.error(_context2.t0);
21165
+ case 19:
21166
+ _context2.prev = 19;
21167
+ cov_kp1klkct2().s[28]++;
21168
+ setIsUploading(false);
21169
+ return _context2.finish(19);
21170
+ case 23:
21171
+ case "end":
21172
+ return _context2.stop();
21173
+ }
21174
+ }, _callee2, null, [[2, 15, 19, 23]]);
21175
+ }));
21176
+ return function productionUpload(_x3, _x4, _x5) {
21177
+ return _ref7.apply(this, arguments);
21178
+ };
21179
+ }();
21180
+ cov_kp1klkct2().s[29]++;
21181
+ var uploadImage = /*#__PURE__*/function () {
21182
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(file, onUploadComplete) {
21183
+ var fileSize, XHRProgress;
21184
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
21185
+ while (1) switch (_context3.prev = _context3.next) {
21186
+ case 0:
21187
+ cov_kp1klkct2().f[5]++;
21188
+ cov_kp1klkct2().s[30]++;
21189
+ setUploadProgress(0);
21190
+ fileSize = (cov_kp1klkct2().s[31]++, file.size);
21191
+ XHRProgress = (cov_kp1klkct2().s[32]++, new XMLHttpRequest());
21192
+ cov_kp1klkct2().s[33]++;
21193
+ XHRProgress.upload.addEventListener("progress", function (e) {
21194
+ cov_kp1klkct2().f[6]++;
21195
+ cov_kp1klkct2().s[34]++;
21196
+ handleUploadProgress(e, fileSize);
21197
+ });
21198
+ cov_kp1klkct2().s[35]++;
21199
+ if (!IS_DEVELOPMENT_OR_HEROKU_ENV) {
21200
+ _context3.next = 14;
21201
+ break;
21202
+ }
21203
+ cov_kp1klkct2().b[3][0]++;
21204
+ _context3.next = 12;
21205
+ return developmentUpload(file, onUploadComplete);
21206
+ case 12:
21207
+ _context3.next = 17;
21208
+ break;
21209
+ case 14:
21210
+ cov_kp1klkct2().b[3][1]++;
21211
+ _context3.next = 17;
21212
+ return productionUpload(file, XHRProgress, onUploadComplete);
21213
+ case 17:
21214
+ case "end":
21215
+ return _context3.stop();
21216
+ }
21217
+ }, _callee3);
21218
+ }));
21219
+ return function uploadImage(_x6, _x7) {
21220
+ return _ref8.apply(this, arguments);
21221
+ };
21222
+ }();
21223
+ cov_kp1klkct2().s[36]++;
21224
+ return {
21225
+ uploadImage: uploadImage,
21226
+ uploadProgress: uploadProgress,
21227
+ isUploading: isUploading
21228
+ };
21229
+ };
21230
+
20282
21231
  function cov_2bqq1nym6() {
20283
21232
  var path = "/home/runner/work/neeto-image-uploader-nano/neeto-image-uploader-nano/index.js";
20284
21233
  var hash = "859c4b94a928e91d6b160a1fd649544ffbf06ed7";
@@ -20310,5 +21259,5 @@ function cov_2bqq1nym6() {
20310
21259
  }
20311
21260
  cov_2bqq1nym6();
20312
21261
 
20313
- export { Modal as AssetLibrary, Image$1 as Image, ImageUploader, Video };
21262
+ export { Modal as AssetLibrary, Image$1 as Image, ImageUploader, Video, useImageUpload };
20314
21263
  //# sourceMappingURL=index.js.map