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