@paydock/client-sdk 1.138.1 → 1.139.0

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 (40) hide show
  1. package/README.md +24 -9
  2. package/bundles/index.cjs +194 -164
  3. package/bundles/index.cjs.d.ts +13 -2
  4. package/bundles/index.mjs +194 -164
  5. package/bundles/index.mjs.d.ts +13 -2
  6. package/bundles/types/checkout/v3/instructions/instruction.card_form.show.d.ts.map +1 -1
  7. package/bundles/types/checkout/v3/utils/checkout-customisation-styles.util.d.ts.map +1 -1
  8. package/bundles/types/components/iframe.d.ts +2 -0
  9. package/bundles/types/components/iframe.d.ts.map +1 -1
  10. package/bundles/types/helper/browser.d.ts +1 -0
  11. package/bundles/types/helper/browser.d.ts.map +1 -1
  12. package/bundles/types/paypal-data-collector/paypal-data-collector.d.ts +12 -3
  13. package/bundles/types/paypal-data-collector/paypal-data-collector.d.ts.map +1 -1
  14. package/bundles/types/paypal-data-collector/paypal-data-collector.service.d.ts +6 -5
  15. package/bundles/types/paypal-data-collector/paypal-data-collector.service.d.ts.map +1 -1
  16. package/bundles/types/secure-remote-commerce/providers/mastercard-src/mastercard-src.d.ts.map +1 -1
  17. package/bundles/types/wallet-buttons/index-cba.d.ts +132 -1
  18. package/bundles/types/wallet-buttons/index-cba.d.ts.map +1 -1
  19. package/bundles/types/wallet-buttons/wallet-buttons.d.ts +1 -1
  20. package/bundles/types/wallet-buttons/wallet-cba-buttons.d.ts +81 -126
  21. package/bundles/types/wallet-buttons/wallet-cba-buttons.d.ts.map +1 -1
  22. package/bundles/types/wallet-buttons/wallet-services/afterpay.wallet-service.d.ts +1 -0
  23. package/bundles/types/wallet-buttons/wallet-services/afterpay.wallet-service.d.ts.map +1 -1
  24. package/bundles/types/wallet-buttons/wallet-services/apple.wallet-service.d.ts +0 -1
  25. package/bundles/types/wallet-buttons/wallet-services/apple.wallet-service.d.ts.map +1 -1
  26. package/bundles/types/wallet-buttons/wallet-services/flypay-v2.wallet-service.d.ts +0 -1
  27. package/bundles/types/wallet-buttons/wallet-services/flypay-v2.wallet-service.d.ts.map +1 -1
  28. package/bundles/types/wallet-buttons/wallet-services/google.wallet-service.d.ts +0 -1
  29. package/bundles/types/wallet-buttons/wallet-services/google.wallet-service.d.ts.map +1 -1
  30. package/bundles/types/wallet-buttons/wallet-services/paypal.wallet-service.d.ts.map +1 -1
  31. package/bundles/types/wallet-buttons/wallet-services/wallet-service.d.ts +6 -0
  32. package/bundles/types/wallet-buttons/wallet-services/wallet-service.d.ts.map +1 -1
  33. package/bundles/widget.umd.js +194 -164
  34. package/bundles/widget.umd.js.d.ts +13 -2
  35. package/bundles/widget.umd.js.min.d.ts +13 -2
  36. package/bundles/widget.umd.min.js +1 -1
  37. package/docs/paypal-data-collector-examples.md +12 -7
  38. package/docs/paypal-data-collector.md +11 -1
  39. package/docs/wallet-buttons.md +1 -1
  40. package/package.json +1 -1
@@ -5,7 +5,7 @@ Widget that collect browser-based data to help reduce fraud. Upon checkout, thes
5
5
  The general flow to use the widgets is:
6
6
  1. Initialize the PayPal Data Collector Widget, providing a Source Website Identifier (Flow ID), plus optional config parameters for the widget. The general format is:
