@ovh-ux/ng-ovh-browser-alert 2.1.0 → 2.1.1

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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.1.1](https://github.com/ovh/manager/compare/@ovh-ux/ng-ovh-browser-alert@2.1.0...@ovh-ux/ng-ovh-browser-alert@2.1.1) (2023-12-05)
7
+
8
+ **Note:** Version bump only for package @ovh-ux/ng-ovh-browser-alert
9
+
10
+
11
+
12
+
13
+
6
14
  # [2.1.0](https://github.com/ovh/manager/compare/@ovh-ux/ng-ovh-browser-alert@2.0.7...@ovh-ux/ng-ovh-browser-alert@2.1.0) (2023-11-21)
7
15
 
8
16
 
package/dist/cjs/index.js CHANGED
@@ -15,47 +15,62 @@ function ___$insertStyle(css) {
15
15
 
16
16
  var angular = require('angular');
17
17
 
18
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
19
+
20
+ var angular__default = /*#__PURE__*/_interopDefaultLegacy(angular);
21
+
18
22
  function _classCallCheck(instance, Constructor) {
19
23
  if (!(instance instanceof Constructor)) {
20
24
  throw new TypeError("Cannot call a class as a function");
21
25
  }
22
26
  }
23
-
24
27
  function _defineProperties(target, props) {
25
28
  for (var i = 0; i < props.length; i++) {
26
29
  var descriptor = props[i];
27
30
  descriptor.enumerable = descriptor.enumerable || false;
28
31
  descriptor.configurable = true;
29
32
  if ("value" in descriptor) descriptor.writable = true;
30
- Object.defineProperty(target, descriptor.key, descriptor);
33
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
31
34
  }
32
35
  }
33
-
34
36
  function _createClass(Constructor, protoProps, staticProps) {
35
37
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
36
38
  if (staticProps) _defineProperties(Constructor, staticProps);
39
+ Object.defineProperty(Constructor, "prototype", {
40
+ writable: false
41
+ });
37
42
  return Constructor;
38
43
  }
44
+ function _toPrimitive(input, hint) {
45
+ if (typeof input !== "object" || input === null) return input;
46
+ var prim = input[Symbol.toPrimitive];
47
+ if (prim !== undefined) {
48
+ var res = prim.call(input, hint || "default");
49
+ if (typeof res !== "object") return res;
50
+ throw new TypeError("@@toPrimitive must return a primitive value.");
51
+ }
52
+ return (hint === "string" ? String : Number)(input);
53
+ }
54
+ function _toPropertyKey(arg) {
55
+ var key = _toPrimitive(arg, "string");
56
+ return typeof key === "symbol" ? key : String(key);
57
+ }
39
58
 
40
59
  var BrowserAlertController = /*#__PURE__*/function () {
41
60
  BrowserAlertController.$inject = ["$scope", "ovhBrowserAlertService"];
42
-
43
61
  function BrowserAlertController($scope, ovhBrowserAlertService) {
44
62
  _classCallCheck(this, BrowserAlertController);
45
-
46
63
  this.$scope = $scope;
47
64
  this.ovhBrowserAlertService = ovhBrowserAlertService;
48
65
  this.$scope.isSupported = this.ovhBrowserAlertService.isSupported();
49
66
  this.$scope.isDeprecated = this.ovhBrowserAlertService.isDeprecated();
50
67
  }
51
-
52
68
  _createClass(BrowserAlertController, [{
53
69
  key: "dismissAlert",
54
70
  value: function dismissAlert() {
55
71
  this.$scope.isDismissed = true;
56
72
  }
57
73
  }]);
58
-
59
74
  return BrowserAlertController;
60
75
  }();
61
76
 
@@ -78,46 +93,45 @@ var bowser = createCommonjsModule(function (module) {
78
93
  * https://github.com/ded/bowser
79
94
  * MIT License | (c) Dustin Diaz 2015
80
95
  */
96
+
81
97
  !function (root, name, definition) {
82
98
  if (module.exports) module.exports = definition();else root[name] = definition();
83
99
  }(commonjsGlobal, 'bowser', function () {
84
100
  /**
85
101
  * See useragents.js for examples of navigator.userAgent
86
102
  */
87
- var t = true;
88
103
 
104
+ var t = true;
89
105
  function detect(ua) {
90
106
  function getFirstMatch(regex) {
91
107
  var match = ua.match(regex);
92
108
  return match && match.length > 1 && match[1] || '';
93
109
  }
94
-
95
110
  function getSecondMatch(regex) {
96
111
  var match = ua.match(regex);
97
112
  return match && match.length > 1 && match[2] || '';
98
113
  }
99
-
100
114
  var iosdevice = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase(),
101
- likeAndroid = /like android/i.test(ua),
102
- android = !likeAndroid && /android/i.test(ua),
103
- nexusMobile = /nexus\s*[0-6]\s*/i.test(ua),
104
- nexusTablet = !nexusMobile && /nexus\s*[0-9]+/i.test(ua),
105
- chromeos = /CrOS/.test(ua),
106
- silk = /silk/i.test(ua),
107
- sailfish = /sailfish/i.test(ua),
108
- tizen = /tizen/i.test(ua),
109
- webos = /(web|hpw)(o|0)s/i.test(ua),
110
- windowsphone = /windows phone/i.test(ua),
111
- windows = !windowsphone && /windows/i.test(ua),
112
- mac = !iosdevice && !silk && /macintosh/i.test(ua),
113
- linux = !android && !sailfish && !tizen && !webos && /linux/i.test(ua),
114
- edgeVersion = getSecondMatch(/edg([ea]|ios)\/(\d+(\.\d+)?)/i),
115
- versionIdentifier = getFirstMatch(/version\/(\d+(\.\d+)?)/i),
116
- tablet = /tablet/i.test(ua) && !/tablet pc/i.test(ua),
117
- mobile = !tablet && /[^-]mobi/i.test(ua),
118
- xbox = /xbox/i.test(ua),
119
- result;
120
-
115
+ likeAndroid = /like android/i.test(ua),
116
+ android = !likeAndroid && /android/i.test(ua),
117
+ nexusMobile = /nexus\s*[0-6]\s*/i.test(ua),
118
+ nexusTablet = !nexusMobile && /nexus\s*[0-9]+/i.test(ua),
119
+ chromeos = /CrOS/.test(ua),
120
+ silk = /silk/i.test(ua),
121
+ sailfish = /sailfish/i.test(ua),
122
+ tizen = /tizen/i.test(ua),
123
+ webos = /(web|hpw)(o|0)s/i.test(ua),
124
+ windowsphone = /windows phone/i.test(ua);
125
+ /SamsungBrowser/i.test(ua);
126
+ var windows = !windowsphone && /windows/i.test(ua),
127
+ mac = !iosdevice && !silk && /macintosh/i.test(ua),
128
+ linux = !android && !sailfish && !tizen && !webos && /linux/i.test(ua),
129
+ edgeVersion = getSecondMatch(/edg([ea]|ios)\/(\d+(\.\d+)?)/i),
130
+ versionIdentifier = getFirstMatch(/version\/(\d+(\.\d+)?)/i),
131
+ tablet = /tablet/i.test(ua) && !/tablet pc/i.test(ua),
132
+ mobile = !tablet && /[^-]mobi/i.test(ua),
133
+ xbox = /xbox/i.test(ua),
134
+ result;
121
135
  if (/opera/i.test(ua)) {
122
136
  // an old Opera
123
137
  result = {
@@ -210,7 +224,6 @@ var bowser = createCommonjsModule(function (module) {
210
224
  osname: 'Windows Phone',
211
225
  windowsphone: t
212
226
  };
213
-
214
227
  if (edgeVersion) {
215
228
  result.msedge = t;
216
229
  result.version = edgeVersion;
@@ -264,7 +277,6 @@ var bowser = createCommonjsModule(function (module) {
264
277
  firefox: t,
265
278
  version: getFirstMatch(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i)
266
279
  };
267
-
268
280
  if (/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(ua)) {
269
281
  result.firefoxos = t;
270
282
  result.osname = 'Firefox OS';
@@ -344,15 +356,14 @@ var bowser = createCommonjsModule(function (module) {
344
356
  name: 'Safari',
345
357
  safari: t
346
358
  };
347
-
348
359
  if (versionIdentifier) {
349
360
  result.version = versionIdentifier;
350
361
  }
351
362
  } else if (iosdevice) {
352
363
  result = {
353
364
  name: iosdevice == 'iphone' ? 'iPhone' : iosdevice == 'ipad' ? 'iPad' : 'iPod'
354
- }; // WTF: version is not part of user agent in web apps
355
-
365
+ };
366
+ // WTF: version is not part of user agent in web apps
356
367
  if (versionIdentifier) {
357
368
  result.version = versionIdentifier;
358
369
  }
@@ -367,9 +378,9 @@ var bowser = createCommonjsModule(function (module) {
367
378
  name: getFirstMatch(/^(.*)\/(.*) /),
368
379
  version: getSecondMatch(/^(.*)\/(.*) /)
369
380
  };
370
- } // set webkit or gecko flag for browsers based on these engines
371
-
381
+ }
372
382
 
383
+ // set webkit or gecko flag for browsers based on these engines
373
384
  if (!result.msedge && /(apple)?webkit/i.test(ua)) {
374
385
  if (/(apple)?webkit\/537\.36/i.test(ua)) {
375
386
  result.name = result.name || "Blink";
@@ -378,7 +389,6 @@ var bowser = createCommonjsModule(function (module) {
378
389
  result.name = result.name || "Webkit";
379
390
  result.webkit = t;
380
391
  }
381
-
382
392
  if (!result.version && versionIdentifier) {
383
393
  result.version = versionIdentifier;
384
394
  }
@@ -386,9 +396,9 @@ var bowser = createCommonjsModule(function (module) {
386
396
  result.name = result.name || "Gecko";
387
397
  result.gecko = t;
388
398
  result.version = result.version || getFirstMatch(/gecko\/(\d+(\.\d+)?)/i);
389
- } // set OS flags for platforms that have multiple browsers
390
-
399
+ }
391
400
 
401
+ // set OS flags for platforms that have multiple browsers
392
402
  if (!result.windowsphone && (android || result.silk)) {
393
403
  result.android = t;
394
404
  result.osname = 'Android';
@@ -409,47 +419,35 @@ var bowser = createCommonjsModule(function (module) {
409
419
  result.linux = t;
410
420
  result.osname = 'Linux';
411
421
  }
412
-
413
422
  function getWindowsVersion(s) {
414
423
  switch (s) {
415
424
  case 'NT':
416
425
  return 'NT';
417
-
418
426
  case 'XP':
419
427
  return 'XP';
420
-
421
428
  case 'NT 5.0':
422
429
  return '2000';
423
-
424
430
  case 'NT 5.1':
425
431
  return 'XP';
426
-
427
432
  case 'NT 5.2':
428
433
  return '2003';
429
-
430
434
  case 'NT 6.0':
431
435
  return 'Vista';
432
-
433
436
  case 'NT 6.1':
434
437
  return '7';
435
-
436
438
  case 'NT 6.2':
437
439
  return '8';
438
-
439
440
  case 'NT 6.3':
440
441
  return '8.1';
441
-
442
442
  case 'NT 10.0':
443
443
  return '10';
444
-
445
444
  default:
446
445
  return undefined;
447
446
  }
448
- } // OS version extraction
449
-
447
+ }
450
448
 
449
+ // OS version extraction
451
450
  var osVersion = '';
452
-
453
451
  if (result.windows) {
454
452
  osVersion = getWindowsVersion(getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i));
455
453
  } else if (result.windowsphone) {
@@ -471,46 +469,40 @@ var bowser = createCommonjsModule(function (module) {
471
469
  } else if (result.tizen) {
472
470
  osVersion = getFirstMatch(/tizen[\/\s](\d+(\.\d+)*)/i);
473
471
  }
474
-
475
472
  if (osVersion) {
476
473
  result.osversion = osVersion;
477
- } // device type extraction
478
-
474
+ }
479
475
 
476
+ // device type extraction
480
477
  var osMajorVersion = !result.windows && osVersion.split('.')[0];
481
-
482
478
  if (tablet || nexusTablet || iosdevice == 'ipad' || android && (osMajorVersion == 3 || osMajorVersion >= 4 && !mobile) || result.silk) {
483
479
  result.tablet = t;
484
480
  } else if (mobile || iosdevice == 'iphone' || iosdevice == 'ipod' || android || nexusMobile || result.blackberry || result.webos || result.bada) {
485
481
  result.mobile = t;
486
- } // Graded Browser Support
487
- // http://developer.yahoo.com/yui/articles/gbs
488
-
482
+ }
489
483
 
484
+ // Graded Browser Support
485
+ // http://developer.yahoo.com/yui/articles/gbs
490
486
  if (result.msedge || result.msie && result.version >= 10 || result.yandexbrowser && result.version >= 15 || result.vivaldi && result.version >= 1.0 || result.chrome && result.version >= 20 || result.samsungBrowser && result.version >= 4 || result.whale && compareVersions([result.version, '1.0']) === 1 || result.mzbrowser && compareVersions([result.version, '6.0']) === 1 || result.focus && compareVersions([result.version, '1.0']) === 1 || result.firefox && result.version >= 20.0 || result.safari && result.version >= 6 || result.opera && result.version >= 10.0 || result.ios && result.osversion && result.osversion.split(".")[0] >= 6 || result.blackberry && result.version >= 10.1 || result.chromium && result.version >= 20) {
491
487
  result.a = t;
492
488
  } else if (result.msie && result.version < 10 || result.chrome && result.version < 20 || result.firefox && result.version < 20.0 || result.safari && result.version < 6 || result.opera && result.version < 10.0 || result.ios && result.osversion && result.osversion.split(".")[0] < 6 || result.chromium && result.version < 20) {
493
489
  result.c = t;
494
490
  } else result.x = t;
495
-
496
491
  return result;
497
492
  }
498
-
499
493
  var bowser = detect(typeof navigator !== 'undefined' ? navigator.userAgent || '' : '');
500
-
501
494
  bowser.test = function (browserList) {
502
495
  for (var i = 0; i < browserList.length; ++i) {
503
496
  var browserItem = browserList[i];
504
-
505
497
  if (typeof browserItem === 'string') {
506
498
  if (browserItem in bowser) {
507
499
  return true;
508
500
  }
509
501
  }
510
502
  }
511
-
512
503
  return false;
513
504
  };
505
+
514
506
  /**
515
507
  * Get version precisions count
516
508
  *
@@ -520,11 +512,10 @@ var bowser = createCommonjsModule(function (module) {
520
512
  * @param {string} version
521
513
  * @return {number}
522
514
  */
523
-
524
-
525
515
  function getVersionPrecision(version) {
526
516
  return version.split(".").length;
527
517
  }
518
+
528
519
  /**
529
520
  * Array::map polyfill
530
521
  *
@@ -532,22 +523,18 @@ var bowser = createCommonjsModule(function (module) {
532
523
  * @param {Function} iterator
533
524
  * @return {Array}
534
525
  */
535
-
536
-
537
526
  function map(arr, iterator) {
538
527
  var result = [],
539
- i;
540
-
528
+ i;
541
529
  if (Array.prototype.map) {
542
530
  return Array.prototype.map.call(arr, iterator);
543
531
  }
544
-
545
532
  for (i = 0; i < arr.length; i++) {
546
533
  result.push(iterator(arr[i]));
547
534
  }
548
-
549
535
  return result;
550
536
  }
537
+
551
538
  /**
552
539
  * Calculate browser version weight
553
540
  *
@@ -560,21 +547,22 @@ var bowser = createCommonjsModule(function (module) {
560
547
  * @param {Array<String>} versions versions to compare
561
548
  * @return {Number} comparison result
562
549
  */
563
-
564
-
565
550
  function compareVersions(versions) {
566
551
  // 1) get common precision for both versions, for example for "10.0" and "9" it should be 2
567
552
  var precision = Math.max(getVersionPrecision(versions[0]), getVersionPrecision(versions[1]));
568
553
  var chunks = map(versions, function (version) {
569
- var delta = precision - getVersionPrecision(version); // 2) "9" -> "9.0" (for precision = 2)
554
+ var delta = precision - getVersionPrecision(version);
570
555
 
571
- version = version + new Array(delta + 1).join(".0"); // 3) "9.0" -> ["000000000"", "000000009"]
556
+ // 2) "9" -> "9.0" (for precision = 2)
557
+ version = version + new Array(delta + 1).join(".0");
572
558
 
559
+ // 3) "9.0" -> ["000000000"", "000000009"]
573
560
  return map(version.split("."), function (chunk) {
574
561
  return new Array(20 - chunk.length).join("0") + chunk;
575
562
  }).reverse();
576
- }); // iterate in reverse order by reversed chunks array
563
+ });
577
564
 
565
+ // iterate in reverse order by reversed chunks array
578
566
  while (--precision >= 0) {
579
567
  // 4) compare: "000000009" > "000000010" = false (but "9" > "10" = true)
580
568
  if (chunks[0][precision] > chunks[1][precision]) {
@@ -589,6 +577,7 @@ var bowser = createCommonjsModule(function (module) {
589
577
  }
590
578
  }
591
579
  }
580
+
592
581
  /**
593
582
  * Check if browser is unsupported
594
583
  *
@@ -607,41 +596,36 @@ var bowser = createCommonjsModule(function (module) {
607
596
  * @param {String} [ua] user agent string
608
597
  * @return {Boolean}
609
598
  */
610
-
611
-
612
599
  function isUnsupportedBrowser(minVersions, strictMode, ua) {
613
- var _bowser = bowser; // make strictMode param optional with ua param usage
600
+ var _bowser = bowser;
614
601
 
602
+ // make strictMode param optional with ua param usage
615
603
  if (typeof strictMode === 'string') {
616
604
  ua = strictMode;
617
605
  strictMode = void 0;
618
606
  }
619
-
620
607
  if (strictMode === void 0) {
621
608
  strictMode = false;
622
609
  }
623
-
624
610
  if (ua) {
625
611
  _bowser = detect(ua);
626
612
  }
627
-
628
613
  var version = "" + _bowser.version;
629
-
630
614
  for (var browser in minVersions) {
631
615
  if (minVersions.hasOwnProperty(browser)) {
632
616
  if (_bowser[browser]) {
633
617
  if (typeof minVersions[browser] !== 'string') {
634
618
  throw new Error('Browser version in the minVersion map should be a string: ' + browser + ': ' + String(minVersions));
635
- } // browser version and min supported version.
636
-
619
+ }
637
620
 
621
+ // browser version and min supported version.
638
622
  return compareVersions([version, minVersions[browser]]) < 0;
639
623
  }
640
624
  }
641
625
  }
642
-
643
626
  return strictMode; // not found
644
627
  }
628
+
645
629
  /**
646
630
  * Check if browser is supported
647
631
  *
@@ -650,27 +634,24 @@ var bowser = createCommonjsModule(function (module) {
650
634
  * @param {String} [ua] user agent string
651
635
  * @return {Boolean}
652
636
  */
653
-
654
-
655
637
  function check(minVersions, strictMode, ua) {
656
638
  return !isUnsupportedBrowser(minVersions, strictMode, ua);
657
639
  }
658
-
659
640
  bowser.isUnsupportedBrowser = isUnsupportedBrowser;
660
641
  bowser.compareVersions = compareVersions;
661
642
  bowser.check = check;
643
+
662
644
  /*
663
645
  * Set our detect method to the main bowser object so we can
664
646
  * reuse it to test other user agents.
665
647
  * This is needed to implement future tests.
666
648
  */
667
-
668
649
  bowser._detect = detect;
650
+
669
651
  /*
670
652
  * Set our detect public method to the main bowser object
671
653
  * This is needed to implement bowser in server side
672
654
  */
673
-
674
655
  bowser.detect = detect;
675
656
  return bowser;
676
657
  });
@@ -698,12 +679,10 @@ var SUPPORTED_BROWSERS = {
698
679
  };
699
680
 
700
681
  /* eslint-disable class-methods-use-this */
701
-
702
682
  var BrowserAlertService = /*#__PURE__*/function () {
703
683
  function BrowserAlertService() {
704
684
  _classCallCheck(this, BrowserAlertService);
705
685
  }
706
-
707
686
  _createClass(BrowserAlertService, [{
708
687
  key: "isSupported",
709
688
  value: function isSupported() {
@@ -715,12 +694,11 @@ var BrowserAlertService = /*#__PURE__*/function () {
715
694
  return !bowser.check(SUPPORTED_BROWSERS.deprecated);
716
695
  }
717
696
  }]);
718
-
719
697
  return BrowserAlertService;
720
698
  }();
721
699
 
722
700
  var moduleName = 'ngOvhBrowserAlert';
723
- angular.module(moduleName, []).service('ovhBrowserAlertService', BrowserAlertService).component('ovhBrowserAlert', component);
701
+ angular__default["default"].module(moduleName, []).service('ovhBrowserAlertService', BrowserAlertService).component('ovhBrowserAlert', component);
724
702
 
725
703
  module.exports = moduleName;
726
704
  //# sourceMappingURL=index.js.map