@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.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.143.0';
1196
-
1197
957
  function isFunction(value) {
1198
958
  return typeof value === 'function';
1199
959
  }
@@ -1851,6 +1611,246 @@ var BehaviorSubject = (function (_super) {
1851
1611
  return BehaviorSubject;
1852
1612
  }(Subject));
1853
1613
 
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
1854
  var ACCESS_HEADER_NAME = {
1855
1855
  accessToken: 'x-access-token',
1856
1856
  publicKey: 'x-user-public-key'
@@ -1941,6 +1941,139 @@ var AccessToken = /*#__PURE__*/function () {
1941
1941
  }]);
1942
1942
  }();
1943
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;
2029
+ }
2030
+ }, {
2031
+ key: "setPurpose",
2032
+ value: function setPurpose(purpose) {
2033
+ this.purpose = purpose;
2034
+ }
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);
2048
+ }
2049
+ }]);
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
+ }
2076
+
1944
2077
  var HttpRequest = /*#__PURE__*/function () {
1945
2078
  function HttpRequest(request) {
1946
2079
  _classCallCheck(this, HttpRequest);
@@ -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, function (err) {
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, _reject) {
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) {
@@ -4802,127 +4975,162 @@ var Api = /*#__PURE__*/function (_ApiBase) {
4802
4975
  }]);
4803
4976
  }(ApiBase);
4804
4977
 
