@paydock/client-sdk 1.119.0-beta → 1.119.2

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 (29) hide show
  1. package/README.md +69 -19
  2. package/bundles/index.cjs +112 -60
  3. package/bundles/index.cjs.d.ts +2060 -2050
  4. package/bundles/index.mjs +106 -53
  5. package/bundles/index.mjs.d.ts +2060 -2050
  6. package/bundles/types/checkout/instructions/v1/instruction.card_form.show.d.ts.map +1 -1
  7. package/bundles/types/components/iframe-event.d.ts +39 -29
  8. package/bundles/types/components/iframe-event.d.ts.map +1 -1
  9. package/bundles/types/helper/custom-error.d.ts +8 -0
  10. package/bundles/types/helper/custom-error.d.ts.map +1 -0
  11. package/bundles/types/shared/services/configuration-validation/configuration-validation.d.ts +1 -1
  12. package/bundles/types/shared/services/configuration-validation/configuration-validation.d.ts.map +1 -1
  13. package/bundles/types/widget/configuration.d.ts +7 -7
  14. package/bundles/types/widget/configuration.d.ts.map +1 -1
  15. package/bundles/types/widget/html-multi-widget.d.ts +1 -2
  16. package/bundles/types/widget/html-multi-widget.d.ts.map +1 -1
  17. package/bundles/types/widget/html-widget.d.ts +2 -1
  18. package/bundles/types/widget/html-widget.d.ts.map +1 -1
  19. package/bundles/types/widget/multi-widget.d.ts +4 -1
  20. package/bundles/types/widget/multi-widget.d.ts.map +1 -1
  21. package/bundles/widget.umd.js +112 -60
  22. package/bundles/widget.umd.js.d.ts +2060 -2050
  23. package/bundles/widget.umd.js.min.d.ts +2060 -2050
  24. package/bundles/widget.umd.min.js +1 -1
  25. package/docs/api-widget.md +21 -16
  26. package/docs/widget-examples.md +48 -3
  27. package/examples/multi-html-widget/extend.html +5 -0
  28. package/package.json +1 -1
  29. package/slate.md +48 -3
@@ -15,6 +15,14 @@
15
15
  </dd>
16
16
  </dl>
17
17
 
18
+ ## Members
19
+
20
+ <dl>
21
+ <dt><a href="#user-content-w_PURPOSE">PURPOSE</a> : <code>object</code></dt>
22
+ <dd><p>Purposes</p>
23
+ </dd>
24
+ </dl>
25
+
18
26
  ## Constants
19
27
 
20
28
  <dl>
@@ -27,9 +35,6 @@
27
35
  <dt><a href="#user-content-w_PAYMENT_TYPE">PAYMENT_TYPE</a> : <code>object</code></dt>
28
36
  <dd><p>List of available payment source types</p>
29
37
  </dd>
30
- <dt><a href="#user-content-w_PURPOSE">PURPOSE</a> : <code>object</code></dt>
31
- <dd><p>Purposes</p>
32
- </dd>
33
38
  <dt><a href="#user-content-w_FORM_FIELD">FORM_FIELD</a> : <code>object</code></dt>
34
39
  <dd><p>Current constant include available type of fields which can be included to widget</p>
35
40
  </dd>
@@ -2267,6 +2272,19 @@ Method for setting a custom language code
2267
2272
  ```javascript
2268
2273
  config.setLanguage('en');
2269
2274
  ```
2275
+ <a name="w_PURPOSE" id="w_PURPOSE" href="#user-content-w_PURPOSE">&nbsp;</a>
2276
+
2277
+ ## PURPOSE : <code>object</code>
2278
+ Purposes
2279
+
2280
+ **Kind**: global variable
2281
+
2282
+ | Param | Type | Default |
2283
+ | --- | --- | --- |
2284
+ | PAYMENT_SOURCE | <code>string</code> | <code>&quot;payment_source&quot;</code> |
2285
+ | CARD_PAYMENT_SOURCE_WITH_CVV | <code>string</code> | <code>&quot;card_payment_source_with_cvv&quot;</code> |
2286
+ | CARD_PAYMENT_SOURCE_WITHOUT_CVV | <code>string</code> | <code>&quot;card_payment_source_without_cvv&quot;</code> |
2287
+
2270
2288
  <a name="w_EVENT" id="w_EVENT" href="#user-content-w_EVENT">&nbsp;</a>
2271
2289
 
