@paydock/client-sdk 1.112.0 → 1.112.5-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 (132) hide show
  1. package/README.md +805 -22
  2. package/bundles/index.cjs +1559 -229
  3. package/bundles/index.cjs.d.ts +2503 -2052
  4. package/bundles/index.mjs +1551 -226
  5. package/bundles/index.mjs.d.ts +2503 -2052
  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 +2 -0
  10. package/bundles/types/api/api-checkout-internal.d.ts.map +1 -1
  11. package/bundles/types/checkout/checkout.d.ts.map +1 -1
  12. package/bundles/types/checkout/helpers/instruction-module.d.ts +1 -1
  13. package/bundles/types/checkout/helpers/instruction-module.d.ts.map +1 -1
  14. package/bundles/types/checkout/helpers/resource-helper.d.ts +4 -3
  15. package/bundles/types/checkout/helpers/resource-helper.d.ts.map +1 -1
  16. package/bundles/types/checkout/helpers/session-helper.d.ts +3 -0
  17. package/bundles/types/checkout/helpers/session-helper.d.ts.map +1 -1
  18. package/bundles/types/checkout/instructions/v1/instruction.afterpay_checkout_form.show.d.ts.map +1 -1
  19. package/bundles/types/checkout/instructions/v1/instruction.apple_pay_form.show.d.ts.map +1 -1
  20. package/bundles/types/checkout/instructions/v1/instruction.canvas_3ds.show.d.ts.map +1 -1
  21. package/bundles/types/checkout/instructions/v1/instruction.card_form.show.d.ts.map +1 -1
  22. package/bundles/types/checkout/instructions/v1/instruction.generic.show_message.d.ts.map +1 -1
  23. package/bundles/types/checkout/instructions/v1/instruction.google_pay_form.show.d.ts.map +1 -1
  24. package/bundles/types/checkout/instructions/v1/instruction.payment_methods.show.d.ts.map +1 -1
  25. package/bundles/types/checkout/instructions/v1/instruction.paypal_form.show.d.ts.map +1 -1
  26. package/bundles/types/checkout/instructions/v1/instruction.zip_checkout_form.show.d.ts.map +1 -1
  27. package/bundles/types/checkout/layout-widgets/additionals.d.ts +1 -1
  28. package/bundles/types/checkout/layout-widgets/additionals.d.ts.map +1 -1
  29. package/bundles/types/checkout/layout-widgets/payment-methods-template.d.ts +3 -0
  30. package/bundles/types/checkout/layout-widgets/payment-methods-template.d.ts.map +1 -1
  31. package/bundles/types/checkout/layout-widgets/payment-methods.d.ts +1 -1
  32. package/bundles/types/checkout/layout-widgets/payment-methods.d.ts.map +1 -1
  33. package/bundles/types/checkout/layout-widgets/payment-template.d.ts +1 -1
  34. package/bundles/types/components/iframe-event.d.ts +39 -27
  35. package/bundles/types/components/iframe-event.d.ts.map +1 -1
  36. package/bundles/types/components/iframe.d.ts +2 -2
  37. package/bundles/types/components/iframe.d.ts.map +1 -1
  38. package/bundles/types/components/param.d.ts +2 -0
  39. package/bundles/types/components/param.d.ts.map +1 -1
  40. package/bundles/types/configs/env/environment.paydock.d.ts.map +1 -1
  41. package/bundles/types/fraud-prevention/constants.d.ts +4 -0
  42. package/bundles/types/fraud-prevention/constants.d.ts.map +1 -0
  43. package/bundles/types/fraud-prevention/events.d.ts +44 -0
  44. package/bundles/types/fraud-prevention/events.d.ts.map +1 -0
  45. package/bundles/types/fraud-prevention/fraud-prevention.service.d.ts +69 -0
  46. package/bundles/types/fraud-prevention/fraud-prevention.service.d.ts.map +1 -0
  47. package/bundles/types/fraud-prevention/index.d.ts +4 -0
  48. package/bundles/types/fraud-prevention/index.d.ts.map +1 -0
  49. package/bundles/types/fraud-prevention/providers/forter/forter-device-agent.service.d.ts +78 -0
  50. package/bundles/types/fraud-prevention/providers/forter/forter-device-agent.service.d.ts.map +1 -0
  51. package/bundles/types/fraud-prevention/providers/forter/templates/forter-snippet-2025-02-06T14:19:34Z.template.d.ts +2 -0
  52. package/bundles/types/fraud-prevention/providers/forter/templates/forter-snippet-2025-02-06T14:19:34Z.template.d.ts.map +1 -0
  53. package/bundles/types/helper/browser.d.ts.map +1 -1
  54. package/bundles/types/helper/custom-error.d.ts +8 -0
  55. package/bundles/types/helper/custom-error.d.ts.map +1 -0
  56. package/bundles/types/index-cba.d.ts +6 -1
  57. package/bundles/types/index-cba.d.ts.map +1 -1
  58. package/bundles/types/index.d.ts +4 -1
  59. package/bundles/types/index.d.ts.map +1 -1
  60. package/bundles/types/paypal-data-collector/index.d.ts +23 -0
  61. package/bundles/types/paypal-data-collector/index.d.ts.map +1 -0
  62. package/bundles/types/paypal-data-collector/paypal-data-collector.d.ts +58 -0
  63. package/bundles/types/paypal-data-collector/paypal-data-collector.d.ts.map +1 -0
  64. package/bundles/types/paypal-data-collector/paypal-data-collector.interfaces.d.ts +21 -0
  65. package/bundles/types/paypal-data-collector/paypal-data-collector.interfaces.d.ts.map +1 -0
  66. package/bundles/types/paypal-data-collector/paypal-data-collector.service.d.ts +17 -0
  67. package/bundles/types/paypal-data-collector/paypal-data-collector.service.d.ts.map +1 -0
  68. package/bundles/types/paypal-save-payment-source/index.d.ts +61 -0
  69. package/bundles/types/paypal-save-payment-source/index.d.ts.map +1 -0
  70. package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.d.ts +85 -0
  71. package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.d.ts.map +1 -0
  72. package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.interfaces.d.ts +83 -0
  73. package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.interfaces.d.ts.map +1 -0
  74. package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.service.d.ts +35 -0
  75. package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.service.d.ts.map +1 -0
  76. package/bundles/types/secure-remote-commerce/click-to-pay-secure-remote-commerce.d.ts +1 -1
  77. package/bundles/types/secure-remote-commerce/click-to-pay-secure-remote-commerce.d.ts.map +1 -1
  78. package/bundles/types/secure-remote-commerce/index.d.ts +2 -0
  79. package/bundles/types/secure-remote-commerce/index.d.ts.map +1 -1
  80. package/bundles/types/secure-remote-commerce/interfaces.d.ts +8 -1
  81. package/bundles/types/secure-remote-commerce/interfaces.d.ts.map +1 -1
  82. package/bundles/types/shared/services/configuration-validation/configuration-validation.d.ts +12 -0
  83. package/bundles/types/shared/services/configuration-validation/configuration-validation.d.ts.map +1 -0
  84. package/bundles/types/shared/services/configuration-validation/types.d.ts +73 -0
  85. package/bundles/types/shared/services/configuration-validation/types.d.ts.map +1 -0
  86. package/bundles/types/wallet-buttons/enums.d.ts +12 -0
  87. package/bundles/types/wallet-buttons/enums.d.ts.map +1 -0
  88. package/bundles/types/wallet-buttons/index.d.ts +5 -1
  89. package/bundles/types/wallet-buttons/index.d.ts.map +1 -1
  90. package/bundles/types/wallet-buttons/wallet-buttons.d.ts +28 -15
  91. package/bundles/types/wallet-buttons/wallet-buttons.d.ts.map +1 -1
  92. package/bundles/types/wallet-buttons/wallet-services/wallet-service.d.ts +1 -1
  93. package/bundles/types/wallet-buttons/wallet-services/wallet-service.d.ts.map +1 -1
  94. package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts +10 -10
  95. package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts.map +1 -1
  96. package/bundles/types/wallet-buttons-express/index.d.ts +1 -0
  97. package/bundles/types/wallet-buttons-express/index.d.ts.map +1 -1
  98. package/bundles/types/wallet-buttons-express/interfaces/wallet-capture-request.interface.d.ts +1 -0
  99. package/bundles/types/wallet-buttons-express/interfaces/wallet-capture-request.interface.d.ts.map +1 -1
  100. package/bundles/types/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.d.ts.map +1 -1
  101. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts +1 -0
  102. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts.map +1 -1
  103. package/bundles/types/wallet-buttons-express/services/paypal/paypal.wallet-button-express.d.ts.map +1 -1
  104. package/bundles/types/widget/configuration.d.ts +13 -9
  105. package/bundles/types/widget/configuration.d.ts.map +1 -1
  106. package/bundles/types/widget/html-multi-widget.d.ts +1 -2
  107. package/bundles/types/widget/html-multi-widget.d.ts.map +1 -1
  108. package/bundles/types/widget/html-widget.d.ts +2 -1
  109. package/bundles/types/widget/html-widget.d.ts.map +1 -1
  110. package/bundles/types/widget/multi-widget.d.ts +5 -1
  111. package/bundles/types/widget/multi-widget.d.ts.map +1 -1
  112. package/bundles/widget.umd.js +1559 -229
  113. package/bundles/widget.umd.js.d.ts +2503 -2052
  114. package/bundles/widget.umd.js.min.d.ts +2503 -2052
  115. package/bundles/widget.umd.min.js +1 -61
  116. package/docs/api-widget.md +21 -16
  117. package/docs/click-to-pay.md +1 -0
  118. package/docs/fraud-prevention-examples.md +195 -0
  119. package/docs/fraud-prevention.md +0 -0
  120. package/docs/install/npm.example.md +1 -1
  121. package/docs/paypal-data-collector-examples.md +59 -0
  122. package/docs/paypal-data-collector.md +149 -0
  123. package/docs/paypal-save-payment-source-examples.md +63 -0
  124. package/docs/paypal-save-payment-source.md +256 -0
  125. package/docs/wallet-buttons-examples.md +1 -1
  126. package/docs/wallet-buttons-express-examples.md +1 -1
  127. package/docs/wallet-buttons-express.md +1 -0
  128. package/docs/wallet-buttons.md +3 -0
  129. package/docs/widget-examples.md +48 -3
  130. package/examples/multi-html-widget/extend.html +5 -0
  131. package/package.json +7 -7
  132. package/slate.md +246 -5
