@paydock/client-sdk 1.113.2 → 1.114.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 (107) hide show
  1. package/README.md +757 -80
  2. package/bundles/index.cjs +1344 -190
  3. package/bundles/index.cjs.d.ts +2355 -2058
  4. package/bundles/index.mjs +1340 -187
  5. package/bundles/index.mjs.d.ts +2355 -2058
  6. package/bundles/types/api/api-base.d.ts.map +1 -1
  7. package/bundles/types/api/api-charge-internal.d.ts +1 -0
  8. package/bundles/types/api/api-charge-internal.d.ts.map +1 -1
  9. package/bundles/types/api/api-checkout-internal.d.ts +1 -0
  10. package/bundles/types/api/api-checkout-internal.d.ts.map +1 -1
  11. package/bundles/types/checkout/helpers/resource-helper.d.ts +4 -3
  12. package/bundles/types/checkout/helpers/resource-helper.d.ts.map +1 -1
  13. package/bundles/types/checkout/helpers/session-helper.d.ts +3 -0
  14. package/bundles/types/checkout/helpers/session-helper.d.ts.map +1 -1
  15. package/bundles/types/checkout/instructions/v1/instruction.afterpay_checkout_form.show.d.ts.map +1 -1
  16. package/bundles/types/checkout/instructions/v1/instruction.card_form.show.d.ts.map +1 -1
  17. package/bundles/types/checkout/instructions/v1/instruction.generic.show_message.d.ts.map +1 -1
  18. package/bundles/types/checkout/instructions/v1/instruction.zip_checkout_form.show.d.ts.map +1 -1
  19. package/bundles/types/checkout/layout-widgets/additionals.d.ts +1 -1
  20. package/bundles/types/checkout/layout-widgets/additionals.d.ts.map +1 -1
  21. package/bundles/types/checkout/layout-widgets/payment-methods-template.d.ts.map +1 -1
  22. package/bundles/types/checkout/layout-widgets/payment-methods.d.ts +1 -1
  23. package/bundles/types/checkout/layout-widgets/payment-methods.d.ts.map +1 -1
  24. package/bundles/types/components/iframe-event.d.ts +34 -29
  25. package/bundles/types/components/iframe-event.d.ts.map +1 -1
  26. package/bundles/types/components/iframe.d.ts +2 -2
  27. package/bundles/types/components/iframe.d.ts.map +1 -1
  28. package/bundles/types/components/param.d.ts +3 -0
  29. package/bundles/types/components/param.d.ts.map +1 -1
  30. package/bundles/types/configs/env/environment.paydock.d.ts.map +1 -1
  31. package/bundles/types/helper/event-error.d.ts +55 -0
  32. package/bundles/types/helper/event-error.d.ts.map +1 -0
  33. package/bundles/types/helper/process-event-error.d.ts +9 -0
  34. package/bundles/types/helper/process-event-error.d.ts.map +1 -0
  35. package/bundles/types/index-cba.d.ts +5 -1
  36. package/bundles/types/index-cba.d.ts.map +1 -1
  37. package/bundles/types/index.d.ts +3 -1
  38. package/bundles/types/index.d.ts.map +1 -1
  39. package/bundles/types/paypal-data-collector/index.d.ts +23 -0
  40. package/bundles/types/paypal-data-collector/index.d.ts.map +1 -0
  41. package/bundles/types/paypal-data-collector/paypal-data-collector.d.ts +58 -0
  42. package/bundles/types/paypal-data-collector/paypal-data-collector.d.ts.map +1 -0
  43. package/bundles/types/paypal-data-collector/paypal-data-collector.interfaces.d.ts +21 -0
  44. package/bundles/types/paypal-data-collector/paypal-data-collector.interfaces.d.ts.map +1 -0
  45. package/bundles/types/paypal-data-collector/paypal-data-collector.service.d.ts +17 -0
  46. package/bundles/types/paypal-data-collector/paypal-data-collector.service.d.ts.map +1 -0
  47. package/bundles/types/paypal-save-payment-source/index.d.ts +61 -0
  48. package/bundles/types/paypal-save-payment-source/index.d.ts.map +1 -0
  49. package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.d.ts +85 -0
  50. package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.d.ts.map +1 -0
  51. package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.interfaces.d.ts +83 -0
  52. package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.interfaces.d.ts.map +1 -0
  53. package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.service.d.ts +35 -0
  54. package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.service.d.ts.map +1 -0
  55. package/bundles/types/secure-remote-commerce/index.d.ts +2 -1
  56. package/bundles/types/secure-remote-commerce/index.d.ts.map +1 -1
  57. package/bundles/types/secure-remote-commerce/interfaces.d.ts +2 -5
  58. package/bundles/types/secure-remote-commerce/interfaces.d.ts.map +1 -1
  59. package/bundles/types/secure-remote-commerce/providers/mastercard-src/mastercard-src.d.ts.map +1 -1
  60. package/bundles/types/shared/services/configuration-validation/configuration-validation.d.ts +12 -0
  61. package/bundles/types/shared/services/configuration-validation/configuration-validation.d.ts.map +1 -0
  62. package/bundles/types/shared/services/configuration-validation/types.d.ts +73 -0
  63. package/bundles/types/shared/services/configuration-validation/types.d.ts.map +1 -0
  64. package/bundles/types/wallet-buttons/enums.d.ts +12 -0
  65. package/bundles/types/wallet-buttons/enums.d.ts.map +1 -0
  66. package/bundles/types/wallet-buttons/index.d.ts +5 -1
  67. package/bundles/types/wallet-buttons/index.d.ts.map +1 -1
  68. package/bundles/types/wallet-buttons/wallet-buttons.d.ts +28 -15
  69. package/bundles/types/wallet-buttons/wallet-buttons.d.ts.map +1 -1
  70. package/bundles/types/wallet-buttons/wallet-services/wallet-service.d.ts +1 -1
  71. package/bundles/types/wallet-buttons/wallet-services/wallet-service.d.ts.map +1 -1
  72. package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts.map +1 -1
  73. package/bundles/types/wallet-buttons-express/index.d.ts +1 -0
  74. package/bundles/types/wallet-buttons-express/index.d.ts.map +1 -1
  75. package/bundles/types/wallet-buttons-express/interfaces/wallet-capture-request.interface.d.ts +1 -0
  76. package/bundles/types/wallet-buttons-express/interfaces/wallet-capture-request.interface.d.ts.map +1 -1
  77. package/bundles/types/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.d.ts.map +1 -1
  78. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts +1 -0
  79. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts.map +1 -1
  80. package/bundles/types/wallet-buttons-express/services/paypal/paypal.wallet-button-express.d.ts.map +1 -1
  81. package/bundles/types/widget/configuration.d.ts +13 -9
  82. package/bundles/types/widget/configuration.d.ts.map +1 -1
  83. package/bundles/types/widget/html-multi-widget.d.ts +1 -2
  84. package/bundles/types/widget/html-multi-widget.d.ts.map +1 -1
  85. package/bundles/types/widget/html-widget.d.ts +2 -1
  86. package/bundles/types/widget/html-widget.d.ts.map +1 -1
  87. package/bundles/types/widget/multi-widget.d.ts +14 -2
  88. package/bundles/types/widget/multi-widget.d.ts.map +1 -1
  89. package/bundles/widget.umd.js +1344 -190
  90. package/bundles/widget.umd.js.d.ts +2355 -2058
  91. package/bundles/widget.umd.js.min.d.ts +2355 -2058
  92. package/bundles/widget.umd.min.js +1 -61
  93. package/docs/api-widget.md +59 -16
  94. package/docs/click-to-pay-examples.md +0 -36
  95. package/docs/click-to-pay.md +1 -3
  96. package/docs/paypal-data-collector-examples.md +59 -0
  97. package/docs/paypal-data-collector.md +149 -0
  98. package/docs/paypal-save-payment-source-examples.md +63 -0
  99. package/docs/paypal-save-payment-source.md +256 -0
  100. package/docs/wallet-buttons-examples.md +1 -1
  101. package/docs/wallet-buttons-express-examples.md +1 -1
  102. package/docs/wallet-buttons-express.md +1 -0
  103. package/docs/wallet-buttons.md +3 -0
  104. package/docs/widget-examples.md +162 -25
  105. package/examples/multi-html-widget/extend.html +5 -0
  106. package/package.json +2 -2
  107. package/slate.md +161 -60
