native-fn 1.0.69 → 1.0.71

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 (28) hide show
  1. package/dist/native.cjs +1 -1
  2. package/dist/native.min.cjs +1 -1
  3. package/dist/native.min.mjs +1 -1
  4. package/dist/native.mjs +1 -1
  5. package/dist/native.umd.js +1 -1
  6. package/dist/native.umd.min.js +1 -1
  7. package/dist/plugin/app/index.cjs +302 -310
  8. package/dist/plugin/app/index.min.cjs +1 -1
  9. package/dist/plugin/app/index.min.mjs +1 -1
  10. package/dist/plugin/app/index.mjs +302 -310
  11. package/dist/plugin/app/index.umd.js +302 -310
  12. package/dist/plugin/app/index.umd.min.js +1 -1
  13. package/dist/plugin/app/src/plugin/app/cores/index.d.ts +14 -0
  14. package/dist/plugin/app/src/plugin/appearance/constants/index.d.ts +1 -1
  15. package/dist/plugin/appearance/index.d.ts +0 -63
  16. package/dist/plugin/appearance/src/plugin/app/cores/index.d.ts +14 -0
  17. package/dist/plugin/appearance/src/plugin/appearance/constants/index.d.ts +1 -1
  18. package/dist/plugin/camera/src/plugin/app/cores/index.d.ts +14 -0
  19. package/dist/plugin/camera/src/plugin/appearance/constants/index.d.ts +1 -1
  20. package/dist/plugin/clipboard/src/plugin/app/cores/index.d.ts +14 -0
  21. package/dist/plugin/clipboard/src/plugin/appearance/constants/index.d.ts +1 -1
  22. package/dist/plugin/fullscreen/src/plugin/app/cores/index.d.ts +14 -0
  23. package/dist/plugin/fullscreen/src/plugin/appearance/constants/index.d.ts +1 -1
  24. package/dist/plugin/theme/src/plugin/app/cores/index.d.ts +14 -0
  25. package/dist/plugin/theme/src/plugin/appearance/constants/index.d.ts +1 -1
  26. package/dist/src/plugin/app/cores/index.d.ts +14 -0
  27. package/dist/src/plugin/appearance/constants/index.d.ts +1 -1
  28. package/package.json +1 -1
@@ -509,6 +509,169 @@ Platform.isMobile = Platform.device === Devices.Mobile;
509
509
  Platform.isDesktop = Platform.device === Devices.Desktop;
510
510
  Platform.isStandalone = getIsStandalone(Platform.os);
511
511
 
