@paydock/client-sdk 1.104.3-beta → 1.104.7-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 (128) hide show
  1. package/README.md +729 -405
  2. package/bundles/index.cjs +29624 -8753
  3. package/bundles/index.cjs.d.ts +484 -381
  4. package/bundles/index.cjs.map +1 -1
  5. package/bundles/index.mjs +29624 -8753
  6. package/bundles/index.mjs.d.ts +484 -381
  7. package/bundles/index.mjs.map +1 -1
  8. package/bundles/types/api/api-base.d.ts +14 -6
  9. package/bundles/types/api/api-base.d.ts.map +1 -1
  10. package/bundles/types/api/api-service-internal.d.ts +2 -1
  11. package/bundles/types/api/api-service-internal.d.ts.map +1 -1
  12. package/bundles/types/api/api.d.ts +1 -1
  13. package/bundles/types/api/api.d.ts.map +1 -1
  14. package/bundles/types/canvas-3ds/canvas-3ds.d.ts +1 -1
  15. package/bundles/types/canvas-3ds/canvas-3ds.d.ts.map +1 -1
  16. package/bundles/types/canvas-3ds/services/gpayments-service.d.ts +3 -3
  17. package/bundles/types/canvas-3ds/services/gpayments-service.d.ts.map +1 -1
  18. package/bundles/types/checkout-button/afterpay/afterpay-checkout-button.d.ts +1 -1
  19. package/bundles/types/checkout-button/afterpay/afterpay-checkout-button.d.ts.map +1 -1
  20. package/bundles/types/checkout-button/checkout-button.d.ts +1 -1
  21. package/bundles/types/checkout-button/checkout-button.d.ts.map +1 -1
  22. package/bundles/types/checkout-button/paypal/paypal-checkout-button.d.ts +1 -1
  23. package/bundles/types/checkout-button/paypal/paypal-checkout-button.d.ts.map +1 -1
  24. package/bundles/types/checkout-button/runner/popup.runner.d.ts +1 -1
  25. package/bundles/types/checkout-button/zipmoney/zipmoney-checkout-button.d.ts +1 -1
  26. package/bundles/types/checkout-button/zipmoney/zipmoney-checkout-button.d.ts.map +1 -1
  27. package/bundles/types/components/container.d.ts +1 -0
  28. package/bundles/types/components/container.d.ts.map +1 -1
  29. package/bundles/types/components/http-core.d.ts.map +1 -1
  30. package/bundles/types/components/iframe-event.d.ts +17 -11
  31. package/bundles/types/components/iframe-event.d.ts.map +1 -1
  32. package/bundles/types/components/link.d.ts +3 -2
  33. package/bundles/types/components/link.d.ts.map +1 -1
  34. package/bundles/types/components/param.d.ts +6 -8
  35. package/bundles/types/components/param.d.ts.map +1 -1
  36. package/bundles/types/components/wallet-background.d.ts +2 -1
  37. package/bundles/types/components/wallet-background.d.ts.map +1 -1
  38. package/bundles/types/configs/env/environment.cba.d.ts +1 -1
  39. package/bundles/types/configs/env/environment.cba.d.ts.map +1 -1
  40. package/bundles/types/configs/env/environment.paydock.d.ts +1 -1
  41. package/bundles/types/configs/env/environment.paydock.d.ts.map +1 -1
  42. package/bundles/types/constants/validators.d.ts +45 -0
  43. package/bundles/types/constants/validators.d.ts.map +1 -0
  44. package/bundles/types/payment-source-widget/html-payment-source-widget.d.ts +17 -13
  45. package/bundles/types/payment-source-widget/html-payment-source-widget.d.ts.map +1 -1
  46. package/bundles/types/payment-source-widget/payment-source-widget.d.ts +1 -1
  47. package/bundles/types/payment-source-widget/payment-source-widget.d.ts.map +1 -1
  48. package/bundles/types/secure-remote-commerce/index.d.ts +102 -1
  49. package/bundles/types/secure-remote-commerce/index.d.ts.map +1 -1
  50. package/bundles/types/secure-remote-commerce/interfaces.d.ts +109 -32
  51. package/bundles/types/secure-remote-commerce/interfaces.d.ts.map +1 -1
  52. package/bundles/types/secure-remote-commerce/mastercard-secure-remote-commerce.d.ts +31 -0
  53. package/bundles/types/secure-remote-commerce/mastercard-secure-remote-commerce.d.ts.map +1 -0
  54. package/bundles/types/secure-remote-commerce/providers/mastercard-src/index.d.ts +2 -0
  55. package/bundles/types/secure-remote-commerce/providers/mastercard-src/index.d.ts.map +1 -0
  56. package/bundles/types/secure-remote-commerce/providers/{visa-src/visa-src.d.ts → mastercard-src/mastercard-src.d.ts} +5 -8
  57. package/bundles/types/secure-remote-commerce/providers/mastercard-src/mastercard-src.d.ts.map +1 -0
  58. package/bundles/types/secure-remote-commerce/secure-remote-commerce.d.ts +13 -91
  59. package/bundles/types/secure-remote-commerce/secure-remote-commerce.d.ts.map +1 -1
  60. package/bundles/types/shared/http/http-request.d.ts +14 -0
  61. package/bundles/types/shared/http/http-request.d.ts.map +1 -0
  62. package/bundles/types/shared/http/index.d.ts +2 -0
  63. package/bundles/types/shared/http/index.d.ts.map +1 -0
  64. package/bundles/types/shared/services/instrumentation/instrumentation.agent.d.ts +15 -0
  65. package/bundles/types/shared/services/instrumentation/instrumentation.agent.d.ts.map +1 -0
  66. package/bundles/types/shared/services/instrumentation/instrumentation.config.d.ts +66 -0
  67. package/bundles/types/shared/services/instrumentation/instrumentation.config.d.ts.map +1 -0
  68. package/bundles/types/shared/services/instrumentation/instrumentation.types.d.ts +14 -0
  69. package/bundles/types/shared/services/instrumentation/instrumentation.types.d.ts.map +1 -0
  70. package/bundles/types/shared/services/instrumentation/repositories/action.repository.d.ts +15 -0
  71. package/bundles/types/shared/services/instrumentation/repositories/action.repository.d.ts.map +1 -0
  72. package/bundles/types/shared/services/instrumentation/repositories/error.repository.d.ts +23 -0
  73. package/bundles/types/shared/services/instrumentation/repositories/error.repository.d.ts.map +1 -0
  74. package/bundles/types/shared/services/instrumentation/repositories/event.repository.d.ts +15 -0
  75. package/bundles/types/shared/services/instrumentation/repositories/event.repository.d.ts.map +1 -0
  76. package/bundles/types/shared/services/instrumentation/repositories/index.d.ts +4 -0
  77. package/bundles/types/shared/services/instrumentation/repositories/index.d.ts.map +1 -0
  78. package/bundles/types/vault-display-widget/vault-display-widget.d.ts +1 -1
  79. package/bundles/types/vault-display-widget/vault-display-widget.d.ts.map +1 -1
  80. package/bundles/types/wallet-buttons/apple.wallet-service.d.ts +2 -0
  81. package/bundles/types/wallet-buttons/apple.wallet-service.d.ts.map +1 -1
  82. package/bundles/types/wallet-buttons/flypay-v2.wallet-service.d.ts +8 -1
  83. package/bundles/types/wallet-buttons/flypay-v2.wallet-service.d.ts.map +1 -1
  84. package/bundles/types/wallet-buttons/google.wallet-service.d.ts +7 -4
  85. package/bundles/types/wallet-buttons/google.wallet-service.d.ts.map +1 -1
  86. package/bundles/types/wallet-buttons/helpers/flypay-v2.helper.d.ts +4 -0
  87. package/bundles/types/wallet-buttons/helpers/flypay-v2.helper.d.ts.map +1 -0
  88. package/bundles/types/wallet-buttons/index.d.ts +126 -0
  89. package/bundles/types/wallet-buttons/index.d.ts.map +1 -1
  90. package/bundles/types/wallet-buttons/interfaces.d.ts +3 -0
  91. package/bundles/types/wallet-buttons/interfaces.d.ts.map +1 -1
  92. package/bundles/types/wallet-buttons/paypal.wallet-service.d.ts.map +1 -1
  93. package/bundles/types/wallet-buttons/wallet-buttons.d.ts +63 -121
  94. package/bundles/types/wallet-buttons/wallet-buttons.d.ts.map +1 -1
  95. package/bundles/types/wallet-buttons/wallet-cba-buttons.d.ts +1 -1
  96. package/bundles/types/wallet-buttons/wallet-cba-buttons.d.ts.map +1 -1
  97. package/bundles/types/wallet-buttons/wallet-service.d.ts +7 -0
  98. package/bundles/types/wallet-buttons/wallet-service.d.ts.map +1 -1
  99. package/bundles/types/widget/configuration.d.ts +1 -1
  100. package/bundles/types/widget/configuration.d.ts.map +1 -1
  101. package/bundles/types/widget/html-multi-widget.d.ts +147 -76
  102. package/bundles/types/widget/html-multi-widget.d.ts.map +1 -1
  103. package/bundles/types/widget/html-widget.d.ts +1 -1
  104. package/bundles/types/widget/html-widget.d.ts.map +1 -1
  105. package/bundles/types/widget/multi-widget.d.ts.map +1 -1
  106. package/bundles/widget.umd.js +29624 -8753
  107. package/bundles/widget.umd.js.d.ts +484 -381
  108. package/bundles/widget.umd.js.map +1 -1
  109. package/bundles/widget.umd.js.min.d.ts +484 -381
  110. package/bundles/widget.umd.min.js +62 -1
  111. package/bundles/widget.umd.min.js.map +1 -1
  112. package/docs/api-ps-widget.md +12 -12
  113. package/docs/api-widget.md +211 -156
  114. package/docs/license.md +1 -1
  115. package/docs/secure-remote-commerce-examples.md +75 -101
  116. package/docs/secure-remote-commerce.md +185 -114
  117. package/docs/wallet-buttons-examples.md +48 -19
  118. package/docs/wallet-buttons.md +197 -2
  119. package/examples/multi-html-widget/simple.html +2 -1
  120. package/package.json +18 -15
  121. package/slate.md +123 -120
  122. package/bundles/types/secure-remote-commerce/providers/visa-src/helper.d.ts +0 -8
  123. package/bundles/types/secure-remote-commerce/providers/visa-src/helper.d.ts.map +0 -1
  124. package/bundles/types/secure-remote-commerce/providers/visa-src/index.d.ts +0 -2
  125. package/bundles/types/secure-remote-commerce/providers/visa-src/index.d.ts.map +0 -1
  126. package/bundles/types/secure-remote-commerce/providers/visa-src/visa-src.d.ts.map +0 -1
  127. package/bundles/types/secure-remote-commerce/providers/visa-src/visa-src.styles.d.ts +0 -9
  128. package/bundles/types/secure-remote-commerce/providers/visa-src/visa-src.styles.d.ts.map +0 -1
