@paydock/client-sdk 1.143.0 → 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.
Files changed (75) hide show
  1. package/README.md +158 -0
  2. package/bundles/index.cjs +920 -661
  3. package/bundles/index.cjs.d.ts +1046 -399
  4. package/bundles/index.mjs +915 -662
  5. package/bundles/index.mjs.d.ts +1046 -399
  6. package/bundles/types/api/api-base.d.ts +15 -2
  7. package/bundles/types/api/api-base.d.ts.map +1 -1
  8. package/bundles/types/api/api-charge-internal.d.ts +3 -49
  9. package/bundles/types/api/api-charge-internal.d.ts.map +1 -1
  10. package/bundles/types/api/api-checkout-internal.d.ts +1 -47
  11. package/bundles/types/api/api-checkout-internal.d.ts.map +1 -1
  12. package/bundles/types/api/api-shared-types.d.ts +53 -0
  13. package/bundles/types/api/api-shared-types.d.ts.map +1 -0
  14. package/bundles/types/canvas-3ds/canvas-3ds-event-map.d.ts +95 -0
  15. package/bundles/types/canvas-3ds/canvas-3ds-event-map.d.ts.map +1 -0
  16. package/bundles/types/canvas-3ds/canvas-3ds.d.ts +10 -7
  17. package/bundles/types/canvas-3ds/canvas-3ds.d.ts.map +1 -1
  18. package/bundles/types/canvas-3ds/index.d.ts +4 -0
  19. package/bundles/types/canvas-3ds/index.d.ts.map +1 -1
  20. package/bundles/types/canvas-3ds/services/gpayments-service.d.ts +41 -12
  21. package/bundles/types/canvas-3ds/services/gpayments-service.d.ts.map +1 -1
  22. package/bundles/types/canvas-3ds/services/standalone3ds-service.d.ts +20 -2
  23. package/bundles/types/canvas-3ds/services/standalone3ds-service.d.ts.map +1 -1
  24. package/bundles/types/checkout/checkout-event-map.d.ts +43 -0
  25. package/bundles/types/checkout/checkout-event-map.d.ts.map +1 -0
  26. package/bundles/types/checkout/checkout.d.ts +25 -9
  27. package/bundles/types/checkout/checkout.d.ts.map +1 -1
  28. package/bundles/types/checkout/v1/instructions/instruction.canvas_3ds.show.d.ts.map +1 -1
  29. package/bundles/types/checkout/v3/instructions/instruction.canvas_3ds.show.d.ts.map +1 -1
  30. package/bundles/types/components/param.d.ts +29 -0
  31. package/bundles/types/components/param.d.ts.map +1 -1
  32. package/bundles/types/helper/event-error.d.ts +49 -1
  33. package/bundles/types/helper/event-error.d.ts.map +1 -1
  34. package/bundles/types/index-cba.d.ts +3 -1
  35. package/bundles/types/index-cba.d.ts.map +1 -1
  36. package/bundles/types/index.d.ts +12 -1
  37. package/bundles/types/index.d.ts.map +1 -1
  38. package/bundles/types/open-wallets/base/open-wallet-buttons.d.ts +37 -0
  39. package/bundles/types/open-wallets/base/open-wallet-buttons.d.ts.map +1 -1
  40. package/bundles/types/open-wallets/base/open-wallet.service.d.ts +12 -0
  41. package/bundles/types/open-wallets/base/open-wallet.service.d.ts.map +1 -1
  42. package/bundles/types/open-wallets/google-pay-open-wallet-button.d.ts.map +1 -1
  43. package/bundles/types/open-wallets/index.d.ts +25 -0
  44. package/bundles/types/open-wallets/index.d.ts.map +1 -1
  45. package/bundles/types/open-wallets/interfaces/apple-pay/apple-pay-payment-request.interface.d.ts +2 -2
  46. package/bundles/types/open-wallets/interfaces/apple-pay/apple-pay-payment-request.interface.d.ts.map +1 -1
  47. package/bundles/types/open-wallets/interfaces/apple-pay/index.d.ts +1 -1
  48. package/bundles/types/open-wallets/interfaces/apple-pay/index.d.ts.map +1 -1
  49. package/bundles/types/open-wallets/interfaces/events.interface.d.ts +1 -1
  50. package/bundles/types/open-wallets/interfaces/events.interface.d.ts.map +1 -1
  51. package/bundles/types/open-wallets/interfaces/google-pay/google-pay-meta.interface.d.ts +46 -0
  52. package/bundles/types/open-wallets/interfaces/google-pay/google-pay-meta.interface.d.ts.map +1 -1
  53. package/bundles/types/open-wallets/services/apple-pay/apple-pay.open-wallet.service.d.ts +48 -2
  54. package/bundles/types/open-wallets/services/apple-pay/apple-pay.open-wallet.service.d.ts.map +1 -1
  55. package/bundles/types/open-wallets/services/google-pay/google-pay.open-wallet.service.d.ts.map +1 -1
  56. package/bundles/types/open-wallets/types/index.d.ts +1 -1
  57. package/bundles/types/open-wallets/types/index.d.ts.map +1 -1
  58. package/bundles/types/open-wallets/types/payment-source.type.d.ts +104 -0
  59. package/bundles/types/open-wallets/types/payment-source.type.d.ts.map +1 -1
  60. package/bundles/types/secure-remote-commerce/secure-remote-commerce.d.ts.map +1 -1
  61. package/bundles/types/wallet-buttons/interfaces.d.ts +55 -1
  62. package/bundles/types/wallet-buttons/interfaces.d.ts.map +1 -1
  63. package/bundles/types/wallet-buttons-express/interfaces/base-wallet-meta.interface.d.ts +7 -0
  64. package/bundles/types/wallet-buttons-express/interfaces/base-wallet-meta.interface.d.ts.map +1 -1
  65. package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts +23 -0
  66. package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts.map +1 -1
  67. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts +31 -0
  68. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts.map +1 -1
  69. package/bundles/widget.umd.js +920 -661
  70. package/bundles/widget.umd.js.d.ts +1046 -399
  71. package/bundles/widget.umd.js.min.d.ts +1046 -399
  72. package/bundles/widget.umd.min.js +1 -1
  73. package/docs/api-canvas3ds.md +19 -12
  74. package/docs/open-wallet-buttons.md +158 -0
  75. package/package.json +6 -2
package/bundles/index.cjs CHANGED
@@ -956,246 +956,6 @@ var ApiCharge = /*#__PURE__*/function () {
956
956
  }]);
957
957
  }();
958
958
 
959
- var ENV = {
960
- SANDBOX: 'sandbox',
961
- SANDBOX_KOVENA: 'sandbox-kovena',
962
- SANDBOX_DEMO: 'sandbox-demo',
963
- SANDBOX_DEMO_KOVENA: 'sandbox-demo-kovena',
964
- PROD: 'production',
965
- STAGING: 'staging',
966
- STAGING_1: 'staging_1',
967
- STAGING_2: 'staging_2',
968
- STAGING_3: 'staging_3',
969
- STAGING_4: 'staging_4',
970
- STAGING_5: 'staging_5',
971
- STAGING_6: 'staging_6',
972
- STAGING_7: 'staging_7',
973
- STAGING_8: 'staging_8',
974
- STAGING_9: 'staging_9',
975
- STAGING_10: 'staging_10',
976
- STAGING_11: 'staging_11',
977
- STAGING_12: 'staging_12',
978
- STAGING_13: 'staging_13',
979
- STAGING_14: 'staging_14',
980
- STAGING_15: 'staging_15'
981
- };
982
- var WIDGET_URL = [{
983
- env: ENV.SANDBOX,
984
- url: 'https://widget-sandbox.'
985
- }, {
986
- env: ENV.SANDBOX_KOVENA,
987
- url: 'https://widget-sandbox.'
988
- }, {
989
- env: ENV.SANDBOX_DEMO,
990
- url: 'https://widget-sandbox-demo.'
991
- }, {
992
- env: ENV.SANDBOX_DEMO_KOVENA,
993
- url: 'https://widget-sandbox-demo.'
994
- }, {
995
- env: ENV.PROD,
996
- url: 'https://widget.'
997
- }, {
998
- env: ENV.STAGING,
999
- url: 'https://widsta.'
1000
- }, {
1001
- env: ENV.STAGING_1,
1002
- url: 'https://widsta-1.'
1003
- }, {
1004
- env: ENV.STAGING_2,
1005
- url: 'https://widsta-2.'
1006
- }, {
1007
- env: ENV.STAGING_3,
1008
- url: 'https://widsta-3.'
1009
- }, {
1010
- env: ENV.STAGING_4,
1011
- url: 'https://widsta-4.'
1012
- }, {
1013
- env: ENV.STAGING_5,
1014
- url: 'https://widsta-5.'
1015
- }, {
1016
- env: ENV.STAGING_6,
1017
- url: 'https://widsta-6.'
1018
- }, {
1019
- env: ENV.STAGING_7,
1020
- url: 'https://widsta-7.'
1021
- }, {
1022
- env: ENV.STAGING_8,
1023
- url: 'https://widsta-8.'
1024
- }, {
1025
- env: ENV.STAGING_9,
1026
- url: 'https://widsta-9.'
1027
- }, {
1028
- env: ENV.STAGING_10,
1029
- url: 'https://widsta-10.'
1030
- }, {
1031
- env: ENV.STAGING_11,
1032
- url: 'https://widsta-11.'
1033
- }, {
1034
- env: ENV.STAGING_12,
1035
- url: 'https://widsta-12.'
1036
- }, {
1037
- env: ENV.STAGING_13,
1038
- url: 'https://widsta-13.'
1039
- }, {
1040
- env: ENV.STAGING_14,
1041
- url: 'https://widsta-14.'
1042
- }, {
1043
- env: ENV.STAGING_15,
1044
- url: 'https://widsta-15.'
1045
- }];
1046
- var API_URL = [{
1047
- env: ENV.SANDBOX,
1048
- url: 'https://api-sandbox.'
1049
- }, {
1050
- env: ENV.PROD,
1051
- url: 'https://api.'
1052
- }, {
1053
- env: ENV.STAGING,
1054
- url: 'https://apista.'
1055
- }, {
1056
- env: ENV.STAGING_1,
1057
- url: 'https://apista-1.'
1058
- }, {
1059
- env: ENV.STAGING_2,
1060
- url: 'https://apista-2.'
1061
- }, {
1062
- env: ENV.STAGING_3,
1063
- url: 'https://apista-3.'
1064
- }, {
1065
- env: ENV.STAGING_4,
1066
- url: 'https://apista-4.'
1067
- }, {
1068
- env: ENV.STAGING_5,
1069
- url: 'https://apista-5.'
1070
- }, {
1071
- env: ENV.STAGING_6,
1072
- url: 'https://apista-6.'
1073
- }, {
1074
- env: ENV.STAGING_7,
1075
- url: 'https://apista-7.'
1076
- }, {
1077
- env: ENV.STAGING_8,
1078
- url: 'https://apista-8.'
1079
- }, {
1080
- env: ENV.STAGING_9,
1081
- url: 'https://apista-9.'
1082
- }, {
1083
- env: ENV.STAGING_10,
1084
- url: 'https://apista-10.'
1085
- }, {
1086
- env: ENV.STAGING_11,
1087
- url: 'https://apista-11.'
1088
- }, {
1089
- env: ENV.STAGING_12,
1090
- url: 'https://apista-12.'
1091
- }, {
1092
- env: ENV.STAGING_13,
1093
- url: 'https://apista-13.'
1094
- }, {
1095
- env: ENV.STAGING_14,
1096
- url: 'https://apista-14.'
1097
- }, {
1098
- env: ENV.STAGING_15,
1099
- url: 'https://apista-15.'
1100
- }];
1101
- var ADDITIONAL_ENV = [ENV.SANDBOX_KOVENA, ENV.SANDBOX_DEMO_KOVENA];
1102
- var REGEX_ALIAS = '^([a-zA-Z0-9](?:(?:[a-zA-Z0-9-.]*(?!-)\\.(?![-.]))*[a-zA-Z0-9]+)?)$';
1103
- var DEFAULT_ENV = ENV.SANDBOX;
1104
- var DEFAULT_ALIAS = {
1105
- PAYDOCK: 'paydock.com',
1106
- KOVENA: 'kovena.com'
1107
- };
1108
- // TODO @ingeniousraccoons we should take advantage of TypeScript mechanism for static environmentId checking and simplified runtime validation
1109
- // TODO @ingeniousraccoons unify `environment.paydock.ts` and `environment.cba.ts` making them configuration driven
1110
- var Env = /*#__PURE__*/function () {
1111
- function Env(configs) {
1112
- var defaultEnv = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_ENV;
1113
- _classCallCheck(this, Env);
1114
- this.environmentConfigurations = configs;
1115
- this.setEnv(defaultEnv);
1116
- }
1117
- return _createClass(Env, [{
1118
- key: "setEnv",
1119
- value: function setEnv(environmentId, alias) {
1120
- this.validateAlias(alias);
1121
- this.validateEnvironmentId(environmentId);
1122
- this.environmentId = environmentId;
1123
- if (alias) {
1124
- this.alias = alias;
1125
- } else if (ADDITIONAL_ENV.includes(this.environmentId)) {
1126
- this.alias = DEFAULT_ALIAS.KOVENA;
1127
- } else {
1128
- this.alias = DEFAULT_ALIAS.PAYDOCK;
1129
- }
1130
- }
1131
- }, {
1132
- key: "getEnv",
1133
- value: function getEnv() {
1134
- return this.environmentId;
1135
- }
1136
- }, {
1137
- key: "getConf",
1138
- value: function getConf() {
1139
- for (var index in this.environmentConfigurations) {
1140
- if (!Object.hasOwn(this.environmentConfigurations, index)) {
1141
- continue;
1142
- }
1143
- if (this.environmentConfigurations[index].env === this.getEnv()) {
1144
- return {
1145
- url: this.environmentConfigurations[index].url.indexOf('localhost') !== -1 ? this.environmentConfigurations[index].url : this.environmentConfigurations[index].url + this.alias,
1146
- env: this.environmentConfigurations[index].env
1147
- };
1148
- }
1149
- }
1150
- throw new Error('Env could not obtain configuration. Unknown environmentId.');
1151
- }
1152
- }, {
1153
- key: "validateAlias",
1154
- value: function validateAlias(alias) {
1155
- if (typeof alias === 'undefined') {
1156
- return;
1157
- }
1158
- if (typeof alias !== 'string') {
1159
- throw new TypeError("Env expects parameter 'alias' to be of type 'string' or 'undefined'.");
1160
- }
1161
- if (!alias.match(REGEX_ALIAS)) {
1162
- throw new Error("Env received malformed alias: ".concat(alias, ". Ensure it satisfies the regex: '").concat(REGEX_ALIAS, "'."));
1163
- }
1164
- }
1165
- }, {
1166
- key: "validateEnvironmentId",
1167
- value: function validateEnvironmentId(environmentId) {
1168
- for (var index in this.environmentConfigurations) {
1169
- if (!Object.hasOwn(this.environmentConfigurations, index)) {
1170
- continue;
1171
- }
1172
- if (this.environmentConfigurations[index].env === environmentId) {
1173
- return;
1174
- }
1175
- }
1176
- throw new TypeError("Env received unknown environmentId: ".concat(environmentId));
1177
- }
1178
- }]);
1179
- }();
1180
-
1181
- var SDK = /*#__PURE__*/function () {
1182
- function SDK() {
1183
- _classCallCheck(this, SDK);
1184
- }
1185
- return _createClass(SDK, null, [{
1186
- key: "version",
1187
- get: function get() {
1188
- return SDK._version.trim() || null;
1189
- }
1190
- }]);
1191
- }();
1192
- SDK.type = 'client';
1193
- SDK.headerKeys = Object.freeze({
1194
- version: 'x-sdk-version',
1195
- type: 'x-sdk-type'
1196
- });
1197
- SDK._version = 'v1.143.0';
1198
-
1199
959
  function isFunction(value) {
1200
960
  return typeof value === 'function';
1201
961
  }