@@ -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. |
@@ -99,6 +99,20 @@ widget.setSupportedCardIcons(['mastercard', 'visa']); // add icons of supported
99
99
 
100
100
  This example shows how you can use a lot of other methods to settings your form
101
101
 
102
+
103
+ ### Error handling
104
+
105
+ ```javascript
106
+ widget.on('error', (error) => {
107
+ const errorDiv = document.getElementById('error');
108
+ const errorMessage = document.getElementById('error-message');
109
+
110
+ errorMessage.textContent = error.data.message;
111
+ errorDiv.style.display = 'block';
112
+ });
113
+ ```
114
+
115
+
102
116
  ### Full example
103
117
 
104
118
  ```html
@@ -114,7 +128,34 @@ This example shows how you can use a lot of other methods to settings your form
114
128
  <div id="widget"
115
129
  widget-style="text-color: #FFFFAA; border-color: #yellow"
116
130
  title="Payment form"
117
- finish-text="Payment resource was successfully accepted"></div>
131
+ finish-text="Payment resource was successfully accepted">
132
+ </div>
133
+
134
+ <div
135
+ id="error"
136
+ style="
137
+ display: none;
138
+ max-width: 600px;
139
+ margin: 16px auto;
140
+ padding: 16px 20px;
141
+ border-radius: 8px;
142
+ background-color: #FEF2F2;
143
+ border: 1px solid #FEE2E2;
144
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
145
+ font-family: system-ui, -apple-system, sans-serif;
146
+ color: #991B1B;
147
+ line-height: 1.5;
148
+ font-size: 14px;
149
+ "
150
+ title="error"
151
+ >
152
+ <div style="display: flex; align-items: flex-start; gap: 12px;">
153
+ <div>
154
+ <h4 style="margin: 0 0 4px 0; font-size: 14px; font-weight: 600;">Access Error</h4>
155
+ <div id="error-message"></div>
156
+ </div>
157
+ </div>
158
+ </div>
118
159
  </form>
119
160
 
120
161
  <script src="https://widget.paydock.com/sdk/latest/widget.umd.js" ></script>
@@ -124,11 +165,15 @@ This example shows how you can use a lot of other methods to settings your form
124
165
  widget.setSupportedCardIcons(['mastercard', 'visa']);
125
166
  widget.setFormFields(['phone', 'email']);
126
167
  widget.setRefId('custom-ref-id');
127
- widget.onFinishInsert('input[name="payment_source_token"]', 'payment_source');z
168
+ widget.onFinishInsert('input[name="payment_source_token"]', 'payment_source');
128
169
 
170
+ widget.on('error', (error) => {
171
+ document.getElementById('error-message').textContent = error.data.message;
172
+ document.getElementById('error').style.display = 'block';
173
+ });
129
174
  widget.load();
130
175
  </script>
131
- </script>
176
+
132
177
  </body>
133
178
  </html>
134
179
  ```
