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