@@ -1853,6 +1613,246 @@ var BehaviorSubject = (function (_super) {
1853
1613
  return BehaviorSubject;
1854
1614
  }(Subject));
1855
1615
 
1616
+ var ENV = {
1617
+ SANDBOX: 'sandbox',
1618
+ SANDBOX_KOVENA: 'sandbox-kovena',
1619
+ SANDBOX_DEMO: 'sandbox-demo',
1620
+ SANDBOX_DEMO_KOVENA: 'sandbox-demo-kovena',
1621
+ PROD: 'production',
1622
+ STAGING: 'staging',
1623
+ STAGING_1: 'staging_1',
1624
+ STAGING_2: 'staging_2',
1625
+ STAGING_3: 'staging_3',
1626
+ STAGING_4: 'staging_4',
1627
+ STAGING_5: 'staging_5',
1628
+ STAGING_6: 'staging_6',
1629
+ STAGING_7: 'staging_7',
1630
+ STAGING_8: 'staging_8',
1631
+ STAGING_9: 'staging_9',
1632
+ STAGING_10: 'staging_10',
1633
+ STAGING_11: 'staging_11',
1634
+ STAGING_12: 'staging_12',
1635
+ STAGING_13: 'staging_13',
1636
+ STAGING_14: 'staging_14',
1637
+ STAGING_15: 'staging_15'
1638
+ };
1639
+ var WIDGET_URL = [{
1640
+ env: ENV.SANDBOX,
1641
+ url: 'https://widget-sandbox.'
1642
+ }, {
1643
+ env: ENV.SANDBOX_KOVENA,
1644
+ url: 'https://widget-sandbox.'
1645
+ }, {
1646
+ env: ENV.SANDBOX_DEMO,
1647
+ url: 'https://widget-sandbox-demo.'
1648
+ }, {
1649
+ env: ENV.SANDBOX_DEMO_KOVENA,
1650
+ url: 'https://widget-sandbox-demo.'
1651
+ }, {
1652
+ env: ENV.PROD,
1653
+ url: 'https://widget.'
1654
+ }, {
1655
+ env: ENV.STAGING,
1656
+ url: 'https://widsta.'
1657
+ }, {
1658
+ env: ENV.STAGING_1,
1659
+ url: 'https://widsta-1.'
1660
+ }, {
1661
+ env: ENV.STAGING_2,
1662
+ url: 'https://widsta-2.'
1663
+ }, {
1664
+ env: ENV.STAGING_3,
1665
+ url: 'https://widsta-3.'
1666
+ }, {
1667
+ env: ENV.STAGING_4,
1668
+ url: 'https://widsta-4.'
1669
+ }, {
1670
+ env: ENV.STAGING_5,
1671
+ url: 'https://widsta-5.'
1672
+ }, {
1673
+ env: ENV.STAGING_6,
1674
+ url: 'https://widsta-6.'
1675
+ }, {
1676
+ env: ENV.STAGING_7,
1677
+ url: 'https://widsta-7.'
1678
+ }, {
1679
+ env: ENV.STAGING_8,
1680
+ url: 'https://widsta-8.'
1681
+ }, {
1682
+ env: ENV.STAGING_9,
1683
+ url: 'https://widsta-9.'
1684
+ }, {
1685
+ env: ENV.STAGING_10,
1686
+ url: 'https://widsta-10.'
1687
+ }, {
1688
+ env: ENV.STAGING_11,
1689
+ url: 'https://widsta-11.'
1690
+ }, {
1691
+ env: ENV.STAGING_12,
1692
+ url: 'https://widsta-12.'
1693
+ }, {
1694
+ env: ENV.STAGING_13,
1695
+ url: 'https://widsta-13.'
1696
+ }, {
1697
+ env: ENV.STAGING_14,
1698
+ url: 'https://widsta-14.'
1699
+ }, {
1700
+ env: ENV.STAGING_15,
1701
+ url: 'https://widsta-15.'
1702
+ }];
1703
+ var API_URL = [{
1704
+ env: ENV.SANDBOX,
1705
+ url: 'https://api-sandbox.'
1706
+ }, {
1707
+ env: ENV.PROD,
1708
+ url: 'https://api.'
1709
+ }, {
1710
+ env: ENV.STAGING,
1711
+ url: 'https://apista.'
1712
+ }, {
1713
+ env: ENV.STAGING_1,
1714
+ url: 'https://apista-1.'
1715
+ }, {
1716
+ env: ENV.STAGING_2,
1717
+ url: 'https://apista-2.'
1718
+ }, {
1719
+ env: ENV.STAGING_3,
1720
+ url: 'https://apista-3.'
1721
+ }, {
1722
+ env: ENV.STAGING_4,
1723
+ url: 'https://apista-4.'
1724
+ }, {
1725
+ env: ENV.STAGING_5,
1726
+ url: 'https://apista-5.'
1727
+ }, {
1728
+ env: ENV.STAGING_6,
1729
+ url: 'https://apista-6.'
1730
+ }, {
1731
+ env: ENV.STAGING_7,
1732
+ url: 'https://apista-7.'
1733
+ }, {
1734
+ env: ENV.STAGING_8,
1735
+ url: 'https://apista-8.'
1736
+ }, {
1737
+ env: ENV.STAGING_9,
1738
+ url: 'https://apista-9.'
1739
+ }, {
1740
+ env: ENV.STAGING_10,
1741
+ url: 'https://apista-10.'
1742
+ }, {
1743
+ env: ENV.STAGING_11,
1744
+ url: 'https://apista-11.'
1745
+ }, {
1746
+ env: ENV.STAGING_12,
1747
+ url: 'https://apista-12.'
1748
+ }, {
1749
+ env: ENV.STAGING_13,
1750
+ url: 'https://apista-13.'
1751
+ }, {
1752
+ env: ENV.STAGING_14,
1753
+ url: 'https://apista-14.'
1754
+ }, {
1755
+ env: ENV.STAGING_15,
1756
+ url: 'https://apista-15.'
1757
+ }];
1758
+ var ADDITIONAL_ENV = [ENV.SANDBOX_KOVENA, ENV.SANDBOX_DEMO_KOVENA];
1759
+ var REGEX_ALIAS = '^([a-zA-Z0-9](?:(?:[a-zA-Z0-9-.]*(?!-)\\.(?![-.]))*[a-zA-Z0-9]+)?)$';
1760
+ var DEFAULT_ENV = ENV.SANDBOX;
1761
+ var DEFAULT_ALIAS = {
1762
+ PAYDOCK: 'paydock.com',
1763
+ KOVENA: 'kovena.com'
1764
+ };
1765
+ // TODO @ingeniousraccoons we should take advantage of TypeScript mechanism for static environmentId checking and simplified runtime validation
1766
+ // TODO @ingeniousraccoons unify `environment.paydock.ts` and `environment.cba.ts` making them configuration driven
1767
+ var Env = /*#__PURE__*/function () {
1768
+ function Env(configs) {
1769
+ var defaultEnv = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_ENV;
1770
+ _classCallCheck(this, Env);
1771
+ this.environmentConfigurations = configs;
1772
+ this.setEnv(defaultEnv);
1773
+ }
1774
+ return _createClass(Env, [{
1775
+ key: "setEnv",
1776
+ value: function setEnv(environmentId, alias) {
1777
+ this.validateAlias(alias);
1778
+ this.validateEnvironmentId(environmentId);
1779
+ this.environmentId = environmentId;
1780
+ if (alias) {
1781
+ this.alias = alias;
1782
+ } else if (ADDITIONAL_ENV.includes(this.environmentId)) {
1783
+ this.alias = DEFAULT_ALIAS.KOVENA;
1784
+ } else {
1785
+ this.alias = DEFAULT_ALIAS.PAYDOCK;
1786
+ }
1787
+ }
1788
+ }, {
1789
+ key: "getEnv",
1790
+ value: function getEnv() {
1791
+ return this.environmentId;
1792
+ }
1793
+ }, {
1794
+ key: "getConf",
1795
+ value: function getConf() {
1796
+ for (var index in this.environmentConfigurations) {
1797
+ if (!Object.hasOwn(this.environmentConfigurations, index)) {
1798
+ continue;
1799
+ }
1800
+ if (this.environmentConfigurations[index].env === this.getEnv()) {
1801
+ return {
1802
+ url: this.environmentConfigurations[index].url.indexOf('localhost') !== -1 ? this.environmentConfigurations[index].url : this.environmentConfigurations[index].url + this.alias,
1803
+ env: this.environmentConfigurations[index].env
1804
+ };
1805
+ }
1806
+ }
1807
+ throw new Error('Env could not obtain configuration. Unknown environmentId.');
1808
+ }
1809
+ }, {
1810
+ key: "validateAlias",
1811
+ value: function validateAlias(alias) {
1812
+ if (typeof alias === 'undefined') {
1813
+ return;
1814
+ }
1815
+ if (typeof alias !== 'string') {
1816
+ throw new TypeError("Env expects parameter 'alias' to be of type 'string' or 'undefined'.");
1817
+ }
1818
+ if (!alias.match(REGEX_ALIAS)) {
1819
+ throw new Error("Env received malformed alias: ".concat(alias, ". Ensure it satisfies the regex: '").concat(REGEX_ALIAS, "'."));
1820
+ }
1821
+ }
1822
+ }, {
1823
+ key: "validateEnvironmentId",
1824
+ value: function validateEnvironmentId(environmentId) {
1825
+ for (var index in this.environmentConfigurations) {
1826
+ if (!Object.hasOwn(this.environmentConfigurations, index)) {
1827
+ continue;
1828
+ }
1829
+ if (this.environmentConfigurations[index].env === environmentId) {
1830
+ return;
1831
+ }
1832
+ }
1833
+ throw new TypeError("Env received unknown environmentId: ".concat(environmentId));
1834
+ }
1835
+ }]);
1836
+ }();
1837
+
1838
+ var SDK = /*#__PURE__*/function () {
1839
+ function SDK() {
1840
+ _classCallCheck(this, SDK);
1841
+ }
1842
+ return _createClass(SDK, null, [{
1843
+ key: "version",
1844
+ get: function get() {
1845
+ return SDK._version.trim() || null;
1846
+ }
1847
+ }]);
1848
+ }();
1849
+ SDK.type = 'client';
1850
+ SDK.headerKeys = Object.freeze({
1851
+ version: 'x-sdk-version',
1852
+ type: 'x-sdk-type'
1853
+ });
1854
+ SDK._version = 'v1.144.1-beta';
1855
+
1856
1856
  var ACCESS_HEADER_NAME = {
1857
1857
  accessToken: 'x-access-token',
1858
1858
  publicKey: 'x-user-public-key'
@@ -1943,6 +1943,139 @@ var AccessToken = /*#__PURE__*/function () {
1943
1943
  }]);