2272
2290
  ## EVENT : <code>object</code>
@@ -2316,19 +2334,6 @@ List of available payment source types
2316
2334
  | BANK_ACCOUNT | <code>string</code> | <code>&quot;bank_account&quot;</code> |
2317
2335
  | CHECKOUT | <code>string</code> | <code>&quot;checkout&quot;</code> |
2318
2336
 
2319
- <a name="w_PURPOSE" id="w_PURPOSE" href="#user-content-w_PURPOSE">&nbsp;</a>
2320
-
2321
- ## PURPOSE : <code>object</code>
2322
- Purposes
2323
-
2324
- **Kind**: global constant
2325
-
2326
- | Param | Type | Default |
2327
- | --- | --- | --- |
2328
- | PAYMENT_SOURCE | <code>string</code> | <code>&quot;payment_source&quot;</code> |
2329
- | CARD_PAYMENT_SOURCE_WITH_CVV | <code>string</code> | <code>&quot;card_payment_source_with_cvv&quot;</code> |
2330
- | CARD_PAYMENT_SOURCE_WITHOUT_CVV | <code>string</code> | <code>&quot;card_payment_source_without_cvv&quot;</code> |
2331
-
2332
2337
  <a name="w_FORM_FIELD" id="w_FORM_FIELD" href="#user-content-w_FORM_FIELD">&nbsp;</a>
2333
2338
 
2334
2339
  ## FORM\_FIELD : <code>object</code>
@@ -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.119.0-beta",
107
+ "version": "1.119.2",
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",
package/slate.md CHANGED
@@ -199,6 +199,20 @@ widget.setSupportedCardIcons(['mastercard', 'visa']); // add icons of supported
199
199
 
200
200
  This example shows how you can use a lot of other methods to settings your form
201
201
 
202
+
203
+ ### Error handling
204
+
205
+ ```javascript
206
+ widget.on('error', (error) => {
207
+ const errorDiv = document.getElementById('error');
208
+ const errorMessage = document.getElementById('error-message');
209
+
210
+ errorMessage.textContent = error.data.message;
211
+ errorDiv.style.display = 'block';
212
+ });
213
+ ```
214
+
215
+
202
216
  ### Full example
203
217
 
204
218
  ```html
@@ -214,7 +228,34 @@ This example shows how you can use a lot of other methods to settings your form
214
228
  <div id="widget"
215
229
  widget-style="text-color: #FFFFAA; border-color: #yellow"
216
230
  title="Payment form"
217
- finish-text="Payment resource was successfully accepted"></div>
231
+ finish-text="Payment resource was successfully accepted">
232
+ </div>
233
+
234
+ <div
235
+ id="error"
236
+ style="
237
+ display: none;
238
+ max-width: 600px;
239
+ margin: 16px auto;
240
+ padding: 16px 20px;
241
+ border-radius: 8px;
242
+ background-color: #FEF2F2;
243
+ border: 1px solid #FEE2E2;
244
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
245
+ font-family: system-ui, -apple-system, sans-serif;
246
+ color: #991B1B;
247
+ line-height: 1.5;
248
+ font-size: 14px;
249
+ "
250
+ title="error"
251
+ >
252
+ <div style="display: flex; align-items: flex-start; gap: 12px;">
253
+ <div>
254
+ <h4 style="margin: 0 0 4px 0; font-size: 14px; font-weight: 600;">Access Error</h4>
255
+ <div id="error-message"></div>
256
+ </div>
257
+ </div>
258
+ </div>
218
259
  </form>
219
260
 
220
261
  <script src="https://widget.paydock.com/sdk/latest/widget.umd.js" ></script>
@@ -224,11 +265,15 @@ This example shows how you can use a lot of other methods to settings your form
224
265
  widget.setSupportedCardIcons(['mastercard', 'visa']);
225
266
  widget.setFormFields(['phone', 'email']);
226
267
  widget.setRefId('custom-ref-id');
227
- widget.onFinishInsert('input[name="payment_source_token"]', 'payment_source');z
268
+ widget.onFinishInsert('input[name="payment_source_token"]', 'payment_source');
228
269
 
270
+ widget.on('error', (error) => {
271
+ document.getElementById('error-message').textContent = error.data.message;
272
+ document.getElementById('error').style.display = 'block';
273
+ });
229
274
  widget.load();
230
275
  </script>
231
- </script>
276
+
232
277
  </body>
233
278
  </html>
234
279
  ```