512
+ function createCustomError(name, Base) {
513
+ if (Base === void 0) { Base = Error; }
514
+ function CustomError(message) {
515
+ if (!(this instanceof CustomError))
516
+ return new CustomError(message);
517
+ var error = new Base(message || '');
518
+ if (typeof Object.setPrototypeOf === 'function')
519
+ Object.setPrototypeOf(error, CustomError.prototype);
520
+ else
521
+ error.__proto__ = CustomError.prototype;
522
+ error.name = name;
523
+ if (message !== undefined)
524
+ error.message = message;
525
+ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
526
+ try {
527
+ Object.defineProperty(error, Symbol.toStringTag, {
528
+ value: name,
529
+ writable: false,
530
+ enumerable: false,
531
+ configurable: true
532
+ });
533
+ }
534
+ catch (_) {
535
+ }
536
+ }
537
+ if (typeof Error.captureStackTrace === 'function') {
538
+ Error.captureStackTrace(error, CustomError);
539
+ }
540
+ else if (Base.captureStackTrace && typeof Base.captureStackTrace === 'function') {
541
+ Base.captureStackTrace(error, CustomError);
542
+ }
543
+ else {
544
+ try {
545
+ var tempError = new Base();
546
+ if (tempError.stack)
547
+ error.stack = tempError.stack;
548
+ }
549
+ catch (_) {
550
+ }
551
+ }
552
+ return error;
553
+ }
554
+ CustomError.prototype = Object.create(Base.prototype, {
555
+ constructor: {
556
+ value: CustomError,
557
+ writable: true,
558
+ enumerable: false,
559
+ configurable: true
560
+ }
561
+ });
562
+ try {
563
+ Object.defineProperty(CustomError.prototype, 'name', {
564
+ value: name,
565
+ writable: true,
566
+ enumerable: false,
567
+ configurable: true
568
+ });
569
+ }
570
+ catch (_) {
571
+ try {
572
+ CustomError.prototype.name = name;
573
+ }
574
+ catch (_) {
575
+ }
576
+ }
577
+ try {
578
+ Object.defineProperty(CustomError, 'name', {
579
+ value: name,
580
+ writable: false,
581
+ enumerable: false,
582
+ configurable: true
583
+ });
584
+ }
585
+ catch (_) {
586
+ }
587
+ return CustomError;
588
+ }
589
+
590
+ var URLOpenError = createCustomError('URLOpenError');
591
+
592
+ function getTopmostWindow() {
593
+ try {
594
+ if (globalThis.top && globalThis.top !== window) {
595
+ void globalThis.top.location.href;
596
+ return globalThis.top;
597
+ }
598
+ }
599
+ catch (_) {
600
+ }
601
+ return window;
602
+ }
603
+
604
+ function createHiddenElement(tagName, focusable) {
605
+ if (focusable === void 0) { focusable = true; }
606
+ if (typeof globalThis.document === 'undefined')
607
+ return undefined;
608
+ var element = globalThis.document.createElement(tagName);
609
+ if ('width' in element)
610
+ element.width = '0';
611
+ if ('height' in element)
612
+ element.height = '0';
613
+ if ('border' in element)
614
+ element.border = '0';
615
+ if ('frameBorder' in element)
616
+ element.frameBorder = '0';
617
+ if ('scrolling' in element)
618
+ element.scrolling = 'no';
619
+ if ('cellPadding' in element)
620
+ element.cellPadding = '0';
621
+ if ('cellSpacing' in element)
622
+ element.cellSpacing = '0';
623
+ if ('frame' in element)
624
+ element.frame = 'void';
625
+ if ('rules' in element)
626
+ element.rules = 'none';
627
+ if ('noWrap' in element)
628
+ element.noWrap = true;
629
+ element.tabIndex = -1;
630
+ element.setAttribute('role', 'presentation');
631
+ if (focusable) {
632
+ element.style.width = '1px';
633
+ element.style.height = '1px';
634
+ }
635
+ else {
636
+ element.setAttribute('aria-hidden', 'true');
637
+ element.style.width = '0';
638
+ element.style.height = '0';
639
+ element.style.zIndex = '-9999';
640
+ element.style.display = 'none';
641
+ element.style.visibility = 'hidden';
642
+ element.style.pointerEvents = 'none';
643
+ }
644
+ element.style.position = 'absolute';
645
+ element.style.top = '0';
646
+ element.style.left = '0';
647
+ element.style.padding = '0';
648
+ element.style.margin = '0';
649
+ element.style.border = 'none';
650
+ element.style.outline = 'none';
651
+ element.style.clip = 'rect(1px, 1px, 1px, 1px)';
652
+ element.style.clipPath = 'inset(50%)';
653
+ element.style.overflow = 'hidden';
654
+ element.style.whiteSpace = 'nowrap';
655
+ return element;
656
+ }
657
+
658
+ function dispatchClickEvent(element, view) {
659
+ if (view === void 0) { view = window; }
660
+ var fake;
661
+ try {
662
+ fake = new MouseEvent('click', {
663
+ bubbles: true,
664
+ cancelable: true,
665
+ view: view
666
+ });
667
+ }
668
+ catch (_) {
669
+ fake = globalThis.document.createEvent('MouseEvents');
670
+ fake.initMouseEvent('click', true, true, view, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
671
+ }
672
+ element.dispatchEvent(fake);
673
+ }
674
+
512
675
  function capitalize(_) {
513
676
  var groups = [];
514
677
  for (var _i = 1; _i < arguments.length; _i++) {
@@ -653,89 +816,156 @@ var EventListenerUtils = {
653
816
  }
654
817
  };
655
818
 
656
- function getTopmostWindow() {
819
+ var _a;
820
+ var App = {
821
+ open: open,
822
+ messenger: (_a = {},
823
+ _a[MessengerType.Telephone] = openMessengerTelephone,
824
+ _a[MessengerType.Message] = openMessengerMessage,
825
+ _a[MessengerType.Mail] = openMessengerMail,
826
+ _a),
827
+ };
828
+ function getTrackId(bundle) {
657
829
  try {
658
- if (globalThis.top && globalThis.top !== window) {
659
- void globalThis.top.location.href;
660
- return globalThis.top;
830
+ var xhr = new XMLHttpRequest();
831
+ xhr.open('GET', 'https://itunes.apple.com/lookup?bundleId=' + bundle, false);
832
+ xhr.send();
833
+ if (xhr.status === 200) {
834
+ try {
835
+ var response = JSON.parse(xhr.response);
836
+ if (response.results === undefined)
837
+ return undefined;
838
+ var results = response.results;
839
+ if (!Array.isArray(results) || results.length === 0)
840
+ return undefined;
841
+ var result = results[0];
842
+ if (result === undefined)
843
+ return undefined;
844
+ return result.trackId;
845
+ }
846
+ catch (_) {
847
+ return undefined;
848
+ }
661
849
  }
850
+ return undefined;
662
851
  }
663
852
  catch (_) {
853
+ return undefined;
664
854
  }
665
- return window;
666
855
  }
667
-
668
- function dispatchClickEvent(element, view) {
669
- if (view === void 0) { view = window; }
670
- var fake;
671
- try {
672
- fake = new MouseEvent('click', {
673
- bubbles: true,
674
- cancelable: true,
675
- view: view
676
- });
856
+ function createIntentURL(scheme, packageName, fallback) {
857
+ var split = scheme.split('://');
858
+ var prefix = split[0];
859
+ var suffix = split[1];
860
+ var intent = 'intent://';
861
+ if (suffix !== undefined)
862
+ intent = intent + suffix;
863
+ intent = intent + '#Intent;'
864
+ + 'scheme=' + prefix + ';'
865
+ + 'action=android.intent.action.VIEW;'
866
+ + 'category=android.intent.category.BROWSABLE;';
867
+ if (packageName !== undefined)
868
+ intent = intent + 'package=' + packageName + ';';
869
+ if (fallback !== undefined && typeof fallback === 'string')
870
+ intent = intent + 'S.browser_fallback_url=' + fallback + ';';
871
+ else if (packageName !== undefined)
872
+ intent = intent + 'S.browser_fallback_url=' + createAppStoreURL(packageName, OS.Android) + ';';
873
+ return intent + 'end';
874
+ }
875
+ function parseIntentURL(intent) {
876
+ var parsed = {};
877
+ var split = intent.split('#Intent;');
878
+ var host = split[0].substring(9);
879
+ var suffix = split[1];
880
+ var parameterString = suffix.substring(0, suffix.length - 4);
881
+ var parameters = parameterString.split(';');
882
+ var extras = {};
883
+ for (var i = 0; i < parameters.length; i++) {
884
+ var part = parameters[i];
885
+ var index = part.indexOf('=');
886
+ if (index !== -1)
887
+ extras[part.substring(0, index)] = part.substring(index + 1);
677
888
  }
678
- catch (_) {
679
- fake = globalThis.document.createEvent('MouseEvents');
680
- fake.initMouseEvent('click', true, true, view, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
889
+ if (extras['scheme'] !== undefined)
890
+ parsed.scheme = (extras['scheme'] + '://' + host);
891
+ if (extras['package'] !== undefined)
892
+ parsed.packageName = extras['package'];
893
+ if (extras['S.browser_fallback_url'] !== undefined)
894
+ parsed.fallback = extras['S.browser_fallback_url'];
895
+ return parsed;
896
+ }
897
+ function createAppStoreURL(packageName, os) {
898
+ if (packageName === undefined)
899
+ return undefined;
900
+ switch (os) {
901
+ case OS.Android:
902
+ return 'market://details?id=' + packageName;
903
+ case OS.iOS:
904
+ return 'itms-apps://itunes.apple.com/app/id' + packageName + '?mt=8';
905
+ case OS.Windows:
906
+ return 'ms-windows-store://pdp/?ProductId=' + packageName;
907
+ case OS.MacOS:
908
+ return 'macappstore://itunes.apple.com/app/id' + packageName + '?mt=12';
909
+ default:
910
+ throw new URLOpenError('Unsupported OS: \"' + Platform.userAgent + '\"');
681
911
  }
682
- element.dispatchEvent(fake);
683
912
  }
684
-
685
- function createHiddenElement(tagName, focusable) {
686
- if (focusable === void 0) { focusable = true; }
687
- if (typeof globalThis.document === 'undefined')
913
+ function createWebStoreURL(packageName, os) {
914
+ if (packageName === undefined)
688
915
  return undefined;
689
- var element = globalThis.document.createElement(tagName);
690
- if ('width' in element)
691
- element.width = '0';
692
- if ('height' in element)
693
- element.height = '0';
694
- if ('border' in element)
695
- element.border = '0';
696
- if ('frameBorder' in element)
697
- element.frameBorder = '0';
698
- if ('scrolling' in element)
699
- element.scrolling = 'no';
700
- if ('cellPadding' in element)
701
- element.cellPadding = '0';
702
- if ('cellSpacing' in element)
703
- element.cellSpacing = '0';
704
- if ('frame' in element)
705
- element.frame = 'void';
706
- if ('rules' in element)
707
- element.rules = 'none';
708
- if ('noWrap' in element)
709
- element.noWrap = true;
710
- element.tabIndex = -1;
711
- element.setAttribute('role', 'presentation');
712
- if (focusable) {
713
- element.style.width = '1px';
714
- element.style.height = '1px';
916
+ switch (os) {
917
+ case OS.Android:
918
+ return 'https://play.google.com/store/apps/details?id=' + packageName;
919
+ case OS.iOS:
920
+ return 'https://itunes.apple.com/app/id' + packageName + '?mt=8';
921
+ case OS.Windows:
922
+ return 'https://apps.microsoft.com/detail/' + packageName;
923
+ case OS.MacOS:
924
+ return 'https://apps.apple.com/app/id' + packageName + '?mt=12';
925
+ default:
926
+ throw new URLOpenError('Unsupported OS: \"' + Platform.userAgent + '\"');
715
927
  }
716
- else {
717
- element.setAttribute('aria-hidden', 'true');
718
- element.style.width = '0';
719
- element.style.height = '0';
720
- element.style.zIndex = '-9999';
721
- element.style.display = 'none';
722
- element.style.visibility = 'hidden';
723
- element.style.pointerEvents = 'none';
928
+ }
929
+ function getDefaultTimeoutByOS(os) {
930
+ switch (os) {
931
+ case OS.iOS:
932
+ return 2000;
933
+ case OS.Android:
934
+ return 1000;
935
+ default:
936
+ return 750;
724
937
  }
725
- element.style.position = 'absolute';
726
- element.style.top = '0';
727
- element.style.left = '0';
728
- element.style.padding = '0';
729
- element.style.margin = '0';
730
- element.style.border = 'none';
731
- element.style.outline = 'none';
732
- element.style.clip = 'rect(1px, 1px, 1px, 1px)';
733
- element.style.clipPath = 'inset(50%)';
734
- element.style.overflow = 'hidden';
735
- element.style.whiteSpace = 'nowrap';
736
- return element;
737
938
  }
738
-
939
+ function canOpenIntentURL() {
940
+ if (Platform.os !== OS.Android)
941
+ return false;
942
+ if (Platform.browser === Browsers.SamsungInternet && compareVersion(Platform.browserVersion, '17.0.1.69') >= 0 && compareVersion(Platform.browserVersion, '17.0.7.34') < 0)
943
+ return false;
944
+ if (Platform.browser === Browsers.Firefox && compareVersion(Platform.browserVersion, '41.0') < 0)
945
+ return false;
946
+ if (Platform.browser === Browsers.Firefox && compareVersion(Platform.browserVersion, '58.0') >= 0 && compareVersion(Platform.browserVersion, '68.11.0') < 0)
947
+ return false;
948
+ if (Platform.browser === Browsers.Firefox && compareVersion(Platform.browserVersion, '79.0') >= 0 && compareVersion(Platform.browserVersion, '81.2.0') < 0)
949
+ return false;
950
+ if (Platform.browser === Browsers.Firefox && compareVersion(Platform.browserVersion, '96.0') >= 0 && compareVersion(Platform.browserVersion, '107.0') < 0)
951
+ return false;
952
+ if (Platform.browser === Browsers.Opera && compareVersion(Platform.browserVersion, '14.0') < 0)
953
+ return false;
954
+ if (/(?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/[\w.]+;/i.test(Platform.userAgent) || /instagram[\/ ][-\w.]+/i.test(Platform.userAgent) || /micromessenger\/([\w.]+)/i.test(Platform.userAgent) || /musical_ly(?:.+app_?version\/|_)[\w.]+/i.test(Platform.userAgent) || /ultralite app_version\/[\w.]+/i.test(Platform.userAgent))
955
+ return false;
956
+ return true;
957
+ }
958
+ function canOpenUniversalURL() {
959
+ return Platform.os === OS.iOS && compareVersion(Platform.osVersion, '9.0') >= 0;
960
+ }
961
+ function getURLOpenError(tried) {
962
+ var triedURLString = '';
963
+ for (var i = 0; i < tried.length; i++)
964
+ triedURLString += '\n' + (i + 1) + ': ' + tried[i];
965
+ if (triedURLString.length > 0)
966
+ triedURLString = '\n' + triedURLString + '\n';
967
+ return new URLOpenError('Failed to open any of the provided URLs: ' + triedURLString);
968
+ }
739
969
  function openURLViaHref(url, index) {
740
970
  var top = getTopmostWindow();
741
971
  var topDocument = top.document;
@@ -899,16 +1129,9 @@ function tryOpenURLViaReactNative(url) {
899
1129
  }
900
1130
  function tryOpenURLViaElectron(url) {
901
1131
  try {
902
- var shell_1;
903
- if (typeof globalThis.electronBridge !== 'undefined') {
904
- shell_1 = globalThis.electronBridge;
905
- }
906
- else {
907
- var electron = require('electron');
908
- shell_1 = electron.shell;
909
- }
1132
+ var electron_1 = require('electron');
910
1133
  return new Promise(function (resolve, reject) {
911
- shell_1
1134
+ electron_1.shell
912
1135
  .openExternal(url)
913
1136
  .then(resolve)
914
1137
  .catch(reject);
@@ -1034,237 +1257,6 @@ function tryOpenURL(url, index, timeout) {
1034
1257
  }
1035
1258
  });
1036
1259
  }
1037
-
1038
- function createCustomError(name, Base) {
1039
- if (Base === void 0) { Base = Error; }
1040
- function CustomError(message) {
1041
- if (!(this instanceof CustomError))
1042
- return new CustomError(message);
1043
- var error = new Base(message || '');
1044
- if (typeof Object.setPrototypeOf === 'function')
1045
- Object.setPrototypeOf(error, CustomError.prototype);
1046
- else
1047
- error.__proto__ = CustomError.prototype;
1048
- error.name = name;
1049
- if (message !== undefined)
1050
- error.message = message;
1051
- if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
1052
- try {
1053
- Object.defineProperty(error, Symbol.toStringTag, {
1054
- value: name,
1055
- writable: false,
1056
- enumerable: false,
1057
- configurable: true
1058
- });
1059
- }
1060
- catch (_) {
1061
- }
1062
- }
1063
- if (typeof Error.captureStackTrace === 'function') {
1064
- Error.captureStackTrace(error, CustomError);
1065
- }
1066
- else if (Base.captureStackTrace && typeof Base.captureStackTrace === 'function') {
1067
- Base.captureStackTrace(error, CustomError);
1068
- }
1069
- else {
1070
- try {
1071
- var tempError = new Base();
1072
- if (tempError.stack)
1073
- error.stack = tempError.stack;
1074
- }
1075
- catch (_) {
1076
- }
1077
- }
1078
- return error;
1079
- }
1080
- CustomError.prototype = Object.create(Base.prototype, {
1081
- constructor: {
1082
- value: CustomError,
1083
- writable: true,
1084
- enumerable: false,
1085
- configurable: true
1086
- }
1087
- });
1088
- try {
1089
- Object.defineProperty(CustomError.prototype, 'name', {
1090
- value: name,
1091
- writable: true,
1092
- enumerable: false,
1093
- configurable: true
1094
- });
1095
- }
1096
- catch (_) {
1097
- try {
1098
- CustomError.prototype.name = name;
1099
- }
1100
- catch (_) {
1101
- }
1102
- }
1103
- try {
1104
- Object.defineProperty(CustomError, 'name', {
1105
- value: name,
1106
- writable: false,
1107
- enumerable: false,
1108
- configurable: true
1109
- });
1110
- }
1111
- catch (_) {
1112
- }
1113
- return CustomError;
1114
- }
1115
-
1116
- var URLOpenError = createCustomError('URLOpenError');
1117
-
1118
- var _a;
1119
- var App = {
1120
- open: open,
1121
- messenger: (_a = {},
1122
- _a[MessengerType.Telephone] = openMessengerTelephone,
1123
- _a[MessengerType.Message] = openMessengerMessage,
1124
- _a[MessengerType.Mail] = openMessengerMail,
1125
- _a),
1126
- };
1127
- function getTrackId(bundle) {
1128
- try {
1129
- var xhr = new XMLHttpRequest();
1130
- xhr.open('GET', 'https://itunes.apple.com/lookup?bundleId=' + bundle, false);
1131
- xhr.send();
1132
- if (xhr.status === 200) {
1133
- try {
1134
- var response = JSON.parse(xhr.response);
1135
- if (response.results === undefined)
1136
- return undefined;
1137
- var results = response.results;
1138
- if (!Array.isArray(results) || results.length === 0)
1139
- return undefined;
1140
- var result = results[0];
1141
- if (result === undefined)
1142
- return undefined;
1143
- return result.trackId;
1144
- }
1145
- catch (_) {
1146
- return undefined;
1147
- }
1148
- }
1149
- return undefined;
1150
- }
1151
- catch (_) {
1152
- return undefined;
1153
- }
1154
- }
1155
- function createIntentURL(scheme, packageName, fallback) {
1156
- var split = scheme.split('://');
1157
- var prefix = split[0];
1158
- var suffix = split[1];
1159
- var intent = 'intent://';
1160
- if (suffix !== undefined)
1161
- intent = intent + suffix;
1162
- intent = intent + '#Intent;'
1163
- + 'scheme=' + prefix + ';'
1164
- + 'action=android.intent.action.VIEW;'
1165
- + 'category=android.intent.category.BROWSABLE;';
1166
- if (packageName !== undefined)
1167
- intent = intent + 'package=' + packageName + ';';
1168
- if (fallback !== undefined && typeof fallback === 'string')
1169
- intent = intent + 'S.browser_fallback_url=' + fallback + ';';
1170
- else if (packageName !== undefined)
1171
- intent = intent + 'S.browser_fallback_url=' + createAppStoreURL(packageName, OS.Android) + ';';
1172
- return intent + 'end';
1173
- }
1174
- function parseIntentURL(intent) {
1175
- var parsed = {};
1176
- var split = intent.split('#Intent;');
1177
- var host = split[0].substring(9);
1178
- var suffix = split[1];
1179
- var parameterString = suffix.substring(0, suffix.length - 4);
1180
- var parameters = parameterString.split(';');
1181
- var extras = {};
1182
- for (var i = 0; i < parameters.length; i++) {
1183
- var part = parameters[i];
1184
- var index = part.indexOf('=');
1185
- if (index !== -1)
1186
- extras[part.substring(0, index)] = part.substring(index + 1);
1187
- }
1188
- if (extras['scheme'] !== undefined)
1189
- parsed.scheme = (extras['scheme'] + '://' + host);
1190
- if (extras['package'] !== undefined)
1191
- parsed.packageName = extras['package'];
1192
- if (extras['S.browser_fallback_url'] !== undefined)
1193
- parsed.fallback = extras['S.browser_fallback_url'];
1194
- return parsed;
1195
- }
1196
- function createAppStoreURL(packageName, os) {
1197
- if (packageName === undefined)
1198
- return undefined;
1199
- switch (os) {
1200
- case OS.Android:
1201
- return 'market://details?id=' + packageName;
1202
- case OS.iOS:
1203
- return 'itms-apps://itunes.apple.com/app/id' + packageName + '?mt=8';
1204
- case OS.Windows:
1205
- return 'ms-windows-store://pdp/?ProductId=' + packageName;
1206
- case OS.MacOS:
1207
- return 'macappstore://itunes.apple.com/app/id' + packageName + '?mt=12';
1208
- default:
1209
- throw new URLOpenError('Unsupported OS: \"' + Platform.userAgent + '\"');
1210
- }
1211
- }
1212
- function createWebStoreURL(packageName, os) {
1213
- if (packageName === undefined)
1214
- return undefined;
1215
- switch (os) {
1216
- case OS.Android:
1217
- return 'https://play.google.com/store/apps/details?id=' + packageName;
1218
- case OS.iOS:
1219
- return 'https://itunes.apple.com/app/id' + packageName + '?mt=8';
1220
- case OS.Windows:
1221
- return 'https://apps.microsoft.com/detail/' + packageName;
1222
- case OS.MacOS:
1223
- return 'https://apps.apple.com/app/id' + packageName + '?mt=12';
1224
- default:
1225
- throw new URLOpenError('Unsupported OS: \"' + Platform.userAgent + '\"');
1226
- }
1227
- }
1228
- function getDefaultTimeoutByOS(os) {
1229
- switch (os) {
1230
- case OS.iOS:
1231
- return 2000;
1232
- case OS.Android:
1233
- return 1000;
1234
- default:
1235
- return 750;
1236
- }
1237
- }
1238
- function canOpenIntentURL() {
1239
- if (Platform.os !== OS.Android)
1240
- return false;
1241
- if (Platform.browser === Browsers.SamsungInternet && compareVersion(Platform.browserVersion, '17.0.1.69') >= 0 && compareVersion(Platform.browserVersion, '17.0.7.34') < 0)
1242
- return false;
1243
- if (Platform.browser === Browsers.Firefox && compareVersion(Platform.browserVersion, '41.0') < 0)
1244
- return false;
1245
- if (Platform.browser === Browsers.Firefox && compareVersion(Platform.browserVersion, '58.0') >= 0 && compareVersion(Platform.browserVersion, '68.11.0') < 0)
1246
- return false;
1247
- if (Platform.browser === Browsers.Firefox && compareVersion(Platform.browserVersion, '79.0') >= 0 && compareVersion(Platform.browserVersion, '81.2.0') < 0)
1248
- return false;
1249
- if (Platform.browser === Browsers.Firefox && compareVersion(Platform.browserVersion, '96.0') >= 0 && compareVersion(Platform.browserVersion, '107.0') < 0)
1250
- return false;
1251
- if (Platform.browser === Browsers.Opera && compareVersion(Platform.browserVersion, '14.0') < 0)
1252
- return false;
1253
- if (/(?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/[\w.]+;/i.test(Platform.userAgent) || /instagram[\/ ][-\w.]+/i.test(Platform.userAgent) || /micromessenger\/([\w.]+)/i.test(Platform.userAgent) || /musical_ly(?:.+app_?version\/|_)[\w.]+/i.test(Platform.userAgent) || /ultralite app_version\/[\w.]+/i.test(Platform.userAgent))
1254
- return false;
1255
- return true;
1256
- }
1257
- function canOpenUniversalURL() {
1258
- return Platform.os === OS.iOS && compareVersion(Platform.osVersion, '9.0') >= 0;
1259
- }
1260
- function getURLOpenError(tried) {
1261
- var triedURLString = '';
1262
- for (var i = 0; i < tried.length; i++)
1263
- triedURLString += '\n' + (i + 1) + ': ' + tried[i];
1264
- if (triedURLString.length > 0)
1265
- triedURLString = '\n' + triedURLString + '\n';
1266
- return new URLOpenError('Failed to open any of the provided URLs: ' + triedURLString);
1267
- }
1268
1260
  function open(options) {
1269
1261
  var os = Platform.os;
1270
1262
  var urls = [];