1944
1944
  }();
1945
1945
 
1946
+ /**
1947
+ * Top-level classification of an error. Used by the SDK to route errors to the
1948
+ * right category in instrumentation and to give consumers a coarse-grained
1949
+ * tag for grouping/filtering. See {@link getErrorCategory} for the mapping
1950
+ * between {@link ERROR_CAUSE} and {@link ERROR_CATEGORY}.
1951
+ */
1952
+ var ERROR_CATEGORY = {
1953
+ /** SDK was misconfigured (missing keys, invalid options, etc.). */
1954
+ CONFIGURATION: 'configuration',
1955
+ /** Authentication or authorization failure. */
1956
+ IDENTITY: 'identity_access_management',
1957
+ /** SDK internal failure or upstream service problem. */
1958
+ INTERNAL: 'internal',
1959
+ /** Flow lifecycle event (user cancelled, aborted, etc.) — not a real fault. */
1960
+ PROCESS: 'process',
1961
+ /** Resource lookup failed or was rate-limited. */
1962
+ RESOURCE: 'resource',
1963
+ /** Invalid input or business-rule validation failure. */
1964
+ VALIDATION: 'validation'
1965
+ };
1966
+ /**
1967
+ * Concrete cause of an error. More specific than {@link ERROR_CATEGORY} —
1968
+ * useful for deciding programmatic responses (e.g. show a retry button only
1969
+ * when `cause` is `'service_unreachable'` or `'server_busy'`).
1970
+ */
1971
+ var ERROR_CAUSE = {
1972
+ /** Operation was aborted programmatically. */
1973
+ ABORTED: 'aborted',
1974
+ /** Caller has insufficient permissions for the operation. */
1975
+ ACCESS_FORBIDDEN: 'access_forbidden',
1976
+ /** Resource already exists when create was expected. */
1977
+ ALREADY_EXISTS: 'already_exists',
1978
+ /** User cancelled the flow (e.g. closed the wallet sheet). */
1979
+ CANCELED: 'canceled',
1980
+ /** SDK was instantiated or invoked with invalid configuration. */
1981
+ INVALID_CONFIGURATION: 'invalid_configuration',
1982
+ /** Input failed structural or business-rule validation. */
1983
+ INVALID_INPUT: 'invalid_input',
1984
+ /** Resource was not found by the backend. */
1985
+ NOT_FOUND: 'not_found',
1986
+ /** Operation is not supported in the current context or version. */
1987
+ NOT_IMPLEMENTED: 'not_implemented',
1988
+ /** Caller exceeded the allowed request rate. */
1989
+ RATE_LIMITED: 'rate_limited',
1990
+ /** Backend is healthy but currently overloaded — typically retryable. */
1991
+ SERVER_BUSY: 'server_busy',
1992
+ /** Backend or third-party service could not be reached — typically retryable. */
1993
+ SERVICE_UNREACHABLE: 'service_unreachable',
1994
+ /** Caller is not authenticated. */
1995
+ UNAUTHORIZED: 'unauthorized',
1996
+ /** Catch-all when no other cause applies. */
1997
+ UNKNOWN: 'unknown_error',
1998
+ /** Request was syntactically valid but semantically rejected. */
1999
+ UNPROCESSABLE_ENTITY: 'unprocessable_entity'
2000
+ };
2001
+ var EventError = /*#__PURE__*/function (_Error) {
2002
+ function EventError(cause, category, retryable, details) {
2003
+ var _this;
2004
+ _classCallCheck(this, EventError);
2005
+ _this = _callSuper(this, EventError, [details.message]);
2006
+ _this.cause = cause;
2007
+ _this.category = category;
2008
+ _this.retryable = retryable;
2009
+ _this.details = details;
2010
+ Object.setPrototypeOf(_this, EventError.prototype);
2011
+ _this.name = EventError.name;
2012
+ return _this;
2013
+ }
2014
+ _inherits(EventError, _Error);
2015
+ return _createClass(EventError, [{
2016
+ key: "toJSON",
2017
+ value: function toJSON() {
2018
+ return {
2019
+ error: {
2020
+ category: this.category,
2021
+ cause: this.cause,
2022
+ details: this.details,
2023
+ retryable: this.retryable
2024
+ }
2025
+ };
2026
+ }
2027
+ }, {
2028
+ key: "setContextId",
2029
+ value: function setContextId(contextId) {
2030
+ this.details.contextId = contextId;
2031
+ }
2032
+ }, {
2033
+ key: "setPurpose",
2034
+ value: function setPurpose(purpose) {
2035
+ this.purpose = purpose;
2036
+ }
2037
+ }], [{
2038
+ key: "create",
2039
+ value: function create(cause, message) {
2040
+ var contextId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
2041
+ var retryable = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
2042
+ var details = {
2043
+ cause: cause,
2044
+ contextId: contextId,
2045
+ message: message,
2046
+ timestamp: new Date().toISOString()
2047
+ };
2048
+ var category = getErrorCategory(cause);
2049
+ return new EventError(cause, category, retryable, details);
2050
+ }
2051
+ }]);
2052
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
2053
+ function getErrorCategory(cause) {
2054
+ switch (cause) {
2055
+ case ERROR_CAUSE.INVALID_CONFIGURATION:
2056
+ return ERROR_CATEGORY.CONFIGURATION;
2057
+ case ERROR_CAUSE.ACCESS_FORBIDDEN:
2058
+ case ERROR_CAUSE.UNAUTHORIZED:
2059
+ return ERROR_CATEGORY.IDENTITY;
2060
+ case ERROR_CAUSE.SERVICE_UNREACHABLE:
2061
+ case ERROR_CAUSE.NOT_IMPLEMENTED:
2062
+ case ERROR_CAUSE.SERVER_BUSY:
2063
+ return ERROR_CATEGORY.INTERNAL;
2064
+ case ERROR_CAUSE.ABORTED:
2065
+ case ERROR_CAUSE.CANCELED:
2066
+ return ERROR_CATEGORY.PROCESS;
2067
+ case ERROR_CAUSE.NOT_FOUND:
2068
+ case ERROR_CAUSE.RATE_LIMITED:
2069
+ return ERROR_CATEGORY.RESOURCE;
2070
+ case ERROR_CAUSE.ALREADY_EXISTS:
2071
+ case ERROR_CAUSE.INVALID_INPUT:
2072
+ case ERROR_CAUSE.UNPROCESSABLE_ENTITY:
2073
+ return ERROR_CATEGORY.VALIDATION;
2074
+ default:
2075
+ return ERROR_CATEGORY.INTERNAL;
2076
+ }
2077
+ }
2078
+
1946
2079
  var HttpRequest = /*#__PURE__*/function () {
1947
2080
  function HttpRequest(request) {
1948
2081
  _classCallCheck(this, HttpRequest);
@@ -4637,18 +4770,23 @@ var ApiBase = /*#__PURE__*/function () {
4637
4770
  var errorCb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (data) {
4638
4771
  return undefined;
4639
4772
  };
4773
+ var onError = function onError(err) {
4774
+ _this4.reportError(errorRepository, err, _extends(_extends({}, _this4.ctx), {
4775
+ classMethod: 'getClient',
4776
+ description: 'Send unsuccessful.'
4777
+ }));
4778
+ errorCb(err);
4779
+ };
4640
4780
  request.onload = function () {
4641
4781
  return _this4.parser({
4642
4782
  text: request.responseText,
4643
4783
  status: request.status
4644
- }, cb, function (err) {
4645
- _this4.reportError(errorRepository, err, _extends(_extends({}, _this4.ctx), {
4646
- classMethod: 'getClient',
4647
- description: 'Send unsuccessful.'
4648
- }));
4649
- errorCb(err);
4650
- });
4784
+ }, cb, onError);
4651
4785
  };
4786
+ // Transport-level failures (dropped connection, failed CORS
4787
+ // preflight, HTTP/2 protocol error, timeout) never fire `onload`,
4788
+ // so without these handlers the request would fail silently.
4789
+ _this4.attachFailureHandlers(request, onError);
4652
4790
  request.send(JSON.stringify(body));
4653
4791
  }
4654
4792
  };