7
7
  ```js
8
- vat paypalDataCollector = new paydock.PayPalDataCollector(
8
+ var paypalDataCollector = new paydock.PayPalDataCollector(
9
9
  sourceWebsiteIdentifier,
10
10
  widgetConfigParams,
11
11
  );
@@ -16,7 +16,7 @@ const collectedDeviceData = await paypalDataCollector.collectDeviceData();
16
16
  const correlationId = collectedDeviceData.correlation_id;
17
17
  ```
18
18
  3. Use freely the correlation_id value as is needed.
19
- 4. Handle the `onError` callback.
19
+ 4. Handle the `onError` callback. The error handler is set up before scripts are loaded to prevent race conditions where script load failures occur before the promise rejection handler is assigned.
20
20
  5. If you are using Content Security Policy (CSP), you must allowlist the paypal fraudnet script URL: `https://c.paypal.com`. See reference [here](https://developer.paypal.com/limited-release/fraudnet/integrate/#link-contentsecuritypolicyintegration).
21
21
 
22
22
  ### PayPalDataCollector Widget example
@@ -49,11 +49,16 @@ A full description of the config parameters for [PayPalDataCollector](#PayPalDat
49
49
  console.log("On Error Callback", error);
50
50
  });
51
51
 
52
- payPalDataCollector.collectDeviceData().then(function(collectedDeviceData) {
53
- //Here when the promise is resolved, it should be able to see the correlation_id.
54
- const correlationId = collectedDeviceData.correlation_id;
55
- console.log("On Success", correlationId);
56
- });
52
+ payPalDataCollector.collectDeviceData()
53
+ .then(function(collectedDeviceData) {
54
+ //Here when the promise is resolved, it should be able to see the correlation_id.
55
+ const correlationId = collectedDeviceData.correlation_id;
56
+ console.log("On Success", correlationId);
57
+ })
58
+ .catch(function(error) {
59
+ // Handle promise rejection if script loading fails
60
+ console.log("Promise rejected", error);
61
+ });
57
62
  </script>
58
63
  </html>
59
64
  ```
@@ -95,12 +95,22 @@ the correlation id used among the requests asynchronously.
95
95
 
96
96
  **Kind**: instance method of [<code>PayPalDataCollector</code>](#PayPalDataCollector)
97
97
  **Returns**: [<code>Promise.&lt;CollectedDeviceData&gt;</code>](#CollectedDeviceData) - Promise when resolved, returns an object
98
- that contains the `correlation_id` key.
98
+ that contains the `correlation_id` key. The promise may be rejected if script loading fails.
99
99
  **Example**
100
100
  ```js
101
101
  const collectedDeviceData = await payPalDataCollectorWidget.collectDeviceData();
102
102
  console.log(collectedDeviceData.correlation_id)
103
103
  ```
104
+ **Example**
105
+ ```js
106
+ payPalDataCollectorWidget.collectDeviceData()
107
+ .then((collectedDeviceData) => {
108
+ console.log(collectedDeviceData.correlation_id);
109
+ })
110
+ .catch((error) => {
111
+ console.error('Failed to collect device data', error);
112
+ });
113
+ ```
104
114
  <a name="PayPalDataCollector+onError" id="PayPalDataCollector+onError" href="#PayPalDataCollector+onError">&nbsp;</a>
105
115
 
106
116
  ### payPalDataCollector.onError([callback])
@@ -558,7 +558,7 @@ Registers a callback function to be invoked when the wallet button gets clicked.
558
558
  There are two operational modes supported, Synchronous and Asynchronous.
559
559
  When asynchronous operations need to occur on the callback handler, attaching the Promise via `attachResult` is required to have the wallet wait for a result.
560
560
  When synchronous operations occur on the callback handler, attaching a boolean result via `attachResult` is optional to control the execution flow.
561
- Note this is supported for Paypal, GooglePay and ApplePay wallet buttons at the moment.
561
+ Note this is supported for Paypal, GooglePay, ApplePay, Afterpay and FlypayV2 wallet buttons at the moment.
562
562
 
563
563
  **Kind**: instance method of [<code>WalletButtons</code>](#WalletButtons)
564
564
 
package/package.json CHANGED
@@ -104,7 +104,7 @@
104
104
  }
105
105
  },
106
106
  "name": "@paydock/client-sdk",
107
- "version": "1.138.1",
107
+ "version": "1.139.0",
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",