@paydock/client-sdk 1.144.0-beta → 1.144.1-beta
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/bundles/index.cjs +467 -419
- package/bundles/index.cjs.d.ts +392 -380
- package/bundles/index.mjs +467 -419
- package/bundles/index.mjs.d.ts +392 -380
- package/bundles/types/api/api-base.d.ts +15 -2
- package/bundles/types/api/api-base.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/secure-remote-commerce.d.ts.map +1 -1
- package/bundles/widget.umd.js +467 -419
- package/bundles/widget.umd.js.d.ts +392 -380
- package/bundles/widget.umd.js.min.d.ts +392 -380
- package/bundles/widget.umd.min.js +1 -1
- package/package.json +6 -2
package/bundles/index.mjs
CHANGED
|
@@ -954,246 +954,6 @@ var ApiCharge = /*#__PURE__*/function () {
|
|
|
954
954
|
}]);
|
|
955
955
|
}();
|
|
956
956
|
|
|
957
|
-
var ENV = {
|
|
958
|
-
SANDBOX: 'sandbox',
|
|
959
|
-
SANDBOX_KOVENA: 'sandbox-kovena',
|
|
960
|
-
SANDBOX_DEMO: 'sandbox-demo',
|
|
961
|
-
SANDBOX_DEMO_KOVENA: 'sandbox-demo-kovena',
|
|
962
|
-
PROD: 'production',
|
|
963
|
-
STAGING: 'staging',
|
|
964
|
-
STAGING_1: 'staging_1',
|
|
965
|
-
STAGING_2: 'staging_2',
|
|
966
|
-
STAGING_3: 'staging_3',
|
|
967
|
-
STAGING_4: 'staging_4',
|
|
968
|
-
STAGING_5: 'staging_5',
|
|
969
|
-
STAGING_6: 'staging_6',
|
|
970
|
-
STAGING_7: 'staging_7',
|
|
971
|
-
STAGING_8: 'staging_8',
|
|
972
|
-
STAGING_9: 'staging_9',
|
|
973
|
-
STAGING_10: 'staging_10',
|
|
974
|
-
STAGING_11: 'staging_11',
|
|
975
|
-
STAGING_12: 'staging_12',
|
|
976
|
-
STAGING_13: 'staging_13',
|
|
977
|
-
STAGING_14: 'staging_14',
|
|
978
|
-
STAGING_15: 'staging_15'
|
|
979
|
-
};
|
|
980
|
-
var WIDGET_URL = [{
|
|
981
|
-
env: ENV.SANDBOX,
|
|
982
|
-
url: 'https://widget-sandbox.'
|
|
983
|
-
}, {
|
|
984
|
-
env: ENV.SANDBOX_KOVENA,
|
|
985
|
-
url: 'https://widget-sandbox.'
|
|
986
|
-
}, {
|
|
987
|
-
env: ENV.SANDBOX_DEMO,
|
|
988
|
-
url: 'https://widget-sandbox-demo.'
|
|
989
|
-
}, {
|
|
990
|
-
env: ENV.SANDBOX_DEMO_KOVENA,
|
|
991
|
-
url: 'https://widget-sandbox-demo.'
|
|
992
|
-
}, {
|
|
993
|
-
env: ENV.PROD,
|
|
994
|
-
url: 'https://widget.'
|
|
995
|
-
}, {
|
|
996
|
-
env: ENV.STAGING,
|
|
997
|
-
url: 'https://widsta.'
|
|
998
|
-
}, {
|
|
999
|
-
env: ENV.STAGING_1,
|
|
1000
|
-
url: 'https://widsta-1.'
|
|
1001
|
-
}, {
|
|
1002
|
-
env: ENV.STAGING_2,
|
|
1003
|
-
url: 'https://widsta-2.'
|
|
1004
|
-
}, {
|
|
1005
|
-
env: ENV.STAGING_3,
|
|
1006
|
-
url: 'https://widsta-3.'
|
|
1007
|
-
}, {
|
|
1008
|
-
env: ENV.STAGING_4,
|
|
1009
|
-
url: 'https://widsta-4.'
|
|
1010
|
-
}, {
|
|
1011
|
-
env: ENV.STAGING_5,
|
|
1012
|
-
url: 'https://widsta-5.'
|
|
1013
|
-
}, {
|
|
1014
|
-
env: ENV.STAGING_6,
|
|
1015
|
-
url: 'https://widsta-6.'
|
|
1016
|
-
}, {
|
|
1017
|
-
env: ENV.STAGING_7,
|
|
1018
|
-
url: 'https://widsta-7.'
|
|
1019
|
-
}, {
|
|
1020
|
-
env: ENV.STAGING_8,
|
|
1021
|
-
url: 'https://widsta-8.'
|
|
1022
|
-
}, {
|
|
1023
|
-
env: ENV.STAGING_9,
|
|
1024
|
-
url: 'https://widsta-9.'
|
|
1025
|
-
}, {
|
|
1026
|
-
env: ENV.STAGING_10,
|
|
1027
|
-
url: 'https://widsta-10.'
|
|
1028
|
-
}, {
|
|
1029
|
-
env: ENV.STAGING_11,
|
|
1030
|
-
url: 'https://widsta-11.'
|
|
1031
|
-
}, {
|
|
1032
|
-
env: ENV.STAGING_12,
|
|
1033
|
-
url: 'https://widsta-12.'
|
|
1034
|
-
}, {
|
|
1035
|
-
env: ENV.STAGING_13,
|
|
1036
|
-
url: 'https://widsta-13.'
|
|
1037
|
-
}, {
|
|
1038
|
-
env: ENV.STAGING_14,
|
|
1039
|
-
url: 'https://widsta-14.'
|
|
1040
|
-
}, {
|
|
1041
|
-
env: ENV.STAGING_15,
|
|
1042
|
-
url: 'https://widsta-15.'
|
|
1043
|
-
}];
|
|
1044
|
-
var API_URL = [{
|
|
1045
|
-
env: ENV.SANDBOX,
|
|
1046
|
-
url: 'https://api-sandbox.'
|
|
1047
|
-
}, {
|
|
1048
|
-
env: ENV.PROD,
|
|
1049
|
-
url: 'https://api.'
|
|
1050
|
-
}, {
|
|
1051
|
-
env: ENV.STAGING,
|
|
1052
|
-
url: 'https://apista.'
|
|
1053
|
-
}, {
|
|
1054
|
-
env: ENV.STAGING_1,
|
|
1055
|
-
url: 'https://apista-1.'
|
|
1056
|
-
}, {
|
|
1057
|
-
env: ENV.STAGING_2,
|
|
1058
|
-
url: 'https://apista-2.'
|
|
1059
|
-
}, {
|
|
1060
|
-
env: ENV.STAGING_3,
|
|
1061
|
-
url: 'https://apista-3.'
|
|
1062
|
-
}, {
|
|
1063
|
-
env: ENV.STAGING_4,
|
|
1064
|
-
url: 'https://apista-4.'
|
|
1065
|
-
}, {
|
|
1066
|
-
env: ENV.STAGING_5,
|
|
1067
|
-
url: 'https://apista-5.'
|
|
1068
|
-
}, {
|
|
1069
|
-
env: ENV.STAGING_6,
|
|
1070
|
-
url: 'https://apista-6.'
|
|
1071
|
-
}, {
|
|
1072
|
-
env: ENV.STAGING_7,
|
|
1073
|
-
url: 'https://apista-7.'
|
|
1074
|
-
}, {
|
|
1075
|
-
env: ENV.STAGING_8,
|
|
1076
|
-
url: 'https://apista-8.'
|
|
1077
|
-
}, {
|
|
1078
|
-
env: ENV.STAGING_9,
|
|
1079
|
-
url: 'https://apista-9.'
|
|
1080
|
-
}, {
|
|
1081
|
-
env: ENV.STAGING_10,
|
|
1082
|
-
url: 'https://apista-10.'
|
|
1083
|
-
}, {
|
|
1084
|
-
env: ENV.STAGING_11,
|
|
1085
|
-
url: 'https://apista-11.'
|
|
1086
|
-
}, {
|
|
1087
|
-
env: ENV.STAGING_12,
|
|
1088
|
-
url: 'https://apista-12.'
|
|
1089
|
-
}, {
|
|
1090
|
-
env: ENV.STAGING_13,
|
|
1091
|
-
url: 'https://apista-13.'
|
|
1092
|
-
}, {
|
|
1093
|
-
env: ENV.STAGING_14,
|
|
1094
|
-
url: 'https://apista-14.'
|
|
1095
|
-
}, {
|
|
1096
|
-
env: ENV.STAGING_15,
|
|
1097
|
-
url: 'https://apista-15.'
|
|
1098
|
-
}];
|
|
1099
|
-
var ADDITIONAL_ENV = [ENV.SANDBOX_KOVENA, ENV.SANDBOX_DEMO_KOVENA];
|
|
1100
|
-
var REGEX_ALIAS = '^([a-zA-Z0-9](?:(?:[a-zA-Z0-9-.]*(?!-)\\.(?![-.]))*[a-zA-Z0-9]+)?)$';
|
|
1101
|
-
var DEFAULT_ENV = ENV.SANDBOX;
|
|
1102
|
-
var DEFAULT_ALIAS = {
|
|
1103
|
-
PAYDOCK: 'paydock.com',
|
|
1104
|
-
KOVENA: 'kovena.com'
|
|
1105
|
-
};
|
|
1106
|
-
// TODO @ingeniousraccoons we should take advantage of TypeScript mechanism for static environmentId checking and simplified runtime validation
|
|
1107
|
-
// TODO @ingeniousraccoons unify `environment.paydock.ts` and `environment.cba.ts` making them configuration driven
|
|
1108
|
-
var Env = /*#__PURE__*/function () {
|
|
1109
|
-
function Env(configs) {
|
|
1110
|
-
var defaultEnv = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_ENV;
|
|
1111
|
-
_classCallCheck(this, Env);
|
|
1112
|
-
this.environmentConfigurations = configs;
|
|
1113
|
-
this.setEnv(defaultEnv);
|
|
1114
|
-
}
|
|
1115
|
-
return _createClass(Env, [{
|
|
1116
|
-
key: "setEnv",
|
|
1117
|
-
value: function setEnv(environmentId, alias) {
|
|
1118
|
-
this.validateAlias(alias);
|
|
1119
|
-
this.validateEnvironmentId(environmentId);
|
|
1120
|
-
this.environmentId = environmentId;
|
|
1121
|
-
if (alias) {
|
|
1122
|
-
this.alias = alias;
|
|
1123
|
-
} else if (ADDITIONAL_ENV.includes(this.environmentId)) {
|
|
1124
|
-
this.alias = DEFAULT_ALIAS.KOVENA;
|
|
1125
|
-
} else {
|
|
1126
|
-
this.alias = DEFAULT_ALIAS.PAYDOCK;
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
}, {
|
|
1130
|
-
key: "getEnv",
|
|
1131
|
-
value: function getEnv() {
|
|
1132
|
-
return this.environmentId;
|
|
1133
|
-
}
|
|
1134
|
-
}, {
|
|
1135
|
-
key: "getConf",
|
|
1136
|
-
value: function getConf() {
|
|
1137
|
-
for (var index in this.environmentConfigurations) {
|
|
1138
|
-
if (!Object.hasOwn(this.environmentConfigurations, index)) {
|
|
1139
|
-
continue;
|
|
1140
|
-
}
|
|
1141
|
-
if (this.environmentConfigurations[index].env === this.getEnv()) {
|
|
1142
|
-
return {
|
|
1143
|
-
url: this.environmentConfigurations[index].url.indexOf('localhost') !== -1 ? this.environmentConfigurations[index].url : this.environmentConfigurations[index].url + this.alias,
|
|
1144
|
-
env: this.environmentConfigurations[index].env
|
|
1145
|
-
};
|
|
1146
|
-
}
|
|
1147
|
-
}
|
|
1148
|
-
throw new Error('Env could not obtain configuration. Unknown environmentId.');
|
|
1149
|
-
}
|
|
1150
|
-
}, {
|
|
1151
|
-
key: "validateAlias",
|
|
1152
|
-
value: function validateAlias(alias) {
|
|
1153
|
-
if (typeof alias === 'undefined') {
|
|
1154
|
-
return;
|
|
1155
|
-
}
|
|
1156
|
-
if (typeof alias !== 'string') {
|
|
1157
|
-
throw new TypeError("Env expects parameter 'alias' to be of type 'string' or 'undefined'.");
|
|
1158
|
-
}
|
|
1159
|
-
if (!alias.match(REGEX_ALIAS)) {
|
|
1160
|
-
throw new Error("Env received malformed alias: ".concat(alias, ". Ensure it satisfies the regex: '").concat(REGEX_ALIAS, "'."));
|
|
1161
|
-
}
|
|
1162
|
-
}
|
|
1163
|
-
}, {
|
|
1164
|
-
key: "validateEnvironmentId",
|
|
1165
|
-
value: function validateEnvironmentId(environmentId) {
|
|
1166
|
-
for (var index in this.environmentConfigurations) {
|
|
1167
|
-
if (!Object.hasOwn(this.environmentConfigurations, index)) {
|
|
1168
|
-
continue;
|
|
1169
|
-
}
|
|
1170
|
-
if (this.environmentConfigurations[index].env === environmentId) {
|
|
1171
|
-
return;
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
throw new TypeError("Env received unknown environmentId: ".concat(environmentId));
|
|
1175
|
-
}
|
|
1176
|
-
}]);
|
|
1177
|
-
}();
|
|
1178
|
-
|
|
1179
|
-
var SDK = /*#__PURE__*/function () {
|
|
1180
|
-
function SDK() {
|
|
1181
|
-
_classCallCheck(this, SDK);
|
|
1182
|
-
}
|
|
1183
|
-
return _createClass(SDK, null, [{
|
|
1184
|
-
key: "version",
|
|
1185
|
-
get: function get() {
|
|
1186
|
-
return SDK._version.trim() || null;
|
|
1187
|
-
}
|
|
1188
|
-
}]);
|
|
1189
|
-
}();
|
|
1190
|
-
SDK.type = 'client';
|
|
1191
|
-
SDK.headerKeys = Object.freeze({
|
|
1192
|
-
version: 'x-sdk-version',
|
|
1193
|
-
type: 'x-sdk-type'
|
|
1194
|
-
});
|
|
1195
|
-
SDK._version = 'v1.144.0-beta';
|
|
1196
|
-
|
|
1197
957
|
function isFunction(value) {
|
|
1198
958
|
return typeof value === 'function';
|
|
1199
959
|
}
|
|
@@ -1851,23 +1611,263 @@ var BehaviorSubject = (function (_super) {
|
|
|
1851
1611
|
return BehaviorSubject;
|
|
1852
1612
|
}(Subject));
|
|
1853
1613
|
|
|
1854
|
-
var
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1614
|
+
var ENV = {
|
|
1615
|
+
SANDBOX: 'sandbox',
|
|
1616
|
+
SANDBOX_KOVENA: 'sandbox-kovena',
|
|
1617
|
+
SANDBOX_DEMO: 'sandbox-demo',
|
|
1618
|
+
SANDBOX_DEMO_KOVENA: 'sandbox-demo-kovena',
|
|
1619
|
+
PROD: 'production',
|
|
1620
|
+
STAGING: 'staging',
|
|
1621
|
+
STAGING_1: 'staging_1',
|
|
1622
|
+
STAGING_2: 'staging_2',
|
|
1623
|
+
STAGING_3: 'staging_3',
|
|
1624
|
+
STAGING_4: 'staging_4',
|
|
1625
|
+
STAGING_5: 'staging_5',
|
|
1626
|
+
STAGING_6: 'staging_6',
|
|
1627
|
+
STAGING_7: 'staging_7',
|
|
1628
|
+
STAGING_8: 'staging_8',
|
|
1629
|
+
STAGING_9: 'staging_9',
|
|
1630
|
+
STAGING_10: 'staging_10',
|
|
1631
|
+
STAGING_11: 'staging_11',
|
|
1632
|
+
STAGING_12: 'staging_12',
|
|
1633
|
+
STAGING_13: 'staging_13',
|
|
1634
|
+
STAGING_14: 'staging_14',
|
|
1635
|
+
STAGING_15: 'staging_15'
|
|
1636
|
+
};
|
|
1637
|
+
var WIDGET_URL = [{
|
|
1638
|
+
env: ENV.SANDBOX,
|
|
1639
|
+
url: 'https://widget-sandbox.'
|
|
1640
|
+
}, {
|
|
1641
|
+
env: ENV.SANDBOX_KOVENA,
|
|
1642
|
+
url: 'https://widget-sandbox.'
|
|
1643
|
+
}, {
|
|
1644
|
+
env: ENV.SANDBOX_DEMO,
|
|
1645
|
+
url: 'https://widget-sandbox-demo.'
|
|
1646
|
+
}, {
|
|
1647
|
+
env: ENV.SANDBOX_DEMO_KOVENA,
|
|
1648
|
+
url: 'https://widget-sandbox-demo.'
|
|
1649
|
+
}, {
|
|
1650
|
+
env: ENV.PROD,
|
|
1651
|
+
url: 'https://widget.'
|
|
1652
|
+
}, {
|
|
1653
|
+
env: ENV.STAGING,
|
|
1654
|
+
url: 'https://widsta.'
|
|
1655
|
+
}, {
|
|
1656
|
+
env: ENV.STAGING_1,
|
|
1657
|
+
url: 'https://widsta-1.'
|
|
1658
|
+
}, {
|
|
1659
|
+
env: ENV.STAGING_2,
|
|
1660
|
+
url: 'https://widsta-2.'
|
|
1661
|
+
}, {
|
|
1662
|
+
env: ENV.STAGING_3,
|
|
1663
|
+
url: 'https://widsta-3.'
|
|
1664
|
+
}, {
|
|
1665
|
+
env: ENV.STAGING_4,
|
|
1666
|
+
url: 'https://widsta-4.'
|
|
1667
|
+
}, {
|
|
1668
|
+
env: ENV.STAGING_5,
|
|
1669
|
+
url: 'https://widsta-5.'
|
|
1670
|
+
}, {
|
|
1671
|
+
env: ENV.STAGING_6,
|
|
1672
|
+
url: 'https://widsta-6.'
|
|
1673
|
+
}, {
|
|
1674
|
+
env: ENV.STAGING_7,
|
|
1675
|
+
url: 'https://widsta-7.'
|
|
1676
|
+
}, {
|
|
1677
|
+
env: ENV.STAGING_8,
|
|
1678
|
+
url: 'https://widsta-8.'
|
|
1679
|
+
}, {
|
|
1680
|
+
env: ENV.STAGING_9,
|
|
1681
|
+
url: 'https://widsta-9.'
|
|
1682
|
+
}, {
|
|
1683
|
+
env: ENV.STAGING_10,
|
|
1684
|
+
url: 'https://widsta-10.'
|
|
1685
|
+
}, {
|
|
1686
|
+
env: ENV.STAGING_11,
|
|
1687
|
+
url: 'https://widsta-11.'
|
|
1688
|
+
}, {
|
|
1689
|
+
env: ENV.STAGING_12,
|
|
1690
|
+
url: 'https://widsta-12.'
|
|
1691
|
+
}, {
|
|
1692
|
+
env: ENV.STAGING_13,
|
|
1693
|
+
url: 'https://widsta-13.'
|
|
1694
|
+
}, {
|
|
1695
|
+
env: ENV.STAGING_14,
|
|
1696
|
+
url: 'https://widsta-14.'
|
|
1697
|
+
}, {
|
|
1698
|
+
env: ENV.STAGING_15,
|
|
1699
|
+
url: 'https://widsta-15.'
|
|
1700
|
+
}];
|
|
1701
|
+
var API_URL = [{
|
|
1702
|
+
env: ENV.SANDBOX,
|
|
1703
|
+
url: 'https://api-sandbox.'
|
|
1704
|
+
}, {
|
|
1705
|
+
env: ENV.PROD,
|
|
1706
|
+
url: 'https://api.'
|
|
1707
|
+
}, {
|
|
1708
|
+
env: ENV.STAGING,
|
|
1709
|
+
url: 'https://apista.'
|
|
1710
|
+
}, {
|
|
1711
|
+
env: ENV.STAGING_1,
|
|
1712
|
+
url: 'https://apista-1.'
|
|
1713
|
+
}, {
|
|
1714
|
+
env: ENV.STAGING_2,
|
|
1715
|
+
url: 'https://apista-2.'
|
|
1716
|
+
}, {
|
|
1717
|
+
env: ENV.STAGING_3,
|
|
1718
|
+
url: 'https://apista-3.'
|
|
1719
|
+
}, {
|
|
1720
|
+
env: ENV.STAGING_4,
|
|
1721
|
+
url: 'https://apista-4.'
|
|
1722
|
+
}, {
|
|
1723
|
+
env: ENV.STAGING_5,
|
|
1724
|
+
url: 'https://apista-5.'
|
|
1725
|
+
}, {
|
|
1726
|
+
env: ENV.STAGING_6,
|
|
1727
|
+
url: 'https://apista-6.'
|
|
1728
|
+
}, {
|
|
1729
|
+
env: ENV.STAGING_7,
|
|
1730
|
+
url: 'https://apista-7.'
|
|
1731
|
+
}, {
|
|
1732
|
+
env: ENV.STAGING_8,
|
|
1733
|
+
url: 'https://apista-8.'
|
|
1734
|
+
}, {
|
|
1735
|
+
env: ENV.STAGING_9,
|
|
1736
|
+
url: 'https://apista-9.'
|
|
1737
|
+
}, {
|
|
1738
|
+
env: ENV.STAGING_10,
|
|
1739
|
+
url: 'https://apista-10.'
|
|
1740
|
+
}, {
|
|
1741
|
+
env: ENV.STAGING_11,
|
|
1742
|
+
url: 'https://apista-11.'
|
|
1743
|
+
}, {
|
|
1744
|
+
env: ENV.STAGING_12,
|
|
1745
|
+
url: 'https://apista-12.'
|
|
1746
|
+
}, {
|
|
1747
|
+
env: ENV.STAGING_13,
|
|
1748
|
+
url: 'https://apista-13.'
|
|
1749
|
+
}, {
|
|
1750
|
+
env: ENV.STAGING_14,
|
|
1751
|
+
url: 'https://apista-14.'
|
|
1752
|
+
}, {
|
|
1753
|
+
env: ENV.STAGING_15,
|
|
1754
|
+
url: 'https://apista-15.'
|
|
1755
|
+
}];
|
|
1756
|
+
var ADDITIONAL_ENV = [ENV.SANDBOX_KOVENA, ENV.SANDBOX_DEMO_KOVENA];
|
|
1757
|
+
var REGEX_ALIAS = '^([a-zA-Z0-9](?:(?:[a-zA-Z0-9-.]*(?!-)\\.(?![-.]))*[a-zA-Z0-9]+)?)$';
|
|
1758
|
+
var DEFAULT_ENV = ENV.SANDBOX;
|
|
1759
|
+
var DEFAULT_ALIAS = {
|
|
1760
|
+
PAYDOCK: 'paydock.com',
|
|
1761
|
+
KOVENA: 'kovena.com'
|
|
1762
|
+
};
|
|
1763
|
+
// TODO @ingeniousraccoons we should take advantage of TypeScript mechanism for static environmentId checking and simplified runtime validation
|
|
1764
|
+
// TODO @ingeniousraccoons unify `environment.paydock.ts` and `environment.cba.ts` making them configuration driven
|
|
1765
|
+
var Env = /*#__PURE__*/function () {
|
|
1766
|
+
function Env(configs) {
|
|
1767
|
+
var defaultEnv = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_ENV;
|
|
1768
|
+
_classCallCheck(this, Env);
|
|
1769
|
+
this.environmentConfigurations = configs;
|
|
1770
|
+
this.setEnv(defaultEnv);
|
|
1771
|
+
}
|
|
1772
|
+
return _createClass(Env, [{
|
|
1773
|
+
key: "setEnv",
|
|
1774
|
+
value: function setEnv(environmentId, alias) {
|
|
1775
|
+
this.validateAlias(alias);
|
|
1776
|
+
this.validateEnvironmentId(environmentId);
|
|
1777
|
+
this.environmentId = environmentId;
|
|
1778
|
+
if (alias) {
|
|
1779
|
+
this.alias = alias;
|
|
1780
|
+
} else if (ADDITIONAL_ENV.includes(this.environmentId)) {
|
|
1781
|
+
this.alias = DEFAULT_ALIAS.KOVENA;
|
|
1782
|
+
} else {
|
|
1783
|
+
this.alias = DEFAULT_ALIAS.PAYDOCK;
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
}, {
|
|
1787
|
+
key: "getEnv",
|
|
1788
|
+
value: function getEnv() {
|
|
1789
|
+
return this.environmentId;
|
|
1790
|
+
}
|
|
1791
|
+
}, {
|
|
1792
|
+
key: "getConf",
|
|
1793
|
+
value: function getConf() {
|
|
1794
|
+
for (var index in this.environmentConfigurations) {
|
|
1795
|
+
if (!Object.hasOwn(this.environmentConfigurations, index)) {
|
|
1796
|
+
continue;
|
|
1797
|
+
}
|
|
1798
|
+
if (this.environmentConfigurations[index].env === this.getEnv()) {
|
|
1799
|
+
return {
|
|
1800
|
+
url: this.environmentConfigurations[index].url.indexOf('localhost') !== -1 ? this.environmentConfigurations[index].url : this.environmentConfigurations[index].url + this.alias,
|
|
1801
|
+
env: this.environmentConfigurations[index].env
|
|
1802
|
+
};
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
throw new Error('Env could not obtain configuration. Unknown environmentId.');
|
|
1806
|
+
}
|
|
1807
|
+
}, {
|
|
1808
|
+
key: "validateAlias",
|
|
1809
|
+
value: function validateAlias(alias) {
|
|
1810
|
+
if (typeof alias === 'undefined') {
|
|
1811
|
+
return;
|
|
1812
|
+
}
|
|
1813
|
+
if (typeof alias !== 'string') {
|
|
1814
|
+
throw new TypeError("Env expects parameter 'alias' to be of type 'string' or 'undefined'.");
|
|
1815
|
+
}
|
|
1816
|
+
if (!alias.match(REGEX_ALIAS)) {
|
|
1817
|
+
throw new Error("Env received malformed alias: ".concat(alias, ". Ensure it satisfies the regex: '").concat(REGEX_ALIAS, "'."));
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
}, {
|
|
1821
|
+
key: "validateEnvironmentId",
|
|
1822
|
+
value: function validateEnvironmentId(environmentId) {
|
|
1823
|
+
for (var index in this.environmentConfigurations) {
|
|
1824
|
+
if (!Object.hasOwn(this.environmentConfigurations, index)) {
|
|
1825
|
+
continue;
|
|
1826
|
+
}
|
|
1827
|
+
if (this.environmentConfigurations[index].env === environmentId) {
|
|
1828
|
+
return;
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
throw new TypeError("Env received unknown environmentId: ".concat(environmentId));
|
|
1832
|
+
}
|
|
1833
|
+
}]);
|
|
1834
|
+
}();
|
|
1835
|
+
|
|
1836
|
+
var SDK = /*#__PURE__*/function () {
|
|
1837
|
+
function SDK() {
|
|
1838
|
+
_classCallCheck(this, SDK);
|
|
1839
|
+
}
|
|
1840
|
+
return _createClass(SDK, null, [{
|
|
1841
|
+
key: "version",
|
|
1842
|
+
get: function get() {
|
|
1843
|
+
return SDK._version.trim() || null;
|
|
1844
|
+
}
|
|
1845
|
+
}]);
|
|
1846
|
+
}();
|
|
1847
|
+
SDK.type = 'client';
|
|
1848
|
+
SDK.headerKeys = Object.freeze({
|
|
1849
|
+
version: 'x-sdk-version',
|
|
1850
|
+
type: 'x-sdk-type'
|
|
1851
|
+
});
|
|
1852
|
+
SDK._version = 'v1.144.1-beta';
|
|
1853
|
+
|
|
1854
|
+
var ACCESS_HEADER_NAME = {
|
|
1855
|
+
accessToken: 'x-access-token',
|
|
1856
|
+
publicKey: 'x-user-public-key'
|
|
1857
|
+
};
|
|
1858
|
+
var AccessToken = /*#__PURE__*/function () {
|
|
1859
|
+
function AccessToken() {
|
|
1860
|
+
_classCallCheck(this, AccessToken);
|
|
1861
|
+
}
|
|
1862
|
+
return _createClass(AccessToken, null, [{
|
|
1863
|
+
key: "validateJWT",
|
|
1864
|
+
value: function validateJWT(jwt) {
|
|
1865
|
+
if (!jwt) return null;
|
|
1866
|
+
var _jwt$split = jwt.split("."),
|
|
1867
|
+
_jwt$split2 = _slicedToArray(_jwt$split, 3),
|
|
1868
|
+
rawHead = _jwt$split2[0],
|
|
1869
|
+
rawBody = _jwt$split2[1],
|
|
1870
|
+
signature = _jwt$split2[2];
|
|
1871
1871
|
if (!rawHead || !rawBody || !signature) return null;
|
|
1872
1872
|
if (2 + rawHead.length + rawBody.length + signature.length !== jwt.length) return null;
|
|
1873
1873
|
try {
|
|
@@ -1914,32 +1914,165 @@ var AccessToken = /*#__PURE__*/function () {
|
|
|
1914
1914
|
}
|
|
1915
1915
|
}
|
|
1916
1916
|
}, {
|
|
1917
|
-
key: "validateJWTWhitelistedDomains",
|
|
1918
|
-
value: function validateJWTWhitelistedDomains(body) {
|
|
1919
|
-
var _a;
|
|
1920
|
-
try {
|
|
1921
|
-
if (!body.meta) return true;
|
|
1922
|
-
var meta = this.extractData(body);
|
|
1923
|
-
if (!meta) return true;
|
|
1924
|
-
if (!((_a = meta.whitelist_domains) === null || _a === void 0 ? void 0 : _a.length)) return true;
|
|
1925
|
-
return meta.whitelist_domains.includes(window.location.hostname);
|
|
1926
|
-
} catch (err) {
|
|
1927
|
-
return true;
|
|
1928
|
-
}
|
|
1917
|
+
key: "validateJWTWhitelistedDomains",
|
|
1918
|
+
value: function validateJWTWhitelistedDomains(body) {
|
|
1919
|
+
var _a;
|
|
1920
|
+
try {
|
|
1921
|
+
if (!body.meta) return true;
|
|
1922
|
+
var meta = this.extractData(body);
|
|
1923
|
+
if (!meta) return true;
|
|
1924
|
+
if (!((_a = meta.whitelist_domains) === null || _a === void 0 ? void 0 : _a.length)) return true;
|
|
1925
|
+
return meta.whitelist_domains.includes(window.location.hostname);
|
|
1926
|
+
} catch (err) {
|
|
1927
|
+
return true;
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
}, {
|
|
1931
|
+
key: "getAccessHeaderNameByToken",
|
|
1932
|
+
value: function getAccessHeaderNameByToken(token) {
|
|
1933
|
+
return !!AccessToken.validateJWT(token) ? ACCESS_HEADER_NAME.accessToken : ACCESS_HEADER_NAME.publicKey;
|
|
1934
|
+
}
|
|
1935
|
+
}, {
|
|
1936
|
+
key: "isJwt",
|
|
1937
|
+
value: function isJwt(value) {
|
|
1938
|
+
var jwtPattern = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
|
|
1939
|
+
return jwtPattern.test(value);
|
|
1940
|
+
}
|
|
1941
|
+
}]);
|
|
1942
|
+
}();
|
|
1943
|
+
|
|
1944
|
+
/**
|
|
1945
|
+
* Top-level classification of an error. Used by the SDK to route errors to the
|
|
1946
|
+
* right category in instrumentation and to give consumers a coarse-grained
|
|
1947
|
+
* tag for grouping/filtering. See {@link getErrorCategory} for the mapping
|
|
1948
|
+
* between {@link ERROR_CAUSE} and {@link ERROR_CATEGORY}.
|
|
1949
|
+
*/
|
|
1950
|
+
var ERROR_CATEGORY = {
|
|
1951
|
+
/** SDK was misconfigured (missing keys, invalid options, etc.). */
|
|
1952
|
+
CONFIGURATION: 'configuration',
|
|
1953
|
+
/** Authentication or authorization failure. */
|
|
1954
|
+
IDENTITY: 'identity_access_management',
|
|
1955
|
+
/** SDK internal failure or upstream service problem. */
|
|
1956
|
+
INTERNAL: 'internal',
|
|
1957
|
+
/** Flow lifecycle event (user cancelled, aborted, etc.) — not a real fault. */
|
|
1958
|
+
PROCESS: 'process',
|
|
1959
|
+
/** Resource lookup failed or was rate-limited. */
|
|
1960
|
+
RESOURCE: 'resource',
|
|
1961
|
+
/** Invalid input or business-rule validation failure. */
|
|
1962
|
+
VALIDATION: 'validation'
|
|
1963
|
+
};
|
|
1964
|
+
/**
|
|
1965
|
+
* Concrete cause of an error. More specific than {@link ERROR_CATEGORY} —
|
|
1966
|
+
* useful for deciding programmatic responses (e.g. show a retry button only
|
|
1967
|
+
* when `cause` is `'service_unreachable'` or `'server_busy'`).
|
|
1968
|
+
*/
|
|
1969
|
+
var ERROR_CAUSE = {
|
|
1970
|
+
/** Operation was aborted programmatically. */
|
|
1971
|
+
ABORTED: 'aborted',
|
|
1972
|
+
/** Caller has insufficient permissions for the operation. */
|
|
1973
|
+
ACCESS_FORBIDDEN: 'access_forbidden',
|
|
1974
|
+
/** Resource already exists when create was expected. */
|
|
1975
|
+
ALREADY_EXISTS: 'already_exists',
|
|
1976
|
+
/** User cancelled the flow (e.g. closed the wallet sheet). */
|
|
1977
|
+
CANCELED: 'canceled',
|
|
1978
|
+
/** SDK was instantiated or invoked with invalid configuration. */
|
|
1979
|
+
INVALID_CONFIGURATION: 'invalid_configuration',
|
|
1980
|
+
/** Input failed structural or business-rule validation. */
|
|
1981
|
+
INVALID_INPUT: 'invalid_input',
|
|
1982
|
+
/** Resource was not found by the backend. */
|
|
1983
|
+
NOT_FOUND: 'not_found',
|
|
1984
|
+
/** Operation is not supported in the current context or version. */
|
|
1985
|
+
NOT_IMPLEMENTED: 'not_implemented',
|
|
1986
|
+
/** Caller exceeded the allowed request rate. */
|
|
1987
|
+
RATE_LIMITED: 'rate_limited',
|
|
1988
|
+
/** Backend is healthy but currently overloaded — typically retryable. */
|
|
1989
|
+
SERVER_BUSY: 'server_busy',
|
|
1990
|
+
/** Backend or third-party service could not be reached — typically retryable. */
|
|
1991
|
+
SERVICE_UNREACHABLE: 'service_unreachable',
|
|
1992
|
+
/** Caller is not authenticated. */
|
|
1993
|
+
UNAUTHORIZED: 'unauthorized',
|
|
1994
|
+
/** Catch-all when no other cause applies. */
|
|
1995
|
+
UNKNOWN: 'unknown_error',
|
|
1996
|
+
/** Request was syntactically valid but semantically rejected. */
|
|
1997
|
+
UNPROCESSABLE_ENTITY: 'unprocessable_entity'
|
|
1998
|
+
};
|
|
1999
|
+
var EventError = /*#__PURE__*/function (_Error) {
|
|
2000
|
+
function EventError(cause, category, retryable, details) {
|
|
2001
|
+
var _this;
|
|
2002
|
+
_classCallCheck(this, EventError);
|
|
2003
|
+
_this = _callSuper(this, EventError, [details.message]);
|
|
2004
|
+
_this.cause = cause;
|
|
2005
|
+
_this.category = category;
|
|
2006
|
+
_this.retryable = retryable;
|
|
2007
|
+
_this.details = details;
|
|
2008
|
+
Object.setPrototypeOf(_this, EventError.prototype);
|
|
2009
|
+
_this.name = EventError.name;
|
|
2010
|
+
return _this;
|
|
2011
|
+
}
|
|
2012
|
+
_inherits(EventError, _Error);
|
|
2013
|
+
return _createClass(EventError, [{
|
|
2014
|
+
key: "toJSON",
|
|
2015
|
+
value: function toJSON() {
|
|
2016
|
+
return {
|
|
2017
|
+
error: {
|
|
2018
|
+
category: this.category,
|
|
2019
|
+
cause: this.cause,
|
|
2020
|
+
details: this.details,
|
|
2021
|
+
retryable: this.retryable
|
|
2022
|
+
}
|
|
2023
|
+
};
|
|
2024
|
+
}
|
|
2025
|
+
}, {
|
|
2026
|
+
key: "setContextId",
|
|
2027
|
+
value: function setContextId(contextId) {
|
|
2028
|
+
this.details.contextId = contextId;
|
|
1929
2029
|
}
|
|
1930
2030
|
}, {
|
|
1931
|
-
key: "
|
|
1932
|
-
value: function
|
|
1933
|
-
|
|
2031
|
+
key: "setPurpose",
|
|
2032
|
+
value: function setPurpose(purpose) {
|
|
2033
|
+
this.purpose = purpose;
|
|
1934
2034
|
}
|
|
1935
|
-
}, {
|
|
1936
|
-
key: "
|
|
1937
|
-
value: function
|
|
1938
|
-
var
|
|
1939
|
-
|
|
2035
|
+
}], [{
|
|
2036
|
+
key: "create",
|
|
2037
|
+
value: function create(cause, message) {
|
|
2038
|
+
var contextId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
2039
|
+
var retryable = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
2040
|
+
var details = {
|
|
2041
|
+
cause: cause,
|
|
2042
|
+
contextId: contextId,
|
|
2043
|
+
message: message,
|
|
2044
|
+
timestamp: new Date().toISOString()
|
|
2045
|
+
};
|
|
2046
|
+
var category = getErrorCategory(cause);
|
|
2047
|
+
return new EventError(cause, category, retryable, details);
|
|
1940
2048
|
}
|
|
1941
2049
|
}]);
|
|
1942
|
-
}();
|
|
2050
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
2051
|
+
function getErrorCategory(cause) {
|
|
2052
|
+
switch (cause) {
|
|
2053
|
+
case ERROR_CAUSE.INVALID_CONFIGURATION:
|
|
2054
|
+
return ERROR_CATEGORY.CONFIGURATION;
|
|
2055
|
+
case ERROR_CAUSE.ACCESS_FORBIDDEN:
|
|
2056
|
+
case ERROR_CAUSE.UNAUTHORIZED:
|
|
2057
|
+
return ERROR_CATEGORY.IDENTITY;
|
|
2058
|
+
case ERROR_CAUSE.SERVICE_UNREACHABLE:
|
|
2059
|
+
case ERROR_CAUSE.NOT_IMPLEMENTED:
|
|
2060
|
+
case ERROR_CAUSE.SERVER_BUSY:
|
|
2061
|
+
return ERROR_CATEGORY.INTERNAL;
|
|
2062
|
+
case ERROR_CAUSE.ABORTED:
|
|
2063
|
+
case ERROR_CAUSE.CANCELED:
|
|
2064
|
+
return ERROR_CATEGORY.PROCESS;
|
|
2065
|
+
case ERROR_CAUSE.NOT_FOUND:
|
|
2066
|
+
case ERROR_CAUSE.RATE_LIMITED:
|
|
2067
|
+
return ERROR_CATEGORY.RESOURCE;
|
|
2068
|
+
case ERROR_CAUSE.ALREADY_EXISTS:
|
|
2069
|
+
case ERROR_CAUSE.INVALID_INPUT:
|
|
2070
|
+
case ERROR_CAUSE.UNPROCESSABLE_ENTITY:
|
|
2071
|
+
return ERROR_CATEGORY.VALIDATION;
|
|
2072
|
+
default:
|
|
2073
|
+
return ERROR_CATEGORY.INTERNAL;
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
1943
2076
|
|
|
1944
2077
|
var HttpRequest = /*#__PURE__*/function () {
|
|
1945
2078
|
function HttpRequest(request) {
|
|
@@ -4635,18 +4768,23 @@ var ApiBase = /*#__PURE__*/function () {
|
|
|
4635
4768
|
var errorCb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (data) {
|
|
4636
4769
|
return undefined;
|
|
4637
4770
|
};
|
|
4771
|
+
var onError = function onError(err) {
|
|
4772
|
+
_this4.reportError(errorRepository, err, _extends(_extends({}, _this4.ctx), {
|
|
4773
|
+
classMethod: 'getClient',
|
|
4774
|
+
description: 'Send unsuccessful.'
|
|
4775
|
+
}));
|
|
4776
|
+
errorCb(err);
|
|
4777
|
+
};
|
|
4638
4778
|
request.onload = function () {
|
|
4639
4779
|
return _this4.parser({
|
|
4640
4780
|
text: request.responseText,
|
|
4641
4781
|
status: request.status
|
|
4642
|
-
}, cb,
|
|
4643
|
-
_this4.reportError(errorRepository, err, _extends(_extends({}, _this4.ctx), {
|
|
4644
|
-
classMethod: 'getClient',
|
|
4645
|
-
description: 'Send unsuccessful.'
|
|
4646
|
-
}));
|
|
4647
|
-
errorCb(err);
|
|
4648
|
-
});
|
|
4782
|
+
}, cb, onError);
|
|
4649
4783
|
};
|
|
4784
|
+
// Transport-level failures (dropped connection, failed CORS
|
|
4785
|
+
// preflight, HTTP/2 protocol error, timeout) never fire `onload`,
|
|
4786
|
+
// so without these handlers the request would fail silently.
|
|
4787
|
+
_this4.attachFailureHandlers(request, onError);
|
|
4650
4788
|
request.send(JSON.stringify(body));
|
|
4651
4789
|
}
|
|
4652
4790
|
};
|
|
@@ -4659,13 +4797,18 @@ var ApiBase = /*#__PURE__*/function () {
|
|
|
4659
4797
|
return {
|
|
4660
4798
|
config: request,
|
|
4661
4799
|
send: function send(body) {
|
|
4662
|
-
return new Promise(function (resolve,
|
|
4800
|
+
return new Promise(function (resolve, reject) {
|
|
4663
4801
|
request.onload = function () {
|
|
4664
4802
|
return resolve({
|
|
4665
4803
|
text: request.responseText,
|
|
4666
4804
|
status: request.status
|
|
4667
4805
|
});
|
|
4668
4806
|
};
|
|
4807
|
+
// Transport-level failures (dropped connection, failed CORS
|
|
4808
|
+
// preflight, HTTP/2 protocol error, timeout) never fire
|
|
4809
|
+
// `onload`, so without these handlers the promise would never
|
|
4810
|
+
// settle and the caller would hang silently.
|
|
4811
|
+
_this5.attachFailureHandlers(request, reject);
|
|
4669
4812
|
request.send(JSON.stringify(body));
|
|
4670
4813
|
}).then(function (value) {
|
|
4671
4814
|
return _this5.parserPromise(value);
|
|
@@ -4717,6 +4860,36 @@ var ApiBase = /*#__PURE__*/function () {
|
|
|
4717
4860
|
return Promise.reject(err);
|
|
4718
4861
|
}
|
|
4719
4862
|
}
|
|
4863
|
+
/**
|
|
4864
|
+
* Wires the XHR failure events that `onload` does not cover. `onload` only
|
|
4865
|
+
* fires when an HTTP response is received (any status, including 4xx/5xx);
|
|
4866
|
+
* transport-level failures — a dropped connection, a failed CORS preflight,
|
|
4867
|
+
* an HTTP/2 protocol error, or a timeout — fire `onerror`/`ontimeout`/
|
|
4868
|
+
* `onabort` instead. Without these the request never settles and fails
|
|
4869
|
+
* silently (e.g. `onUnavailable` is never invoked for wallet callbacks).
|
|
4870
|
+
*/
|
|
4871
|
+
}, {
|
|
4872
|
+
key: "attachFailureHandlers",
|
|
4873
|
+
value: function attachFailureHandlers(request, onFailure) {
|
|
4874
|
+
request.onerror = function () {
|
|
4875
|
+
return onFailure({
|
|
4876
|
+
message: 'Network request failed: the service could not be reached.',
|
|
4877
|
+
code: ERROR_CAUSE.SERVICE_UNREACHABLE
|
|
4878
|
+
});
|
|
4879
|
+
};
|
|
4880
|
+
request.ontimeout = function () {
|
|
4881
|
+
return onFailure({
|
|
4882
|
+
message: 'Network request timed out: the service could not be reached.',
|
|
4883
|
+
code: ERROR_CAUSE.SERVICE_UNREACHABLE
|
|
4884
|
+
});
|
|
4885
|
+
};
|
|
4886
|
+
request.onabort = function () {
|
|
4887
|
+
return onFailure({
|
|
4888
|
+
message: 'Network request was aborted.',
|
|
4889
|
+
code: ERROR_CAUSE.ABORTED
|
|
4890
|
+
});
|
|
4891
|
+
};
|
|
4892
|
+
}
|
|
4720
4893
|
}, {
|
|
4721
4894
|
key: "newApiRequest",
|
|
4722
4895
|
value: function newApiRequest(method, link) {
|
|
@@ -12865,139 +13038,6 @@ function getHandleCvv(configuration) {
|
|
|
12865
13038
|
}
|
|
12866
13039
|
}
|
|
12867
13040
|
|
|
12868
|
-
/**
|
|
12869
|
-
* Top-level classification of an error. Used by the SDK to route errors to the
|
|
12870
|
-
* right category in instrumentation and to give consumers a coarse-grained
|
|
12871
|
-
* tag for grouping/filtering. See {@link getErrorCategory} for the mapping
|
|
12872
|
-
* between {@link ERROR_CAUSE} and {@link ERROR_CATEGORY}.
|
|
12873
|
-
*/
|
|
12874
|
-
var ERROR_CATEGORY = {
|
|
12875
|
-
/** SDK was misconfigured (missing keys, invalid options, etc.). */
|
|
12876
|
-
CONFIGURATION: 'configuration',
|
|
12877
|
-
/** Authentication or authorization failure. */
|
|
12878
|
-
IDENTITY: 'identity_access_management',
|
|
12879
|
-
/** SDK internal failure or upstream service problem. */
|
|
12880
|
-
INTERNAL: 'internal',
|
|
12881
|
-
/** Flow lifecycle event (user cancelled, aborted, etc.) — not a real fault. */
|
|
12882
|
-
PROCESS: 'process',
|
|
12883
|
-
/** Resource lookup failed or was rate-limited. */
|
|
12884
|
-
RESOURCE: 'resource',
|
|
12885
|
-
/** Invalid input or business-rule validation failure. */
|
|
12886
|
-
VALIDATION: 'validation'
|
|
12887
|
-
};
|
|
12888
|
-
/**
|
|
12889
|
-
* Concrete cause of an error. More specific than {@link ERROR_CATEGORY} —
|
|
12890
|
-
* useful for deciding programmatic responses (e.g. show a retry button only
|
|
12891
|
-
* when `cause` is `'service_unreachable'` or `'server_busy'`).
|
|
12892
|
-
*/
|
|
12893
|
-
var ERROR_CAUSE = {
|
|
12894
|
-
/** Operation was aborted programmatically. */
|
|
12895
|
-
ABORTED: 'aborted',
|
|
12896
|
-
/** Caller has insufficient permissions for the operation. */
|
|
12897
|
-
ACCESS_FORBIDDEN: 'access_forbidden',
|
|
12898
|
-
/** Resource already exists when create was expected. */
|
|
12899
|
-
ALREADY_EXISTS: 'already_exists',
|
|
12900
|
-
/** User cancelled the flow (e.g. closed the wallet sheet). */
|
|
12901
|
-
CANCELED: 'canceled',
|
|
12902
|
-
/** SDK was instantiated or invoked with invalid configuration. */
|
|
12903
|
-
INVALID_CONFIGURATION: 'invalid_configuration',
|
|
12904
|
-
/** Input failed structural or business-rule validation. */
|
|
12905
|
-
INVALID_INPUT: 'invalid_input',
|
|
12906
|
-
/** Resource was not found by the backend. */
|
|
12907
|
-
NOT_FOUND: 'not_found',
|
|
12908
|
-
/** Operation is not supported in the current context or version. */
|
|
12909
|
-
NOT_IMPLEMENTED: 'not_implemented',
|
|
12910
|
-
/** Caller exceeded the allowed request rate. */
|
|
12911
|
-
RATE_LIMITED: 'rate_limited',
|
|
12912
|
-
/** Backend is healthy but currently overloaded — typically retryable. */
|
|
12913
|
-
SERVER_BUSY: 'server_busy',
|
|
12914
|
-
/** Backend or third-party service could not be reached — typically retryable. */
|
|
12915
|
-
SERVICE_UNREACHABLE: 'service_unreachable',
|
|
12916
|
-
/** Caller is not authenticated. */
|
|
12917
|
-
UNAUTHORIZED: 'unauthorized',
|
|
12918
|
-
/** Catch-all when no other cause applies. */
|
|
12919
|
-
UNKNOWN: 'unknown_error',
|
|
12920
|
-
/** Request was syntactically valid but semantically rejected. */
|
|
12921
|
-
UNPROCESSABLE_ENTITY: 'unprocessable_entity'
|
|
12922
|
-
};
|
|
12923
|
-
var EventError = /*#__PURE__*/function (_Error) {
|
|
12924
|
-
function EventError(cause, category, retryable, details) {
|
|
12925
|
-
var _this;
|
|
12926
|
-
_classCallCheck(this, EventError);
|
|
12927
|
-
_this = _callSuper(this, EventError, [details.message]);
|
|
12928
|
-
_this.cause = cause;
|
|
12929
|
-
_this.category = category;
|
|
12930
|
-
_this.retryable = retryable;
|
|
12931
|
-
_this.details = details;
|
|
12932
|
-
Object.setPrototypeOf(_this, EventError.prototype);
|
|
12933
|
-
_this.name = EventError.name;
|
|
12934
|
-
return _this;
|
|
12935
|
-
}
|
|
12936
|
-
_inherits(EventError, _Error);
|
|
12937
|
-
return _createClass(EventError, [{
|
|
12938
|
-
key: "toJSON",
|
|
12939
|
-
value: function toJSON() {
|
|
12940
|
-
return {
|
|
12941
|
-
error: {
|
|
12942
|
-
category: this.category,
|
|
12943
|
-
cause: this.cause,
|
|
12944
|
-
details: this.details,
|
|
12945
|
-
retryable: this.retryable
|
|
12946
|
-
}
|
|
12947
|
-
};
|
|
12948
|
-
}
|
|
12949
|
-
}, {
|
|
12950
|
-
key: "setContextId",
|
|
12951
|
-
value: function setContextId(contextId) {
|
|
12952
|
-
this.details.contextId = contextId;
|
|
12953
|
-
}
|
|
12954
|
-
}, {
|
|
12955
|
-
key: "setPurpose",
|
|
12956
|
-
value: function setPurpose(purpose) {
|
|
12957
|
-
this.purpose = purpose;
|
|
12958
|
-
}
|
|
12959
|
-
}], [{
|
|
12960
|
-
key: "create",
|
|
12961
|
-
value: function create(cause, message) {
|
|
12962
|
-
var contextId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
12963
|
-
var retryable = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
12964
|
-
var details = {
|
|
12965
|
-
cause: cause,
|
|
12966
|
-
contextId: contextId,
|
|
12967
|
-
message: message,
|
|
12968
|
-
timestamp: new Date().toISOString()
|
|
12969
|
-
};
|
|
12970
|
-
var category = getErrorCategory(cause);
|
|
12971
|
-
return new EventError(cause, category, retryable, details);
|
|
12972
|
-
}
|
|
12973
|
-
}]);
|
|
12974
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
12975
|
-
function getErrorCategory(cause) {
|
|
12976
|
-
switch (cause) {
|
|
12977
|
-
case ERROR_CAUSE.INVALID_CONFIGURATION:
|
|
12978
|
-
return ERROR_CATEGORY.CONFIGURATION;
|
|
12979
|
-
case ERROR_CAUSE.ACCESS_FORBIDDEN:
|
|
12980
|
-
case ERROR_CAUSE.UNAUTHORIZED:
|
|
12981
|
-
return ERROR_CATEGORY.IDENTITY;
|
|
12982
|
-
case ERROR_CAUSE.SERVICE_UNREACHABLE:
|
|
12983
|
-
case ERROR_CAUSE.NOT_IMPLEMENTED:
|
|
12984
|
-
case ERROR_CAUSE.SERVER_BUSY:
|
|
12985
|
-
return ERROR_CATEGORY.INTERNAL;
|
|
12986
|
-
case ERROR_CAUSE.ABORTED:
|
|
12987
|
-
case ERROR_CAUSE.CANCELED:
|
|
12988
|
-
return ERROR_CATEGORY.PROCESS;
|
|
12989
|
-
case ERROR_CAUSE.NOT_FOUND:
|
|
12990
|
-
case ERROR_CAUSE.RATE_LIMITED:
|
|
12991
|
-
return ERROR_CATEGORY.RESOURCE;
|
|
12992
|
-
case ERROR_CAUSE.ALREADY_EXISTS:
|
|
12993
|
-
case ERROR_CAUSE.INVALID_INPUT:
|
|
12994
|
-
case ERROR_CAUSE.UNPROCESSABLE_ENTITY:
|
|
12995
|
-
return ERROR_CATEGORY.VALIDATION;
|
|
12996
|
-
default:
|
|
12997
|
-
return ERROR_CATEGORY.INTERNAL;
|
|
12998
|
-
}
|
|
12999
|
-
}
|
|
13000
|
-
|
|
13001
13041
|
function processEventError(err) {
|
|
13002
13042
|
var cause;
|
|
13003
13043
|
var message;
|
|
@@ -22895,6 +22935,14 @@ var SRC = /*#__PURE__*/function () {
|
|
|
22895
22935
|
if (_this.provider) {
|
|
22896
22936
|
_this.provider.load();
|
|
22897
22937
|
}
|
|
22938
|
+
})["catch"](function (error) {
|
|
22939
|
+
var _a;
|
|
22940
|
+
// Surface config-load failures (including transport-level ones now
|
|
22941
|
+
// rejected by ApiBase) instead of leaving the widget hung silently.
|
|
22942
|
+
_this.eventEmitter.emit(EVENT$1.CHECKOUT_ERROR, {
|
|
22943
|
+
type: EVENT_DATA_TYPE.CRITICAL_ERROR,
|
|
22944
|
+
data: (_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : 'Failed to load Click to Pay configuration.'
|
|
22945
|
+
});
|
|
22898
22946
|
});
|
|
22899
22947
|
}
|
|
22900
22948
|
/**
|