@@ -4661,13 +4799,18 @@ var ApiBase = /*#__PURE__*/function () {
4661
4799
  return {
4662
4800
  config: request,
4663
4801
  send: function send(body) {
4664
- return new Promise(function (resolve, _reject) {
4802
+ return new Promise(function (resolve, reject) {
4665
4803
  request.onload = function () {
4666
4804
  return resolve({
4667
4805
  text: request.responseText,
4668
4806
  status: request.status
4669
4807
  });
4670
4808
  };
4809
+ // Transport-level failures (dropped connection, failed CORS
4810
+ // preflight, HTTP/2 protocol error, timeout) never fire
4811
+ // `onload`, so without these handlers the promise would never
4812
+ // settle and the caller would hang silently.
4813
+ _this5.attachFailureHandlers(request, reject);
4671
4814
  request.send(JSON.stringify(body));
4672
4815
  }).then(function (value) {
4673
4816
  return _this5.parserPromise(value);
@@ -4719,6 +4862,36 @@ var ApiBase = /*#__PURE__*/function () {
4719
4862
  return Promise.reject(err);
4720
4863
  }
4721
4864
  }
4865
+ /**
4866
+ * Wires the XHR failure events that `onload` does not cover. `onload` only
4867
+ * fires when an HTTP response is received (any status, including 4xx/5xx);
4868
+ * transport-level failures — a dropped connection, a failed CORS preflight,
4869
+ * an HTTP/2 protocol error, or a timeout — fire `onerror`/`ontimeout`/
4870
+ * `onabort` instead. Without these the request never settles and fails
4871
+ * silently (e.g. `onUnavailable` is never invoked for wallet callbacks).
4872
+ */
4873
+ }, {
4874
+ key: "attachFailureHandlers",
4875
+ value: function attachFailureHandlers(request, onFailure) {
4876
+ request.onerror = function () {
4877
+ return onFailure({
4878
+ message: 'Network request failed: the service could not be reached.',
4879
+ code: ERROR_CAUSE.SERVICE_UNREACHABLE
4880
+ });
4881
+ };
4882
+ request.ontimeout = function () {
4883
+ return onFailure({
4884
+ message: 'Network request timed out: the service could not be reached.',
4885
+ code: ERROR_CAUSE.SERVICE_UNREACHABLE
4886
+ });
4887
+ };
4888
+ request.onabort = function () {
4889
+ return onFailure({
4890
+ message: 'Network request was aborted.',
4891
+ code: ERROR_CAUSE.ABORTED
4892
+ });
4893
+ };
4894
+ }
4722
4895
  }, {
4723
4896
  key: "newApiRequest",
4724
4897
  value: function newApiRequest(method, link) {
@@ -4804,127 +4977,162 @@ var Api = /*#__PURE__*/function (_ApiBase) {
4804
4977
  }]);
4805
4978
  }(ApiBase);
4806
4979
 
4807
- var Url = /*#__PURE__*/function () {
4808
- function Url() {
4809
- _classCallCheck(this, Url);
4980
+ var WALLET_CAPTURE_LINK = '/v1/charges/wallet/capture';
4981
+ var WALLET_CALLBACK_LINK = '/v1/charges/wallet/callback';
4982
+ var STANDALONE_3DS_PROCESS_LINK = '/v1/charges/standalone-3ds/process';
4983
+ var STANDALONE_3DS_HANDLE_LINK = '/v1/charges/standalone-3ds/handle';
4984
+ var ApiChargeInternal = /*#__PURE__*/function () {
4985
+ function ApiChargeInternal(api) {
4986
+ _classCallCheck(this, ApiChargeInternal);
4987
+ this.api = api;
4810
4988
  }
4811
- return _createClass(Url, null, [{
4812
- key: "extendSearchParams",
4813
- value: function extendSearchParams(uri, key, val) {
4814
- return uri.replace(new RegExp("([?&]" + key + "(?=[=&#]|$)[^#&]*|(?=#|$))"), "&" + key + "=" + encodeURIComponent(val)).replace(/^([^?&]+)&/, "$1?");
4989
+ return _createClass(ApiChargeInternal, [{
4990
+ key: "walletCapture",
4991
+ value: function walletCapture(payload) {
4992
+ return this.api.getClientPromise('POST', WALLET_CAPTURE_LINK).send(payload);
4815
4993
  }
4816
4994
  }, {
4817
- key: "serialize",
4818
- value: function serialize(params) {
4819
- return Object.keys(params).map(function (key) {
4820
- return encodeURIComponent(key) + '=' + encodeURIComponent(params[key]);
4821
- }).join('&');
4995
+ key: "walletCallback",
4996
+ value: function walletCallback(payload) {
4997
+ return this.api.getClientPromise('POST', WALLET_CALLBACK_LINK).send(payload);
4998
+ }
4999
+ }, {
5000
+ key: "standalone3dsProcess",
5001
+ value: function standalone3dsProcess(payload) {
5002
+ return this.api.getClientPromise('POST', STANDALONE_3DS_PROCESS_LINK).send(payload);
5003
+ }
5004
+ }, {
5005
+ key: "standalone3dsHandle",
5006
+ value: function standalone3dsHandle() {
5007
+ return this.api.getClientPromise('GET', STANDALONE_3DS_HANDLE_LINK).send(undefined);
4822
5008
  }
4823
5009
  }]);
4824
5010
  }();
4825
5011
 
4826
- var Uuid = /*#__PURE__*/function () {
4827
- function Uuid() {
4828
- _classCallCheck(this, Uuid);
5012
+ var CALLBACK_LINK = '/v1/checkouts/callback';
5013
+ var INSTRUCTION_LINK = '/v1/checkouts/instruction';
5014
+ var STATUS_LINK = '/v1/checkouts';
5015
+ var ApiCheckoutInternal = /*#__PURE__*/function () {
5016
+ function ApiCheckoutInternal(api) {
5017
+ _classCallCheck(this, ApiCheckoutInternal);
5018
+ this.api = api;
5019
+ this.getInstructionLink = function () {
5020
+ return "".concat(INSTRUCTION_LINK, "?time=").concat(Date.now());
5021
+ };
4829
5022
  }
4830
- return _createClass(Uuid, null, [{
4831
- key: "generate",
4832
- value: function generate() {
4833
- if (typeof window !== "undefined" && typeof window.crypto !== "undefined" && typeof window.crypto.getRandomValues !== "undefined") {
4834
- var buf = new Uint16Array(8);
4835
- window.crypto.getRandomValues(buf);
4836
- return this.hash(buf[0]) + this.hash(buf[1]) + "-" + this.hash(buf[2]) + "-" + this.hash(buf[3]) + "-" + this.hash(buf[4]) + "-" + this.hash(buf[5]) + this.hash(buf[6]) + this.hash(buf[7]);
4837
- } else {
4838
- return this.random() + this.random() + "-" + this.random() + "-" + this.random() + "-" + this.random() + "-" + this.random() + this.random() + this.random();
4839
- }
5023
+ return _createClass(ApiCheckoutInternal, [{
5024
+ key: "instructions",
5025
+ value: function instructions() {
5026
+ return this.api.requestObservable('GET', this.getInstructionLink(), {});
4840
5027
  }
4841
5028
  }, {
4842
- key: "hash",
4843
- value: function hash(number) {
4844
- var hash = number.toString(16);
4845
- while (hash.length < 4) {
4846
- hash = "0" + hash;
4847
- }
4848
- return hash;
5029
+ key: "callback",
5030
+ value: function callback(payload) {
5031
+ return this.api.getClientPromise('POST', CALLBACK_LINK).send(payload);
4849
5032
  }
4850
5033
  }, {
4851
- key: "random",
4852
- value: function random() {
4853
- return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
5034
+ key: "status",
5035
+ value: function status(id) {
5036
+ return this.api.getClientPromise('GET', "".concat(STATUS_LINK, "/").concat(id)).send('');
4854
5037
  }
4855
5038
  }]);
4856
5039
  }();
4857
5040
 
4858
- var WIDGET_LINK = '/remote-action';
4859
- var VAULT_DISPLAY_WIDGET_LINK = '/vault-display';
4860
- var PAYMENT_SOURCE_LINK = '/payment-sources';
4861
- var SECURE_3D = '/3ds/webhook';
4862
- var FLYPAY_LINK = '/wallet/flypay';
4863
- var FLYPAY_LOGO_LINK = '/images/coles-pay-logo.png';
4864
- var MESSAGE_WIDGET_LINK = '/message-widget';
4865
- var MASTERCARD_SRC = '/secure-remote-commerce/mastercard';
4866
- var Link = /*#__PURE__*/function () {
4867
- function Link(linkResource) {
4868
- _classCallCheck(this, Link);
4869
- this.params = {};
4870
- this.widgetId = Uuid.generate();
4871
- this.linkResource = linkResource;
4872
- this.env = new Env(WIDGET_URL);
4873
- this.setParams({
4874
- widget_id: this.widgetId
4875
- });
5041
+ var GET_WALLET_CONFIG = '/v1/gateways/:gateway_id/wallet-config';
5042
+ var ApiGatewayInternal = /*#__PURE__*/function () {
5043
+ function ApiGatewayInternal(api) {
5044
+ _classCallCheck(this, ApiGatewayInternal);
5045
+ this.api = api;
4876
5046
  }
4877
- return _createClass(Link, [{
4878
- key: "getNetUrl",
4879
- value: function getNetUrl() {
4880
- return this.env.getConf().url + this.linkResource;
5047
+ return _createClass(ApiGatewayInternal, [{
5048
+ key: "getWalletConfig",
5049
+ value: function getWalletConfig(gateway_id) {
5050
+ var url = GET_WALLET_CONFIG.replace(':gateway_id', gateway_id);
5051
+ return this.api.getClientPromise('GET', url).send(undefined);
4881
5052
  }
4882
- }, {
4883
- key: "getUrl",
4884
- value: function getUrl() {
4885
- var url = this.getNetUrl();
4886
- var params = this.getParams();
4887
- for (var key in params) {
4888
- if (params.hasOwnProperty(key)) url = Url.extendSearchParams(url, key, params[key]);
4889
- }
4890
- return url;
5053
+ }]);
5054
+ }();
5055
+
5056
+ var CREATE_OTT = '/v1/payment_sources/tokens';
5057
+ var CREATE_SESSION = '/v1/payment_sources/payment-session';
5058
+ var ApiPaymentSourceInternal = /*#__PURE__*/function () {
5059
+ function ApiPaymentSourceInternal(api) {
5060
+ _classCallCheck(this, ApiPaymentSourceInternal);
5061
+ this.api = api;
5062
+ }
5063
+ return _createClass(ApiPaymentSourceInternal, [{
5064
+ key: "createOTT",
5065
+ value: function createOTT(payload) {
5066
+ return this.api.getClientPromise('POST', CREATE_OTT).send(payload);
4891
5067
  }
4892
5068
  }, {
4893
- key: "setParams",
4894
- value: function setParams(params) {
4895
- this.params = _extends({}, this.params, params);
5069
+ key: "createSession",
5070
+ value: function createSession(payload) {
5071
+ return this.api.getClientPromise('POST', CREATE_SESSION).send(payload);
4896
5072
  }
4897
- }, {
4898
- key: "concatParams",
4899
- value: function concatParams(params) {
4900
- for (var key in params) {
4901
- if (!params.hasOwnProperty(key) || !params[key].length) continue;
4902
- if (typeof this.params[key] !== 'string') this.params[key] = '';
4903
- if (this.params[key].length) this.params[key] += ',' + params[key];else this.params[key] += params[key];
4904
- }
5073
+ }]);
5074
+ }();
5075
+
5076
+ var GET_CONFIG = '/v1/services/:service_id/config';
5077
+ var ApiServiceInternal = /*#__PURE__*/function () {
5078
+ function ApiServiceInternal(api) {
5079
+ _classCallCheck(this, ApiServiceInternal);
5080
+ this.api = api;
5081
+ }
5082
+ return _createClass(ApiServiceInternal, [{
5083
+ key: "getConfig",
5084
+ value: function getConfig(service_id) {
5085
+ var url = GET_CONFIG.replace(':service_id', service_id);
5086
+ return this.api.getClientPromise('GET', url).send(undefined);
5087
+ }
5088
+ }]);
5089
+ }();
5090
+ var SERVICE_TYPES;
5091
+ (function (SERVICE_TYPES) {
5092
+ SERVICE_TYPES["ACCERTIFY"] = "Accertify";
5093
+ SERVICE_TYPES["BOOKING"] = "Booking";
5094
+ SERVICE_TYPES["GPAYMENTS"] = "GPayments";
5095
+ SERVICE_TYPES["CLICK_TO_PAY"] = "ClickToPay";
5096
+ SERVICE_TYPES["MASTERCARD_NT"] = "MastercardSCOF";
5097
+ SERVICE_TYPES["VISA_NT"] = "VisaVTS";
5098
+ SERVICE_TYPES["FORTER"] = "Forter";
5099
+ SERVICE_TYPES["APPLE_PAY"] = "ApplePay";
5100
+ SERVICE_TYPES["GOOGLE_PAY"] = "GooglePay";
5101
+ })(SERVICE_TYPES || (SERVICE_TYPES = {}));
5102
+
5103
+ var ApiInternal = /*#__PURE__*/function (_ApiBase) {
5104
+ function ApiInternal() {
5105
+ _classCallCheck(this, ApiInternal);
5106
+ return _callSuper(this, ApiInternal, arguments);
5107
+ }
5108
+ _inherits(ApiInternal, _ApiBase);
5109
+ return _createClass(ApiInternal, [{
5110
+ key: "charge",
5111
+ value: function charge() {
5112
+ return new ApiChargeInternal(this);
4905
5113
  }
4906
5114
  }, {
4907
- key: "getParams",
4908
- value: function getParams() {
4909
- return this.params;
5115
+ key: "service",
5116
+ value: function service() {
5117
+ return new ApiServiceInternal(this);
4910
5118
  }
4911
5119
  }, {
4912
- key: "setEnv",
4913
- value: function setEnv(env, alias) {
4914
- this.env.setEnv(env, alias);
5120
+ key: "checkout",
5121
+ value: function checkout() {
5122
+ return new ApiCheckoutInternal(this);
4915
5123
  }
4916
5124
  }, {
4917
- key: "getEnv",
4918
- value: function getEnv() {
4919
- return this.env.getEnv();
5125
+ key: "gateway",
5126
+ value: function gateway() {
5127
+ return new ApiGatewayInternal(this);
4920
5128
  }
4921
5129
  }, {
4922
- key: "getBaseUrl",
4923
- value: function getBaseUrl() {
4924
- return this.env.getConf().url;
5130
+ key: "paymentSource",
5131
+ value: function paymentSource() {
5132
+ return new ApiPaymentSourceInternal(this);
4925
5133
  }
4926
5134
  }]);
4927
- }();
5135
+ }(ApiBase);
4928
5136
 
4929
5137
  var IFrame = /*#__PURE__*/function () {
4930
5138
  function IFrame(container) {
@@ -5121,10 +5329,10 @@ var IFrameEvent = /*#__PURE__*/function () {
5121
5329
  }();
5122
5330
 
5123
5331
  var hiddenStyle = {
5124
- visibility: "hidden",
5125
- border: "0",
5126
- width: "0",
5127
- height: "0"
5332
+ visibility: 'hidden',
5333
+ border: '0',
5334
+ width: '0',
5335
+ height: '0'
5128
5336
  };
5129
5337
  var PROCESS_STANDALONE_3DS_STATUS;
5130
5338
  (function (PROCESS_STANDALONE_3DS_STATUS) {
@@ -5146,14 +5354,30 @@ var IFRAME_STATUS;
5146
5354
  IFRAME_STATUS["TIMEOUT"] = "AuthTimedOut";
5147
5355
  IFRAME_STATUS["INVALID"] = "invalid_event";
5148
5356
  })(IFRAME_STATUS || (IFRAME_STATUS = {}));
5357
+ /**
5358
+ * Event name constants emitted during the Standalone 3DS (GPayments) flow.
5359
+ * Used internally by `GPaymentsService` and re-exported publicly as `CANVAS_3DS_EVENT`.
5360
+ */
5149
5361
  var GPAYMENTS_EVENT = {
5362
+ /** Authentication succeeded. Payload: `Canvas3dsAuthPayload`. */
5150
5363
  AUTH_SUCCESS: 'chargeAuthSuccess',
5364
+ /** Authentication failed — covers issuer rejection, iframe timeout (`AuthTimedOut`), and invalid-event outcomes. Payload: `Canvas3dsAuthPayload`. */
5151
5365
  AUTH_ERROR: 'chargeAuthReject',
5366
+ /** Decoupled authentication — issuer will authenticate out-of-band. Payload: `Canvas3dsAuthPayload`. */
5152
5367
  DECOUPLED: 'chargeAuthDecoupled',
5368
+ /** Challenge required — issuer demands user interaction. Payload: `Canvas3dsAuthPayload`. */
5153
5369
  CHALLENGE: 'chargeAuthChallenge',
5370
+ /** Informational signal emitted by the GPayments flow. Internal — not part of the public typed surface. */
5154
5371
  INFO: 'chargeAuthInfo',
5372
+ /** Error during the flow (network, parsing, etc.). Payload: `Canvas3dsErrorPayload`. */
5155
5373
  ERROR: 'error'
5156
5374
  };
5375
+ /**
5376
+ * Public alias for GPAYMENTS_EVENT. Same object reference — no behavioral change.
5377
+ * Prefer `CANVAS_3DS_EVENT` in public-facing code; `GPAYMENTS_EVENT` remains for
5378
+ * backwards-compatible internal usage.
5379
+ */
5380
+ var CANVAS_3DS_EVENT = GPAYMENTS_EVENT;
5157
5381
  var GPaymentsService = /*#__PURE__*/function () {
5158
5382
  function GPaymentsService(container, api, eventEmitter) {
5159
5383
  _classCallCheck(this, GPaymentsService);
@@ -5181,20 +5405,22 @@ var GPaymentsService = /*#__PURE__*/function () {
5181
5405
  value: function initializeIFrames(initializationUrl, secondaryUrl, title) {
5182
5406
  var hideAuthorization = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
5183
5407
  var container = this.container.getElement();
5184
- if (!container) return;
5185
- var divAuthorization = document.createElement("div");
5186
- divAuthorization.setAttribute("id", "paydock_authorization_iframe");
5408
+ if (!container) {
5409
+ return;
5410
+ }
5411
+ var divAuthorization = document.createElement('div');
5412
+ divAuthorization.setAttribute('id', 'paydock_authorization_iframe');
5187
5413
  container.appendChild(divAuthorization);
5188
- this.browserAndChallengeContainer = new Container("#paydock_authorization_iframe");
5414
+ this.browserAndChallengeContainer = new Container('#paydock_authorization_iframe');
5189
5415
  this.iFrameAuthorization = new IFrame(this.browserAndChallengeContainer);
5190
5416
  this.iFrameAuthorization.load(initializationUrl, {
5191
5417
  title: title
5192
5418
  });
5193
5419
  if (secondaryUrl) {
5194
- var divSecondaryURL = document.createElement("div");
5195
- divSecondaryURL.setAttribute("id", "paydock_secondary_iframe");
5420
+ var divSecondaryURL = document.createElement('div');
5421
+ divSecondaryURL.setAttribute('id', 'paydock_secondary_iframe');
5196
5422
  container.appendChild(divSecondaryURL);
5197
- this.monitoringContainer = new Container("#paydock_secondary_iframe");
5423
+ this.monitoringContainer = new Container('#paydock_secondary_iframe');
5198
5424
  this.iFrameSecondaryUrl = new IFrame(this.monitoringContainer);
5199
5425
  this.iFrameSecondaryUrl.load(secondaryUrl, {
5200
5426
  title: title
@@ -5210,8 +5436,12 @@ var GPaymentsService = /*#__PURE__*/function () {
5210
5436
  var hideAuthorization = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
5211
5437
  var _a;
5212
5438
  for (var prop in hiddenStyle) {
5213
- if (!hiddenStyle.hasOwnProperty(prop)) continue;
5214
- if (hideAuthorization) this.iFrameAuthorization.setStyle(prop, hiddenStyle[prop]);
5439
+ if (!Object.hasOwn(hiddenStyle, prop)) {
5440
+ continue;
5441
+ }
5442
+ if (hideAuthorization) {
5443
+ this.iFrameAuthorization.setStyle(prop, hiddenStyle[prop]);
5444
+ }
5215
5445
  (_a = this.iFrameSecondaryUrl) === null || _a === void 0 ? void 0 : _a.setStyle(prop, hiddenStyle[prop]);
5216
5446
  }
5217
5447
  }
@@ -5221,13 +5451,17 @@ var GPaymentsService = /*#__PURE__*/function () {
5221
5451
  var _this = this;
5222
5452
  this.iFrameEvent.on(EVENT$4.CHARGE_AUTH, widgetId, function (data) {
5223
5453
  if (data.status === IFRAME_STATUS.SKIPPED || data.status === IFRAME_STATUS.FINISHED) {
5224
- if (data.info) _this.eventEmitter.emit(GPAYMENTS_EVENT.INFO, {
5225
- info: data.info
5226
- });
5454
+ if (data.info) {
5455
+ _this.eventEmitter.emit(GPAYMENTS_EVENT.INFO, {
5456
+ info: data.info
5457
+ });
5458
+ }
5227
5459
  _this.performAuthentication(data);
5228
- } else if (data.status === IFRAME_STATUS.TIMEOUT || data.status === IFRAME_STATUS.INVALID) _this.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this.parseHandleResponse({
5229
- status: data.status
5230
- }, data.charge_3ds_id));
5460
+ } else if (data.status === IFRAME_STATUS.TIMEOUT || data.status === IFRAME_STATUS.INVALID) {
5461
+ _this.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this.parseHandleResponse({
5462
+ status: data.status
5463
+ }, data.charge_3ds_id));
5464
+ }
5231
5465
  });
5232
5466
  this.iFrameEvent.on(EVENT$4.CHARGE_AUTH_SUCCESS, widgetId, function (data) {
5233
5467
  _this.processResult(data.charge_3ds_id);
@@ -5267,13 +5501,19 @@ var GPaymentsService = /*#__PURE__*/function () {
5267
5501
  key: "processResult",
5268
5502
  value: function processResult(charge3dsId) {
5269
5503
  var _this2 = this;
5270
- if (this.resultRead) return;
5504
+ if (this.resultRead) {
5505
+ return;
5506
+ }
5271
5507
  this.resultRead = true;
5272
5508
  this.api.charge().standalone3dsHandle().then(function (result) {
5273
5509
  var _a;
5274
5510
  _this2.iFrameAuthorization.remove();
5275
5511
  (_a = _this2.iFrameSecondaryUrl) === null || _a === void 0 ? void 0 : _a.remove();
5276
- if (result.status === PROCESS_STANDALONE_3DS_STATUS.SUCCESS) _this2.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_SUCCESS, _this2.parseResultData(result, charge3dsId));else _this2.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this2.parseResultData(result, charge3dsId));
5512
+ if (result.status === PROCESS_STANDALONE_3DS_STATUS.SUCCESS) {
5513
+ _this2.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_SUCCESS, _this2.parseResultData(result, charge3dsId));
5514
+ } else {
5515
+ _this2.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this2.parseResultData(result, charge3dsId));
5516
+ }
5277
5517
  }, function (err) {
5278
5518
  _this2.eventEmitter.emit(GPAYMENTS_EVENT.ERROR, _this2.parseError(err, charge3dsId));
5279
5519
  });
@@ -5298,10 +5538,16 @@ var GPaymentsService = /*#__PURE__*/function () {
5298
5538
  key: "doPolling",
5299
5539
  value: function doPolling(url, charge3dsId) {
5300
5540
  var _this3 = this;
5301
- this.externalAPI("GET", url).then(function (data) {
5302
- if (!data.event || data.event === "AuthResultNotReady") setTimeout(function () {
5303
- _this3.doPolling(url, charge3dsId);
5304
- }, 2000);else if (data.event === 'AuthResultReady') _this3.processResult(charge3dsId);else throw new Error("Event not supported");
5541
+ this.externalAPI('GET', url).then(function (data) {
5542
+ if (!data.event || data.event === 'AuthResultNotReady') {
5543
+ setTimeout(function () {
5544
+ _this3.doPolling(url, charge3dsId);
5545
+ }, 2000);
5546
+ } else if (data.event === 'AuthResultReady') {
5547
+ _this3.processResult(charge3dsId);
5548
+ } else {
5549
+ throw new Error('Event not supported');
5550
+ }
5305
5551
  })["catch"](function (err) {
5306
5552
  return _this3.eventEmitter.emit(GPAYMENTS_EVENT.ERROR, _this3.parseError(err, charge3dsId));
5307
5553
  });
@@ -5318,16 +5564,24 @@ var GPaymentsService = /*#__PURE__*/function () {
5318
5564
  charge_3ds_id: charge_3ds_id
5319
5565
  }).then(function (authenticationResult) {
5320
5566
  var _a, _b;
5321
- if (authenticationResult.status === AUTHENTICATION_STATUS.SUCCESS) _this4.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_SUCCESS, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));else if (authenticationResult.status === AUTHENTICATION_STATUS.PENDING) {
5567
+ if (authenticationResult.status === AUTHENTICATION_STATUS.SUCCESS) {
5568
+ _this4.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_SUCCESS, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));
5569
+ } else if (authenticationResult.status === AUTHENTICATION_STATUS.PENDING) {
5322
5570
  if ((_a = authenticationResult === null || authenticationResult === void 0 ? void 0 : authenticationResult.result) === null || _a === void 0 ? void 0 : _a.challenge) {
5323
5571
  _this4.eventEmitter.emit(GPAYMENTS_EVENT.CHALLENGE, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));
5324
5572
  _this4.initializeIFrames(authenticationResult.result.challenge_url, undefined, 'Authentication Challenge', false);
5325
- if (authenticationResult.result.secondary_url) _this4.doPolling(authenticationResult.result.secondary_url, charge_3ds_id);
5573
+ if (authenticationResult.result.secondary_url) {
5574
+ _this4.doPolling(authenticationResult.result.secondary_url, charge_3ds_id);
5575
+ }
5326
5576
  } else if ((_b = authenticationResult === null || authenticationResult === void 0 ? void 0 : authenticationResult.result) === null || _b === void 0 ? void 0 : _b.decoupled_challenge) {
5327
5577
  _this4.eventEmitter.emit(GPAYMENTS_EVENT.DECOUPLED, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));
5328
- if (authenticationResult.result.secondary_url) _this4.doPolling(authenticationResult.result.secondary_url, charge_3ds_id);
5578
+ if (authenticationResult.result.secondary_url) {
5579
+ _this4.doPolling(authenticationResult.result.secondary_url, charge_3ds_id);
5580
+ }
5329
5581
  }
5330
- } else return _this4.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));
5582
+ } else {
5583
+ return _this4.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));
5584
+ }
5331
5585
  }, function (err) {
5332
5586
  _this4.eventEmitter.emit(GPAYMENTS_EVENT.ERROR, _this4.parseError(err, charge_3ds_id));
5333
5587
  });
@@ -5335,192 +5589,159 @@ var GPaymentsService = /*#__PURE__*/function () {
5335
5589
  }]);
5336
5590
  }();
5337
5591
 
5338
- var WALLET_CAPTURE_LINK = '/v1/charges/wallet/capture';
5339
- var WALLET_CALLBACK_LINK = '/v1/charges/wallet/callback';
5340
- var STANDALONE_3DS_PROCESS_LINK = '/v1/charges/standalone-3ds/process';
5341
- var STANDALONE_3DS_HANDLE_LINK = '/v1/charges/standalone-3ds/handle';
5342
- var ApiChargeInternal = /*#__PURE__*/function () {
5343
- function ApiChargeInternal(api) {
5344
- _classCallCheck(this, ApiChargeInternal);
5345
- this.api = api;
5592
+ var STANDALONE_3DS_GATEWAYS = {
5593
+ GPAYMENTS: 'GPayments'
5594
+ };
5595
+ var Standalone3dsService = /*#__PURE__*/function () {
5596
+ function Standalone3dsService(container, eventEmitter) {
5597
+ _classCallCheck(this, Standalone3dsService);
5598
+ this.env = DEFAULT_ENV;
5599
+ this.container = container;
5600
+ this.eventEmitter = eventEmitter;
5346
5601
  }
5347
- return _createClass(ApiChargeInternal, [{
5348
- key: "walletCapture",
5349
- value: function walletCapture(payload) {
5350
- return this.api.getClientPromise('POST', WALLET_CAPTURE_LINK).send(payload);
5351
- }
5352
- }, {
5353
- key: "walletCallback",
5354
- value: function walletCallback(payload) {
5355
- return this.api.getClientPromise('POST', WALLET_CALLBACK_LINK).send(payload);
5356
- }
5357
- }, {
5358
- key: "standalone3dsProcess",
5359
- value: function standalone3dsProcess(payload) {
5360
- return this.api.getClientPromise('POST', STANDALONE_3DS_PROCESS_LINK).send(payload);
5602
+ return _createClass(Standalone3dsService, [{
5603
+ key: "load",
5604
+ value: function load(token, options) {
5605
+ var parsedToken = AccessToken.validateJWT(token);
5606
+ if (!parsedToken) {
5607
+ throw new Error('Invalid charge token');
5608
+ }
5609
+ var tokenData = AccessToken.extractData(parsedToken.body);
5610
+ var api = new ApiInternal(token, API_AUTH_TYPE.TOKEN);
5611
+ api.setEnv(this.env, this.alias);
5612
+ switch (tokenData.service_type) {
5613
+ case STANDALONE_3DS_GATEWAYS.GPAYMENTS:
5614
+ new GPaymentsService(this.container, api, this.eventEmitter).load(tokenData, options.title);
5615
+ break;
5616
+ }
5361
5617
  }
5362
5618
  }, {
5363
- key: "standalone3dsHandle",
5364
- value: function standalone3dsHandle() {
5365
- return this.api.getClientPromise('GET', STANDALONE_3DS_HANDLE_LINK).send(undefined);
5619
+ key: "setEnv",
5620
+ value: function setEnv(env, alias) {
5621
+ this.env = env;
5622
+ this.alias = alias;
5366
5623
  }
5367
5624
  }]);
5368
5625
  }();
5369
5626
 
5370
- var CALLBACK_LINK = '/v1/checkouts/callback';
5371
- var INSTRUCTION_LINK = '/v1/checkouts/instruction';
5372
- var STATUS_LINK = '/v1/checkouts';
5373
- var ApiCheckoutInternal = /*#__PURE__*/function () {
5374
- function ApiCheckoutInternal(api) {
5375
- _classCallCheck(this, ApiCheckoutInternal);
5376
- this.api = api;
5377
- this.getInstructionLink = function () {
5378
- return "".concat(INSTRUCTION_LINK, "?time=").concat(Date.now());
5379
- };
5627
+ var Url = /*#__PURE__*/function () {
5628
+ function Url() {
5629
+ _classCallCheck(this, Url);
5380
5630
  }
5381
- return _createClass(ApiCheckoutInternal, [{
5382
- key: "instructions",
5383
- value: function instructions() {
5384
- return this.api.requestObservable('GET', this.getInstructionLink(), {});
5385
- }
5386
- }, {
5387
- key: "callback",
5388
- value: function callback(payload) {
5389
- return this.api.getClientPromise('POST', CALLBACK_LINK).send(payload);
5631
+ return _createClass(Url, null, [{
5632
+ key: "extendSearchParams",
5633
+ value: function extendSearchParams(uri, key, val) {
5634
+ return uri.replace(new RegExp("([?&]" + key + "(?=[=&#]|$)[^#&]*|(?=#|$))"), "&" + key + "=" + encodeURIComponent(val)).replace(/^([^?&]+)&/, "$1?");
5390
5635
  }
5391
5636
  }, {
5392
- key: "status",
5393
- value: function status(id) {
5394
- return this.api.getClientPromise('GET', "".concat(STATUS_LINK, "/").concat(id)).send('');
5395
- }
5396
- }]);
5397
- }();
5398
-
5399
- var GET_WALLET_CONFIG = '/v1/gateways/:gateway_id/wallet-config';
5400
- var ApiGatewayInternal = /*#__PURE__*/function () {
5401
- function ApiGatewayInternal(api) {
5402
- _classCallCheck(this, ApiGatewayInternal);
5403
- this.api = api;
5404
- }
5405
- return _createClass(ApiGatewayInternal, [{
5406
- key: "getWalletConfig",
5407
- value: function getWalletConfig(gateway_id) {
5408
- var url = GET_WALLET_CONFIG.replace(':gateway_id', gateway_id);
5409
- return this.api.getClientPromise('GET', url).send(undefined);
5637
+ key: "serialize",
5638
+ value: function serialize(params) {
5639
+ return Object.keys(params).map(function (key) {
5640
+ return encodeURIComponent(key) + '=' + encodeURIComponent(params[key]);
5641
+ }).join('&');
5410
5642
  }
5411
5643
  }]);
5412
5644
  }();
5413
5645
 
5414
- var CREATE_OTT = '/v1/payment_sources/tokens';
5415
- var CREATE_SESSION = '/v1/payment_sources/payment-session';
5416
- var ApiPaymentSourceInternal = /*#__PURE__*/function () {
5417
- function ApiPaymentSourceInternal(api) {
5418
- _classCallCheck(this, ApiPaymentSourceInternal);
5419
- this.api = api;
5646
+ var Uuid = /*#__PURE__*/function () {
5647
+ function Uuid() {
5648
+ _classCallCheck(this, Uuid);
5420
5649
  }
5421
- return _createClass(ApiPaymentSourceInternal, [{
5422
- key: "createOTT",
5423
- value: function createOTT(payload) {
5424
- return this.api.getClientPromise('POST', CREATE_OTT).send(payload);
5650
+ return _createClass(Uuid, null, [{
5651
+ key: "generate",
5652
+ value: function generate() {
5653
+ if (typeof window !== "undefined" && typeof window.crypto !== "undefined" && typeof window.crypto.getRandomValues !== "undefined") {
5654
+ var buf = new Uint16Array(8);
5655
+ window.crypto.getRandomValues(buf);
5656
+ return this.hash(buf[0]) + this.hash(buf[1]) + "-" + this.hash(buf[2]) + "-" + this.hash(buf[3]) + "-" + this.hash(buf[4]) + "-" + this.hash(buf[5]) + this.hash(buf[6]) + this.hash(buf[7]);
5657
+ } else {
5658
+ return this.random() + this.random() + "-" + this.random() + "-" + this.random() + "-" + this.random() + "-" + this.random() + this.random() + this.random();
5659
+ }
5425
5660
  }
5426
5661
  }, {
5427
- key: "createSession",
5428
- value: function createSession(payload) {
5429
- return this.api.getClientPromise('POST', CREATE_SESSION).send(payload);
5662
+ key: "hash",
5663
+ value: function hash(number) {
5664
+ var hash = number.toString(16);
5665
+ while (hash.length < 4) {
5666
+ hash = "0" + hash;
5667
+ }
5668
+ return hash;
5430
5669
  }
5431
- }]);
5432
- }();
5433
-
5434
- var GET_CONFIG = '/v1/services/:service_id/config';
5435
- var ApiServiceInternal = /*#__PURE__*/function () {
5436
- function ApiServiceInternal(api) {
5437
- _classCallCheck(this, ApiServiceInternal);
5438
- this.api = api;
5439
- }
5440
- return _createClass(ApiServiceInternal, [{
5441
- key: "getConfig",
5442
- value: function getConfig(service_id) {
5443
- var url = GET_CONFIG.replace(':service_id', service_id);
5444
- return this.api.getClientPromise('GET', url).send(undefined);
5670
+ }, {
5671
+ key: "random",
5672
+ value: function random() {
5673
+ return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
5445
5674
  }
5446
5675
  }]);
5447
5676
  }();
5448
- var SERVICE_TYPES;
5449
- (function (SERVICE_TYPES) {
5450
- SERVICE_TYPES["ACCERTIFY"] = "Accertify";
5451
- SERVICE_TYPES["BOOKING"] = "Booking";
5452
- SERVICE_TYPES["GPAYMENTS"] = "GPayments";
5453
- SERVICE_TYPES["CLICK_TO_PAY"] = "ClickToPay";
5454
- SERVICE_TYPES["MASTERCARD_NT"] = "MastercardSCOF";
5455
- SERVICE_TYPES["VISA_NT"] = "VisaVTS";
5456
- SERVICE_TYPES["FORTER"] = "Forter";
5457
- SERVICE_TYPES["APPLE_PAY"] = "ApplePay";
5458
- SERVICE_TYPES["GOOGLE_PAY"] = "GooglePay";
5459
- })(SERVICE_TYPES || (SERVICE_TYPES = {}));
5460
5677
 
5461
- var ApiInternal = /*#__PURE__*/function (_ApiBase) {
5462
- function ApiInternal() {
5463
- _classCallCheck(this, ApiInternal);
5464
- return _callSuper(this, ApiInternal, arguments);
5678
+ var WIDGET_LINK = '/remote-action';
5679
+ var VAULT_DISPLAY_WIDGET_LINK = '/vault-display';
5680
+ var PAYMENT_SOURCE_LINK = '/payment-sources';
5681
+ var SECURE_3D = '/3ds/webhook';
5682
+ var FLYPAY_LINK = '/wallet/flypay';
5683
+ var FLYPAY_LOGO_LINK = '/images/coles-pay-logo.png';
5684
+ var MESSAGE_WIDGET_LINK = '/message-widget';
5685
+ var MASTERCARD_SRC = '/secure-remote-commerce/mastercard';
5686
+ var Link = /*#__PURE__*/function () {
5687
+ function Link(linkResource) {
5688
+ _classCallCheck(this, Link);
5689
+ this.params = {};
5690
+ this.widgetId = Uuid.generate();
5691
+ this.linkResource = linkResource;
5692
+ this.env = new Env(WIDGET_URL);
5693
+ this.setParams({
5694
+ widget_id: this.widgetId
5695
+ });
5465
5696
  }
5466
- _inherits(ApiInternal, _ApiBase);
5467
- return _createClass(ApiInternal, [{
5468
- key: "charge",
5469
- value: function charge() {
5470
- return new ApiChargeInternal(this);
5697
+ return _createClass(Link, [{
5698
+ key: "getNetUrl",
5699
+ value: function getNetUrl() {
5700
+ return this.env.getConf().url + this.linkResource;
5471
5701
  }
5472
5702
  }, {
5473
- key: "service",
5474
- value: function service() {
5475
- return new ApiServiceInternal(this);
5703
+ key: "getUrl",
5704
+ value: function getUrl() {
5705
+ var url = this.getNetUrl();
5706
+ var params = this.getParams();
5707
+ for (var key in params) {
5708
+ if (params.hasOwnProperty(key)) url = Url.extendSearchParams(url, key, params[key]);
5709
+ }
5710
+ return url;
5476
5711
  }
5477
5712
  }, {
5478
- key: "checkout",
5479
- value: function checkout() {
5480
- return new ApiCheckoutInternal(this);
5713
+ key: "setParams",
5714
+ value: function setParams(params) {
5715
+ this.params = _extends({}, this.params, params);
5481
5716
  }
5482
5717
  }, {
5483
- key: "gateway",
5484
- value: function gateway() {
5485
- return new ApiGatewayInternal(this);
5718
+ key: "concatParams",
5719
+ value: function concatParams(params) {
5720
+ for (var key in params) {
5721
+ if (!params.hasOwnProperty(key) || !params[key].length) continue;
5722
+ if (typeof this.params[key] !== 'string') this.params[key] = '';
5723
+ if (this.params[key].length) this.params[key] += ',' + params[key];else this.params[key] += params[key];
5724
+ }
5486
5725
  }
5487
5726
  }, {
5488
- key: "paymentSource",
5489
- value: function paymentSource() {
5490
- return new ApiPaymentSourceInternal(this);
5491
- }
5492
- }]);
5493
- }(ApiBase);
5494
-
5495
- var STANDALONE_3DS_GATEWAYS = {
5496
- GPAYMENTS: "GPayments"
5497
- };
5498
- var Standalone3dsService = /*#__PURE__*/function () {
5499
- function Standalone3dsService(container, eventEmitter) {
5500
- _classCallCheck(this, Standalone3dsService);
5501
- this.env = DEFAULT_ENV;
5502
- this.container = container;
5503
- this.eventEmitter = eventEmitter;
5504
- }
5505
- return _createClass(Standalone3dsService, [{
5506
- key: "load",
5507
- value: function load(token, options) {
5508
- var parsedToken = AccessToken.validateJWT(token);
5509
- if (!parsedToken) throw new Error("Invalid charge token");
5510
- var tokenData = AccessToken.extractData(parsedToken.body);
5511
- var api = new ApiInternal(token, API_AUTH_TYPE.TOKEN);
5512
- api.setEnv(this.env, this.alias);
5513
- switch (tokenData.service_type) {
5514
- case STANDALONE_3DS_GATEWAYS.GPAYMENTS:
5515
- new GPaymentsService(this.container, api, this.eventEmitter).load(tokenData, options.title);
5516
- break;
5517
- }
5727
+ key: "getParams",
5728
+ value: function getParams() {
5729
+ return this.params;
5518
5730
  }
5519
5731
  }, {
5520
5732
  key: "setEnv",
5521
5733
  value: function setEnv(env, alias) {
5522
- this.env = env;
5523
- this.alias = alias;
5734
+ this.env.setEnv(env, alias);
5735
+ }
5736
+ }, {
5737
+ key: "getEnv",
5738
+ value: function getEnv() {
5739
+ return this.env.getEnv();
5740
+ }
5741
+ }, {
5742
+ key: "getBaseUrl",
5743
+ value: function getBaseUrl() {
5744
+ return this.env.getConf().url;
5524
5745
  }
5525
5746
  }]);
5526
5747
  }();
@@ -5560,7 +5781,7 @@ var TOKEN_FORMAT$2;
5560
5781
  * @param {string} CHARGE_AUTH_CHALLENGE=chargeAuthChallenge
5561
5782
  * @param {string} CHARGE_AUTH_INFO=chargeAuthInfo
5562
5783
  * @param {string} ERROR=error
5563
- */
5784
+ */
5564
5785
  /**
5565
5786
  * Class Canvas3ds include method for working on html
5566
5787
  * @constructor
@@ -5596,13 +5817,21 @@ var Canvas3ds = /*#__PURE__*/function () {
5596
5817
  *
5597
5818
  */
5598
5819
  function load() {
5599
- if (this.token.format === TOKEN_FORMAT$2.HTML) this.iFrame.loadFromHtml(this.token.content, {
5600
- title: '3d secure authentication'
5601
- }, 'threeDSecure-iframe');else if (this.token.format === TOKEN_FORMAT$2.URL) this.iFrame.load(this.token.content, {
5602
- title: '3d secure authentication'
5603
- }, 'threeDSecure-iframe');else if (this.token.format === TOKEN_FORMAT$2.STANDALONE_3DS) this.standalone3dsService.load(this.token.content, {
5604
- title: '3d secure authentication'
5605
- });else console.error('Token contain unsupported payload');
5820
+ if (this.token.format === TOKEN_FORMAT$2.HTML) {
5821
+ this.iFrame.loadFromHtml(this.token.content, {
5822
+ title: '3d secure authentication'
5823
+ }, 'threeDSecure-iframe');
5824
+ } else if (this.token.format === TOKEN_FORMAT$2.URL) {
5825
+ this.iFrame.load(this.token.content, {
5826
+ title: '3d secure authentication'
5827
+ }, 'threeDSecure-iframe');
5828
+ } else if (this.token.format === TOKEN_FORMAT$2.STANDALONE_3DS) {
5829
+ this.standalone3dsService.load(this.token.content, {
5830
+ title: '3d secure authentication'
5831
+ });
5832
+ } else {
5833
+ console.error('Token contain unsupported payload');
5834
+ }
5606
5835
  }
5607
5836
  /**
5608
5837
  * Current method can change environment. By default environment = sandbox.
@@ -5619,7 +5848,9 @@ var Canvas3ds = /*#__PURE__*/function () {
5619
5848
  this.link.setEnv(env, alias);
5620
5849
  this.standalone3dsService.setEnv(env, alias);
5621
5850
  for (var index in this.configs) {
5622
- if (!this.configs.hasOwnProperty(index)) continue;
5851
+ if (!Object.hasOwn(this.configs, index)) {
5852
+ continue;
5853
+ }
5623
5854
  this.configs[index].setEnv(env, alias);
5624
5855
  }
5625
5856
  }
@@ -5629,34 +5860,45 @@ var Canvas3ds = /*#__PURE__*/function () {
5629
5860
  return this.link.getEnv();
5630
5861
  }
5631
5862
  /**
5632
- * Listen to events of widget
5863
+ * Listen to events of widget.
5633
5864
  *
5634
- * @example
5865
+ * Available event names are defined in {@link Canvas3dsEventMap} (typed) and
5866
+ * {@link CANVAS_3DS_EVENT} (string constants). Using a literal event name
5867
+ * narrows the callback payload via the typed overloads.
5635
5868
  *
5636
- * widget.on('chargeAuthReject', function (data) {
5637
- * console.log(data);
5869
+ * @example
5870
+ * // Callback form — payload is narrowed by the event name
5871
+ * widget.on('chargeAuthReject', (data) => {
5872
+ * console.log(data); // data is Canvas3dsAuthPayload | Canvas3dsChargeAuthEventPayload
5638
5873
  * });
5639
- * // or
5640
- * widget.on('chargeAuthReject').then(function (data) {
5641
- * console.log(data);
5874
+ *
5875
+ * // Promise form
5876
+ * widget.on('chargeAuthReject').then((data) => {
5877
+ * console.log(data);
5642
5878
  * });
5643
- * @param {string} eventName - Available event names [EVENT]{@link EVENT} [STANDALONE_3DS_EVENT]{@link STANDALONE_3DS_EVENT}
5644
- * @param {listener} [cb]
5645
- * @return {Promise<IEventData> | void}
5879
+ *
5880
+ * @param eventName - Event name from {@link Canvas3dsEventMap} or any string for dynamic events.
5881
+ * @param cb - Optional listener callback. If omitted, returns a Promise that resolves on the next emission.
5882
+ * @returns `void` when a callback is provided; otherwise a Promise that resolves with the event payload.
5646
5883
  */
5884
+ // biome-ignore lint/suspicious/noExplicitAny: implementation signature must accept any payload shape to satisfy all overloads above
5647
5885
  }, {
5648
5886
  key: "on",
5649
5887
  value: function on(eventName, cb) {
5650
5888
  var _this = this;
5651
5889
  if (this.token.format === TOKEN_FORMAT$2.STANDALONE_3DS) {
5652
- if (typeof cb === 'function') return this.eventEmitter.subscribe(eventName, cb);
5890
+ if (typeof cb === 'function') {
5891
+ return this.eventEmitter.subscribe(eventName, cb);
5892
+ }
5653
5893
  return new Promise(function (resolve) {
5654
5894
  return _this.eventEmitter.subscribe(eventName, function (res) {
5655
5895
  return resolve(res);
5656
5896
  });
5657
5897
  });
5658
5898
  } else {
5659
- if (typeof cb === 'function') return this.event.on(eventName, this.link.getParams().ref_id, cb);
5899
+ if (typeof cb === 'function') {
5900
+ return this.event.on(eventName, this.link.getParams().ref_id, cb);
5901
+ }
5660
5902
  return new Promise(function (resolve) {
5661
5903
  return _this.event.on(eventName, _this.link.getParams().ref_id, function (res) {
5662
5904
  return resolve(res);
@@ -5700,6 +5942,19 @@ var Canvas3ds = /*#__PURE__*/function () {
5700
5942
  }]);
5701
5943
  }();
5702
5944
 
5945
+ /**
5946
+ * Public, tree-shakeable alias for the internal `TOKEN_FORMAT` enum in canvas-3ds.ts.
5947
+ * Mirrors the string values of that enum without exposing the private enum itself.
5948
+ */
5949
+ var Canvas3dsTokenFormat = {
5950
+ /** Token whose `content` is a complete HTML page. The SDK renders it inside an iframe. */
5951
+ HTML: 'html',
5952
+ /** Token whose `content` is a URL. The SDK loads it inside an iframe. */
5953
+ URL: 'url',
5954
+ /** Token whose `content` describes a standalone 3DS service (e.g. GPayments). The SDK delegates to that service's flow. */
5955
+ STANDALONE_3DS: 'standalone_3ds'
5956
+ };
5957
+
5703
5958
  var Spinner = /*#__PURE__*/function () {
5704
5959
  function Spinner() {
5705
5960
  _classCallCheck(this, Spinner);
@@ -12785,108 +13040,6 @@ function getHandleCvv(configuration) {
12785
13040
  }
12786
13041
  }
12787
13042
 
12788
- var ERROR_CATEGORY = {
12789
- CONFIGURATION: 'configuration',
12790
- IDENTITY: 'identity_access_management',
12791
- INTERNAL: 'internal',
12792
- PROCESS: 'process',
12793
- RESOURCE: 'resource',
12794
- VALIDATION: 'validation'
12795
- };
12796
- var ERROR_CAUSE = {
12797
- ABORTED: 'aborted',
12798
- ACCESS_FORBIDDEN: 'access_forbidden',
12799
- ALREADY_EXISTS: 'already_exists',
12800
- CANCELED: 'canceled',
12801
- INVALID_CONFIGURATION: 'invalid_configuration',
12802
- INVALID_INPUT: 'invalid_input',
12803
- NOT_FOUND: 'not_found',
12804
- NOT_IMPLEMENTED: 'not_implemented',
12805
- RATE_LIMITED: 'rate_limited',
12806
- SERVER_BUSY: 'server_busy',
12807
- SERVICE_UNREACHABLE: 'service_unreachable',
12808
- UNAUTHORIZED: 'unauthorized',
12809
- UNKNOWN: 'unknown_error',
12810
- UNPROCESSABLE_ENTITY: 'unprocessable_entity'
12811
- };
12812
- var EventError = /*#__PURE__*/function (_Error) {
12813
- function EventError(cause, category, retryable, details) {
12814
- var _this;
12815
- _classCallCheck(this, EventError);
12816
- _this = _callSuper(this, EventError, [details.message]);
12817
- _this.cause = cause;
12818
- _this.category = category;
12819
- _this.retryable = retryable;
12820
- _this.details = details;
12821
- Object.setPrototypeOf(_this, EventError.prototype);
12822
- _this.name = EventError.name;
12823
- return _this;
12824
- }
12825
- _inherits(EventError, _Error);
12826
- return _createClass(EventError, [{
12827
- key: "toJSON",
12828
- value: function toJSON() {
12829
- return {
12830
- error: {
12831
- category: this.category,
12832
- cause: this.cause,
12833
- details: this.details,
12834
- retryable: this.retryable
12835
- }
12836
- };
12837
- }
12838
- }, {
12839
- key: "setContextId",
12840
- value: function setContextId(contextId) {
12841
- this.details.contextId = contextId;
12842
- }
12843
- }, {
12844
- key: "setPurpose",
12845
- value: function setPurpose(purpose) {
12846
- this.purpose = purpose;
12847
- }
12848
- }], [{
12849
- key: "create",
12850
- value: function create(cause, message) {
12851
- var contextId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
12852
- var retryable = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
12853
- var details = {
12854
- cause: cause,
12855
- contextId: contextId,
12856
- message: message,
12857
- timestamp: new Date().toISOString()
12858
- };
12859
- var category = getErrorCategory(cause);
12860
- return new EventError(cause, category, retryable, details);
12861
- }
12862
- }]);
12863
- }(/*#__PURE__*/_wrapNativeSuper(Error));
12864
- function getErrorCategory(cause) {
12865
- switch (cause) {
12866
- case ERROR_CAUSE.INVALID_CONFIGURATION:
12867
- return ERROR_CATEGORY.CONFIGURATION;
12868
- case ERROR_CAUSE.ACCESS_FORBIDDEN:
12869
- case ERROR_CAUSE.UNAUTHORIZED:
12870
- return ERROR_CATEGORY.IDENTITY;
12871
- case ERROR_CAUSE.SERVICE_UNREACHABLE:
12872
- case ERROR_CAUSE.NOT_IMPLEMENTED:
12873
- case ERROR_CAUSE.SERVER_BUSY:
12874
- return ERROR_CATEGORY.INTERNAL;
12875
- case ERROR_CAUSE.ABORTED:
12876
- case ERROR_CAUSE.CANCELED:
12877
- return ERROR_CATEGORY.PROCESS;
12878
- case ERROR_CAUSE.NOT_FOUND:
12879
- case ERROR_CAUSE.RATE_LIMITED:
12880
- return ERROR_CATEGORY.RESOURCE;
12881
- case ERROR_CAUSE.ALREADY_EXISTS:
12882
- case ERROR_CAUSE.INVALID_INPUT:
12883
- case ERROR_CAUSE.UNPROCESSABLE_ENTITY:
12884
- return ERROR_CATEGORY.VALIDATION;
12885
- default:
12886
- return ERROR_CATEGORY.INTERNAL;
12887
- }
12888
- }
12889
-
12890
13043
  function processEventError(err) {
12891
13044
  var cause;
12892
13045
  var message;
@@ -14866,7 +15019,6 @@ var InstructionCanvas3dsShow$1 = /*#__PURE__*/function (_InstructionHandler) {
14866
15019
  });
14867
15020
  canvas.on('chargeAuthReject', function () {
14868
15021
  var _a;
14869
- // **TODO add interface for chargeAuthReject event **//
14870
15022
  (_a = _this.checkoutWidget) === null || _a === void 0 ? void 0 : _a.fetchInstruction();
14871
15023
  _this.api.checkout().callback({
14872
15024
  event: 'callback.child_widget.status',
@@ -14883,13 +15035,13 @@ var InstructionCanvas3dsShow$1 = /*#__PURE__*/function (_InstructionHandler) {
14883
15035
  });
14884
15036
  canvas.on('error', function (event) {
14885
15037
  var _a;
14886
- // **TODO add interface for error event **//
14887
15038
  (_a = _this.checkoutWidget) === null || _a === void 0 ? void 0 : _a.fetchInstruction();
15039
+ var message = (event && _typeof$1(event) === 'object' && 'event' in event ? event.event : null) || 'error in 3ds widget';
14888
15040
  _this.api.checkout().callback({
14889
15041
  event: 'callback.child_widget.status',
14890
15042
  payload: {
14891
15043
  status: 'error',
14892
- message: (event === null || event === void 0 ? void 0 : event.event) || 'error in 3ds widget'
15044
+ message: message
14893
15045
  }
14894
15046
  }).then(function () {
14895
15047
  return console.info('callback.child_widget.status: - errorEvent');
@@ -17257,7 +17409,6 @@ var InstructionCanvas3dsShow = /*#__PURE__*/function (_InstructionHandler) {
17257
17409
  });
17258
17410
  canvas.on('chargeAuthReject', function () {
17259
17411
  var _a;
17260
- // **TODO add interface for chargeAuthReject event **//
17261
17412
  (_a = _this.checkoutWidget) === null || _a === void 0 ? void 0 : _a.fetchInstruction();
17262
17413
  _this.api.checkout().callback({
17263
17414
  event: 'callback.child_widget.status',
@@ -17274,13 +17425,13 @@ var InstructionCanvas3dsShow = /*#__PURE__*/function (_InstructionHandler) {
17274
17425
  });
17275
17426
  canvas.on('error', function (event) {
17276
17427
  var _a;
17277
- // **TODO add interface for error event **//
17278
17428
  (_a = _this.checkoutWidget) === null || _a === void 0 ? void 0 : _a.fetchInstruction();
17429
+ var message = (event && _typeof$1(event) === 'object' && 'event' in event ? event.event : null) || 'error in 3ds widget';
17279
17430
  _this.api.checkout().callback({
17280
17431
  event: 'callback.child_widget.status',
17281
17432
  payload: {
17282
17433
  status: 'error',
17283
- message: (event === null || event === void 0 ? void 0 : event.event) || 'error in 3ds widget'
17434
+ message: message
17284
17435
  }
17285
17436
  }).then(function () {
17286
17437
  return console.info('callback.child_widget.status: - errorEvent');
@@ -18647,10 +18798,16 @@ function getCheckoutVersionHandler(version) {
18647
18798
  }
18648
18799
  }
18649
18800
 
18801
+ /** Event name emitted when a checkout payment completes successfully. */
18802
+ var PAYMENT_SUCCESSFUL = 'paymentSuccessful';
18803
+ /** Event name emitted when a checkout payment fails. */
18804
+ var PAYMENT_FAILURE = 'paymentFailure';
18805
+ /** Event name emitted when a checkout session expires. */
18806
+ var PAYMENT_EXPIRED = 'paymentExpired';
18650
18807
  var EVENT$2 = {
18651
- PAYMENT_SUCCESSFUL: 'paymentSuccessful',
18652
- PAYMENT_FAILURE: 'paymentFailure',
18653
- PAYMENT_EXPIRED: 'paymentExpired'
18808
+ PAYMENT_SUCCESSFUL: PAYMENT_SUCCESSFUL,
18809
+ PAYMENT_FAILURE: PAYMENT_FAILURE,
18810
+ PAYMENT_EXPIRED: PAYMENT_EXPIRED
18654
18811
  };
18655
18812
  /**
18656
18813
  * Class CheckoutButton transform usual button into checkout
@@ -18675,7 +18832,7 @@ var Checkout = /*#__PURE__*/function () {
18675
18832
  this.checkoutFinished = false;
18676
18833
  try {
18677
18834
  this.eventEmitter = new EventEmitter();
18678
- this.intentTokenPayload = this.extractIntentTokenPayload(intentToken);
18835
+ this.intentTokenPayload = this.extractCheckoutIntentTokenPayload(intentToken);
18679
18836
  this.checkoutVersionHandler = getCheckoutVersionHandler(this.intentTokenPayload.version);
18680
18837
  this.instructions = this.initContractVersion();
18681
18838
  this.api = new ApiInternal(this.intentToken, API_AUTH_TYPE.TOKEN);
@@ -18736,8 +18893,8 @@ var Checkout = /*#__PURE__*/function () {
18736
18893
  }, 14 * 60 * 1000 + 45 * 1000);
18737
18894
  }
18738
18895
  }, {
18739
- key: "extractIntentTokenPayload",
18740
- value: function extractIntentTokenPayload(intentToken) {
18896
+ key: "extractCheckoutIntentTokenPayload",
18897
+ value: function extractCheckoutIntentTokenPayload(intentToken) {
18741
18898
  var tokenContent = AccessToken.validateJWT(intentToken);
18742
18899
  if (!tokenContent) {
18743
18900
  throw new Error('Intent token is broken or expired. Please, issue new one.');
@@ -18765,7 +18922,7 @@ var Checkout = /*#__PURE__*/function () {
18765
18922
  value: function ready() {
18766
18923
  var _this3 = this;
18767
18924
  this.changeLoadingSpinnerVisibility(true);
18768
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
18925
+ // biome-ignore lint/suspicious/noExplicitAny: checkoutApi.status returns a dynamic shape whose fields are narrowed at the call-sites below
18769
18926
  this.checkoutApi.status(this.intentTokenPayload.intent_id).then(function (response) {
18770
18927
  if (!(response === null || response === void 0 ? void 0 : response.status)) {
18771
18928
  throw new Error('Checkout Intent Status structure inconsistent');
@@ -18874,8 +19031,8 @@ var Checkout = /*#__PURE__*/function () {
18874
19031
  * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
18875
19032
  *
18876
19033
  * @example
18877
- * widget.onPaymentInReview((data) => {
18878
- * console.log('Payment in fraud review');
19034
+ * widget.onPaymentExpired((data) => {
19035
+ * console.log('Payment session expired');
18879
19036
  * });
18880
19037
  */
18881
19038
  }, {
@@ -18996,6 +19153,7 @@ var OpenWalletButtons = /*#__PURE__*/function () {
18996
19153
  function OpenWalletButtons(selector, publicKeyOrAccessToken, serviceId, meta) {
18997
19154
  _classCallCheck(this, OpenWalletButtons);
18998
19155
  this.env = DEFAULT_ENV;
19156
+ this.isDisabled = false;
18999
19157
  this.onShippingOptionsChangeHandlerRegistered = false;
19000
19158
  // Runtime guard: TypeScript's `abstract` keyword exists only at compile time.
19001
19159
  // Without this check, instantiating the base class directly silently fails
@@ -19140,6 +19298,68 @@ var OpenWalletButtons = /*#__PURE__*/function () {
19140
19298
  _this.handleOnError(error instanceof Error ? error : new Error(String(error)), exports.ERROR_OPERATION.CONFIGURATION);
19141
19299
  });
19142
19300
  }
19301
+ /**
19302
+ * Enables the wallet button, restoring interactivity and visual appearance.
19303
+ * If the button was previously disabled via `disable()`, calling this method
19304
+ * re-enables clicks and removes the disabled visual state.
19305
+ *
19306
+ * Idempotent — calling on an already-enabled button has no effect.
19307
+ *
19308
+ * @example
19309
+ * button.enable();
19310
+ */
19311
+ }, {
19312
+ key: "enable",
19313
+ value: function enable() {
19314
+ this.isDisabled = false;
19315
+ this.applyDisabledStyles();
19316
+ }
19317
+ /**
19318
+ * Disables the wallet button, preventing clicks and applying a visual disabled state.
19319
+ * When disabled, the button appears grayed out (`opacity: 0.5`) and does not
19320
+ * respond to user interaction (`pointer-events: none`). For accessibility, the
19321
+ * `aria-disabled="true"` attribute is also set on the container.
19322
+ *
19323
+ * Programmatic clicks (e.g. invoked by the wallet provider's SDK) are blocked
19324
+ * by an explicit guard inside the click handler — the button's wallet service
19325
+ * checks the disabled state before processing.
19326
+ *
19327
+ * Idempotent — calling on an already-disabled button has no effect.
19328
+ * Safe to call before `load()` (no-throw); the styles are applied once the
19329
+ * container element exists.
19330
+ *
19331
+ * @example
19332
+ * button.disable();
19333
+ */
19334
+ }, {
19335
+ key: "disable",
19336
+ value: function disable() {
19337
+ this.isDisabled = true;
19338
+ this.applyDisabledStyles();
19339
+ }
19340
+ /**
19341
+ * Applies the disabled / enabled visual state to the container element.
19342
+ * Reads `this.isDisabled` and toggles the corresponding CSS + ARIA attributes.
19343
+ *
19344
+ * @private
19345
+ */
19346
+ }, {
19347
+ key: "applyDisabledStyles",
19348
+ value: function applyDisabledStyles() {
19349
+ var element = this.container.getElement();
19350
+ if (!element) {
19351
+ return;
19352
+ }
19353
+ if (this.isDisabled) {
19354
+ element.style.pointerEvents = 'none';
19355
+ element.style.opacity = '0.5';
19356
+ element.setAttribute('aria-disabled', 'true');
19357
+ } else {
19358
+ element.style.pointerEvents = '';
19359
+ element.style.opacity = '';
19360
+ element.removeAttribute('aria-disabled');
19361
+ }
19362
+ }
19143
19363
  /**
19144
19364
  * Current method can change environment. By default environment = sandbox.
19145
19365
  * Also we can change domain alias for this environment. By default domain_alias = paydock.com
@@ -19629,7 +19849,9 @@ var SERVICE_GROUP;
19629
19849
  * Returns `undefined` if the resulting object has no remaining properties.
19630
19850
  */
19631
19851
  function stripEmpty(obj) {
19632
- if (!obj || _typeof$1(obj) !== 'object') return undefined;
19852
+ if (!obj || _typeof$1(obj) !== 'object') {
19853
+ return undefined;
19854
+ }
19633
19855
  var result = {};
19634
19856
  for (var _i = 0, _Object$entries = Object.entries(obj); _i < _Object$entries.length; _i++) {
19635
19857
  var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
@@ -19678,13 +19900,30 @@ var OpenWalletService = /*#__PURE__*/function () {
19678
19900
  this.serviceGroup = SERVICE_GROUP.WALLET;
19679
19901
  }
19680
19902
  /**
19681
- * Creates a One-Time Token (OTT) by sending the payment data to the API.
19682
- * Emits {@link EVENT.SUCCESS} on success or {@link EVENT.ERROR} on failure.
19903
+ * Returns whether the wallet button is currently disabled.
19904
+ * Reads the `aria-disabled` attribute from the container element — set by the
19905
+ * button class via {@link OpenWalletButtons.disable} / {@link OpenWalletButtons.enable}.
19683
19906
  *
19684
- * @param data - The payment data including amount, shipping, billing, card info, and ref token.
19685
- * @returns A promise resolving to the OTT response.
19907
+ * Used to short-circuit click handlers in concrete wallet services for clicks
19908
+ * that bypass the DOM `pointer-events: none` guard (e.g. invoked by the wallet
19909
+ * provider's SDK callback).
19910
+ *
19911
+ * @returns `true` if the container is marked as disabled, `false` otherwise.
19686
19912
  */
19687
19913
  return _createClass(OpenWalletService, [{
19914
+ key: "isButtonDisabled",
19915
+ value: function isButtonDisabled() {
19916
+ var element = this.container.getElement();
19917
+ return (element === null || element === void 0 ? void 0 : element.getAttribute('aria-disabled')) === 'true';
19918
+ }
19919
+ /**
19920
+ * Creates a One-Time Token (OTT) by sending the payment data to the API.
19921
+ * Emits {@link EVENT.SUCCESS} on success or {@link EVENT.ERROR} on failure.
19922
+ *
19923
+ * @param data - The payment data including amount, shipping, billing, card info, and ref token.
19924
+ * @returns A promise resolving to the OTT response.
19925
+ */
19926
+ }, {
19688
19927
  key: "createOTT",
19689
19928
  value: function createOTT(data) {
19690
19929
  var _this = this;
@@ -20205,6 +20444,9 @@ var ApplePayOpenWalletService = /*#__PURE__*/function (_OpenWalletService) {
20205
20444
  key: "onApplePayButtonClicked",
20206
20445
  value: function onApplePayButtonClicked() {
20207
20446
  var _this7 = this;
20447
+ if (this.isButtonDisabled()) {
20448
+ return;
20449
+ }
20208
20450
  var applePayApiVersion = getSupportedApplePayVersion();
20209
20451
  if (applePayApiVersion === 0) {
20210
20452
  this.handleOnUnavailable('Apple Pay version not supported');
@@ -20955,6 +21197,9 @@ var GooglePayOpenWalletService = /*#__PURE__*/function (_OpenWalletService) {
20955
21197
  key: "onGooglePayButtonClicked",
20956
21198
  value: function onGooglePayButtonClicked() {
20957
21199
  var _this5 = this;
21200
+ if (this.isButtonDisabled()) {
21201
+ return;
21202
+ }
20958
21203
  if (this.processingButtonClick) {
20959
21204
  console.warn('Google Pay button clicked while processing.');
20960
21205
  return;
@@ -22692,6 +22937,14 @@ var SRC = /*#__PURE__*/function () {
22692
22937
  if (_this.provider) {
22693
22938
  _this.provider.load();
22694
22939
  }
22940
+ })["catch"](function (error) {
22941
+ var _a;
22942
+ // Surface config-load failures (including transport-level ones now
22943
+ // rejected by ApiBase) instead of leaving the widget hung silently.
22944
+ _this.eventEmitter.emit(EVENT.CHECKOUT_ERROR, {
22945
+ type: EVENT_DATA_TYPE.CRITICAL_ERROR,
22946
+ data: (_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : 'Failed to load Click to Pay configuration.'
22947
+ });
22695
22948
  });
22696
22949
  }
22697
22950
  /**
@@ -44481,8 +44734,11 @@ exports.AfterpayOnSiteMessaging = AfterpayOnSiteMessaging;
44481
44734
  exports.Api = Api;
44482
44735
  exports.ApplePayOpenWalletButton = ApplePayOpenWalletButton;
44483
44736
  exports.ApplePayWalletButtonExpress = ApplePayWalletButtonExpress;
44737
+ exports.CANVAS_3DS_EVENT = CANVAS_3DS_EVENT;
44484
44738
  exports.CHECKOUT_BUTTON_EVENT = CHECKOUT_BUTTON_EVENT;
44739
+ exports.CHECKOUT_EVENT = EVENT$2;
44485
44740
  exports.Canvas3ds = Canvas3ds;
44741
+ exports.Canvas3dsTokenFormat = Canvas3dsTokenFormat;
44486
44742
  exports.Checkout = Checkout;
44487
44743
  exports.ClickToPay = ClickToPay;
44488
44744
  exports.Configuration = Configuration;
@@ -44499,6 +44755,9 @@ exports.HtmlPaymentSourceWidget = HtmlPaymentSourceWidget;
44499
44755
  exports.HtmlWidget = HtmlWidget;
44500
44756
  exports.InstructionDebugger = InstructionDebugger;
44501
44757
  exports.MultiWidget = MultiWidget;
44758
+ exports.PAYMENT_EXPIRED = PAYMENT_EXPIRED;
44759
+ exports.PAYMENT_FAILURE = PAYMENT_FAILURE;
44760
+ exports.PAYMENT_SUCCESSFUL = PAYMENT_SUCCESSFUL;
44502
44761
  exports.PAYMENT_TYPE = PAYMENT_TYPE;
44503
44762
  exports.PayPalDataCollector = PayPalDataCollector;
44504
44763
  exports.PayPalSavePaymentSourceWidget = PayPalSavePaymentSourceWidget;