@@ -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.112.0",
107
+ "version": "1.112.5-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",
@@ -119,8 +119,6 @@
119
119
  "compute:sha:bundles": "npm run compute:checksums:bundles | sha256sum",
120
120
  "doc:cba": "run-s clean:lib tsc:cba markdown:cba",
121
121
  "doc:paydock": "run-s clean:lib tsc:paydock markdown:paydock",
122
- "lint": "tslint -c tslint.json 'src/**/*.ts{,x}'",
123
- "lint:fix": "tslint -c tslint.json 'src/**/*.ts{,x}' --fix",
124
122
  "markdown:cba": "grunt cba_docs",
125
123
  "markdown:paydock": "grunt docs",
126
124
  "publish:local": "./publish-to-local-registry.sh",
@@ -131,8 +129,8 @@
131
129
  "tsc:cba": "tsc --project tsconfig.cba.json",
132
130
  "tsc:paydock": "tsc --project tsconfig.paydock.json",
133
131
  "tidy:ci": "biome ci --no-errors-on-unmatched .",
134
- "tidy:precommit": "biome ci --no-errors-on-unmatched --changed .",
135
- "tidy": "biome check --apply --formatter-enabled=true --linter-enabled=true --organize-imports-enabled=true --no-errors-on-unmatched .",
132
+ "tidy:precommit": "biome check --no-errors-on-unmatched --staged --write .",
133
+ "tidy": "biome check --write --no-errors-on-unmatched --changed .",
136
134
  "typecheck": "tsc --project tsconfig.json --noEmit"