package/docs/license.md CHANGED
@@ -1,2 +1,2 @@
1
1
  ## License
2
- Copyright (c) 2023 paydock
2
+ Copyright (c) 2024 paydock
@@ -1,26 +1,30 @@
1
- ## Secure Remote Commerce
2
- You can find description of all methods and parameters [here](https://www.npmjs.com/package/@paydock/client-sdk#SRC).
1
+ # Secure Remote Commerce
3
2
 
4
- This widget provides you with the ability to easily integrate with SRC providers. Currently Visa SRC is supported.
3
+ ## Overview
4
+
5
+ Integrate with Mastercard SRC using Paydock's Mastercard SRC widget.
6
+ For a full description of the methods and parameters, reference the [README file](https://www.npmjs.com/package/@paydock/client-sdk#SRC).
5
7
 
6
8
  ## SRC simple example
7
9
 
8
- ### Container
10
+ The following section provides an example use case and integration for the widget.
11
+
12
+ ### Create a Container
13
+
14
+ To integrate the SRC checkout iFrame, create a container in your HTML code. This container serves as the placeholder for the iFrame.
9
15
 
10
16
  ```html
11
- <div id="checkoutButton"></div>
12
17
  <div id="checkoutIframe"></div>
13
18
  ```
14
19
 
15
- You must create a container for the initial checkout button, and a different one for the checkout iFrame. Inside the first tag the button will be initialized, and inside the second one the iFrame will be loaded once the button is clicked.
20
+ ### Initialize the Widget
16
21
 
22
+ Use the following code to initialize your widget:
17
23
 
18
- ### Initialization
19
24
  ```javascript
20
- var src = new paydock.SRC(
21
- "#checkoutButton",
25
+ var src = new paydock.MastercardSRCClickToPay(
22
26
  "#checkoutIframe",
23
- "scheme_service_id",
27
+ "service_id",
24
28
  "paydock_public_key_or_access_token",
25
29
  {}, // meta
26
30
  );
@@ -29,23 +33,22 @@ src.load();
29
33
 
30
34
  ```javascript
31
35
  // ES2015 | TypeScript
32
-
33
- import { SRC } from '@paydock/client-sdk';
34
-
35
- var src = new SRC(
36
- "#checkoutButton",
36
+ import { MastercardSRCClickToPay } from '@paydock/client-sdk';
37
+ var src = new MastercardSRCClickToPay(
37
38
  "#checkoutIframe",
38
- "scheme_service_id",
39
+ "service_id",
39
40
  "paydock_public_key_or_access_token",
40
41
  {}, // meta
41
42
  );
42
43
  src.load();
43
44
  ```
44
45
 
45
- *NOTE:* it's highly recommended to use a Paydock Access Token instead of the public key for security reasons. When creating it, you will need to enable the `Secure Remote Commerce` and add a whiteliste for the domain of your checkout screen.
46
+ *NOTE:* Paydock recommends that you use a Paydock Access Token instead of a public key for security reasons in production environments. When creating your access token, you must enable the `Secure Remote Commerce` and add a whitelist for the domain of your checkout screen.
46
47
 
47
48
  ### Full example
48
49
 
50
+ A full example of the container and the initialized widget is as follows:
51
+
49
52
  ```html
50
53
  <!DOCTYPE html>
51
54
  <html lang="en">
@@ -55,14 +58,12 @@ src.load();
55
58
  <style>iframe {border: 0;width: 40%;height: 300px;}</style>
56
59
  </head>
57
60
  <body>
58
- <div id="checkoutButton"></div>
59
61
  <div id="checkoutIframe"></div>
60
62
  <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
61
63
  <script>
62
- var src = new paydock.SRC(
63
- "#checkoutButton",
64
+ var src = new paydock.MastercardSRCClickToPay(
64
65
  "#checkoutIframe",
65
- "scheme_service_id",
66
+ "service_id",
66
67
  "paydock_public_key_or_access_token",
67
68
  {},
68
69
  );
@@ -72,50 +73,30 @@ src.load();
72
73
  </html>
73
74
  ```
74
75
 
76
+ ## Customize your SRC Checkout
75
77
 
76
- ## SRC advanced example
78
+ The following is an advanced example that includes customization. You can use these methods to enhance your checkout experience.
77
79
 
78
80
  ### Settings
79
81
 
80
82
  ```javascript
81
-
82
- src.setEnv('sandbox'); // set enviroment
83
-
84
- src.hideButton(); // hide button
85
-
86
- src.showButton(); // show button
87
-
83
+ src.setEnv('sandbox'); // set environment
88
84
  src.hideCheckout(); // hide checkout iframe
89
-
90
85
  src.showCheckout(); // show checkout iframe
91
-
92
- src.on('checkoutButtonLoaded', () => {
93
- console.log("Button loaded");
94
- });
95
-
96
- src.on('checkoutButtonClicked', () => {
97
- console.log("Button clicked");
98
- });
99
-
100
86
  src.on('iframeLoaded', () => {
101
87
  console.log("Initial iframe loaded");
102
88
  });
103
-
104
89
  src.on('checkoutReady', () => {
105
90
  console.log("Checkout ready to be used");
106
91
  });
107
-
108
92
  src.on('checkoutCompleted', (token) => {
109
93
  console.log(token);
110
94
  });
111
-
112
95
  src.on('checkoutError', (error) => {
113
96
  console.log(error);
114
97
  });
115
98
  ```
116
99
 
117
- Here you can see how you can use this methods to customize your checkout experience
118
-
119
100
  ### Full example
120
101
 
121
102
  ```html
@@ -127,64 +108,73 @@ Here you can see how you can use this methods to customize your checkout experie
127
108
  <style>iframe {border: 0;width: 40%;height: 450px;}</style>
128
109
  </head>
129
110
  <body>
130
- <div id="checkoutButton"></div>
131
111
  <div id="checkoutIframe"></div>
132
112
  <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
133
113
  <script>
134
- var src = new paydock.SRC(
135
- "#checkoutButton",
114
+ var src = new paydock.MastercardSRCClickToPay(
136
115
  "#checkoutIframe",
137
- "scheme_service_id",
116
+ "service_id",
138
117
  "paydock_public_key_or_access_token",
139
118
  {},
140
119
  );
141
-
120
+ src.on('iframeLoaded', () => {
121
+ console.log("Initial iframe loaded");
122
+ });
142
123
  src.on('checkoutReady', () => {
143
124
  console.log("Checkout ready to be used");
144
125
  });
145
-
146
126
  src.on('checkoutCompleted', (token) => {
147
127
  console.log(token);
148
128
  });
129
+ src.on('checkoutError', (error) => {
130
+ console.log(error);
131
+ });
149
132
  src.load();
150
133
  </script>
151
134
  </body>
152
135
  </html>
153
136
  ```
154
137
 
155
- ## Customization options for address fields
156
- ### Shipping address:
138
+ ## Customize your billing address fields
157
139
 
158
- To customize shipping address experience we use a flag that manages how VisaSRC requires or not shipping address to the customer. Options are NONE (default option), POSTAL_COUNTRY or ALL.
140
+ To customize your billing address experience, Paydock uses a flag that manages whether a customer's billing address is mandatory.
141
+ The options for this customization are NONE (default option), and POSTAL_COUNTRY or FULL.
159
142
 
160
143
  ```
161
- var src = new paydock.SRC(
162
- "#checkoutButton",
144
+ var src = new paydock.MastercardSRCClickToPay(
163
145
  "#checkoutIframe",
164
- "scheme_service_id",
146
+ "service_id",
165
147
  "paydock_public_key_or_access_token",
166
148
  {
167
149
  "dpa_transaction_options": {
168
- "dpa_shipping_preference": "ALL"
150
+ "dpa_billing_preference": "FULL"
169
151
  }
170
152
  },
171
153
  );
172
154
  ```
173
155
 
174
- With this the Visa popup requires the shipping address from consumer, and these information will be stored in the Paydock charge.
156
+ The SRC checkout in the example requires the billing address from the customer, which is then returned as a part of the checkout data. The data is then stored and leveraged in the Paydock charge.
157
+ You can also provide the billing address at the time of creating the charge. For example, if you have a different method for collecting the billing address, such as outside of the SRC checkout, you can provide it alongside other information at the charge creation step:
175
158
 
176
- Another option is at time of creating the charge. Say that you have a different way of collecting the shipping address (outside Paydock checkout), you can then disable the shipping address on our SRC widget and send it when creating the charge creation after getting the One Time Token out of the SRC widget:
159
+ 1. Disable the billing address in Paydock's SRC widget.
160
+ 2. Get your One Time Token from the SRC widget alongside other details that may have been collected outside the SRC checkout as the shipping address.
161
+ 3. Send the billing address when creating the charge.
177
162
 
178
163
  ```
179
164
  POST v1/charges
180
-
181
165
  {
182
166
  "amount": "10.00",
183
167
  "currency": "AUD",
184
- "token": "token",
168
+ "token": "one_time_token",
185
169
  "customer": {
186
170
  "payment_source": {
187
- "gateway_id": "gateway_id"
171
+ "gateway_id": "gateway_id",
172
+ "address_line1": "address_line1",
173
+ "address_line2": "address_line2",
174
+ "address_city": "address_city",
175
+ "address_postcode": "address_postcode",
176
+ "address_state": "address_state",
177
+ "address_country": "address_country"
188
178
  }
189
179
  },
190
180
  "shipping": {
@@ -199,60 +189,44 @@ POST v1/charges
199
189
  }
200
190
  ```
201
191
 
202
- - Billing address:
192
+ ## How to customize accepted cards
203
193
 
204
- Billing address fields are always present on the checkout and required when adding a new credit card (or for new consumer checkout). You can send billing fields on the meta data to pre-fill these fields inside the customer object:
194
+ You can send a flag `unaccepted_card_type` to block the usage of a specific card type. The available options are 'DEBIT' and 'CREDIT'.
195
+
196
+ ### Example code
197
+
198
+ The following example demonstrates how to block the card:
205
199
 
206
200
  ```
207
- var src = new paydock.SRC(
208
- "#checkoutButton",
201
+ var src = new paydock.MastercardSRCClickToPay(
209
202
  "#checkoutIframe",
210
- "scheme_service_id",
211
- "paydock_public_key_or_access_token",
203
+ "service_id",
204
+ "paydock_public_key",
212
205
  {
213
- "customer": {
214
- "email": "test@email.com",
215
- "first_name": "Name",
216
- "last_name": "Surname",
217
- "phone": {
218
- "country_code": "1",
219
- "phone": "2124567890"
220
- },
221
- "payment_source": {
222
- "address_line1": "Line 1",
223
- "address_line2": "Line 2",
224
- "address_city": "Miami",
225
- "address_postcode": "33126",
226
- "address_state": "FL",
227
- "address_country": "US"
228
- }
229
- }
206
+ unaccepted_card_type: 'DEBIT'
230
207
  },
231
208
  );
232
209
  ```
233
210
 
234
- ## Personalization Styling
211
+ ## Personalize the Style
235
212
 
236
- To improve the experience in the use of the widget, it is allowed to send props that customize the UI.
213
+ Customize the look and feel of your UI. The following example demonstrates changes in the styling of the buttons.
237
214
 
238
215
  ### Example code
239
216
 
240
217
  ```
241
- var src = new paydock.SRC(
242
- "#checkoutButton",
218
+ var src = new paydock.MastercardSRCClickToPay(
243
219
  "#checkoutIframe",
244
- "scheme_service_id",
220
+ "service_id",
245
221
  "paydock_public_key",
222
+ {},
246
223
  );
247
-
248
- button.setStyles({"primary_color":"#a83232","button_text_color":"#171e9c","font_family":"sans-serif"})
249
-
224
+ src.setStyles({
225
+ enable_src_popup: true,
226
+ primary_button_color: 'red',
227
+ secondary_button_color: 'red',
228
+ primary_button_text_color: 'red',
229
+ secondary_button_text_color: 'red',
230
+ font_family: 'Arial',
231
+ });
250
232
  ```
251
- ## Event and Values
252
-
253
- | Event Value | Type | Description |
254
- | ------------------- | ------------------- | -------------------------------------------------------------- |
255
- | primary_color | <code>string</code> | HEX color for the principal buttons, example : #32a852 |
256
- | button_text_color | <code>string</code> | HEX color for the text of the buttons, example : #32a852|
257
- | font_family | <code>string</code> | Look more [mozilla.org/color](https://developer.mozilla.org/en-US/docs/Web/CSS/font-family)|
258
- | card_schemes | <code>[string] - array of string</code> | Possible values "visa", "mastercard", "amex" and "discover" - Default show all logos