4805
- var Url = /*#__PURE__*/function () {
4806
- function Url() {
4807
- _classCallCheck(this, Url);
4978
+ var WALLET_CAPTURE_LINK = '/v1/charges/wallet/capture';
4979
+ var WALLET_CALLBACK_LINK = '/v1/charges/wallet/callback';
4980
+ var STANDALONE_3DS_PROCESS_LINK = '/v1/charges/standalone-3ds/process';
4981
+ var STANDALONE_3DS_HANDLE_LINK = '/v1/charges/standalone-3ds/handle';
4982
+ var ApiChargeInternal = /*#__PURE__*/function () {
4983
+ function ApiChargeInternal(api) {
4984
+ _classCallCheck(this, ApiChargeInternal);
4985
+ this.api = api;
4808
4986
  }
4809
- return _createClass(Url, null, [{
4810
- key: "extendSearchParams",
4811
- value: function extendSearchParams(uri, key, val) {
4812
- return uri.replace(new RegExp("([?&]" + key + "(?=[=&#]|$)[^#&]*|(?=#|$))"), "&" + key + "=" + encodeURIComponent(val)).replace(/^([^?&]+)&/, "$1?");
4987
+ return _createClass(ApiChargeInternal, [{
4988
+ key: "walletCapture",
4989
+ value: function walletCapture(payload) {
4990
+ return this.api.getClientPromise('POST', WALLET_CAPTURE_LINK).send(payload);
4813
4991
  }
4814
4992
  }, {
4815
- key: "serialize",
4816
- value: function serialize(params) {
4817
- return Object.keys(params).map(function (key) {
4818
- return encodeURIComponent(key) + '=' + encodeURIComponent(params[key]);
4819
- }).join('&');
4993
+ key: "walletCallback",
4994
+ value: function walletCallback(payload) {
4995
+ return this.api.getClientPromise('POST', WALLET_CALLBACK_LINK).send(payload);
4996
+ }
4997
+ }, {
4998
+ key: "standalone3dsProcess",
4999
+ value: function standalone3dsProcess(payload) {
5000
+ return this.api.getClientPromise('POST', STANDALONE_3DS_PROCESS_LINK).send(payload);
5001
+ }
5002
+ }, {
5003
+ key: "standalone3dsHandle",
5004
+ value: function standalone3dsHandle() {
5005
+ return this.api.getClientPromise('GET', STANDALONE_3DS_HANDLE_LINK).send(undefined);
4820
5006
  }
4821
5007
  }]);
4822
5008
  }();
4823
5009
 
4824
- var Uuid = /*#__PURE__*/function () {
4825
- function Uuid() {
4826
- _classCallCheck(this, Uuid);
5010
+ var CALLBACK_LINK = '/v1/checkouts/callback';
5011
+ var INSTRUCTION_LINK = '/v1/checkouts/instruction';
5012
+ var STATUS_LINK = '/v1/checkouts';
5013
+ var ApiCheckoutInternal = /*#__PURE__*/function () {
5014
+ function ApiCheckoutInternal(api) {
5015
+ _classCallCheck(this, ApiCheckoutInternal);
5016
+ this.api = api;
5017
+ this.getInstructionLink = function () {
5018
+ return "".concat(INSTRUCTION_LINK, "?time=").concat(Date.now());
5019
+ };
4827
5020
  }
4828
- return _createClass(Uuid, null, [{
4829
- key: "generate",
4830
- value: function generate() {
4831
- if (typeof window !== "undefined" && typeof window.crypto !== "undefined" && typeof window.crypto.getRandomValues !== "undefined") {
4832
- var buf = new Uint16Array(8);
4833
- window.crypto.getRandomValues(buf);
4834
- 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]);
4835
- } else {
4836
- return this.random() + this.random() + "-" + this.random() + "-" + this.random() + "-" + this.random() + "-" + this.random() + this.random() + this.random();
4837
- }
5021
+ return _createClass(ApiCheckoutInternal, [{
5022
+ key: "instructions",
5023
+ value: function instructions() {
5024
+ return this.api.requestObservable('GET', this.getInstructionLink(), {});
4838
5025
  }
4839
5026
  }, {
4840
- key: "hash",
4841
- value: function hash(number) {
4842
- var hash = number.toString(16);
4843
- while (hash.length < 4) {
4844
- hash = "0" + hash;
4845
- }
4846
- return hash;
5027
+ key: "callback",
5028
+ value: function callback(payload) {
5029
+ return this.api.getClientPromise('POST', CALLBACK_LINK).send(payload);
4847
5030
  }
4848
5031
  }, {
4849
- key: "random",
4850
- value: function random() {
4851
- return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
5032
+ key: "status",
5033
+ value: function status(id) {
5034
+ return this.api.getClientPromise('GET', "".concat(STATUS_LINK, "/").concat(id)).send('');
4852
5035
  }
4853
5036
  }]);
4854
5037
  }();
4855
5038
 
4856
- var WIDGET_LINK = '/remote-action';
4857
- var VAULT_DISPLAY_WIDGET_LINK = '/vault-display';
4858
- var PAYMENT_SOURCE_LINK = '/payment-sources';
4859
- var SECURE_3D = '/3ds/webhook';
4860
- var FLYPAY_LINK = '/wallet/flypay';
4861
- var FLYPAY_LOGO_LINK = '/images/coles-pay-logo.png';
4862
- var MESSAGE_WIDGET_LINK = '/message-widget';
4863
- var MASTERCARD_SRC = '/secure-remote-commerce/mastercard';
4864
- var Link = /*#__PURE__*/function () {
4865
- function Link(linkResource) {
4866
- _classCallCheck(this, Link);
4867
- this.params = {};
4868
- this.widgetId = Uuid.generate();
4869
- this.linkResource = linkResource;
4870
- this.env = new Env(WIDGET_URL);
4871
- this.setParams({
4872
- widget_id: this.widgetId
4873
- });
5039
+ var GET_WALLET_CONFIG = '/v1/gateways/:gateway_id/wallet-config';
5040
+ var ApiGatewayInternal = /*#__PURE__*/function () {
5041
+ function ApiGatewayInternal(api) {
5042
+ _classCallCheck(this, ApiGatewayInternal);
5043
+ this.api = api;
4874
5044
  }
4875
- return _createClass(Link, [{
4876
- key: "getNetUrl",
4877
- value: function getNetUrl() {
4878
- return this.env.getConf().url + this.linkResource;
5045
+ return _createClass(ApiGatewayInternal, [{
5046
+ key: "getWalletConfig",
5047
+ value: function getWalletConfig(gateway_id) {
5048
+ var url = GET_WALLET_CONFIG.replace(':gateway_id', gateway_id);
5049
+ return this.api.getClientPromise('GET', url).send(undefined);
4879
5050
  }
4880
- }, {
4881
- key: "getUrl",
4882
- value: function getUrl() {
4883
- var url = this.getNetUrl();
4884
- var params = this.getParams();
4885
- for (var key in params) {
4886
- if (params.hasOwnProperty(key)) url = Url.extendSearchParams(url, key, params[key]);
4887
- }
4888
- return url;
5051
+ }]);
5052
+ }();
5053
+
5054
+ var CREATE_OTT = '/v1/payment_sources/tokens';
5055
+ var CREATE_SESSION = '/v1/payment_sources/payment-session';
5056
+ var ApiPaymentSourceInternal = /*#__PURE__*/function () {
5057
+ function ApiPaymentSourceInternal(api) {
5058
+ _classCallCheck(this, ApiPaymentSourceInternal);
5059
+ this.api = api;
5060
+ }
5061
+ return _createClass(ApiPaymentSourceInternal, [{
5062
+ key: "createOTT",
5063
+ value: function createOTT(payload) {
5064
+ return this.api.getClientPromise('POST', CREATE_OTT).send(payload);
4889
5065
  }
4890
5066
  }, {
4891
- key: "setParams",
4892
- value: function setParams(params) {
4893
- this.params = _extends({}, this.params, params);
5067
+ key: "createSession",
5068
+ value: function createSession(payload) {
5069
+ return this.api.getClientPromise('POST', CREATE_SESSION).send(payload);
4894
5070
  }
4895
- }, {
4896
- key: "concatParams",
4897
- value: function concatParams(params) {
4898
- for (var key in params) {
4899
- if (!params.hasOwnProperty(key) || !params[key].length) continue;
4900
- if (typeof this.params[key] !== 'string') this.params[key] = '';
4901
- if (this.params[key].length) this.params[key] += ',' + params[key];else this.params[key] += params[key];
4902
- }
5071
+ }]);
5072
+ }();
5073
+
5074
+ var GET_CONFIG = '/v1/services/:service_id/config';
5075
+ var ApiServiceInternal = /*#__PURE__*/function () {
5076
+ function ApiServiceInternal(api) {
5077
+ _classCallCheck(this, ApiServiceInternal);
5078
+ this.api = api;
5079
+ }
5080
+ return _createClass(ApiServiceInternal, [{
5081
+ key: "getConfig",
5082
+ value: function getConfig(service_id) {
5083
+ var url = GET_CONFIG.replace(':service_id', service_id);
5084
+ return this.api.getClientPromise('GET', url).send(undefined);
5085
+ }
5086
+ }]);
5087
+ }();
5088
+ var SERVICE_TYPES;
5089
+ (function (SERVICE_TYPES) {
5090
+ SERVICE_TYPES["ACCERTIFY"] = "Accertify";
5091
+ SERVICE_TYPES["BOOKING"] = "Booking";
5092
+ SERVICE_TYPES["GPAYMENTS"] = "GPayments";
5093
+ SERVICE_TYPES["CLICK_TO_PAY"] = "ClickToPay";
5094
+ SERVICE_TYPES["MASTERCARD_NT"] = "MastercardSCOF";
5095
+ SERVICE_TYPES["VISA_NT"] = "VisaVTS";
5096
+ SERVICE_TYPES["FORTER"] = "Forter";
5097
+ SERVICE_TYPES["APPLE_PAY"] = "ApplePay";
5098
+ SERVICE_TYPES["GOOGLE_PAY"] = "GooglePay";
5099
+ })(SERVICE_TYPES || (SERVICE_TYPES = {}));
5100
+
5101
+ var ApiInternal = /*#__PURE__*/function (_ApiBase) {
5102
+ function ApiInternal() {
5103
+ _classCallCheck(this, ApiInternal);
5104
+ return _callSuper(this, ApiInternal, arguments);
5105
+ }
5106
+ _inherits(ApiInternal, _ApiBase);
5107
+ return _createClass(ApiInternal, [{
5108
+ key: "charge",
5109
+ value: function charge() {
5110
+ return new ApiChargeInternal(this);
4903
5111
  }
4904
5112
  }, {
4905
- key: "getParams",
4906
- value: function getParams() {
4907
- return this.params;
5113
+ key: "service",
5114
+ value: function service() {
5115
+ return new ApiServiceInternal(this);
4908
5116
  }
4909
5117
  }, {
4910
- key: "setEnv",
4911
- value: function setEnv(env, alias) {
4912
- this.env.setEnv(env, alias);
5118
+ key: "checkout",
5119
+ value: function checkout() {
5120
+ return new ApiCheckoutInternal(this);
4913
5121
  }
4914
5122
  }, {
4915
- key: "getEnv",
4916
- value: function getEnv() {
4917
- return this.env.getEnv();
5123
+ key: "gateway",
5124
+ value: function gateway() {
5125
+ return new ApiGatewayInternal(this);
4918
5126
  }
4919
5127
  }, {
4920
- key: "getBaseUrl",
4921
- value: function getBaseUrl() {
4922
- return this.env.getConf().url;
5128
+ key: "paymentSource",
5129
+ value: function paymentSource() {
5130
+ return new ApiPaymentSourceInternal(this);
4923
5131
  }
4924
5132
  }]);
4925
- }();
5133
+ }(ApiBase);
4926
5134
 
4927
5135
  var IFrame = /*#__PURE__*/function () {
4928
5136
  function IFrame(container) {
@@ -5119,10 +5327,10 @@ var IFrameEvent = /*#__PURE__*/function () {
5119
5327
  }();
5120
5328
 
5121
5329
  var hiddenStyle = {
5122
- visibility: "hidden",
5123
- border: "0",
5124
- width: "0",
5125
- height: "0"
5330
+ visibility: 'hidden',
5331
+ border: '0',
5332
+ width: '0',
5333
+ height: '0'
5126
5334
  };
5127
5335
  var PROCESS_STANDALONE_3DS_STATUS;
5128
5336
  (function (PROCESS_STANDALONE_3DS_STATUS) {
@@ -5144,14 +5352,30 @@ var IFRAME_STATUS;
5144
5352
  IFRAME_STATUS["TIMEOUT"] = "AuthTimedOut";
5145
5353
  IFRAME_STATUS["INVALID"] = "invalid_event";
5146
5354
  })(IFRAME_STATUS || (IFRAME_STATUS = {}));
5355
+ /**
5356
+ * Event name constants emitted during the Standalone 3DS (GPayments) flow.
5357
+ * Used internally by `GPaymentsService` and re-exported publicly as `CANVAS_3DS_EVENT`.
5358
+ */
5147
5359
  var GPAYMENTS_EVENT = {
5360
+ /** Authentication succeeded. Payload: `Canvas3dsAuthPayload`. */
5148
5361
  AUTH_SUCCESS: 'chargeAuthSuccess',
5362
+ /** Authentication failed — covers issuer rejection, iframe timeout (`AuthTimedOut`), and invalid-event outcomes. Payload: `Canvas3dsAuthPayload`. */
5149
5363
  AUTH_ERROR: 'chargeAuthReject',
5364
+ /** Decoupled authentication — issuer will authenticate out-of-band. Payload: `Canvas3dsAuthPayload`. */
5150
5365
  DECOUPLED: 'chargeAuthDecoupled',
5366
+ /** Challenge required — issuer demands user interaction. Payload: `Canvas3dsAuthPayload`. */
5151
5367
  CHALLENGE: 'chargeAuthChallenge',
5368
+ /** Informational signal emitted by the GPayments flow. Internal — not part of the public typed surface. */
5152
5369
  INFO: 'chargeAuthInfo',
5370
+ /** Error during the flow (network, parsing, etc.). Payload: `Canvas3dsErrorPayload`. */
5153
5371
  ERROR: 'error'
5154
5372
  };
5373
+ /**
5374
+ * Public alias for GPAYMENTS_EVENT. Same object reference — no behavioral change.
5375
+ * Prefer `CANVAS_3DS_EVENT` in public-facing code; `GPAYMENTS_EVENT` remains for
5376
+ * backwards-compatible internal usage.
5377
+ */
5378
+ var CANVAS_3DS_EVENT = GPAYMENTS_EVENT;
5155
5379
  var GPaymentsService = /*#__PURE__*/function () {
5156
5380
  function GPaymentsService(container, api, eventEmitter) {
5157
5381
  _classCallCheck(this, GPaymentsService);
@@ -5179,20 +5403,22 @@ var GPaymentsService = /*#__PURE__*/function () {
5179
5403
  value: function initializeIFrames(initializationUrl, secondaryUrl, title) {
5180
5404
  var hideAuthorization = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
5181
5405
  var container = this.container.getElement();
5182
- if (!container) return;
5183
- var divAuthorization = document.createElement("div");
5184
- divAuthorization.setAttribute("id", "paydock_authorization_iframe");
5406
+ if (!container) {
5407
+ return;
5408
+ }
5409
+ var divAuthorization = document.createElement('div');
5410
+ divAuthorization.setAttribute('id', 'paydock_authorization_iframe');
5185
5411
  container.appendChild(divAuthorization);
5186
- this.browserAndChallengeContainer = new Container("#paydock_authorization_iframe");
5412
+ this.browserAndChallengeContainer = new Container('#paydock_authorization_iframe');
5187
5413
  this.iFrameAuthorization = new IFrame(this.browserAndChallengeContainer);
5188
5414
  this.iFrameAuthorization.load(initializationUrl, {
5189
5415
  title: title
5190
5416
  });
5191
5417
  if (secondaryUrl) {
5192
- var divSecondaryURL = document.createElement("div");
5193
- divSecondaryURL.setAttribute("id", "paydock_secondary_iframe");
5418
+ var divSecondaryURL = document.createElement('div');
5419
+ divSecondaryURL.setAttribute('id', 'paydock_secondary_iframe');
5194
5420
  container.appendChild(divSecondaryURL);
5195
- this.monitoringContainer = new Container("#paydock_secondary_iframe");
5421
+ this.monitoringContainer = new Container('#paydock_secondary_iframe');
5196
5422
  this.iFrameSecondaryUrl = new IFrame(this.monitoringContainer);
5197
5423
  this.iFrameSecondaryUrl.load(secondaryUrl, {
5198
5424
  title: title
@@ -5208,8 +5434,12 @@ var GPaymentsService = /*#__PURE__*/function () {
5208
5434
  var hideAuthorization = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
5209
5435
  var _a;
5210
5436
  for (var prop in hiddenStyle) {
5211
- if (!hiddenStyle.hasOwnProperty(prop)) continue;
5212
- if (hideAuthorization) this.iFrameAuthorization.setStyle(prop, hiddenStyle[prop]);
5437
+ if (!Object.hasOwn(hiddenStyle, prop)) {
5438
+ continue;
5439
+ }
5440
+ if (hideAuthorization) {
5441
+ this.iFrameAuthorization.setStyle(prop, hiddenStyle[prop]);
5442
+ }
5213
5443
  (_a = this.iFrameSecondaryUrl) === null || _a === void 0 ? void 0 : _a.setStyle(prop, hiddenStyle[prop]);
5214
5444
  }
5215
5445
  }
@@ -5219,13 +5449,17 @@ var GPaymentsService = /*#__PURE__*/function () {
5219
5449
  var _this = this;
5220
5450
  this.iFrameEvent.on(EVENT$5.CHARGE_AUTH, widgetId, function (data) {
5221
5451
  if (data.status === IFRAME_STATUS.SKIPPED || data.status === IFRAME_STATUS.FINISHED) {
5222
- if (data.info) _this.eventEmitter.emit(GPAYMENTS_EVENT.INFO, {
5223
- info: data.info
5224
- });
5452
+ if (data.info) {
5453
+ _this.eventEmitter.emit(GPAYMENTS_EVENT.INFO, {
5454
+ info: data.info
5455
+ });
5456
+ }
5225
5457
  _this.performAuthentication(data);
5226
- } else if (data.status === IFRAME_STATUS.TIMEOUT || data.status === IFRAME_STATUS.INVALID) _this.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this.parseHandleResponse({
5227
- status: data.status
5228
- }, data.charge_3ds_id));
5458
+ } else if (data.status === IFRAME_STATUS.TIMEOUT || data.status === IFRAME_STATUS.INVALID) {
5459
+ _this.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this.parseHandleResponse({
5460
+ status: data.status
5461
+ }, data.charge_3ds_id));
5462
+ }
5229
5463
  });
5230
5464
  this.iFrameEvent.on(EVENT$5.CHARGE_AUTH_SUCCESS, widgetId, function (data) {
5231
5465
  _this.processResult(data.charge_3ds_id);
@@ -5265,13 +5499,19 @@ var GPaymentsService = /*#__PURE__*/function () {
5265
5499
  key: "processResult",
5266
5500
  value: function processResult(charge3dsId) {
5267
5501
  var _this2 = this;
5268
- if (this.resultRead) return;
5502
+ if (this.resultRead) {
5503
+ return;
5504
+ }
5269
5505
  this.resultRead = true;
5270
5506
  this.api.charge().standalone3dsHandle().then(function (result) {
5271
5507
  var _a;
5272
5508
  _this2.iFrameAuthorization.remove();
5273
5509
  (_a = _this2.iFrameSecondaryUrl) === null || _a === void 0 ? void 0 : _a.remove();
5274
- 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));
5510
+ if (result.status === PROCESS_STANDALONE_3DS_STATUS.SUCCESS) {
5511
+ _this2.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_SUCCESS, _this2.parseResultData(result, charge3dsId));
5512
+ } else {
5513
+ _this2.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this2.parseResultData(result, charge3dsId));
5514
+ }
5275
5515
  }, function (err) {
5276
5516
  _this2.eventEmitter.emit(GPAYMENTS_EVENT.ERROR, _this2.parseError(err, charge3dsId));
5277
5517
  });
@@ -5296,10 +5536,16 @@ var GPaymentsService = /*#__PURE__*/function () {
5296
5536
  key: "doPolling",
5297
5537
  value: function doPolling(url, charge3dsId) {
5298
5538
  var _this3 = this;
5299
- this.externalAPI("GET", url).then(function (data) {
5300
- if (!data.event || data.event === "AuthResultNotReady") setTimeout(function () {
5301
- _this3.doPolling(url, charge3dsId);
5302
- }, 2000);else if (data.event === 'AuthResultReady') _this3.processResult(charge3dsId);else throw new Error("Event not supported");
5539
+ this.externalAPI('GET', url).then(function (data) {
5540
+ if (!data.event || data.event === 'AuthResultNotReady') {
5541
+ setTimeout(function () {
5542
+ _this3.doPolling(url, charge3dsId);
5543
+ }, 2000);
5544
+ } else if (data.event === 'AuthResultReady') {
5545
+ _this3.processResult(charge3dsId);
5546
+ } else {
5547
+ throw new Error('Event not supported');
5548
+ }
5303
5549
  })["catch"](function (err) {
5304
5550
  return _this3.eventEmitter.emit(GPAYMENTS_EVENT.ERROR, _this3.parseError(err, charge3dsId));
5305
5551
  });
@@ -5316,16 +5562,24 @@ var GPaymentsService = /*#__PURE__*/function () {
5316
5562
  charge_3ds_id: charge_3ds_id
5317
5563
  }).then(function (authenticationResult) {
5318
5564
  var _a, _b;
5319
- 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) {
5565
+ if (authenticationResult.status === AUTHENTICATION_STATUS.SUCCESS) {
5566
+ _this4.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_SUCCESS, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));
5567
+ } else if (authenticationResult.status === AUTHENTICATION_STATUS.PENDING) {
5320
5568
  if ((_a = authenticationResult === null || authenticationResult === void 0 ? void 0 : authenticationResult.result) === null || _a === void 0 ? void 0 : _a.challenge) {
5321
5569
  _this4.eventEmitter.emit(GPAYMENTS_EVENT.CHALLENGE, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));
5322
5570
  _this4.initializeIFrames(authenticationResult.result.challenge_url, undefined, 'Authentication Challenge', false);
5323
- if (authenticationResult.result.secondary_url) _this4.doPolling(authenticationResult.result.secondary_url, charge_3ds_id);
5571
+ if (authenticationResult.result.secondary_url) {
5572
+ _this4.doPolling(authenticationResult.result.secondary_url, charge_3ds_id);
5573
+ }
5324
5574
  } else if ((_b = authenticationResult === null || authenticationResult === void 0 ? void 0 : authenticationResult.result) === null || _b === void 0 ? void 0 : _b.decoupled_challenge) {
5325
5575
  _this4.eventEmitter.emit(GPAYMENTS_EVENT.DECOUPLED, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));
5326
- if (authenticationResult.result.secondary_url) _this4.doPolling(authenticationResult.result.secondary_url, charge_3ds_id);
5576
+ if (authenticationResult.result.secondary_url) {
5577
+ _this4.doPolling(authenticationResult.result.secondary_url, charge_3ds_id);
5578
+ }
5327
5579
  }
5328
- } else return _this4.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));
5580
+ } else {
5581
+ return _this4.eventEmitter.emit(GPAYMENTS_EVENT.AUTH_ERROR, _this4.parseHandleResponse(authenticationResult, charge_3ds_id));
5582
+ }
5329
5583
  }, function (err) {
5330
5584
  _this4.eventEmitter.emit(GPAYMENTS_EVENT.ERROR, _this4.parseError(err, charge_3ds_id));
5331
5585
  });
@@ -5333,192 +5587,159 @@ var GPaymentsService = /*#__PURE__*/function () {
5333
5587
  }]);
5334
5588
  }();
5335
5589
 
5336
- var WALLET_CAPTURE_LINK = '/v1/charges/wallet/capture';
5337
- var WALLET_CALLBACK_LINK = '/v1/charges/wallet/callback';
5338
- var STANDALONE_3DS_PROCESS_LINK = '/v1/charges/standalone-3ds/process';
5339
- var STANDALONE_3DS_HANDLE_LINK = '/v1/charges/standalone-3ds/handle';
5340
- var ApiChargeInternal = /*#__PURE__*/function () {
5341
- function ApiChargeInternal(api) {
5342
- _classCallCheck(this, ApiChargeInternal);
5343
- this.api = api;
5590
+ var STANDALONE_3DS_GATEWAYS = {
5591
+ GPAYMENTS: 'GPayments'
5592
+ };
5593
+ var Standalone3dsService = /*#__PURE__*/function () {
5594
+ function Standalone3dsService(container, eventEmitter) {
5595
+ _classCallCheck(this, Standalone3dsService);
5596
+ this.env = DEFAULT_ENV;
5597
+ this.container = container;
5598
+ this.eventEmitter = eventEmitter;
5344
5599
  }
5345
- return _createClass(ApiChargeInternal, [{
5346
- key: "walletCapture",
5347
- value: function walletCapture(payload) {
5348
- return this.api.getClientPromise('POST', WALLET_CAPTURE_LINK).send(payload);
5349
- }
5350
- }, {
5351
- key: "walletCallback",
5352
- value: function walletCallback(payload) {
5353
- return this.api.getClientPromise('POST', WALLET_CALLBACK_LINK).send(payload);
5354
- }
5355
- }, {
5356
- key: "standalone3dsProcess",
5357
- value: function standalone3dsProcess(payload) {
5358
- return this.api.getClientPromise('POST', STANDALONE_3DS_PROCESS_LINK).send(payload);
5600
+ return _createClass(Standalone3dsService, [{
5601
+ key: "load",
5602
+ value: function load(token, options) {
5603
+ var parsedToken = AccessToken.validateJWT(token);
5604
+ if (!parsedToken) {
5605
+ throw new Error('Invalid charge token');
5606
+ }
5607
+ var tokenData = AccessToken.extractData(parsedToken.body);
5608
+ var api = new ApiInternal(token, API_AUTH_TYPE.TOKEN);
5609
+ api.setEnv(this.env, this.alias);
5610
+ switch (tokenData.service_type) {
5611
+ case STANDALONE_3DS_GATEWAYS.GPAYMENTS:
5612
+ new GPaymentsService(this.container, api, this.eventEmitter).load(tokenData, options.title);
5613
+ break;
5614
+ }
5359
5615
  }
5360
5616
  }, {
5361
- key: "standalone3dsHandle",
5362
- value: function standalone3dsHandle() {
5363
- return this.api.getClientPromise('GET', STANDALONE_3DS_HANDLE_LINK).send(undefined);
5617
+ key: "setEnv",
5618
+ value: function setEnv(env, alias) {
5619
+ this.env = env;
5620
+ this.alias = alias;
5364
5621
  }
5365
5622
  }]);
5366
5623
  }();
5367
5624
 
5368
- var CALLBACK_LINK = '/v1/checkouts/callback';
5369
- var INSTRUCTION_LINK = '/v1/checkouts/instruction';
5370
- var STATUS_LINK = '/v1/checkouts';
5371
- var ApiCheckoutInternal = /*#__PURE__*/function () {
5372
- function ApiCheckoutInternal(api) {
5373
- _classCallCheck(this, ApiCheckoutInternal);
5374
- this.api = api;
5375
- this.getInstructionLink = function () {
5376
- return "".concat(INSTRUCTION_LINK, "?time=").concat(Date.now());
5377
- };
5625
+ var Url = /*#__PURE__*/function () {
5626
+ function Url() {
5627
+ _classCallCheck(this, Url);
5378
5628
  }
5379
- return _createClass(ApiCheckoutInternal, [{
5380
- key: "instructions",
5381
- value: function instructions() {
5382
- return this.api.requestObservable('GET', this.getInstructionLink(), {});
5383
- }
5384
- }, {
5385
- key: "callback",
5386
- value: function callback(payload) {
5387
- return this.api.getClientPromise('POST', CALLBACK_LINK).send(payload);
5629
+ return _createClass(Url, null, [{
5630
+ key: "extendSearchParams",
5631
+ value: function extendSearchParams(uri, key, val) {
5632
+ return uri.replace(new RegExp("([?&]" + key + "(?=[=&#]|$)[^#&]*|(?=#|$))"), "&" + key + "=" + encodeURIComponent(val)).replace(/^([^?&]+)&/, "$1?");
5388
5633
  }
5389
5634
  }, {
5390
- key: "status",
5391
- value: function status(id) {
5392
- return this.api.getClientPromise('GET', "".concat(STATUS_LINK, "/").concat(id)).send('');
5393
- }
5394
- }]);
5395
- }();
5396
-
5397
- var GET_WALLET_CONFIG = '/v1/gateways/:gateway_id/wallet-config';
5398
- var ApiGatewayInternal = /*#__PURE__*/function () {
5399
- function ApiGatewayInternal(api) {
5400
- _classCallCheck(this, ApiGatewayInternal);
5401
- this.api = api;
5402
- }
5403
- return _createClass(ApiGatewayInternal, [{
5404
- key: "getWalletConfig",
5405
- value: function getWalletConfig(gateway_id) {
5406
- var url = GET_WALLET_CONFIG.replace(':gateway_id', gateway_id);
5407
- return this.api.getClientPromise('GET', url).send(undefined);
5635
+ key: "serialize",
5636
+ value: function serialize(params) {
5637
+ return Object.keys(params).map(function (key) {
5638
+ return encodeURIComponent(key) + '=' + encodeURIComponent(params[key]);
5639
+ }).join('&');
5408
5640
  }
5409
5641
  }]);
5410
5642
  }();
5411
5643
 
5412
- var CREATE_OTT = '/v1/payment_sources/tokens';
5413
- var CREATE_SESSION = '/v1/payment_sources/payment-session';
5414
- var ApiPaymentSourceInternal = /*#__PURE__*/function () {
5415
- function ApiPaymentSourceInternal(api) {
5416
- _classCallCheck(this, ApiPaymentSourceInternal);
5417
- this.api = api;
5644
+ var Uuid = /*#__PURE__*/function () {
5645
+ function Uuid() {
5646
+ _classCallCheck(this, Uuid);
5418
5647
  }
5419
- return _createClass(ApiPaymentSourceInternal, [{
5420
- key: "createOTT",
5421
- value: function createOTT(payload) {
5422
- return this.api.getClientPromise('POST', CREATE_OTT).send(payload);
5648
+ return _createClass(Uuid, null, [{
5649
+ key: "generate",
5650
+ value: function generate() {
5651
+ if (typeof window !== "undefined" && typeof window.crypto !== "undefined" && typeof window.crypto.getRandomValues !== "undefined") {
5652
+ var buf = new Uint16Array(8);
5653
+ window.crypto.getRandomValues(buf);
5654
+ 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]);
5655
+ } else {
5656
+ return this.random() + this.random() + "-" + this.random() + "-" + this.random() + "-" + this.random() + "-" + this.random() + this.random() + this.random();
5657
+ }
5423
5658
  }
5424
5659
  }, {
5425
- key: "createSession",
5426
- value: function createSession(payload) {
5427
- return this.api.getClientPromise('POST', CREATE_SESSION).send(payload);
5660
+ key: "hash",
5661
+ value: function hash(number) {
5662
+ var hash = number.toString(16);
5663
+ while (hash.length < 4) {
5664
+ hash = "0" + hash;
5665
+ }
5666
+ return hash;
5428
5667
  }
5429
- }]);
5430
- }();
5431
-
5432
- var GET_CONFIG = '/v1/services/:service_id/config';
5433
- var ApiServiceInternal = /*#__PURE__*/function () {
5434
- function ApiServiceInternal(api) {
5435
- _classCallCheck(this, ApiServiceInternal);
5436
- this.api = api;
5437
- }
5438
- return _createClass(ApiServiceInternal, [{
5439
- key: "getConfig",
5440
- value: function getConfig(service_id) {
5441
- var url = GET_CONFIG.replace(':service_id', service_id);
5442
- return this.api.getClientPromise('GET', url).send(undefined);
5668
+ }, {
5669
+ key: "random",
5670
+ value: function random() {
5671
+ return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
5443
5672
  }
5444
5673
  }]);
5445
5674
  }();
5446
- var SERVICE_TYPES;
5447
- (function (SERVICE_TYPES) {
5448
- SERVICE_TYPES["ACCERTIFY"] = "Accertify";
5449
- SERVICE_TYPES["BOOKING"] = "Booking";
5450
- SERVICE_TYPES["GPAYMENTS"] = "GPayments";
5451
- SERVICE_TYPES["CLICK_TO_PAY"] = "ClickToPay";
5452
- SERVICE_TYPES["MASTERCARD_NT"] = "MastercardSCOF";
5453
- SERVICE_TYPES["VISA_NT"] = "VisaVTS";
5454
- SERVICE_TYPES["FORTER"] = "Forter";
5455
- SERVICE_TYPES["APPLE_PAY"] = "ApplePay";
5456
- SERVICE_TYPES["GOOGLE_PAY"] = "GooglePay";
5457
- })(SERVICE_TYPES || (SERVICE_TYPES = {}));
5458
5675
 
5459
- var ApiInternal = /*#__PURE__*/function (_ApiBase) {
5460
- function ApiInternal() {
5461
- _classCallCheck(this, ApiInternal);
5462
- return _callSuper(this, ApiInternal, arguments);
5676
+ var WIDGET_LINK = '/remote-action';
5677
+ var VAULT_DISPLAY_WIDGET_LINK = '/vault-display';
5678
+ var PAYMENT_SOURCE_LINK = '/payment-sources';
5679
+ var SECURE_3D = '/3ds/webhook';
5680
+ var FLYPAY_LINK = '/wallet/flypay';
5681
+ var FLYPAY_LOGO_LINK = '/images/coles-pay-logo.png';
5682
+ var MESSAGE_WIDGET_LINK = '/message-widget';
5683
+ var MASTERCARD_SRC = '/secure-remote-commerce/mastercard';
5684
+ var Link = /*#__PURE__*/function () {
5685
+ function Link(linkResource) {
5686
+ _classCallCheck(this, Link);
5687
+ this.params = {};
5688
+ this.widgetId = Uuid.generate();
5689
+ this.linkResource = linkResource;
5690
+ this.env = new Env(WIDGET_URL);
5691
+ this.setParams({
5692
+ widget_id: this.widgetId
5693
+ });
5463
5694
  }
5464
- _inherits(ApiInternal, _ApiBase);
5465
- return _createClass(ApiInternal, [{
5466
- key: "charge",
5467
- value: function charge() {
5468
- return new ApiChargeInternal(this);
5695
+ return _createClass(Link, [{
5696
+ key: "getNetUrl",
5697
+ value: function getNetUrl() {
5698
+ return this.env.getConf().url + this.linkResource;
5469
5699
  }
5470
5700
  }, {
5471
- key: "service",
5472
- value: function service() {
5473
- return new ApiServiceInternal(this);
5701
+ key: "getUrl",
5702
+ value: function getUrl() {
5703
+ var url = this.getNetUrl();
5704
+ var params = this.getParams();
5705
+ for (var key in params) {
5706
+ if (params.hasOwnProperty(key)) url = Url.extendSearchParams(url, key, params[key]);
5707
+ }
5708
+ return url;
5474
5709
  }
5475
5710
  }, {
5476
- key: "checkout",
5477
- value: function checkout() {
5478
- return new ApiCheckoutInternal(this);
5711
+ key: "setParams",
5712
+ value: function setParams(params) {
5713
+ this.params = _extends({}, this.params, params);
5479
5714
  }
5480
5715
  }, {
5481
- key: "gateway",
5482
- value: function gateway() {
5483
- return new ApiGatewayInternal(this);
5716
+ key: "concatParams",
5717
+ value: function concatParams(params) {
5718
+ for (var key in params) {
5719
+ if (!params.hasOwnProperty(key) || !params[key].length) continue;
5720
+ if (typeof this.params[key] !== 'string') this.params[key] = '';
5721
+ if (this.params[key].length) this.params[key] += ',' + params[key];else this.params[key] += params[key];
5722
+ }
5484
5723
  }
5485
5724
  }, {
5486
- key: "paymentSource",
5487
- value: function paymentSource() {
5488
- return new ApiPaymentSourceInternal(this);
5489
- }
5490
- }]);
5491
- }(ApiBase);
5492
-
5493
- var STANDALONE_3DS_GATEWAYS = {
5494
- GPAYMENTS: "GPayments"
5495
- };
5496
- var Standalone3dsService = /*#__PURE__*/function () {
5497
- function Standalone3dsService(container, eventEmitter) {
5498
- _classCallCheck(this, Standalone3dsService);
5499
- this.env = DEFAULT_ENV;
5500
- this.container = container;
5501
- this.eventEmitter = eventEmitter;
5502
- }
5503
- return _createClass(Standalone3dsService, [{
5504
- key: "load",
5505
- value: function load(token, options) {
5506
- var parsedToken = AccessToken.validateJWT(token);
5507
- if (!parsedToken) throw new Error("Invalid charge token");
5508
- var tokenData = AccessToken.extractData(parsedToken.body);
5509
- var api = new ApiInternal(token, API_AUTH_TYPE.TOKEN);
5510
- api.setEnv(this.env, this.alias);
5511
- switch (tokenData.service_type) {
5512
- case STANDALONE_3DS_GATEWAYS.GPAYMENTS:
5513
- new GPaymentsService(this.container, api, this.eventEmitter).load(tokenData, options.title);
5514
- break;
5515
- }
5725
+ key: "getParams",
5726
+ value: function getParams() {
5727
+ return this.params;
5516
5728
  }
5517
5729
  }, {
5518
5730
  key: "setEnv",
5519
5731
  value: function setEnv(env, alias) {
5520
- this.env = env;
5521
- this.alias = alias;
5732
+ this.env.setEnv(env, alias);
5733
+ }
5734
+ }, {
5735
+ key: "getEnv",
5736
+ value: function getEnv() {
5737
+ return this.env.getEnv();
5738
+ }
5739
+ }, {
5740
+ key: "getBaseUrl",
5741
+ value: function getBaseUrl() {
5742
+ return this.env.getConf().url;
5522
5743
  }
5523
5744
  }]);
5524
5745
  }();
@@ -5558,7 +5779,7 @@ var TOKEN_FORMAT$2;
5558
5779
  * @param {string} CHARGE_AUTH_CHALLENGE=chargeAuthChallenge
5559
5780
  * @param {string} CHARGE_AUTH_INFO=chargeAuthInfo
5560
5781
  * @param {string} ERROR=error
5561
- */
5782
+ */
5562
5783
  /**
5563
5784
  * Class Canvas3ds include method for working on html
5564
5785
  * @constructor
@@ -5594,13 +5815,21 @@ var Canvas3ds = /*#__PURE__*/function () {
5594
5815
  *
5595
5816
  */
5596
5817
  function load() {
5597
- if (this.token.format === TOKEN_FORMAT$2.HTML) this.iFrame.loadFromHtml(this.token.content, {
5598
- title: '3d secure authentication'
5599
- }, 'threeDSecure-iframe');else if (this.token.format === TOKEN_FORMAT$2.URL) this.iFrame.load(this.token.content, {
5600
- title: '3d secure authentication'
5601
- }, 'threeDSecure-iframe');else if (this.token.format === TOKEN_FORMAT$2.STANDALONE_3DS) this.standalone3dsService.load(this.token.content, {
5602
- title: '3d secure authentication'
5603
- });else console.error('Token contain unsupported payload');
5818
+ if (this.token.format === TOKEN_FORMAT$2.HTML) {
5819
+ this.iFrame.loadFromHtml(this.token.content, {
5820
+ title: '3d secure authentication'
5821
+ }, 'threeDSecure-iframe');
5822
+ } else if (this.token.format === TOKEN_FORMAT$2.URL) {
5823
+ this.iFrame.load(this.token.content, {
5824
+ title: '3d secure authentication'
5825
+ }, 'threeDSecure-iframe');
5826
+ } else if (this.token.format === TOKEN_FORMAT$2.STANDALONE_3DS) {
5827
+ this.standalone3dsService.load(this.token.content, {
5828
+ title: '3d secure authentication'
5829
+ });
5830
+ } else {
5831
+ console.error('Token contain unsupported payload');
5832
+ }
5604
5833
  }
5605
5834
  /**
5606
5835
  * Current method can change environment. By default environment = sandbox.
@@ -5617,7 +5846,9 @@ var Canvas3ds = /*#__PURE__*/function () {
5617
5846
  this.link.setEnv(env, alias);
5618
5847
  this.standalone3dsService.setEnv(env, alias);
5619
5848
  for (var index in this.configs) {
5620
- if (!this.configs.hasOwnProperty(index)) continue;
5849
+ if (!Object.hasOwn(this.configs, index)) {
5850
+ continue;
5851
+ }
5621
5852
  this.configs[index].setEnv(env, alias);
5622
5853
  }
5623
5854
  }
@@ -5627,34 +5858,45 @@ var Canvas3ds = /*#__PURE__*/function () {
5627
5858
  return this.link.getEnv();
5628
5859
  }
5629
5860
  /**
5630
- * Listen to events of widget
5861
+ * Listen to events of widget.
5631
5862
  *
5632
- * @example
5863
+ * Available event names are defined in {@link Canvas3dsEventMap} (typed) and
5864
+ * {@link CANVAS_3DS_EVENT} (string constants). Using a literal event name
5865
+ * narrows the callback payload via the typed overloads.
5633
5866
  *
5634
- * widget.on('chargeAuthReject', function (data) {
5635
- * console.log(data);
5867
+ * @example
5868
+ * // Callback form — payload is narrowed by the event name
5869
+ * widget.on('chargeAuthReject', (data) => {
5870
+ * console.log(data); // data is Canvas3dsAuthPayload | Canvas3dsChargeAuthEventPayload
5636
5871
  * });
5637
- * // or
5638
- * widget.on('chargeAuthReject').then(function (data) {
5639
- * console.log(data);
5872
+ *
5873
+ * // Promise form
5874
+ * widget.on('chargeAuthReject').then((data) => {
5875
+ * console.log(data);
5640
5876
  * });
5641
- * @param {string} eventName - Available event names [EVENT]{@link EVENT} [STANDALONE_3DS_EVENT]{@link STANDALONE_3DS_EVENT}
5642
- * @param {listener} [cb]
5643
- * @return {Promise<IEventData> | void}
5877
+ *
5878
+ * @param eventName - Event name from {@link Canvas3dsEventMap} or any string for dynamic events.
5879
+ * @param cb - Optional listener callback. If omitted, returns a Promise that resolves on the next emission.
5880
+ * @returns `void` when a callback is provided; otherwise a Promise that resolves with the event payload.
5644
5881
  */
5882
+ // biome-ignore lint/suspicious/noExplicitAny: implementation signature must accept any payload shape to satisfy all overloads above
5645
5883
  }, {
5646
5884
  key: "on",
5647
5885
  value: function on(eventName, cb) {
5648
5886
  var _this = this;
5649
5887
  if (this.token.format === TOKEN_FORMAT$2.STANDALONE_3DS) {
5650
- if (typeof cb === 'function') return this.eventEmitter.subscribe(eventName, cb);
5888
+ if (typeof cb === 'function') {
5889
+ return this.eventEmitter.subscribe(eventName, cb);
5890
+ }
5651
5891
  return new Promise(function (resolve) {
5652
5892
  return _this.eventEmitter.subscribe(eventName, function (res) {
5653
5893
  return resolve(res);
5654
5894
  });
5655
5895
  });
5656
5896
  } else {
5657
- if (typeof cb === 'function') return this.event.on(eventName, this.link.getParams().ref_id, cb);
5897
+ if (typeof cb === 'function') {
5898
+ return this.event.on(eventName, this.link.getParams().ref_id, cb);
5899
+ }
5658
5900
  return new Promise(function (resolve) {
5659
5901
  return _this.event.on(eventName, _this.link.getParams().ref_id, function (res) {
5660
5902
  return resolve(res);
@@ -5698,6 +5940,19 @@ var Canvas3ds = /*#__PURE__*/function () {
5698
5940
  }]);
5699
5941
  }();
5700
5942
 
5943
+ /**
5944
+ * Public, tree-shakeable alias for the internal `TOKEN_FORMAT` enum in canvas-3ds.ts.
5945
+ * Mirrors the string values of that enum without exposing the private enum itself.
5946
+ */
5947
+ var Canvas3dsTokenFormat = {
5948
+ /** Token whose `content` is a complete HTML page. The SDK renders it inside an iframe. */
5949
+ HTML: 'html',
5950
+ /** Token whose `content` is a URL. The SDK loads it inside an iframe. */
5951
+ URL: 'url',
5952
+ /** Token whose `content` describes a standalone 3DS service (e.g. GPayments). The SDK delegates to that service's flow. */
5953
+ STANDALONE_3DS: 'standalone_3ds'
5954
+ };
5955
+
5701
5956
  var Spinner = /*#__PURE__*/function () {
5702
5957
  function Spinner() {
5703
5958
  _classCallCheck(this, Spinner);
@@ -12783,108 +13038,6 @@ function getHandleCvv(configuration) {
12783
13038
  }
12784
13039
  }
12785
13040
 
12786
- var ERROR_CATEGORY = {
12787
- CONFIGURATION: 'configuration',
12788
- IDENTITY: 'identity_access_management',
12789
- INTERNAL: 'internal',
12790
- PROCESS: 'process',
12791
- RESOURCE: 'resource',
12792
- VALIDATION: 'validation'
12793
- };
12794
- var ERROR_CAUSE = {
12795
- ABORTED: 'aborted',
12796
- ACCESS_FORBIDDEN: 'access_forbidden',
12797
- ALREADY_EXISTS: 'already_exists',
12798
- CANCELED: 'canceled',
12799
- INVALID_CONFIGURATION: 'invalid_configuration',
12800
- INVALID_INPUT: 'invalid_input',
12801
- NOT_FOUND: 'not_found',
12802
- NOT_IMPLEMENTED: 'not_implemented',
12803
- RATE_LIMITED: 'rate_limited',
12804
- SERVER_BUSY: 'server_busy',
12805
- SERVICE_UNREACHABLE: 'service_unreachable',
12806
- UNAUTHORIZED: 'unauthorized',
12807
- UNKNOWN: 'unknown_error',
12808
- UNPROCESSABLE_ENTITY: 'unprocessable_entity'
12809
- };
12810
- var EventError = /*#__PURE__*/function (_Error) {
12811
- function EventError(cause, category, retryable, details) {
12812
- var _this;
12813
- _classCallCheck(this, EventError);
12814
- _this = _callSuper(this, EventError, [details.message]);
12815
- _this.cause = cause;
12816
- _this.category = category;
12817
- _this.retryable = retryable;
12818
- _this.details = details;
12819
- Object.setPrototypeOf(_this, EventError.prototype);
12820
- _this.name = EventError.name;
12821
- return _this;
12822
- }
12823
- _inherits(EventError, _Error);
12824
- return _createClass(EventError, [{
12825
- key: "toJSON",
12826
- value: function toJSON() {
12827
- return {
12828
- error: {
12829
- category: this.category,
12830
- cause: this.cause,
12831
- details: this.details,
12832
- retryable: this.retryable
12833
- }
12834
- };
12835
- }
12836
- }, {
12837
- key: "setContextId",
12838
- value: function setContextId(contextId) {
12839
- this.details.contextId = contextId;
12840
- }
12841
- }, {
12842
- key: "setPurpose",
12843
- value: function setPurpose(purpose) {
12844
- this.purpose = purpose;
12845
- }
12846
- }], [{
12847
- key: "create",
12848
- value: function create(cause, message) {
12849
- var contextId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
12850
- var retryable = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
12851
- var details = {
12852
- cause: cause,
12853
- contextId: contextId,
12854
- message: message,
12855
- timestamp: new Date().toISOString()
12856
- };
12857
- var category = getErrorCategory(cause);
12858
- return new EventError(cause, category, retryable, details);
12859
- }
12860
- }]);
12861
- }(/*#__PURE__*/_wrapNativeSuper(Error));
12862
- function getErrorCategory(cause) {
12863
- switch (cause) {
12864
- case ERROR_CAUSE.INVALID_CONFIGURATION:
12865
- return ERROR_CATEGORY.CONFIGURATION;
12866
- case ERROR_CAUSE.ACCESS_FORBIDDEN:
12867
- case ERROR_CAUSE.UNAUTHORIZED:
12868
- return ERROR_CATEGORY.IDENTITY;
12869
- case ERROR_CAUSE.SERVICE_UNREACHABLE:
12870
- case ERROR_CAUSE.NOT_IMPLEMENTED:
12871
- case ERROR_CAUSE.SERVER_BUSY:
12872
- return ERROR_CATEGORY.INTERNAL;
12873
- case ERROR_CAUSE.ABORTED:
12874
- case ERROR_CAUSE.CANCELED:
12875
- return ERROR_CATEGORY.PROCESS;
12876
- case ERROR_CAUSE.NOT_FOUND:
12877
- case ERROR_CAUSE.RATE_LIMITED:
12878
- return ERROR_CATEGORY.RESOURCE;
12879
- case ERROR_CAUSE.ALREADY_EXISTS:
12880
- case ERROR_CAUSE.INVALID_INPUT:
12881
- case ERROR_CAUSE.UNPROCESSABLE_ENTITY:
12882
- return ERROR_CATEGORY.VALIDATION;
12883
- default:
12884
- return ERROR_CATEGORY.INTERNAL;
12885
- }
12886
- }
12887
-
12888
13041
  function processEventError(err) {
12889
13042
  var cause;
12890
13043
  var message;
@@ -14864,7 +15017,6 @@ var InstructionCanvas3dsShow$1 = /*#__PURE__*/function (_InstructionHandler) {
14864
15017
  });
14865
15018
  canvas.on('chargeAuthReject', function () {
14866
15019
  var _a;
14867
- // **TODO add interface for chargeAuthReject event **//
14868
15020
  (_a = _this.checkoutWidget) === null || _a === void 0 ? void 0 : _a.fetchInstruction();
14869
15021
  _this.api.checkout().callback({
14870
15022
  event: 'callback.child_widget.status',
@@ -14881,13 +15033,13 @@ var InstructionCanvas3dsShow$1 = /*#__PURE__*/function (_InstructionHandler) {
14881
15033
  });
14882
15034
  canvas.on('error', function (event) {
14883
15035
  var _a;
14884
- // **TODO add interface for error event **//
14885
15036
  (_a = _this.checkoutWidget) === null || _a === void 0 ? void 0 : _a.fetchInstruction();
15037
+ var message = (event && _typeof$1(event) === 'object' && 'event' in event ? event.event : null) || 'error in 3ds widget';
14886
15038
  _this.api.checkout().callback({
14887
15039
  event: 'callback.child_widget.status',
14888
15040
  payload: {
14889
15041
  status: 'error',
14890
- message: (event === null || event === void 0 ? void 0 : event.event) || 'error in 3ds widget'
15042
+ message: message
14891
15043
  }
14892
15044
  }).then(function () {
14893
15045
  return console.info('callback.child_widget.status: - errorEvent');
@@ -17255,7 +17407,6 @@ var InstructionCanvas3dsShow = /*#__PURE__*/function (_InstructionHandler) {
17255
17407
  });
17256
17408
  canvas.on('chargeAuthReject', function () {
17257
17409
  var _a;
17258
- // **TODO add interface for chargeAuthReject event **//
17259
17410
  (_a = _this.checkoutWidget) === null || _a === void 0 ? void 0 : _a.fetchInstruction();
17260
17411
  _this.api.checkout().callback({
17261
17412
  event: 'callback.child_widget.status',
@@ -17272,13 +17423,13 @@ var InstructionCanvas3dsShow = /*#__PURE__*/function (_InstructionHandler) {
17272
17423
  });
17273
17424
  canvas.on('error', function (event) {
17274
17425
  var _a;
17275
- // **TODO add interface for error event **//
17276
17426
  (_a = _this.checkoutWidget) === null || _a === void 0 ? void 0 : _a.fetchInstruction();
17427
+ var message = (event && _typeof$1(event) === 'object' && 'event' in event ? event.event : null) || 'error in 3ds widget';
17277
17428
  _this.api.checkout().callback({
17278
17429
  event: 'callback.child_widget.status',
17279
17430
  payload: {
17280
17431
  status: 'error',
17281
- message: (event === null || event === void 0 ? void 0 : event.event) || 'error in 3ds widget'
17432
+ message: message
17282
17433
  }
17283
17434
  }).then(function () {
17284
17435
  return console.info('callback.child_widget.status: - errorEvent');
@@ -18645,10 +18796,16 @@ function getCheckoutVersionHandler(version) {
18645
18796
  }
18646
18797
  }
18647
18798
 
18799
+ /** Event name emitted when a checkout payment completes successfully. */
18800
+ var PAYMENT_SUCCESSFUL = 'paymentSuccessful';
18801
+ /** Event name emitted when a checkout payment fails. */
18802
+ var PAYMENT_FAILURE = 'paymentFailure';
18803
+ /** Event name emitted when a checkout session expires. */
18804
+ var PAYMENT_EXPIRED = 'paymentExpired';
18648
18805
  var EVENT$3 = {
18649
- PAYMENT_SUCCESSFUL: 'paymentSuccessful',
18650
- PAYMENT_FAILURE: 'paymentFailure',
18651
- PAYMENT_EXPIRED: 'paymentExpired'
18806
+ PAYMENT_SUCCESSFUL: PAYMENT_SUCCESSFUL,
18807
+ PAYMENT_FAILURE: PAYMENT_FAILURE,
18808
+ PAYMENT_EXPIRED: PAYMENT_EXPIRED
18652
18809
  };
18653
18810
  /**
18654
18811
  * Class CheckoutButton transform usual button into checkout
@@ -18673,7 +18830,7 @@ var Checkout = /*#__PURE__*/function () {
18673
18830
  this.checkoutFinished = false;
18674
18831
  try {
18675
18832
  this.eventEmitter = new EventEmitter();
18676
- this.intentTokenPayload = this.extractIntentTokenPayload(intentToken);
18833
+ this.intentTokenPayload = this.extractCheckoutIntentTokenPayload(intentToken);
18677
18834
  this.checkoutVersionHandler = getCheckoutVersionHandler(this.intentTokenPayload.version);
18678
18835
  this.instructions = this.initContractVersion();
18679
18836
  this.api = new ApiInternal(this.intentToken, API_AUTH_TYPE.TOKEN);
@@ -18734,8 +18891,8 @@ var Checkout = /*#__PURE__*/function () {
18734
18891
  }, 14 * 60 * 1000 + 45 * 1000);
18735
18892
  }
18736
18893
  }, {
18737
- key: "extractIntentTokenPayload",
18738
- value: function extractIntentTokenPayload(intentToken) {
18894
+ key: "extractCheckoutIntentTokenPayload",
18895
+ value: function extractCheckoutIntentTokenPayload(intentToken) {
18739
18896
  var tokenContent = AccessToken.validateJWT(intentToken);
18740
18897
  if (!tokenContent) {
18741
18898
  throw new Error('Intent token is broken or expired. Please, issue new one.');
@@ -18763,7 +18920,7 @@ var Checkout = /*#__PURE__*/function () {
18763
18920
  value: function ready() {
18764
18921
  var _this3 = this;
18765
18922
  this.changeLoadingSpinnerVisibility(true);
18766
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
18923
+ // biome-ignore lint/suspicious/noExplicitAny: checkoutApi.status returns a dynamic shape whose fields are narrowed at the call-sites below
18767
18924
  this.checkoutApi.status(this.intentTokenPayload.intent_id).then(function (response) {
18768
18925
  if (!(response === null || response === void 0 ? void 0 : response.status)) {
18769
18926
  throw new Error('Checkout Intent Status structure inconsistent');
@@ -18872,8 +19029,8 @@ var Checkout = /*#__PURE__*/function () {
18872
19029
  * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
18873
19030
  *
18874
19031
  * @example
18875
- * widget.onPaymentInReview((data) => {
18876
- * console.log('Payment in fraud review');
19032
+ * widget.onPaymentExpired((data) => {
19033
+ * console.log('Payment session expired');
18877
19034
  * });
18878
19035
  */
18879
19036
  }, {
@@ -18994,6 +19151,7 @@ var OpenWalletButtons = /*#__PURE__*/function () {
18994
19151
  function OpenWalletButtons(selector, publicKeyOrAccessToken, serviceId, meta) {
18995
19152
  _classCallCheck(this, OpenWalletButtons);
18996
19153
  this.env = DEFAULT_ENV;
19154
+ this.isDisabled = false;
18997
19155
  this.onShippingOptionsChangeHandlerRegistered = false;
18998
19156
  // Runtime guard: TypeScript's `abstract` keyword exists only at compile time.
18999
19157
  // Without this check, instantiating the base class directly silently fails
@@ -19138,6 +19296,68 @@ var OpenWalletButtons = /*#__PURE__*/function () {
19138
19296
  _this.handleOnError(error instanceof Error ? error : new Error(String(error)), ERROR_OPERATION.CONFIGURATION);
19139
19297
  });
19140
19298
  }
19299
+ /**
19300
+ * Enables the wallet button, restoring interactivity and visual appearance.
19301
+ * If the button was previously disabled via `disable()`, calling this method
19302
+ * re-enables clicks and removes the disabled visual state.
19303
+ *
19304
+ * Idempotent — calling on an already-enabled button has no effect.
19305
+ *
19306
+ * @example
19307
+ * button.enable();
19308
+ */
19309
+ }, {
19310
+ key: "enable",
19311
+ value: function enable() {
19312
+ this.isDisabled = false;
19313
+ this.applyDisabledStyles();
19314
+ }
19315
+ /**
19316
+ * Disables the wallet button, preventing clicks and applying a visual disabled state.
19317
+ * When disabled, the button appears grayed out (`opacity: 0.5`) and does not
19318
+ * respond to user interaction (`pointer-events: none`). For accessibility, the
19319
+ * `aria-disabled="true"` attribute is also set on the container.
19320
+ *
19321
+ * Programmatic clicks (e.g. invoked by the wallet provider's SDK) are blocked
19322
+ * by an explicit guard inside the click handler — the button's wallet service
19323
+ * checks the disabled state before processing.
19324
+ *
19325
+ * Idempotent — calling on an already-disabled button has no effect.
19326
+ * Safe to call before `load()` (no-throw); the styles are applied once the
19327
+ * container element exists.
19328
+ *
19329
+ * @example
19330
+ * button.disable();
19331
+ */
19332
+ }, {
19333
+ key: "disable",
19334
+ value: function disable() {
19335
+ this.isDisabled = true;
19336
+ this.applyDisabledStyles();
19337
+ }
19338
+ /**
19339
+ * Applies the disabled / enabled visual state to the container element.
19340
+ * Reads `this.isDisabled` and toggles the corresponding CSS + ARIA attributes.
19341
+ *
19342
+ * @private
19343
+ */
19344
+ }, {
19345
+ key: "applyDisabledStyles",
19346
+ value: function applyDisabledStyles() {
19347
+ var element = this.container.getElement();
19348
+ if (!element) {
19349
+ return;
19350
+ }
19351
+ if (this.isDisabled) {
19352
+ element.style.pointerEvents = 'none';
19353
+ element.style.opacity = '0.5';
19354
+ element.setAttribute('aria-disabled', 'true');
19355
+ } else {
19356
+ element.style.pointerEvents = '';
19357
+ element.style.opacity = '';
19358
+ element.removeAttribute('aria-disabled');
19359
+ }
19360
+ }
19141
19361
  /**
19142
19362
  * Current method can change environment. By default environment = sandbox.
19143
19363
  * Also we can change domain alias for this environment. By default domain_alias = paydock.com
@@ -19627,7 +19847,9 @@ var SERVICE_GROUP;
19627
19847
  * Returns `undefined` if the resulting object has no remaining properties.
19628
19848
  */
19629
19849
  function stripEmpty(obj) {
19630
- if (!obj || _typeof$1(obj) !== 'object') return undefined;
19850
+ if (!obj || _typeof$1(obj) !== 'object') {
19851
+ return undefined;
19852
+ }
19631
19853
  var result = {};
19632
19854
  for (var _i = 0, _Object$entries = Object.entries(obj); _i < _Object$entries.length; _i++) {
19633
19855
  var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
@@ -19676,13 +19898,30 @@ var OpenWalletService = /*#__PURE__*/function () {
19676
19898
  this.serviceGroup = SERVICE_GROUP.WALLET;
19677
19899
  }
19678
19900
  /**
19679
- * Creates a One-Time Token (OTT) by sending the payment data to the API.
19680
- * Emits {@link EVENT.SUCCESS} on success or {@link EVENT.ERROR} on failure.
19901
+ * Returns whether the wallet button is currently disabled.
19902
+ * Reads the `aria-disabled` attribute from the container element — set by the
19903
+ * button class via {@link OpenWalletButtons.disable} / {@link OpenWalletButtons.enable}.
19681
19904
  *
19682
- * @param data - The payment data including amount, shipping, billing, card info, and ref token.
19683
- * @returns A promise resolving to the OTT response.
19905
+ * Used to short-circuit click handlers in concrete wallet services for clicks
19906
+ * that bypass the DOM `pointer-events: none` guard (e.g. invoked by the wallet
19907
+ * provider's SDK callback).
19908
+ *
19909
+ * @returns `true` if the container is marked as disabled, `false` otherwise.
19684
19910
  */
19685
19911
  return _createClass(OpenWalletService, [{
19912
+ key: "isButtonDisabled",
19913
+ value: function isButtonDisabled() {
19914
+ var element = this.container.getElement();
19915
+ return (element === null || element === void 0 ? void 0 : element.getAttribute('aria-disabled')) === 'true';
19916
+ }
19917
+ /**
19918
+ * Creates a One-Time Token (OTT) by sending the payment data to the API.
19919
+ * Emits {@link EVENT.SUCCESS} on success or {@link EVENT.ERROR} on failure.
19920
+ *
19921
+ * @param data - The payment data including amount, shipping, billing, card info, and ref token.
19922
+ * @returns A promise resolving to the OTT response.
19923
+ */
19924
+ }, {
19686
19925
  key: "createOTT",
19687
19926
  value: function createOTT(data) {
19688
19927
  var _this = this;
@@ -20203,6 +20442,9 @@ var ApplePayOpenWalletService = /*#__PURE__*/function (_OpenWalletService) {
20203
20442
  key: "onApplePayButtonClicked",
20204
20443
  value: function onApplePayButtonClicked() {
20205
20444
  var _this7 = this;
20445
+ if (this.isButtonDisabled()) {
20446
+ return;
20447
+ }
20206
20448
  var applePayApiVersion = getSupportedApplePayVersion();
20207
20449
  if (applePayApiVersion === 0) {
20208
20450
  this.handleOnUnavailable('Apple Pay version not supported');
@@ -20953,6 +21195,9 @@ var GooglePayOpenWalletService = /*#__PURE__*/function (_OpenWalletService) {
20953
21195
  key: "onGooglePayButtonClicked",
20954
21196
  value: function onGooglePayButtonClicked() {
20955
21197
  var _this5 = this;
21198
+ if (this.isButtonDisabled()) {
21199
+ return;
21200
+ }
20956
21201
  if (this.processingButtonClick) {
20957
21202
  console.warn('Google Pay button clicked while processing.');
20958
21203
  return;
@@ -22690,6 +22935,14 @@ var SRC = /*#__PURE__*/function () {
22690
22935
  if (_this.provider) {
22691
22936
  _this.provider.load();
22692
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
+ });
22693
22946
  });
22694
22947
  }
22695
22948
  /**
@@ -44474,4 +44727,4 @@ var browser = /*#__PURE__*/Object.freeze({
44474
44727
  zlibSync: zlibSync
44475
44728
  });
44476
44729
 
44477
- export { AfterpayCheckoutButton, AfterpayOnSiteMessaging, Api, ApplePayOpenWalletButton, ApplePayWalletButtonExpress, CHECKOUT_BUTTON_EVENT, Canvas3ds, Checkout, ClickToPay, Configuration, ContactShippingEditingMode, ELEMENT, ERROR_OPERATION, EVENT$5 as EVENT, Builder$1 as ExternalCheckoutBuilder, Checker as ExternalCheckoutChecker, FORM_FIELD$1 as FORM_FIELD, FRAUD_PREVENTION_EVENTS, FraudPreventionService, GooglePayOpenWalletButton, HtmlMultiWidget, HtmlPaymentSourceWidget, HtmlWidget, InstructionDebugger, MultiWidget, PAYMENT_TYPE, PURPOSE, PayPalDataCollector, PayPalSavePaymentSourceWidget, Builder as PaymentSourceBuilder, PaymentSourceWidget, PaypalCheckoutButton, PaypalWalletButtonExpress, STYLABLE_ELEMENT, STYLABLE_ELEMENT_STATE, STYLE$2 as STYLE, SUPPORTED_CARD_TYPES, TEXT, TOKEN_TYPE, TRIGGER$1 as TRIGGER, TYPE, VAULT_DISPLAY_STYLE, VaultDisplayWidget, EVENT as WALLET_BUTTONS_EXPRESS_EVENT, WALLET_TYPES, WalletButtons, ZipmoneyCheckoutButton };
44730
+ export { AfterpayCheckoutButton, AfterpayOnSiteMessaging, Api, ApplePayOpenWalletButton, ApplePayWalletButtonExpress, CANVAS_3DS_EVENT, CHECKOUT_BUTTON_EVENT, EVENT$3 as CHECKOUT_EVENT, Canvas3ds, Canvas3dsTokenFormat, Checkout, ClickToPay, Configuration, ContactShippingEditingMode, ELEMENT, ERROR_OPERATION, EVENT$5 as EVENT, Builder$1 as ExternalCheckoutBuilder, Checker as ExternalCheckoutChecker, FORM_FIELD$1 as FORM_FIELD, FRAUD_PREVENTION_EVENTS, FraudPreventionService, GooglePayOpenWalletButton, HtmlMultiWidget, HtmlPaymentSourceWidget, HtmlWidget, InstructionDebugger, MultiWidget, PAYMENT_EXPIRED, PAYMENT_FAILURE, PAYMENT_SUCCESSFUL, PAYMENT_TYPE, PURPOSE, PayPalDataCollector, PayPalSavePaymentSourceWidget, Builder as PaymentSourceBuilder, PaymentSourceWidget, PaypalCheckoutButton, PaypalWalletButtonExpress, STYLABLE_ELEMENT, STYLABLE_ELEMENT_STATE, STYLE$2 as STYLE, SUPPORTED_CARD_TYPES, TEXT, TOKEN_TYPE, TRIGGER$1 as TRIGGER, TYPE, VAULT_DISPLAY_STYLE, VaultDisplayWidget, EVENT as WALLET_BUTTONS_EXPRESS_EVENT, WALLET_TYPES, WalletButtons, ZipmoneyCheckoutButton };