@@ -0,0 +1,256 @@
1
+ ## Classes
2
+
3
+ <dl>
4
+ <dt><a href="#PayPalSavePaymentSourceWidget">PayPalSavePaymentSourceWidget</a></dt>
5
+ <dd><p>PayPal Save Payment Source Widget constructor</p>
6
+ </dd>
7
+ </dl>
8
+
9
+ ## Typedefs
10
+
11
+ <dl>
12
+ <dt><a href="#OnSuccessCallback">OnSuccessCallback</a> : <code>function</code></dt>
13
+ <dd><p>Callback for onSuccess method.</p>
14
+ </dd>
15
+ <dt><a href="#OnErrorCallback">OnErrorCallback</a> : <code>function</code></dt>
16
+ <dd><p>Callback for onError method.</p>
17
+ </dd>
18
+ <dt><a href="#OnCancelCallback">OnCancelCallback</a> : <code>function</code></dt>
19
+ <dd><p>Callback for onCancel method.</p>
20
+ </dd>
21
+ </dl>
22
+
23
+ ## Interfaces
24
+
25
+ <dl>
26
+ <dt><a href="#PayPalSavePaymentSourceWidgetConfig">PayPalSavePaymentSourceWidgetConfig</a> : <code>object</code></dt>
27
+ <dd><p>Interface of data used for PayPal configuration. For further information refer to <a href="https://developer.paypal.com/sdk/js/reference/#style">the documentation</a>.</p>
28
+ </dd>
29
+ <dt><a href="#ErrorCodes">ErrorCodes</a> : <code>object</code></dt>
30
+ <dd><p>Interface of possible error codes inside onError event data.</p>
31
+ </dd>
32
+ <dt><a href="#IOnSuccessEventData">IOnSuccessEventData</a> : <code>object</code></dt>
33
+ <dd><p>Interface for IOnSuccessEventData</p>
34
+ </dd>
35
+ <dt><a href="#IOnErrorEventData">IOnErrorEventData</a> : <code>object</code></dt>
36
+ <dd><p>Interface for IOnErrorEventData</p>
37
+ </dd>
38
+ <dt><a href="#IOnCancelEventData">IOnCancelEventData</a> : <code>object</code></dt>
39
+ <dd><p>Interface for IOnCancelEventData</p>
40
+ </dd>
41
+ </dl>
42
+
43
+ <a name="PayPalSavePaymentSourceWidgetConfig" id="PayPalSavePaymentSourceWidgetConfig" href="#PayPalSavePaymentSourceWidgetConfig">&nbsp;</a>
44
+
45
+ ## PayPalSavePaymentSourceWidgetConfig : <code>object</code>
46
+ Interface of data used for PayPal configuration. For further information refer to [the documentation](https://developer.paypal.com/sdk/js/reference/#style).
47
+
48
+ **Kind**: global interface
49
+
50
+ | Param | Type | Description |
51
+ | --- | --- | --- |
52
+ | [style.layout] | <code>&#x27;vertical&#x27;</code> \| <code>&#x27;horizontal&#x27;</code> | Used for indicating the PayPal Button layout. |
53
+ | [style.color] | <code>&#x27;blue&#x27;</code> \| <code>&#x27;gold&#x27;</code> \| <code>&#x27;silver&#x27;</code> \| <code>&#x27;black&#x27;</code> \| <code>&#x27;white&#x27;</code> | Used for indicating the main color of the PayPal Button. |
54
+ | [style.shape] | <code>&#x27;rect&#x27;</code> \| <code>&#x27;sharp&#x27;</code> \| <code>&#x27;pill&#x27;</code> | Used for indicating the shape of the PayPal Button. |
55
+ | [style.label] | <code>&#x27;paypal&#x27;</code> \| <code>&#x27;checkout&#x27;</code> \| <code>&#x27;buynow&#x27;</code> \| <code>&#x27;pay&#x27;</code> | Used for indicating the label of the PayPal Button. |
56
+ | [style.disableMaxWidth] | <code>boolean</code> | Used for indicating if the max width will be disabled. |
57
+ | [style.disableMaxHeight] | <code>boolean</code> | Used for indicating the max height will be disabled. |
58
+ | [style.height] | <code>number</code> | Used for indicating the height of the PayPal Button, if disableMaxHeight is true. |
59
+ | [style.borderRadius] | <code>number</code> | Used for indicating the border radius of the PayPal Button. |
60
+ | [style.tagline] | <code>boolean</code> | Used for indicating the tagline of the PayPal Button. |
61
+ | [message.amount] | <code>number</code> | Used for indicating an amount before the payment. |
62
+ | [message.align] | <code>&#x27;center&#x27;</code> \| <code>&#x27;left&#x27;</code> \| <code>&#x27;right&#x27;</code> | Used for indicating the align of the message. |
63
+ | [message.color] | <code>&#x27;black&#x27;</code> \| <code>&#x27;white&#x27;</code> | Used for indicating the color of the message. |
64
+ | [message.position] | <code>&#x27;top&#x27;</code> \| <code>&#x27;bottom&#x27;</code> | Used for indicating the position of the message. |
65
+
66
+ <a name="ErrorCodes" id="ErrorCodes" href="#ErrorCodes">&nbsp;</a>
67
+
68
+ ## ErrorCodes : <code>object</code>
69
+ Interface of possible error codes inside onError event data.
70
+
71
+ **Kind**: global interface
72
+
73
+ | Param | Type | Description |
74
+ | --- | --- | --- |
75
+ | [unavailable] | <code>string</code> | Error code when an error occurs loading the widget. |
76
+ | [onPaypalVaultSetupTokenError] | <code>string</code> | Error code when an error occrus on PayPal side. |
77
+ | [onGetIdTokenError] | <code>string</code> | Error code when trying to get ID token from PayPal. |
78
+ | [onGetWalletConfigError] | <code>string</code> | Error code when trying to get wallet config from Paydock. |
79
+ | [onGetSetupTokenError] | <code>string</code> | Error code when trying to get the setup token from PayPal. |
80
+ | [onOneTimeTokenError] | <code>string</code> | Error code when trying to get the one time token from Paydock. |
81
+
82
+ <a name="IOnSuccessEventData" id="IOnSuccessEventData" href="#IOnSuccessEventData">&nbsp;</a>
83
+
84
+ ## IOnSuccessEventData : <code>object</code>
85
+ Interface for IOnSuccessEventData
86
+
87
+ **Kind**: global interface
88
+
89
+ | Param | Type | Description |
90
+ | --- | --- | --- |
91
+ | event | <code>EVENTS</code> | Event Name is 'ON_SUCCESS' |
92
+ | data | <code>object</code> | Data object |
93
+ | data.token | <code>string</code> | One Time Token to be exchanged for a Paydock Customer. |
94
+ | [data.email] | <code>string</code> | Paypal account customer email if retrieved from Paypal servers. |
95
+
96
+ <a name="IOnErrorEventData" id="IOnErrorEventData" href="#IOnErrorEventData">&nbsp;</a>
97
+
98
+ ## IOnErrorEventData : <code>object</code>
99
+ Interface for IOnErrorEventData
100
+
101
+ **Kind**: global interface
102
+
103
+ | Param | Type | Description |
104
+ | --- | --- | --- |
105
+ | event | <code>EVENTS</code> | Event Name is 'ON_ERROR' |
106
+ | data | <code>object</code> | Error data object |
107
+ | data.error_code | [<code>ErrorCodes</code>](#ErrorCodes) | Error code. One of ErrorCodes. |
108
+ | [data.details] | <code>string</code> | Error details. |
109
+ | [data.message] | <code>string</code> | Error message. |
110
+
111
+ <a name="IOnCancelEventData" id="IOnCancelEventData" href="#IOnCancelEventData">&nbsp;</a>
112
+
113
+ ## IOnCancelEventData : <code>object</code>
114
+ Interface for IOnCancelEventData
115
+
116
+ **Kind**: global interface
117
+
118
+ | Param | Type | Description |
119
+ | --- | --- | --- |
120
+ | event | <code>EVENTS</code> | Event Name is 'ON_CANCEL' |
121
+
122
+ <a name="PayPalSavePaymentSourceWidget" id="PayPalSavePaymentSourceWidget" href="#PayPalSavePaymentSourceWidget">&nbsp;</a>
123
+
124
+ ## PayPalSavePaymentSourceWidget
125
+ PayPal Save Payment Source Widget constructor
126
+
127
+ **Kind**: global class
128
+
129
+ * [PayPalSavePaymentSourceWidget](#PayPalSavePaymentSourceWidget)
130
+ * [new PayPalSavePaymentSourceWidget(selector, publicKey, gatewayId, config)](#new_PayPalSavePaymentSourceWidget_new)
131
+ * [.load()](#PayPalSavePaymentSourceWidget+load)
132
+ * [.setEnv(env, [alias])](#PayPalSavePaymentSourceWidget+setEnv)
133
+ * [.onSuccess([callback])](#PayPalSavePaymentSourceWidget+onSuccess)
134
+ * [.onError([callback])](#PayPalSavePaymentSourceWidget+onError)
135
+ * [.onCancel([callback])](#PayPalSavePaymentSourceWidget+onCancel)
136
+
137
+ <a name="new_PayPalSavePaymentSourceWidget_new" id="new_PayPalSavePaymentSourceWidget_new" href="#new_PayPalSavePaymentSourceWidget_new">&nbsp;</a>
138
+
139
+ ### new PayPalSavePaymentSourceWidget(selector, publicKey, gatewayId, config)
140
+
141
+ | Param | Type | Description |
142
+ | --- | --- | --- |
143
+ | selector | <code>string</code> | Selector of html element. Container for PayPal Save Payment Source Widget. |
144
+ | publicKey | <code>string</code> | PayDock users public key. |
145
+ | gatewayId | <code>string</code> | PayDock's PayPal gatewayId. |
146
+ | config | [<code>PayPalSavePaymentSourceWidgetConfig</code>](#PayPalSavePaymentSourceWidgetConfig) | Extra configuration for the widget, like styles. |
147
+
148
+ **Example**
149
+ ```js
150
+ var payPalSavePaymentSourceWidget = new PayPalSavePaymentSourceWidget('#paypalButton', 'public_key', 'gateway_id');
151
+ ```
152
+ <a name="PayPalSavePaymentSourceWidget+load" id="PayPalSavePaymentSourceWidget+load" href="#PayPalSavePaymentSourceWidget+load">&nbsp;</a>
153
+
154
+ ### payPalSavePaymentSourceWidget.load()
155
+ The final method after configuring the PayPalSavePaymentSource Widget to
156
+ start the load process.
157
+
158
+ **Kind**: instance method of [<code>PayPalSavePaymentSourceWidget</code>](#PayPalSavePaymentSourceWidget)
159
+ <a name="PayPalSavePaymentSourceWidget+setEnv" id="PayPalSavePaymentSourceWidget+setEnv" href="#PayPalSavePaymentSourceWidget+setEnv">&nbsp;</a>
160
+
161
+ ### payPalSavePaymentSourceWidget.setEnv(env, [alias])
162
+ Current method can change environment. By default environment = sandbox.
163
+ Also we can change domain alias for this environment. By default domain_alias = paydock.com
164
+
165
+ **Kind**: instance method of [<code>PayPalSavePaymentSourceWidget</code>](#PayPalSavePaymentSourceWidget)
166
+
167
+ | Param | Type | Description |
168
+ | --- | --- | --- |
169
+ | env | <code>string</code> | sandbox, production |
170
+ | [alias] | <code>string</code> | Own domain alias |
171
+
172
+ **Example**
173
+ ```js
174
+ payPalSavePaymentSourceWidget.setEnv('production');
175
+ ```
176
+ <a name="PayPalSavePaymentSourceWidget+onSuccess" id="PayPalSavePaymentSourceWidget+onSuccess" href="#PayPalSavePaymentSourceWidget+onSuccess">&nbsp;</a>
177
+
178
+ ### payPalSavePaymentSourceWidget.onSuccess([callback])
179
+ If the setup token was successfully approved and a OTT was generated, the function passed as parameter will be called.
180
+ Important: Do not perform thread blocking operations in callback such as window.alert() calls.
181
+
182
+ **Kind**: instance method of [<code>PayPalSavePaymentSourceWidget</code>](#PayPalSavePaymentSourceWidget)
183
+
184
+ | Param | Type | Description |
185
+ | --- | --- | --- |
186
+ | [callback] | [<code>OnSuccessCallback</code>](#OnSuccessCallback) | Function to be called when the result is successful. |
187
+
188
+ **Example**
189
+ ```js
190
+ payPalSavePaymentSourceWidget.onSuccess((eventData) => console.log('One time token and email obtained successfully'));
191
+ ```
192
+ <a name="PayPalSavePaymentSourceWidget+onError" id="PayPalSavePaymentSourceWidget+onError" href="#PayPalSavePaymentSourceWidget+onError">&nbsp;</a>
193
+
194
+ ### payPalSavePaymentSourceWidget.onError([callback])
195
+ If in the process for obtaining the setup token fails, the function passed as parameter will be called.
196
+ Important: Do not perform thread blocking operations in callback such as window.alert() calls.
197
+
198
+ **Kind**: instance method of [<code>PayPalSavePaymentSourceWidget</code>](#PayPalSavePaymentSourceWidget)
199
+
200
+ | Param | Type | Description |
201
+ | --- | --- | --- |
202
+ | [callback] | [<code>OnErrorCallback</code>](#OnErrorCallback) | Function to be called when there is an error in the flow. |
203
+
204
+ **Example**
205
+ ```js
206
+ payPalSavePaymentSourceWidget.onError((eventData) => console.log('Some error occurred'));
207
+ ```
208
+ <a name="PayPalSavePaymentSourceWidget+onCancel" id="PayPalSavePaymentSourceWidget+onCancel" href="#PayPalSavePaymentSourceWidget+onCancel">&nbsp;</a>
209
+
210
+ ### payPalSavePaymentSourceWidget.onCancel([callback])
211
+ If in the process for obtaining the setup token was cancelled, the function passed as parameter will be called.
212
+ Important: Do not perform thread blocking operations in callback such as window.alert() calls.
213
+
214
+ **Kind**: instance method of [<code>PayPalSavePaymentSourceWidget</code>](#PayPalSavePaymentSourceWidget)
215
+
216
+ | Param | Type | Description |
217
+ | --- | --- | --- |
218
+ | [callback] | [<code>OnCancelCallback</code>](#OnCancelCallback) | Function to be called when the operation is cancelled. |
219
+
220
+ **Example**
221
+ ```js
222
+ payPalSavePaymentSourceWidget.onCancel(() => console.log('Operation cancelled'));
223
+ ```
224
+ <a name="OnSuccessCallback" id="OnSuccessCallback" href="#OnSuccessCallback">&nbsp;</a>
225
+
226
+ ## OnSuccessCallback : <code>function</code>
227
+ Callback for onSuccess method.
228
+
229
+ **Kind**: global typedef
230
+
231
+ | Param | Type |
232
+ | --- | --- |
233
+ | data | [<code>IOnSuccessEventData</code>](#IOnSuccessEventData) |
234
+
235
+ <a name="OnErrorCallback" id="OnErrorCallback" href="#OnErrorCallback">&nbsp;</a>
236
+
237
+ ## OnErrorCallback : <code>function</code>
238
+ Callback for onError method.
239
+
240
+ **Kind**: global typedef
241
+
242
+ | Param | Type |
243
+ | --- | --- |
244
+ | data | [<code>IOnErrorEventData</code>](#IOnErrorEventData) |
245
+
246
+ <a name="OnCancelCallback" id="OnCancelCallback" href="#OnCancelCallback">&nbsp;</a>
247
+
248
+ ## OnCancelCallback : <code>function</code>
249
+ Callback for onCancel method.
250
+
251
+ **Kind**: global typedef
252
+
253
+ | Param | Type |
254
+ | --- | --- |
255
+ | data | [<code>IOnCancelEventData</code>](#IOnCancelEventData) |
256
+
@@ -425,7 +425,7 @@ _(Required `meta` fields: - . Optional `meta` fields: -)_
425
425
  },
426
426
  );
427
427
  button.setEnv('sandbox');
428
- button.onUnavailable(() => console.log("No wallet buttons available"));
428
+ button.onUnavailable((data) => console.log("No wallet buttons available"));
429
429
  button.onPaymentSuccessful((data) => console.log("The payment was successful"));
430
430
  button.onPaymentError((data) => console.log("The payment was not successful"));
431
431
  button.onAuthTokensChanged((data) => console.log('Authentication tokens changed'));
@@ -63,7 +63,7 @@ A full description of the meta parameters for [ApplePayWalletButtonExpress](#App
63
63
  }
64
64
  );
65
65
 
66
- button.setEnv(sandbox);
66
+ button.setEnv('sandbox');
67
67
 
68
68
  button.onUnavailable(function() {
69
69
  console.log("Button not available");
@@ -111,6 +111,7 @@ For in-depth information, please refer to the [Paypal documentation](https://dev
111
111
  | amount | <code>number</code> | Total amount of the transaction. Represents the money to be charged. |
112
112
  | currency | <code>string</code> | Currency of the transaction in ISO 4217 currency code format. |
113
113
  | [pay_later] | <code>boolean</code> | Flag to enable Pay Later feature of PayPal, allowing Pay in 4. Default false. |
114
+ | [hide_message] | <code>boolean</code> | Used to hide Pay Later message in PayPal Smart Checkout WalletButton integration. Optional for [PayPal]. N/A for other wallets. |
114
115
  | [standalone] | <code>boolean</code> | Flag to specify if the PayPal standalone button should be used. Default false. |
115
116
  | [capture] | <code>boolean</code> | Flag to specify if the transaction amount should be captured immediately or authorized for later capture. Default false. |
116
117
  | [style] | <code>object</code> | Styling configurations for the PayPal widget. |
@@ -131,6 +131,8 @@ Interface of data from an unavailable event.
131
131
  | Param | Type | Description |
132
132
  | --- | --- | --- |
133
133
  | [wallet] | <code>string</code> | For gateways with more than one wallet button available (e.g: MPGS with ApplePay and GooglePay). Possible values for wallet are 'apple' or 'google'. |
134
+ | [type] | <code>string</code> | Event Code. Value can be 'create_order_id_error' on FlypayV2 order creation failure. Optional for [Flypay V2]. N/A for other wallets. |
135
+ | [error_code] | <code>string</code> | Event Error Code. Value can be any error code return from Paydock's API. Optional for [Flypay V2]. N/A for other wallets. + |
134
136
 
135
137
  <a name="IWalletUpdateData" id="IWalletUpdateData" href="#IWalletUpdateData">&nbsp;</a>
136
138
 
@@ -155,6 +157,7 @@ Interface of data used by the wallet checkout and payment proccess.
155
157
  | [amount_label] | <code>string</code> | Label shown next to the total amount to be paid. Required for [Stripe, ApplePay, GooglePay]. N/A for [FlyPay, Flypay V2, PayPal, Afterpay]. |
156
158
  | [country] | <code>string</code> | Country of the user. 2 letter ISO code format. Required for [Stripe, ApplePay, GooglePay, Afterpay]. N/A for [FlyPay, Flypay V2, PayPal]. |
157
159
  | [pay_later] | <code>boolean</code> | Used to enable Pay Later feature in PayPal Smart Checkout WalletButton integration when available. Optional for [PayPal]. N/A for other wallets. |
160
+ | [hide_message] | <code>boolean</code> | Used to hide Pay Later message in PayPal Smart Checkout WalletButton integration. Optional for [PayPal]. N/A for other wallets. |
158
161
  | [standalone] | <code>boolean</code> | Used to enable Standalone Buttons feature in PayPal Smart Checkout WalletButton integration. Used together with `pay_later`. Optional for [PayPal]. N/A for other wallets. |
159
162
  | [show_billing_address] | <code>boolean</code> | Used to hide/show the billing address on ApplePay and GooglePay popups. Default value is false. Optional for [ApplePay, GooglePay]. N/A for other wallets. |
160
163
  | [request_payer_name] | <code>boolean</code> | Used mainly for fraud purposes - recommended set to true. Optional for [Stripe]. N/A for other wallets. |
@@ -1,4 +1,5 @@
1
1
  ## Widget
2
+
2
3
  You can find description of all methods and parameters [here](https://www.npmjs.com/package/@paydock/client-sdk#widget-simple-example)
3
4
 
4
5
  A payment form where it is possible to enter card data/bank accounts and then receive a one-time
@@ -15,8 +16,8 @@ It is possible in real-time to monitor the actions of user with widget and get i
15
16
 
16
17
  You must create a container for the widget. Inside this tag, the widget will be initialized
17
18
 
18
-
19
19
  ### Initialization
20
+
20
21
  ```javascript
21
22
  var widget = new paydock.HtmlWidget('#widget', 'publicKey');
22
23
  widget.load();
@@ -33,7 +34,6 @@ widget.load();
33
34
 
34
35
  Then write only need 2 lines of code in js to initialize widget
35
36
 
36
-
37
37
  ### Full example
38
38
 
39
39
  ```html
@@ -59,19 +59,18 @@ Then write only need 2 lines of code in js to initialize widget
59
59
  </html>
60
60
  ```
61
61
 
62
-
63
62
  ## Widget advanced example
64
63
 
65
64
  ### Customization
66
65
 
67
66
  ```javascript
68
67
  widget.setStyles({
69
- background_color: 'rgb(0, 0, 0)',
70
- border_color: 'yellow',
71
- text_color: '#FFFFAA',
72
- button_color: 'rgba(255, 255, 255, 0.9)',
73
- font_size: '20px'
74
- });
68
+ background_color: 'rgb(0, 0, 0)',
69
+ border_color: 'yellow',
70
+ text_color: '#FFFFAA',
71
+ button_color: 'rgba(255, 255, 255, 0.9)',
72
+ font_size: '20px'
73
+ });
75
74
  ```
76
75
 
77
76
  This example shows how you can customize to your needs and design
@@ -80,9 +79,9 @@ This example shows how you can customize to your needs and design
80
79
 
81
80
  ```html
82
81
  <div id="widget"
83
- widget-style="text-color: #FFFFAA; border-color: #yellow"
84
- title="Payment form"
85
- finish-text="Payment resource was successfully accepted"></div>
82
+ widget-style="text-color: #FFFFAA; border-color: #yellow"
83
+ title="Payment form"
84
+ finish-text="Payment resource was successfully accepted"></div>
86
85
  ```
87
86
 
88
87
  This example shows how you can set style and texts from html
@@ -99,36 +98,174 @@ widget.setSupportedCardIcons(['mastercard', 'visa']); // add icons of supported
99
98
 
100
99
  This example shows how you can use a lot of other methods to settings your form
101
100
 
101
+ ### Error handling
102
+
103
+ ## Overview
104
+
105
+ Error events are emitted when an error occurs during widget operations. These events provide detailed information about the error, including its category, cause, and contextual details.
106
+
107
+ ## Error Event Structure
108
+
109
+ ### Base Properties
110
+
111
+ | Property | Type | Description |
112
+ |----------|------|-------------|
113
+ | `event` | `string` | Always set to `"error"` |
114
+ | `purpose` | `string` | Indicates the purpose of the action that triggered the error event (e.g., `"payment_source"`) |
115
+ | `message_source` | `string` | Source of the message (e.g., `"widget.paydock"`) |
116
+ | `ref_id` | `string` | Reference ID for the operation |
117
+ | `widget_id` | `string` | Unique identifier of the widget instance |
118
+ | `error` | `object` | Error object containing error information |
119
+
120
+ ### Error Object Properties
121
+
122
+ The `error` object contains detailed information about the error:
123
+
124
+ | Property | Type | Description |
125
+ |----------|------|-------------|
126
+ | `category` | `string` | High-level error classification |
127
+ | `cause` | `string` | Specific error cause |
128
+ | `retryable` | `boolean` | Indicates if the operation can be retried |
129
+ | `details` | `object` | Additional error context |
130
+
131
+ ## Error Categories
132
+
133
+ | Category | Description |
134
+ |----------|-------------|
135
+ | `configuration` | Configuration-related errors |
136
+ | `identity_access_management` | Authentication and authorization errors |
137
+ | `internal` | Internal system errors |
138
+ | `process` | Process and operation errors |
139
+ | `resource` | Resource-related errors |
140
+ | `validation` | Input validation errors |
141
+
142
+ ## Error Causes
143
+
144
+ | Cause | Category | Description |
145
+ |-------|----------|-------------|
146
+ | `aborted` | `process` | Operation was aborted |
147
+ | `access_forbidden` | `identity` | Access to resource is forbidden |
148
+ | `already_exists` | `validation` | Resource already exists |
149
+ | `canceled` | `process` | Operation was canceled |
150
+ | `invalid_configuration` | `configuration` | Invalid widget configuration |
151
+ | `invalid_input` | `validation` | Invalid input provided |
152
+ | `not_found` | `resource` | Requested resource not found |
153
+ | `not_implemented` | `process` | Requested feature not implemented |
154
+ | `rate_limited` | `process` | Too many requests |
155
+ | `server_busy` | `process` | Server is too busy to handle request |
156
+ | `service_unreachable` | `process` | Unable to reach required service |
157
+ | `unauthorized` | `identity` | Authentication required |
158
+ | `unknown_error` | `internal` | Unexpected error occurred |
159
+ | `unprocessable_entity` | `validation` | Valid input but cannot be processed |
160
+
161
+ ## Error Details Object
162
+
163
+ | Property | Type | Description |
164
+ |----------|------|-------------|
165
+ | `cause` | `string` | Matches the top-level error cause |
166
+ | `contextId` | `string` | Context identifier (usually matches widget_id) |
167
+ | `message` | `string` | Human-readable error message |
168
+ | `timestamp` | `string` | ISO 8601 timestamp of when the error occurred |
169
+
170
+ ## Example
171
+
172
+ ```javascript
173
+ widget.hideUiErrors(); // hide default UI errors and handle errors by listening to error events with widget.on('error')
174
+
175
+ widget.on('error', (error) => {
176
+ console.log(error);
177
+ // {
178
+ // "event": "error",
179
+ // "purpose": "payment_source",
180
+ // "message_source": "widget.paydock",
181
+ // "ref_id": "",
182
+ // "widget_id": "d4744f30-dcf5-168e-7f78-c8273a3401d4",
183
+ // "error": {
184
+ // "category": "process",
185
+ // "cause": "service_unreachable",
186
+ // "details": {
187
+ // "cause": "service_unreachable",
188
+ // "contextId": "d4744f30-dcf5-168e-7f78-c8273a3401d4",
189
+ // "message": "The service is not availabe",
190
+ // "timestamp": "2025-02-13T09:30:21.157Z"
191
+ // },
192
+ // "retryable": false
193
+ // }
194
+ // }
195
+ });
196
+ ```
197
+
198
+ ## Handling Errors (Tips)
199
+
200
+ When handling errors, consider:
201
+
202
+ 1. Check the `retryable` flag to determine if the operation can be retried
203
+ 2. Use the `category` for high-level error handling logic
204
+ 3. Use the `cause` for specific error handling cases
205
+ 4. The `contextId` can be used for error tracking and debugging
206
+ 5. The `timestamp` helps with error logging and debugging
207
+
102
208
  ### Full example
103
209
 
104
210
  ```html
105
211
  <!DOCTYPE html>
106
212
  <html lang="en">
107
213
  <head>
108
- <meta charset="UTF-8">
109
- <title>Title</title>
110
- <style>iframe {border: 0;width: 100%;height: 400px;}</style>
214
+ <meta charset="UTF-8">
215
+ <title>Title</title>
216
+ <style>iframe {border: 0;width: 100%;height: 400px;}</style>
111
217
  </head>
112
218
  <body>
113
219
  <form id="paymentForm">
114
220
  <div id="widget"
115
221
  widget-style="text-color: #FFFFAA; border-color: #yellow"
116
222
  title="Payment form"
117
- finish-text="Payment resource was successfully accepted"></div>
223
+ finish-text="Payment resource was successfully accepted">
224
+ </div>
225
+
226
+ <div
227
+ id="error"
228
+ style="
229
+ display: none;
230
+ max-width: 600px;
231
+ margin: 16px auto;
232
+ padding: 16px 20px;
233
+ border-radius: 8px;
234
+ background-color: #FEF2F2;
235
+ border: 1px solid #FEE2E2;
236
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
237
+ font-family: system-ui, -apple-system, sans-serif;
238
+ color: #991B1B;
239
+ line-height: 1.5;
240
+ font-size: 14px;
241
+ "
242
+ title="error"
243
+ >
244
+ <div style="display: flex; align-items: flex-start; gap: 12px;">
245
+ <div>
246
+ <h4 style="margin: 0 0 4px 0; font-size: 14px; font-weight: 600;">Access Error</h4>
247
+ <div id="error-message"></div>
248
+ </div>
249
+ </div>
250
+ </div>
118
251
  </form>
119
252
 
120
253
  <script src="https://widget.paydock.com/sdk/latest/widget.umd.js" ></script>
121
254
  <script>
122
- var widget = new paydock.HtmlWidget('#widget', 'publicKey', 'gatewayId');
123
-
124
- widget.setSupportedCardIcons(['mastercard', 'visa']);
125
- widget.setFormFields(['phone', 'email']);
126
- widget.setRefId('custom-ref-id');
127
- widget.onFinishInsert('input[name="payment_source_token"]', 'payment_source');z
128
-
129
- widget.load();
130
- </script>
255
+ var widget = new paydock.HtmlWidget('#widget', 'publicKey', 'gatewayId');
256
+
257
+ widget.setSupportedCardIcons(['mastercard', 'visa']);
258
+ widget.setFormFields(['phone', 'email']);
259
+ widget.setRefId('custom-ref-id');
260
+ widget.onFinishInsert('input[name="payment_source_token"]', 'payment_source');
261
+
262
+ widget.on('error', ({ error }) => {
263
+ document.getElementById('error-message').textContent = error.details.message;
264
+ document.getElementById('error').style.display = 'block';
265
+ });
266
+ widget.load();
131
267
  </script>
268
+
132
269
  </body>
133
270
  </html>
134
271
  ```
@@ -24,6 +24,11 @@
24
24
  new paydock.Configuration('gatewayId', 'bank_account')
25
25
  ]);
26
26
 
27
+ // ### listen to access errors and handle them ###
28
+ widget.on('error', function (error) {
29
+ console.error('An error occurred', error);
30
+ });
31
+
27
32
  widget.load();
28
33
  </script>
29
34
  </body>
package/package.json CHANGED
@@ -104,7 +104,7 @@
104
104
  }
105
105
  },
106
106
  "name": "@paydock/client-sdk",
107
- "version": "1.113.2",
107
+ "version": "1.114.7-beta",
108
108
  "scripts": {
109
109
  "build:doc": "node docs/html/marked.js",
110
110
  "build:js": "rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",
@@ -151,7 +151,7 @@
151
151
  "@babel/preset-env": "7.24.5",
152
152
  "@babel/runtime": "7.24.5",
153
153
  "@babel/runtime-corejs2": "7.24.5",
154
- "@biomejs/biome": "1.7.3",
154
+ "@biomejs/biome": "1.9.4",
155
155
  "@rollup/plugin-babel": "6.0.4",
156
156
  "@rollup/plugin-commonjs": "25.0.7",
157
157
  "@rollup/plugin-json": "6.1.0",