@paydock/client-sdk 1.127.0 → 1.128.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.
- package/README.md +1136 -3960
- package/bundles/index.cjs +292 -85
- package/bundles/index.cjs.d.ts +48 -3
- package/bundles/index.mjs +292 -85
- package/bundles/index.mjs.d.ts +48 -3
- package/bundles/types/checkout/checkout.d.ts +4 -4
- package/bundles/types/checkout/checkout.d.ts.map +1 -1
- package/bundles/types/checkout/layout-widgets/additionals.d.ts.map +1 -1
- package/bundles/types/checkout/layout-widgets/payment-template.d.ts.map +1 -1
- package/bundles/types/components/param.d.ts +2 -0
- package/bundles/types/components/param.d.ts.map +1 -1
- package/bundles/types/components/trigger.d.ts +2 -0
- package/bundles/types/components/trigger.d.ts.map +1 -1
- package/bundles/types/index-cba.d.ts +11 -11
- package/bundles/types/index-cba.d.ts.map +1 -1
- package/bundles/types/index.d.ts +11 -11
- package/bundles/types/index.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/click-to-pay-secure-remote-commerce.d.ts +24 -2
- package/bundles/types/secure-remote-commerce/click-to-pay-secure-remote-commerce.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/index.d.ts +7 -1
- package/bundles/types/secure-remote-commerce/index.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/interfaces.d.ts +10 -2
- package/bundles/types/secure-remote-commerce/interfaces.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/providers/mastercard-src/mastercard-src.d.ts +15 -4
- package/bundles/types/secure-remote-commerce/providers/mastercard-src/mastercard-src.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/providers/src-provider.d.ts +2 -0
- package/bundles/types/secure-remote-commerce/providers/src-provider.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/services/performance.service.d.ts +32 -0
- package/bundles/types/secure-remote-commerce/services/performance.service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/index.d.ts +6 -6
- package/bundles/types/wallet-buttons/wallet-buttons.d.ts +2 -2
- package/bundles/types/wallet-buttons-express/enum/event.enum.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/index.d.ts +3 -3
- package/bundles/types/wallet-buttons-express/index.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/charge-wallet-token-meta.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-click-event-data.interface.d.ts +2 -2
- package/bundles/types/wallet-buttons-express/interfaces/on-click-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-close-event-data.interface.d.ts +2 -2
- package/bundles/types/wallet-buttons-express/interfaces/on-close-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-error-event-data.interface.d.ts +2 -2
- package/bundles/types/wallet-buttons-express/interfaces/on-error-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-error-event-data.interface.d.ts +2 -2
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-error-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-in-review-event-data.interface.d.ts +2 -2
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-in-review-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-successful-event-data.interface.d.ts +2 -2
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-successful-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-shipping-address-change-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-shipping-address-change-event-response.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-shipping-option-change-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-unavailable-event-data.interface.d.ts +2 -2
- package/bundles/types/wallet-buttons-express/interfaces/on-unavailable-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts +5 -5
- package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-data.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-method.type.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts +1 -1
- package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/types/shipping-event-to-response.type.d.ts +4 -4
- package/bundles/types/wallet-buttons-express/types/shipping-event-to-response.type.d.ts.map +1 -1
- package/bundles/types/widget/multi-widget.d.ts +8 -0
- package/bundles/types/widget/multi-widget.d.ts.map +1 -1
- package/bundles/widget.umd.js +292 -85
- package/bundles/widget.umd.js.d.ts +48 -3
- package/bundles/widget.umd.js.min.d.ts +48 -3
- package/bundles/widget.umd.min.js +1 -1
- package/docs/api-checkout-button.md +0 -370
- package/docs/api-widget.md +1 -2110
- package/docs/checkout-examples.md +2 -127
- package/docs/click-to-pay-examples.md +109 -0
- package/docs/click-to-pay.md +31 -1
- package/docs/license.md +1 -1
- package/docs/wallet-buttons-examples.md +3 -134
- package/docs/wallet-buttons.md +10 -10
- package/docs/wallet-cba-buttons-examples.md +1 -1
- package/package.json +1 -1
- package/slate.md +114 -524
- package/docs/api-vault-display.md +0 -94
package/bundles/index.cjs
CHANGED
|
@@ -954,7 +954,7 @@ SDK.headerKeys = Object.freeze({
|
|
|
954
954
|
version: 'x-sdk-version',
|
|
955
955
|
type: 'x-sdk-type'
|
|
956
956
|
});
|
|
957
|
-
SDK._version = 'v1.
|
|
957
|
+
SDK._version = 'v1.128.2';
|
|
958
958
|
|
|
959
959
|
/******************************************************************************
|
|
960
960
|
Copyright (c) Microsoft Corporation.
|
|
@@ -5757,7 +5757,8 @@ var FORM_FIELD$1 = {
|
|
|
5757
5757
|
ADDRESS_COUNTRY: 'address_country',
|
|
5758
5758
|
ADDRESS_CITY: 'address_city',
|
|
5759
5759
|
ADDRESS_POSTCODE: 'address_postcode',
|
|
5760
|
-
ADDRESS_COMPANY: 'address_company'
|
|
5760
|
+
ADDRESS_COMPANY: 'address_company',
|
|
5761
|
+
SAVE_CARD_CONSENT_ACCEPTED: 'save_card_consent_accepted'
|
|
5761
5762
|
};
|
|
5762
5763
|
var STYLE$2 = {
|
|
5763
5764
|
BACKGROUND_COLOR: 'background_color',
|
|
@@ -8658,6 +8659,59 @@ var HtmlPaymentSourceWidget = /*#__PURE__*/function (_PaymentSourceWidget) {
|
|
|
8658
8659
|
}]);
|
|
8659
8660
|
}(PaymentSourceWidget);
|
|
8660
8661
|
|
|
8662
|
+
/**
|
|
8663
|
+
* Interface for classes that represent a trigger data.
|
|
8664
|
+
* @interface ITriggerData
|
|
8665
|
+
*
|
|
8666
|
+
* @param {string} [configuration_token]
|
|
8667
|
+
* @param {string} [tab_number]
|
|
8668
|
+
* @param {string} [elements]
|
|
8669
|
+
* @param {string} [form_values]
|
|
8670
|
+
* */
|
|
8671
|
+
/**
|
|
8672
|
+
* List of available triggers
|
|
8673
|
+
*
|
|
8674
|
+
* @type {object}
|
|
8675
|
+
* @param {string} SUBMIT_FORM=submit_form
|
|
8676
|
+
* @param {string} CHANGE_TAB=tab
|
|
8677
|
+
* @param {string} HIDE_ELEMENTS=hide_elements
|
|
8678
|
+
* @param {string} SHOW_ELEMENTS=show_elements
|
|
8679
|
+
* @param {string} REFRESH_CHECKOUT=refresh_checkout
|
|
8680
|
+
* @param {string} UPDATE_FORM_VALUES=update_form_values
|
|
8681
|
+
* @param {string} INIT_CHECKOUT=init_checkout
|
|
8682
|
+
* @param {string} INJECT_CUSTOMER_DATA=inject_customer_data
|
|
8683
|
+
*/
|
|
8684
|
+
var TRIGGER$1 = {
|
|
8685
|
+
SUBMIT_FORM: 'submit_form',
|
|
8686
|
+
CHANGE_TAB: 'tab',
|
|
8687
|
+
HIDE_ELEMENTS: 'hide_elements',
|
|
8688
|
+
SHOW_ELEMENTS: 'show_elements',
|
|
8689
|
+
REFRESH_CHECKOUT: 'refresh_checkout',
|
|
8690
|
+
UPDATE_FORM_VALUES: 'update_form_values',
|
|
8691
|
+
INIT_CHECKOUT: 'init_checkout',
|
|
8692
|
+
INJECT_CUSTOMER_DATA: 'inject_customer_data'
|
|
8693
|
+
};
|
|
8694
|
+
var Trigger = /*#__PURE__*/function () {
|
|
8695
|
+
function Trigger(iFrame) {
|
|
8696
|
+
_classCallCheck(this, Trigger);
|
|
8697
|
+
this.iFrame = iFrame;
|
|
8698
|
+
}
|
|
8699
|
+
return _createClass(Trigger, [{
|
|
8700
|
+
key: "push",
|
|
8701
|
+
value: function push(triggerName) {
|
|
8702
|
+
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8703
|
+
if (!this.iFrame.isExist()) return;
|
|
8704
|
+
if (ObjectHelper.values(TRIGGER$1).indexOf(triggerName) === -1) console.warn('unsupported trigger type');
|
|
8705
|
+
var body = {
|
|
8706
|
+
trigger: triggerName,
|
|
8707
|
+
destination: 'widget.paydock',
|
|
8708
|
+
data: data
|
|
8709
|
+
};
|
|
8710
|
+
this.iFrame.getElement().contentWindow.postMessage(JSON.stringify(body), '*');
|
|
8711
|
+
}
|
|
8712
|
+
}]);
|
|
8713
|
+
}();
|
|
8714
|
+
|
|
8661
8715
|
/**
|
|
8662
8716
|
* List of available event's name in the Click To Pay checkout lifecycle
|
|
8663
8717
|
* @enum EVENT
|
|
@@ -8703,12 +8757,125 @@ var STYLE = {
|
|
|
8703
8757
|
ENABLE_SRC_POPUP: 'enable_src_popup'
|
|
8704
8758
|
};
|
|
8705
8759
|
|
|
8760
|
+
var PerformanceService = /*#__PURE__*/function () {
|
|
8761
|
+
function PerformanceService() {
|
|
8762
|
+
_classCallCheck(this, PerformanceService);
|
|
8763
|
+
}
|
|
8764
|
+
return _createClass(PerformanceService, null, [{
|
|
8765
|
+
key: "initialize",
|
|
8766
|
+
value: function initialize(env) {
|
|
8767
|
+
var _this = this;
|
|
8768
|
+
performance.now();
|
|
8769
|
+
// Set environment configuration
|
|
8770
|
+
var envInstance = new Env(API_URL, env);
|
|
8771
|
+
var finalUrl = envInstance.getConf().url;
|
|
8772
|
+
// Add performance optimizations in parallel
|
|
8773
|
+
Promise.all([
|
|
8774
|
+
// Add preconnect
|
|
8775
|
+
new Promise(function (resolve) {
|
|
8776
|
+
_this.addLinkTag('preconnect', finalUrl, true);
|
|
8777
|
+
resolve();
|
|
8778
|
+
}),
|
|
8779
|
+
// Add DNS prefetch
|
|
8780
|
+
new Promise(function (resolve) {
|
|
8781
|
+
_this.addLinkTag('dns-prefetch', finalUrl);
|
|
8782
|
+
resolve();
|
|
8783
|
+
}),
|
|
8784
|
+
// Send warmup request
|
|
8785
|
+
new Promise(function (resolve) {
|
|
8786
|
+
if (window.fetch) {
|
|
8787
|
+
fetch("".concat(finalUrl, "/v1/echo"), {
|
|
8788
|
+
mode: 'no-cors',
|
|
8789
|
+
keepalive: true
|
|
8790
|
+
})["catch"](function () {})["finally"](resolve);
|
|
8791
|
+
} else {
|
|
8792
|
+
resolve();
|
|
8793
|
+
}
|
|
8794
|
+
})]);
|
|
8795
|
+
}
|
|
8796
|
+
/**
|
|
8797
|
+
* Dynamically adds or updates a `<link>` tag in the document's `<head>`.
|
|
8798
|
+
* This utility is designed for performance optimizations like `dns-prefetch` and `preconnect`.
|
|
8799
|
+
*
|
|
8800
|
+
* @param rel - The relationship type of the link (e.g., 'dns-prefetch', 'preconnect').
|
|
8801
|
+
* @param href - The URL for the resource.
|
|
8802
|
+
* @param crossorigin - Specifies if the resource should be fetched with a CORS request. Defaults to false.
|
|
8803
|
+
*/
|
|
8804
|
+
}, {
|
|
8805
|
+
key: "addLinkTag",
|
|
8806
|
+
value: function addLinkTag(rel, href) {
|
|
8807
|
+
var crossorigin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
8808
|
+
try {
|
|
8809
|
+
var existingTag = document.head.querySelector("link[rel=\"".concat(rel, "\"][href*=\"").concat(new URL(href).host, "\"]"));
|
|
8810
|
+
if (existingTag) {
|
|
8811
|
+
return;
|
|
8812
|
+
}
|
|
8813
|
+
var linkElement = this.createLinkElement(rel, href, crossorigin);
|
|
8814
|
+
document.head.prepend(linkElement);
|
|
8815
|
+
} catch (error) {
|
|
8816
|
+
console.error("\u274C [Performance] Failed to add ".concat(rel, " tag for ").concat(href, "."), error);
|
|
8817
|
+
}
|
|
8818
|
+
}
|
|
8819
|
+
/**
|
|
8820
|
+
* Creates and configures a new HTMLLinkElement.
|
|
8821
|
+
*
|
|
8822
|
+
* @param rel - The relationship type.
|
|
8823
|
+
* @param href - The resource URL.
|
|
8824
|
+
* @param crossorigin - The CORS setting.
|
|
8825
|
+
* @returns A configured HTMLLinkElement.
|
|
8826
|
+
* @private
|
|
8827
|
+
*/
|
|
8828
|
+
}, {
|
|
8829
|
+
key: "createLinkElement",
|
|
8830
|
+
value: function createLinkElement(rel, href, crossorigin) {
|
|
8831
|
+
var linkElement = document.createElement('link');
|
|
8832
|
+
linkElement.rel = rel;
|
|
8833
|
+
linkElement.href = this.determineHref(rel, href);
|
|
8834
|
+
if (crossorigin) {
|
|
8835
|
+
linkElement.crossOrigin = 'anonymous';
|
|
8836
|
+
}
|
|
8837
|
+
return linkElement;
|
|
8838
|
+
}
|
|
8839
|
+
/**
|
|
8840
|
+
* Determines the appropriate href value based on the link relationship.
|
|
8841
|
+
*
|
|
8842
|
+
* @param rel - The relationship type.
|
|
8843
|
+
* @param originalHref - The original URL.
|
|
8844
|
+
* @returns The processed href string.
|
|
8845
|
+
* @private
|
|
8846
|
+
*/
|
|
8847
|
+
}, {
|
|
8848
|
+
key: "determineHref",
|
|
8849
|
+
value: function determineHref(rel, originalHref) {
|
|
8850
|
+
if (rel === 'dns-prefetch') {
|
|
8851
|
+
// For dns-prefetch, a protocol-relative URL to the host is sufficient.
|
|
8852
|
+
var _URL = new URL(originalHref),
|
|
8853
|
+
host = _URL.host;
|
|
8854
|
+
return "//".concat(host);
|
|
8855
|
+
}
|
|
8856
|
+
// For others, like preconnect, the full original URL is required.
|
|
8857
|
+
return originalHref;
|
|
8858
|
+
}
|
|
8859
|
+
}]);
|
|
8860
|
+
}();
|
|
8861
|
+
|
|
8706
8862
|
var ClickToPaySRC = /*#__PURE__*/function () {
|
|
8707
8863
|
function ClickToPaySRC(iframe_selector, service_id, public_key, meta, eventEmitter, autoResize, env, alias) {
|
|
8708
8864
|
_classCallCheck(this, ClickToPaySRC);
|
|
8865
|
+
var _a, _b, _c;
|
|
8709
8866
|
this.meta = meta;
|
|
8710
8867
|
this.eventEmitter = eventEmitter;
|
|
8711
8868
|
this.autoResize = autoResize;
|
|
8869
|
+
this.isIframeLoaded = false;
|
|
8870
|
+
this.injectedCustomerData = null;
|
|
8871
|
+
if (meta.dpa_config) {
|
|
8872
|
+
var hasAllRawDpaConfig = !!(((_a = this.meta.dpa_config) === null || _a === void 0 ? void 0 : _a.dpa_id) && ((_b = this.meta.dpa_config) === null || _b === void 0 ? void 0 : _b.dpa_name) && ((_c = this.meta.dpa_config) === null || _c === void 0 ? void 0 : _c.dpa_supported_card_schemes));
|
|
8873
|
+
// if doesnt have all fields remove dpa_config from meta
|
|
8874
|
+
if (!hasAllRawDpaConfig) {
|
|
8875
|
+
console.warn('DPA config is missing some required fields, removing it from meta');
|
|
8876
|
+
delete meta.dpa_config;
|
|
8877
|
+
}
|
|
8878
|
+
}
|
|
8712
8879
|
this.link = new Link(MASTERCARD_SRC);
|
|
8713
8880
|
this.link.setParams(_extends({
|
|
8714
8881
|
service_id: service_id,
|
|
@@ -8725,6 +8892,7 @@ var ClickToPaySRC = /*#__PURE__*/function () {
|
|
|
8725
8892
|
if (env) this.link.setEnv(env, alias);
|
|
8726
8893
|
this.iFrameContainer = new Container(iframe_selector);
|
|
8727
8894
|
this.iFrame = new IFrame(this.iFrameContainer);
|
|
8895
|
+
this.trigger = new Trigger(this.iFrame);
|
|
8728
8896
|
this.iFrameEvent = new IFrameEvent(window);
|
|
8729
8897
|
this.setupIFrameEvents();
|
|
8730
8898
|
}
|
|
@@ -8760,6 +8928,8 @@ var ClickToPaySRC = /*#__PURE__*/function () {
|
|
|
8760
8928
|
key: "load",
|
|
8761
8929
|
value: function load() {
|
|
8762
8930
|
var _this2 = this;
|
|
8931
|
+
// Initialize performance optimizations when environment is guaranteed to be final
|
|
8932
|
+
PerformanceService.initialize(this.link.getEnv());
|
|
8763
8933
|
this.iFrame.load(this.link.getUrl(), {
|
|
8764
8934
|
title: 'Click To Pay checkout'
|
|
8765
8935
|
});
|
|
@@ -8768,7 +8938,12 @@ var ClickToPaySRC = /*#__PURE__*/function () {
|
|
|
8768
8938
|
if (iframeElement) {
|
|
8769
8939
|
iframeElement.setAttribute('allow', 'payment; accelerometer;');
|
|
8770
8940
|
iframeElement.onload = function () {
|
|
8771
|
-
|
|
8941
|
+
_this2.isIframeLoaded = true;
|
|
8942
|
+
_this2.eventEmitter.emit(EVENT$3.IFRAME_LOADED, {});
|
|
8943
|
+
if (_this2.injectedCustomerData) {
|
|
8944
|
+
_this2.injectCustomerData(_this2.injectedCustomerData);
|
|
8945
|
+
_this2.injectedCustomerData = null;
|
|
8946
|
+
}
|
|
8772
8947
|
};
|
|
8773
8948
|
}
|
|
8774
8949
|
}
|
|
@@ -8811,6 +8986,22 @@ var ClickToPaySRC = /*#__PURE__*/function () {
|
|
|
8811
8986
|
}
|
|
8812
8987
|
});
|
|
8813
8988
|
}
|
|
8989
|
+
/**
|
|
8990
|
+
* Send customer data to iframe using the established trigger pattern
|
|
8991
|
+
*
|
|
8992
|
+
* @param {CustomerData} customerData - Customer data to inject
|
|
8993
|
+
*/
|
|
8994
|
+
}, {
|
|
8995
|
+
key: "injectCustomerData",
|
|
8996
|
+
value: function injectCustomerData(customerData) {
|
|
8997
|
+
if (!this.isIframeLoaded) {
|
|
8998
|
+
this.injectedCustomerData = customerData;
|
|
8999
|
+
return;
|
|
9000
|
+
}
|
|
9001
|
+
this.trigger.push(TRIGGER$1.INJECT_CUSTOMER_DATA, {
|
|
9002
|
+
customer: customerData
|
|
9003
|
+
});
|
|
9004
|
+
}
|
|
8814
9005
|
}]);
|
|
8815
9006
|
}();
|
|
8816
9007
|
|
|
@@ -8999,74 +9190,75 @@ var ClickToPay = /*#__PURE__*/function (_SRC) {
|
|
|
8999
9190
|
_this.service_id = service_id;
|
|
9000
9191
|
_this.public_key_or_access_token = public_key_or_access_token;
|
|
9001
9192
|
_this.meta = meta;
|
|
9193
|
+
_this.holdingForCustomerData = false;
|
|
9194
|
+
_this.pendingCustomerData = null;
|
|
9195
|
+
// Dequeue customer data only when the iframe has loaded
|
|
9196
|
+
_this.on('iframeLoaded', function () {
|
|
9197
|
+
if (_this.pendingCustomerData && _this.provider) {
|
|
9198
|
+
_this.provider.injectCustomerData(_this.pendingCustomerData);
|
|
9199
|
+
_this.pendingCustomerData = null;
|
|
9200
|
+
}
|
|
9201
|
+
});
|
|
9002
9202
|
return _this;
|
|
9003
9203
|
}
|
|
9004
9204
|
/**
|
|
9005
9205
|
* The final method after configuring the SRC to start the load process of Click To Pay checkout
|
|
9006
|
-
*
|
|
9007
9206
|
*/
|
|
9008
9207
|
_inherits(ClickToPay, _SRC);
|
|
9009
9208
|
return _createClass(ClickToPay, [{
|
|
9010
9209
|
key: "load",
|
|
9011
9210
|
value: function load() {
|
|
9012
|
-
if (this.provider)
|
|
9211
|
+
if (this.provider) {
|
|
9212
|
+
return;
|
|
9213
|
+
}
|
|
9013
9214
|
this.meta.customizations = this.style;
|
|
9215
|
+
this.holdingForCustomerData = !!this.meta.hold_for_customer_data;
|
|
9014
9216
|
this.provider = new ClickToPaySRC(this.iframe_selector, this.service_id, this.public_key_or_access_token, this.meta, this.eventEmitter, this.autoResize, this.env, this.alias);
|
|
9015
9217
|
this.provider.load();
|
|
9016
9218
|
}
|
|
9017
|
-
|
|
9018
|
-
|
|
9019
|
-
|
|
9020
|
-
|
|
9021
|
-
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
|
|
9025
|
-
|
|
9026
|
-
|
|
9027
|
-
|
|
9028
|
-
|
|
9029
|
-
|
|
9030
|
-
|
|
9031
|
-
|
|
9032
|
-
|
|
9033
|
-
|
|
9034
|
-
|
|
9035
|
-
|
|
9036
|
-
|
|
9037
|
-
|
|
9038
|
-
|
|
9039
|
-
|
|
9040
|
-
|
|
9041
|
-
|
|
9042
|
-
|
|
9043
|
-
|
|
9044
|
-
|
|
9045
|
-
|
|
9046
|
-
|
|
9047
|
-
|
|
9048
|
-
|
|
9049
|
-
|
|
9050
|
-
|
|
9051
|
-
|
|
9052
|
-
|
|
9053
|
-
|
|
9054
|
-
|
|
9055
|
-
|
|
9056
|
-
|
|
9057
|
-
value: function push(triggerName) {
|
|
9058
|
-
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
9059
|
-
if (!this.iFrame.isExist()) return;
|
|
9060
|
-
if (ObjectHelper.values(TRIGGER$1).indexOf(triggerName) === -1) console.warn('unsupported trigger type');
|
|
9061
|
-
var body = {
|
|
9062
|
-
trigger: triggerName,
|
|
9063
|
-
destination: 'widget.paydock',
|
|
9064
|
-
data: data
|
|
9065
|
-
};
|
|
9066
|
-
this.iFrame.getElement().contentWindow.postMessage(JSON.stringify(body), '*');
|
|
9219
|
+
/**
|
|
9220
|
+
* Inject customer data after widget initialization via postMessage
|
|
9221
|
+
*
|
|
9222
|
+
* @param {Customer} customerData - Customer data to inject
|
|
9223
|
+
* @throws {Error} When customer data is invalid or widget is not ready
|
|
9224
|
+
* @example
|
|
9225
|
+
* widget.injectCustomerData({
|
|
9226
|
+
* email: 'user@example.com',
|
|
9227
|
+
* first_name: 'John',
|
|
9228
|
+
* last_name: 'Doe'
|
|
9229
|
+
* });
|
|
9230
|
+
*/
|
|
9231
|
+
}, {
|
|
9232
|
+
key: "injectCustomerData",
|
|
9233
|
+
value: function injectCustomerData(customerData) {
|
|
9234
|
+
if (!this.validateCustomerData(customerData)) {
|
|
9235
|
+
throw new Error('Invalid customer data format. Must include at least email or phone.');
|
|
9236
|
+
}
|
|
9237
|
+
if (!this.provider) {
|
|
9238
|
+
throw new Error('ClickToPay is not ready. Please call `load` method first.');
|
|
9239
|
+
}
|
|
9240
|
+
this.provider.injectCustomerData(customerData);
|
|
9241
|
+
}
|
|
9242
|
+
/**
|
|
9243
|
+
* Validate customer data format
|
|
9244
|
+
*
|
|
9245
|
+
* @private
|
|
9246
|
+
* @param {Customer} customerData - Customer data to validate
|
|
9247
|
+
* @returns {boolean} True if valid
|
|
9248
|
+
*/
|
|
9249
|
+
}, {
|
|
9250
|
+
key: "validateCustomerData",
|
|
9251
|
+
value: function validateCustomerData(customerData) {
|
|
9252
|
+
if (!customerData || _typeof$1(customerData) !== 'object') {
|
|
9253
|
+
return false;
|
|
9254
|
+
}
|
|
9255
|
+
// Check if at least email or phone is provided
|
|
9256
|
+
var hasEmail = customerData.email && typeof customerData.email === 'string';
|
|
9257
|
+
var hasPhone = customerData.phone && _typeof$1(customerData.phone) === 'object' && customerData.phone.phone && typeof customerData.phone.phone === 'string';
|
|
9258
|
+
return hasEmail || hasPhone;
|
|
9067
9259
|
}
|
|
9068
9260
|
}]);
|
|
9069
|
-
}();
|
|
9261
|
+
}(SRC);
|
|
9070
9262
|
|
|
9071
9263
|
var VAULT_DISPLAY_EVENT;
|
|
9072
9264
|
(function (VAULT_DISPLAY_EVENT) {
|
|
@@ -13021,7 +13213,7 @@ var EVENT$2 = {
|
|
|
13021
13213
|
ON_CHECKOUT_CLOSE: EventEnum.ON_CHECKOUT_CLOSE
|
|
13022
13214
|
};
|
|
13023
13215
|
/**
|
|
13024
|
-
* Class WalletButtons to work with different E-Wallets within html (currently supports Apple Pay, Google Pay, Google Pay™ and Apple Pay via Stripe, Flypay
|
|
13216
|
+
* Class WalletButtons to work with different E-Wallets within html (currently supports Apple Pay, Google Pay, Google Pay™ and Apple Pay via Stripe, Flypay V2, Paypal, Afterpay)
|
|
13025
13217
|
* @constructor
|
|
13026
13218
|
*
|
|
13027
13219
|
* @example
|
|
@@ -13138,7 +13330,7 @@ var WalletButtons = /*#__PURE__*/function () {
|
|
|
13138
13330
|
}
|
|
13139
13331
|
/**
|
|
13140
13332
|
* Triggers the update process of the wallet, if available.
|
|
13141
|
-
* Currently supported by
|
|
13333
|
+
* Currently supported by Paypal and ApplePay/GooglePay via MPGS Wallets.
|
|
13142
13334
|
*
|
|
13143
13335
|
* @example
|
|
13144
13336
|
* var button = new WalletButtons(
|
|
@@ -13258,7 +13450,7 @@ var WalletButtons = /*#__PURE__*/function () {
|
|
|
13258
13450
|
* });
|
|
13259
13451
|
* // or
|
|
13260
13452
|
* button.on('unavailable').then(function () {
|
|
13261
|
-
* console.log('No button is available);
|
|
13453
|
+
* console.log('No button is available');
|
|
13262
13454
|
* });
|
|
13263
13455
|
*
|
|
13264
13456
|
* @param {string} eventName - Available event names [EVENT]{@link EVENT}
|
|
@@ -15012,6 +15204,21 @@ var MultiWidget = /*#__PURE__*/function () {
|
|
|
15012
15204
|
error: error
|
|
15013
15205
|
});
|
|
15014
15206
|
}
|
|
15207
|
+
/**
|
|
15208
|
+
* The Current method can set a consent checkbox to save card
|
|
15209
|
+
*
|
|
15210
|
+
* @example
|
|
15211
|
+
* widget.enableSaveCardConsentCheckbox();
|
|
15212
|
+
*
|
|
15213
|
+
*/
|
|
15214
|
+
}, {
|
|
15215
|
+
key: "enableSaveCardConsentCheckbox",
|
|
15216
|
+
value: function enableSaveCardConsentCheckbox() {
|
|
15217
|
+
var _a, _b, _c;
|
|
15218
|
+
if (((_c = (_b = (_a = this.configs[0]) === null || _a === void 0 ? void 0 : _a.getConfigs()) === null || _b === void 0 ? void 0 : _b.predefined_fields) === null || _c === void 0 ? void 0 : _c.type) === 'card') {
|
|
15219
|
+
this.setFormValue('save_card_consent_accepted', 'false');
|
|
15220
|
+
}
|
|
15221
|
+
}
|
|
15015
15222
|
}]);
|
|
15016
15223
|
}();
|
|
15017
15224
|
|
|
@@ -15685,6 +15892,30 @@ var HtmlWidget = /*#__PURE__*/function (_HtmlMultiWidget) {
|
|
|
15685
15892
|
}]);
|
|
15686
15893
|
}(HtmlMultiWidget);
|
|
15687
15894
|
|
|
15895
|
+
var Spinner = /*#__PURE__*/function () {
|
|
15896
|
+
function Spinner() {
|
|
15897
|
+
_classCallCheck(this, Spinner);
|
|
15898
|
+
}
|
|
15899
|
+
return _createClass(Spinner, null, [{
|
|
15900
|
+
key: "getSpinnerElement",
|
|
15901
|
+
value: function getSpinnerElement() {
|
|
15902
|
+
return document.getElementById('spinner');
|
|
15903
|
+
}
|
|
15904
|
+
}, {
|
|
15905
|
+
key: "show",
|
|
15906
|
+
value: function show() {
|
|
15907
|
+
var spinner = this.getSpinnerElement();
|
|
15908
|
+
spinner === null || spinner === void 0 ? void 0 : spinner.classList.remove('spinner-wrapper--hidden');
|
|
15909
|
+
}
|
|
15910
|
+
}, {
|
|
15911
|
+
key: "hide",
|
|
15912
|
+
value: function hide() {
|
|
15913
|
+
var spinner = this.getSpinnerElement();
|
|
15914
|
+
spinner === null || spinner === void 0 ? void 0 : spinner.classList.add('spinner-wrapper--hidden');
|
|
15915
|
+
}
|
|
15916
|
+
}]);
|
|
15917
|
+
}();
|
|
15918
|
+
|
|
15688
15919
|
var InstructionModule$1 = /*#__PURE__*/function () {
|
|
15689
15920
|
function InstructionModule() {
|
|
15690
15921
|
_classCallCheck(this, InstructionModule);
|
|
@@ -15750,30 +15981,6 @@ function Instruction(instruction) {
|
|
|
15750
15981
|
};
|
|
15751
15982
|
}
|
|
15752
15983
|
|
|
15753
|
-
var Spinner = /*#__PURE__*/function () {
|
|
15754
|
-
function Spinner() {
|
|
15755
|
-
_classCallCheck(this, Spinner);
|
|
15756
|
-
}
|
|
15757
|
-
return _createClass(Spinner, null, [{
|
|
15758
|
-
key: "getSpinnerElement",
|
|
15759
|
-
value: function getSpinnerElement() {
|
|
15760
|
-
return document.getElementById('spinner');
|
|
15761
|
-
}
|
|
15762
|
-
}, {
|
|
15763
|
-
key: "show",
|
|
15764
|
-
value: function show() {
|
|
15765
|
-
var spinner = this.getSpinnerElement();
|
|
15766
|
-
spinner === null || spinner === void 0 ? void 0 : spinner.classList.remove('spinner-wrapper--hidden');
|
|
15767
|
-
}
|
|
15768
|
-
}, {
|
|
15769
|
-
key: "hide",
|
|
15770
|
-
value: function hide() {
|
|
15771
|
-
var spinner = this.getSpinnerElement();
|
|
15772
|
-
spinner === null || spinner === void 0 ? void 0 : spinner.classList.add('spinner-wrapper--hidden');
|
|
15773
|
-
}
|
|
15774
|
-
}]);
|
|
15775
|
-
}();
|
|
15776
|
-
|
|
15777
15984
|
var SessionHelper = /*#__PURE__*/function () {
|
|
15778
15985
|
function SessionHelper() {
|
|
15779
15986
|
_classCallCheck(this, SessionHelper);
|
|
@@ -17309,7 +17516,7 @@ var Checkout = /*#__PURE__*/function () {
|
|
|
17309
17516
|
key: "isTimeoutInstruction",
|
|
17310
17517
|
value: function isTimeoutInstruction(response) {
|
|
17311
17518
|
var _a, _b;
|
|
17312
|
-
return ((_a = response.payload) === null || _a === void 0 ? void 0 : _a.status) === 'expired' || ((_b = response.
|
|
17519
|
+
return ((_a = response.payload) === null || _a === void 0 ? void 0 : _a.status) === 'expired' || ((_b = response.payload) === null || _b === void 0 ? void 0 : _b.title) === 'Session expired';
|
|
17313
17520
|
}
|
|
17314
17521
|
}, {
|
|
17315
17522
|
key: "handleInstruction",
|
|
@@ -19109,7 +19316,7 @@ var PayPalSavePaymentSourceWidget = /*#__PURE__*/function () {
|
|
|
19109
19316
|
}]);
|
|
19110
19317
|
}();
|
|
19111
19318
|
|
|
19112
|
-
window.postMessage(
|
|
19319
|
+
window.postMessage('PAYDOCK_PAYMENTS_WIDGET_LOADED');
|
|
19113
19320
|
|
|
19114
19321
|
class Timer {
|
|
19115
19322
|
constructor(opts, ms) {
|
package/bundles/index.cjs.d.ts
CHANGED
|
@@ -281,6 +281,7 @@ declare const FORM_FIELD: {
|
|
|
281
281
|
ADDRESS_CITY: string;
|
|
282
282
|
ADDRESS_POSTCODE: string;
|
|
283
283
|
ADDRESS_COMPANY: string;
|
|
284
|
+
SAVE_CARD_CONSENT_ACCEPTED: string;
|
|
284
285
|
};
|
|
285
286
|
declare const STYLE: {
|
|
286
287
|
BACKGROUND_COLOR: string;
|
|
@@ -455,6 +456,7 @@ interface IParams extends IStyles$1, ITexts, ICommonParams {
|
|
|
455
456
|
vault_display_token?: string;
|
|
456
457
|
sdk_origin?: boolean;
|
|
457
458
|
hide_ui_errors?: boolean;
|
|
459
|
+
save_card_consent_accepted?: string;
|
|
458
460
|
}
|
|
459
461
|
interface ICountryPhoneMask {
|
|
460
462
|
preferred_countries?: string[];
|
|
@@ -1215,6 +1217,14 @@ declare class MultiWidget {
|
|
|
1215
1217
|
setLanguage(code: any): void;
|
|
1216
1218
|
getLink(): Link;
|
|
1217
1219
|
protected handleErrorEvent(event: EventTypes, error: IEventError, purpose: PURPOSE): void;
|
|
1220
|
+
/**
|
|
1221
|
+
* The Current method can set a consent checkbox to save card
|
|
1222
|
+
*
|
|
1223
|
+
* @example
|
|
1224
|
+
* widget.enableSaveCardConsentCheckbox();
|
|
1225
|
+
*
|
|
1226
|
+
*/
|
|
1227
|
+
enableSaveCardConsentCheckbox(): void;
|
|
1218
1228
|
}
|
|
1219
1229
|
|
|
1220
1230
|
interface ITriggerData {
|
|
@@ -1243,6 +1253,7 @@ interface ITriggerData {
|
|
|
1243
1253
|
* @param {string} REFRESH_CHECKOUT=refresh_checkout
|
|
1244
1254
|
* @param {string} UPDATE_FORM_VALUES=update_form_values
|
|
1245
1255
|
* @param {string} INIT_CHECKOUT=init_checkout
|
|
1256
|
+
* @param {string} INJECT_CUSTOMER_DATA=inject_customer_data
|
|
1246
1257
|
*/
|
|
1247
1258
|
declare const TRIGGER: {
|
|
1248
1259
|
SUBMIT_FORM: string;
|
|
@@ -1252,6 +1263,7 @@ declare const TRIGGER: {
|
|
|
1252
1263
|
REFRESH_CHECKOUT: string;
|
|
1253
1264
|
UPDATE_FORM_VALUES: string;
|
|
1254
1265
|
INIT_CHECKOUT: string;
|
|
1266
|
+
INJECT_CUSTOMER_DATA: string;
|
|
1255
1267
|
};
|
|
1256
1268
|
declare class Trigger {
|
|
1257
1269
|
protected iFrame: IFrame;
|
|
@@ -2899,6 +2911,12 @@ interface Customer {
|
|
|
2899
2911
|
first_name?: string;
|
|
2900
2912
|
last_name?: string;
|
|
2901
2913
|
}
|
|
2914
|
+
interface DpaConfig {
|
|
2915
|
+
dpa_id: string;
|
|
2916
|
+
dpa_name: string;
|
|
2917
|
+
dpa_supported_card_schemes: ('MASTERCARD' | 'VISA' | 'AMEX' | 'DISCOVER')[];
|
|
2918
|
+
mode: 'sandbox' | 'live';
|
|
2919
|
+
}
|
|
2902
2920
|
interface IClickToPayMeta extends IBaseSRCMeta {
|
|
2903
2921
|
dpa_data?: IBaseSRCMeta['dpa_data'] & {
|
|
2904
2922
|
dpa_address?: string;
|
|
@@ -2927,6 +2945,8 @@ interface IClickToPayMeta extends IBaseSRCMeta {
|
|
|
2927
2945
|
customer?: Customer;
|
|
2928
2946
|
unaccepted_card_type?: 'CREDIT' | 'DEBIT';
|
|
2929
2947
|
recognition_token?: string;
|
|
2948
|
+
dpa_config?: DpaConfig;
|
|
2949
|
+
hold_for_customer_data?: boolean;
|
|
2930
2950
|
}
|
|
2931
2951
|
type MASTERCARD_DPA_SHIPPING_BILLING_PREFERENCE = 'FULL' | 'POSTAL_COUNTRY' | 'NONE';
|
|
2932
2952
|
type MASTERCARD_ORDER_TYPE = 'SPLIT_SHIPMENT' | 'PREFERRED_CARD';
|
|
@@ -3077,6 +3097,8 @@ declare class ApiInternal extends ApiBase {
|
|
|
3077
3097
|
gateway(): ApiGatewayInternal;
|
|
3078
3098
|
}
|
|
3079
3099
|
|
|
3100
|
+
type CustomerData = Customer;
|
|
3101
|
+
|
|
3080
3102
|
interface SRCProvider {
|
|
3081
3103
|
load(): void;
|
|
3082
3104
|
getEnv(): string;
|
|
@@ -3086,6 +3108,7 @@ interface SRCProvider {
|
|
|
3086
3108
|
showCheckout?(): void;
|
|
3087
3109
|
reload(): void;
|
|
3088
3110
|
useAutoResize?(): void;
|
|
3111
|
+
injectCustomerData(customerData: CustomerData): void;
|
|
3089
3112
|
}
|
|
3090
3113
|
|
|
3091
3114
|
declare abstract class SRC {
|
|
@@ -3189,12 +3212,34 @@ declare class ClickToPay extends SRC {
|
|
|
3189
3212
|
protected service_id: string;
|
|
3190
3213
|
protected public_key_or_access_token: string;
|
|
3191
3214
|
protected meta: IClickToPayMeta;
|
|
3215
|
+
protected holdingForCustomerData: boolean;
|
|
3216
|
+
private pendingCustomerData;
|
|
3192
3217
|
/** @constructs */ constructor(iframe_selector: string, service_id: string, public_key_or_access_token: string, meta: IClickToPayMeta);
|
|
3193
3218
|
/**
|
|
3194
3219
|
* The final method after configuring the SRC to start the load process of Click To Pay checkout
|
|
3195
|
-
*
|
|
3196
3220
|
*/
|
|
3197
3221
|
load(): void;
|
|
3222
|
+
/**
|
|
3223
|
+
* Inject customer data after widget initialization via postMessage
|
|
3224
|
+
*
|
|
3225
|
+
* @param {Customer} customerData - Customer data to inject
|
|
3226
|
+
* @throws {Error} When customer data is invalid or widget is not ready
|
|
3227
|
+
* @example
|
|
3228
|
+
* widget.injectCustomerData({
|
|
3229
|
+
* email: 'user@example.com',
|
|
3230
|
+
* first_name: 'John',
|
|
3231
|
+
* last_name: 'Doe'
|
|
3232
|
+
* });
|
|
3233
|
+
*/
|
|
3234
|
+
injectCustomerData(customerData: Customer): void;
|
|
3235
|
+
/**
|
|
3236
|
+
* Validate customer data format
|
|
3237
|
+
*
|
|
3238
|
+
* @private
|
|
3239
|
+
* @param {Customer} customerData - Customer data to validate
|
|
3240
|
+
* @returns {boolean} True if valid
|
|
3241
|
+
*/
|
|
3242
|
+
private validateCustomerData;
|
|
3198
3243
|
}
|
|
3199
3244
|
|
|
3200
3245
|
declare class VaultDisplayIframeEvent extends IFrameEvent {
|
|
@@ -3408,7 +3453,7 @@ interface IWalletUpdateData {
|
|
|
3408
3453
|
success: boolean;
|
|
3409
3454
|
}
|
|
3410
3455
|
/**
|
|
3411
|
-
* Class WalletButtons to work with different E-Wallets within html (currently supports Apple Pay, Google Pay, Google Pay™ and Apple Pay via Stripe, Flypay
|
|
3456
|
+
* Class WalletButtons to work with different E-Wallets within html (currently supports Apple Pay, Google Pay, Google Pay™ and Apple Pay via Stripe, Flypay V2, Paypal, Afterpay)
|
|
3412
3457
|
* @constructor
|
|
3413
3458
|
*
|
|
3414
3459
|
* @example
|
|
@@ -3443,7 +3488,7 @@ declare class WalletButtons {
|
|
|
3443
3488
|
load(): void;
|
|
3444
3489
|
/**
|
|
3445
3490
|
* Triggers the update process of the wallet, if available.
|
|
3446
|
-
* Currently supported by
|
|
3491
|
+
* Currently supported by Paypal and ApplePay/GooglePay via MPGS Wallets.
|
|
3447
3492
|
*
|
|
3448
3493
|
* @example
|
|
3449
3494
|
* var button = new WalletButtons(
|