137
135
  },
138
136
  "dependencies": {
@@ -151,7 +149,9 @@
151
149
  "@babel/preset-env": "7.24.5",
152
150
  "@babel/runtime": "7.24.5",
153
151
  "@babel/runtime-corejs2": "7.24.5",
154
- "@biomejs/biome": "1.7.3",
152
+ "@biomejs/biome": "1.9.4",
153
+ "@commitlint/cli": "19.5.0",
154
+ "@commitlint/config-conventional": "19.5.0",
155
155
  "@rollup/plugin-babel": "6.0.4",
156
156
  "@rollup/plugin-commonjs": "25.0.7",
157
157
  "@rollup/plugin-json": "6.1.0",
@@ -194,6 +194,7 @@
194
194
  "karma-jasmine": "1.1.2",
195
195
  "karma-jasmine-ajax": "0.1.13",
196
196
  "karma-mocha-reporter": "2.2.5",
197
+ "lefthook": "^1.10.10",
197
198
  "marked": "4.3.0",
198
199
  "npm-run-all2": "6.2.0",
199
200
  "process": "0.11.10",
@@ -203,7 +204,6 @@
203
204
  "rxjs": "7.8.1",
204
205
  "tsify": "3.0.4",
205
206
  "tslib": "2.6.2",
206
- "tslint": "5.20.1",
207
207
  "typescript": "5.4.5",
208
208
  "zod": "3.23.8"
209
209
  },