@paydock/client-sdk 1.142.0 → 1.143.0-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.
- package/README.md +85 -0
- package/bundles/index.cjs +324 -193
- package/bundles/index.cjs.d.ts +535 -482
- package/bundles/index.mjs +159 -27
- package/bundles/index.mjs.d.ts +535 -482
- package/bundles/types/components/apple-pay-version.d.ts +29 -0
- package/bundles/types/components/apple-pay-version.d.ts.map +1 -0
- package/bundles/types/index.d.ts +2 -2
- package/bundles/types/index.d.ts.map +1 -1
- package/bundles/types/open-wallets/base/open-wallet-buttons.d.ts.map +1 -1
- package/bundles/types/open-wallets/index.d.ts +1 -1
- package/bundles/types/open-wallets/index.d.ts.map +1 -1
- package/bundles/types/open-wallets/services/apple-pay/apple-pay.open-wallet.service.d.ts.map +1 -1
- package/bundles/types/payment-source-widget/index.d.ts +1 -1
- package/bundles/types/payment-source-widget/index.d.ts.map +1 -1
- package/bundles/types/vault-display-widget/vault-display-widget.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/wallet-services/apple.wallet-service.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts +16 -0
- package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/index.d.ts +36 -0
- package/bundles/types/wallet-buttons-express/index.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/services/paypal/paypal.wallet-button-express.d.ts +1 -1
- package/bundles/types/wallet-buttons-express/services/paypal/paypal.wallet-button-express.d.ts.map +1 -1
- package/bundles/types/widget/html-multi-widget.d.ts +4 -1
- package/bundles/types/widget/html-multi-widget.d.ts.map +1 -1
- package/bundles/types/widget/index.d.ts +2 -1
- package/bundles/types/widget/index.d.ts.map +1 -1
- package/bundles/types/widget/widget-event-map.d.ts +37 -0
- package/bundles/types/widget/widget-event-map.d.ts.map +1 -0
- package/bundles/widget.umd.js +324 -193
- package/bundles/widget.umd.js.d.ts +535 -482
- package/bundles/widget.umd.js.min.d.ts +535 -482
- package/bundles/widget.umd.min.js +1 -1
- package/docs/wallet-buttons-express.md +85 -0
- package/package.json +6 -3
package/bundles/index.mjs
CHANGED
|
@@ -1192,7 +1192,7 @@ SDK.headerKeys = Object.freeze({
|
|
|
1192
1192
|
version: 'x-sdk-version',
|
|
1193
1193
|
type: 'x-sdk-type'
|
|
1194
1194
|
});
|
|
1195
|
-
SDK._version = 'v1.
|
|
1195
|
+
SDK._version = 'v1.143.0-beta';
|
|
1196
1196
|
|
|
1197
1197
|
function isFunction(value) {
|
|
1198
1198
|
return typeof value === 'function';
|
|
@@ -8088,7 +8088,7 @@ var AfterPayWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
8088
8088
|
}]);
|
|
8089
8089
|
}(WalletService);
|
|
8090
8090
|
|
|
8091
|
-
/*! @license DOMPurify 3.
|
|
8091
|
+
/*! @license DOMPurify 3.4.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.0/LICENSE */
|
|
8092
8092
|
|
|
8093
8093
|
var purify_cjs;
|
|
8094
8094
|
var hasRequiredPurify_cjs;
|
|
@@ -8296,7 +8296,7 @@ function requirePurify_cjs () {
|
|
|
8296
8296
|
|
|
8297
8297
|
const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'exportparts', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inert', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'part', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'slot', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
|
|
8298
8298
|
const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'mask-type', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
|
|
8299
|
-
const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', '
|
|
8299
|
+
const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnalign', 'columnlines', 'columnspacing', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lquote', 'lspace', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
|
|
8300
8300
|
const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
|
|
8301
8301
|
|
|
8302
8302
|
// eslint-disable-next-line unicorn/better-regex
|
|
@@ -8393,7 +8393,7 @@ function requirePurify_cjs () {
|
|
|
8393
8393
|
function createDOMPurify() {
|
|
8394
8394
|
let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
|
|
8395
8395
|
const DOMPurify = root => createDOMPurify(root);
|
|
8396
|
-
DOMPurify.version = '3.
|
|
8396
|
+
DOMPurify.version = '3.4.0';
|
|
8397
8397
|
DOMPurify.removed = [];
|
|
8398
8398
|
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
|
|
8399
8399
|
// Not running in a browser, provide a factory function
|
|
@@ -8669,7 +8669,7 @@ function requirePurify_cjs () {
|
|
|
8669
8669
|
NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
|
|
8670
8670
|
MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS;
|
|
8671
8671
|
HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS;
|
|
8672
|
-
CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING ||
|
|
8672
|
+
CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || create(null);
|
|
8673
8673
|
if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
|
|
8674
8674
|
CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
|
|
8675
8675
|
}
|
|
@@ -8709,13 +8709,10 @@ function requirePurify_cjs () {
|
|
|
8709
8709
|
addToSet(ALLOWED_ATTR, xml);
|
|
8710
8710
|
}
|
|
8711
8711
|
}
|
|
8712
|
-
/*
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
if (!objectHasOwnProperty(cfg, 'ADD_ATTR')) {
|
|
8717
|
-
EXTRA_ELEMENT_HANDLING.attributeCheck = null;
|
|
8718
|
-
}
|
|
8712
|
+
/* Always reset function-based ADD_TAGS / ADD_ATTR checks to prevent
|
|
8713
|
+
* leaking across calls when switching from function to array config */
|
|
8714
|
+
EXTRA_ELEMENT_HANDLING.tagCheck = null;
|
|
8715
|
+
EXTRA_ELEMENT_HANDLING.attributeCheck = null;
|
|
8719
8716
|
/* Merge configuration parameters */
|
|
8720
8717
|
if (cfg.ADD_TAGS) {
|
|
8721
8718
|
if (typeof cfg.ADD_TAGS === 'function') {
|
|
@@ -9038,6 +9035,11 @@ function requirePurify_cjs () {
|
|
|
9038
9035
|
_forceRemove(currentNode);
|
|
9039
9036
|
return true;
|
|
9040
9037
|
}
|
|
9038
|
+
/* Remove risky CSS construction leading to mXSS */
|
|
9039
|
+
if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === 'style' && _isNode(currentNode.firstElementChild)) {
|
|
9040
|
+
_forceRemove(currentNode);
|
|
9041
|
+
return true;
|
|
9042
|
+
}
|
|
9041
9043
|
/* Remove any occurrence of processing instructions */
|
|
9042
9044
|
if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
|
|
9043
9045
|
_forceRemove(currentNode);
|
|
@@ -9049,7 +9051,7 @@ function requirePurify_cjs () {
|
|
|
9049
9051
|
return true;
|
|
9050
9052
|
}
|
|
9051
9053
|
/* Remove element if anything forbids its presence */
|
|
9052
|
-
if (!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) &&
|
|
9054
|
+
if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
|
|
9053
9055
|
/* Check if we have a custom element to handle */
|
|
9054
9056
|
if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
|
|
9055
9057
|
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
|
|
@@ -9288,7 +9290,7 @@ function requirePurify_cjs () {
|
|
|
9288
9290
|
*
|
|
9289
9291
|
* @param fragment to iterate over recursively
|
|
9290
9292
|
*/
|
|
9291
|
-
const
|
|
9293
|
+
const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
|
|
9292
9294
|
let shadowNode = null;
|
|
9293
9295
|
const shadowIterator = _createNodeIterator(fragment);
|
|
9294
9296
|
/* Execute a hook if present */
|
|
@@ -9302,7 +9304,7 @@ function requirePurify_cjs () {
|
|
|
9302
9304
|
_sanitizeAttributes(shadowNode);
|
|
9303
9305
|
/* Deep shadow DOM detected */
|
|
9304
9306
|
if (shadowNode.content instanceof DocumentFragment) {
|
|
9305
|
-
|
|
9307
|
+
_sanitizeShadowDOM2(shadowNode.content);
|
|
9306
9308
|
}
|
|
9307
9309
|
}
|
|
9308
9310
|
/* Execute a hook if present */
|
|
@@ -9397,7 +9399,7 @@ function requirePurify_cjs () {
|
|
|
9397
9399
|
_sanitizeAttributes(currentNode);
|
|
9398
9400
|
/* Shadow DOM detected, sanitize it */
|
|
9399
9401
|
if (currentNode.content instanceof DocumentFragment) {
|
|
9400
|
-
|
|
9402
|
+
_sanitizeShadowDOM2(currentNode.content);
|
|
9401
9403
|
}
|
|
9402
9404
|
}
|
|
9403
9405
|
/* If we sanitized `dirty` in-place, return it. */
|
|
@@ -9406,6 +9408,14 @@ function requirePurify_cjs () {
|
|
|
9406
9408
|
}
|
|
9407
9409
|
/* Return sanitized string or DOM */
|
|
9408
9410
|
if (RETURN_DOM) {
|
|
9411
|
+
if (SAFE_FOR_TEMPLATES) {
|
|
9412
|
+
body.normalize();
|
|
9413
|
+
let html = body.innerHTML;
|
|
9414
|
+
arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
|
|
9415
|
+
html = stringReplace(html, expr, ' ');
|
|
9416
|
+
});
|
|
9417
|
+
body.innerHTML = html;
|
|
9418
|
+
}
|
|
9409
9419
|
if (RETURN_DOM_FRAGMENT) {
|
|
9410
9420
|
returnNode = createDocumentFragment.call(body.ownerDocument);
|
|
9411
9421
|
while (body.firstChild) {
|
|
@@ -10238,6 +10248,44 @@ var FlypayWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
10238
10248
|
}]);
|
|
10239
10249
|
}(WalletService);
|
|
10240
10250
|
|
|
10251
|
+
/**
|
|
10252
|
+
* Maximum Apple Pay JS API version the SDK targets.
|
|
10253
|
+
* Bump this when adopting features from a newer version.
|
|
10254
|
+
*/
|
|
10255
|
+
var APPLE_PAY_MAX_VERSION = 14;
|
|
10256
|
+
/**
|
|
10257
|
+
* Minimum Apple Pay JS API version the SDK can operate with.
|
|
10258
|
+
*
|
|
10259
|
+
* Version 3 (iOS 11 / macOS 10.13) is required because the SDK uses:
|
|
10260
|
+
* - `ApplePayError` constructor
|
|
10261
|
+
* - Object-form `completeShippingContactSelection(update)`
|
|
10262
|
+
* - Object-form `completeShippingMethodSelection(update)`
|
|
10263
|
+
* - `supportedCountries` in payment requests
|
|
10264
|
+
*
|
|
10265
|
+
* All of these were introduced in version 3.
|
|
10266
|
+
*/
|
|
10267
|
+
var APPLE_PAY_MIN_VERSION = 3;
|
|
10268
|
+
/**
|
|
10269
|
+
* Detects the highest Apple Pay JS API version the current device supports,
|
|
10270
|
+
* starting from {@link APPLE_PAY_MAX_VERSION} down to {@link APPLE_PAY_MIN_VERSION}.
|
|
10271
|
+
*
|
|
10272
|
+
* Returns `0` if Apple Pay is not available or the device does not support
|
|
10273
|
+
* the minimum required version.
|
|
10274
|
+
*
|
|
10275
|
+
* @see https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/supportsversion
|
|
10276
|
+
*/
|
|
10277
|
+
function getSupportedApplePayVersion() {
|
|
10278
|
+
if (!window.ApplePaySession) {
|
|
10279
|
+
return 0;
|
|
10280
|
+
}
|
|
10281
|
+
for (var v = APPLE_PAY_MAX_VERSION; v >= APPLE_PAY_MIN_VERSION; v--) {
|
|
10282
|
+
if (ApplePaySession.supportsVersion(v)) {
|
|
10283
|
+
return v;
|
|
10284
|
+
}
|
|
10285
|
+
}
|
|
10286
|
+
return 0;
|
|
10287
|
+
}
|
|
10288
|
+
|
|
10241
10289
|
var DEFAULT_APPLE_PAY_CAPABILITIES$2 = ['paymentCredentialsAvailable'];
|
|
10242
10290
|
var AppleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
10243
10291
|
function AppleWalletService(publicKey, meta, gatewayName, eventEmitter) {
|
|
@@ -10567,7 +10615,14 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
10567
10615
|
key: "onApplePayButtonClicked",
|
|
10568
10616
|
value: function onApplePayButtonClicked() {
|
|
10569
10617
|
var _this5 = this;
|
|
10570
|
-
|
|
10618
|
+
var applePayApiVersion = getSupportedApplePayVersion();
|
|
10619
|
+
if (applePayApiVersion === 0) {
|
|
10620
|
+
this.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, {
|
|
10621
|
+
wallet: WALLET_TYPE.APPLE
|
|
10622
|
+
});
|
|
10623
|
+
return;
|
|
10624
|
+
}
|
|
10625
|
+
this.paymentSession = new ApplePaySession(applePayApiVersion, this.createRequest());
|
|
10571
10626
|
this.paymentSession.onvalidatemerchant = this.onValidateMerchant;
|
|
10572
10627
|
this.paymentSession.onpaymentauthorized = this.onPaymentAuthorized;
|
|
10573
10628
|
this.paymentSession.oncancel = this.onCancelPayment;
|
|
@@ -18940,6 +18995,13 @@ var OpenWalletButtons = /*#__PURE__*/function () {
|
|
|
18940
18995
|
_classCallCheck(this, OpenWalletButtons);
|
|
18941
18996
|
this.env = DEFAULT_ENV;
|
|
18942
18997
|
this.onShippingOptionsChangeHandlerRegistered = false;
|
|
18998
|
+
// Runtime guard: TypeScript's `abstract` keyword exists only at compile time.
|
|
18999
|
+
// Without this check, instantiating the base class directly silently fails
|
|
19000
|
+
// later when `this.validateWalletMeta()` resolves to `undefined`, producing
|
|
19001
|
+
// a confusing "is not a function" error far from the actual mistake.
|
|
19002
|
+
if ((this instanceof OpenWalletButtons ? this.constructor : void 0) === OpenWalletButtons) {
|
|
19003
|
+
throw new Error('OpenWalletButtons is an abstract base class and cannot be instantiated directly. ' + 'Use ApplePayOpenWalletButton or GooglePayOpenWalletButton instead.');
|
|
19004
|
+
}
|
|
18943
19005
|
this.eventEmitter = new EventEmitter();
|
|
18944
19006
|
this.container = new Container(selector);
|
|
18945
19007
|
this.api = new ApiInternal(publicKeyOrAccessToken, this.getApiAuthType(publicKeyOrAccessToken));
|
|
@@ -20141,7 +20203,12 @@ var ApplePayOpenWalletService = /*#__PURE__*/function (_OpenWalletService) {
|
|
|
20141
20203
|
key: "onApplePayButtonClicked",
|
|
20142
20204
|
value: function onApplePayButtonClicked() {
|
|
20143
20205
|
var _this7 = this;
|
|
20144
|
-
|
|
20206
|
+
var applePayApiVersion = getSupportedApplePayVersion();
|
|
20207
|
+
if (applePayApiVersion === 0) {
|
|
20208
|
+
this.handleOnUnavailable('Apple Pay version not supported');
|
|
20209
|
+
return;
|
|
20210
|
+
}
|
|
20211
|
+
this.paymentSession = new ApplePaySession(applePayApiVersion, this.mapMetaToApplePayPaymentRequest());
|
|
20145
20212
|
this.paymentSession.onvalidatemerchant = this.onValidateMerchant;
|
|
20146
20213
|
this.paymentSession.onpaymentauthorized = this.onPaymentAuthorized;
|
|
20147
20214
|
this.paymentSession.oncancel = this.onCancelPayment;
|
|
@@ -22999,6 +23066,7 @@ var BaseWalletButton = /*#__PURE__*/function () {
|
|
|
22999
23066
|
function BaseWalletButton(selector, publicKeyOrAccessToken, gatewayId, meta, requiredMetaFields) {
|
|
23000
23067
|
_classCallCheck(this, BaseWalletButton);
|
|
23001
23068
|
this.env = DEFAULT_ENV;
|
|
23069
|
+
this.isDisabled = false;
|
|
23002
23070
|
this.onShippingOptionsChangeHandlerRegistered = false;
|
|
23003
23071
|
this.eventEmitter = new EventEmitter();
|
|
23004
23072
|
this.container = new Container(selector);
|
|
@@ -23031,6 +23099,30 @@ var BaseWalletButton = /*#__PURE__*/function () {
|
|
|
23031
23099
|
this.env = env;
|
|
23032
23100
|
this.api.setEnv(env, alias);
|
|
23033
23101
|
}
|
|
23102
|
+
/**
|
|
23103
|
+
* Enables the wallet button, restoring interactivity and visual appearance.
|
|
23104
|
+
*
|
|
23105
|
+
* @example
|
|
23106
|
+
* button.enable();
|
|
23107
|
+
*/
|
|
23108
|
+
}, {
|
|
23109
|
+
key: "enable",
|
|
23110
|
+
value: function enable() {
|
|
23111
|
+
this.isDisabled = false;
|
|
23112
|
+
this.applyDisabledStyles();
|
|
23113
|
+
}
|
|
23114
|
+
/**
|
|
23115
|
+
* Disables the wallet button, preventing clicks and applying a visual disabled state.
|
|
23116
|
+
*
|
|
23117
|
+
* @example
|
|
23118
|
+
* button.disable();
|
|
23119
|
+
*/
|
|
23120
|
+
}, {
|
|
23121
|
+
key: "disable",
|
|
23122
|
+
value: function disable() {
|
|
23123
|
+
this.isDisabled = true;
|
|
23124
|
+
this.applyDisabledStyles();
|
|
23125
|
+
}
|
|
23034
23126
|
/**
|
|
23035
23127
|
* Callback for onClick method.
|
|
23036
23128
|
*
|
|
@@ -23495,6 +23587,23 @@ var BaseWalletButton = /*#__PURE__*/function () {
|
|
|
23495
23587
|
code: ((_c = err === null || err === void 0 ? void 0 : err.error) === null || _c === void 0 ? void 0 : _c.code) || (err === null || err === void 0 ? void 0 : err.code) || ((_d = err === null || err === void 0 ? void 0 : err.error_summary) === null || _d === void 0 ? void 0 : _d.code)
|
|
23496
23588
|
};
|
|
23497
23589
|
}
|
|
23590
|
+
}, {
|
|
23591
|
+
key: "applyDisabledStyles",
|
|
23592
|
+
value: function applyDisabledStyles() {
|
|
23593
|
+
var element = this.container.getElement();
|
|
23594
|
+
if (!element) {
|
|
23595
|
+
return;
|
|
23596
|
+
}
|
|
23597
|
+
if (this.isDisabled) {
|
|
23598
|
+
element.style.pointerEvents = 'none';
|
|
23599
|
+
element.style.opacity = '0.5';
|
|
23600
|
+
element.setAttribute('aria-disabled', 'true');
|
|
23601
|
+
} else {
|
|
23602
|
+
element.style.pointerEvents = '';
|
|
23603
|
+
element.style.opacity = '';
|
|
23604
|
+
element.removeAttribute('aria-disabled');
|
|
23605
|
+
}
|
|
23606
|
+
}
|
|
23498
23607
|
}, {
|
|
23499
23608
|
key: "validateRequiredMetaFields",
|
|
23500
23609
|
value: function validateRequiredMetaFields(requiredMetaFields) {
|
|
@@ -23566,7 +23675,14 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
23566
23675
|
_classCallCheck(this, ApplePayWalletButtonExpress);
|
|
23567
23676
|
_this = _callSuper(this, ApplePayWalletButtonExpress, [selector, publicKeyOrAccessToken, gatewayId, meta, ['amount_label', 'country']]);
|
|
23568
23677
|
_this.onApplePayButtonClicked = function () {
|
|
23569
|
-
|
|
23678
|
+
if (_this.isDisabled) {
|
|
23679
|
+
return;
|
|
23680
|
+
}
|
|
23681
|
+
var applePayApiVersion = getSupportedApplePayVersion();
|
|
23682
|
+
if (applePayApiVersion === 0) {
|
|
23683
|
+
_this.handleOnUnavailable();
|
|
23684
|
+
return;
|
|
23685
|
+
}
|
|
23570
23686
|
_this.paymentSession = new ApplePaySession(applePayApiVersion, _this.createRequest());
|
|
23571
23687
|
_this.paymentSession.onvalidatemerchant = _this.onValidateMerchant;
|
|
23572
23688
|
_this.paymentSession.onpaymentauthorized = _this.onPaymentAuthorized;
|
|
@@ -23844,6 +23960,7 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
23844
23960
|
return;
|
|
23845
23961
|
}
|
|
23846
23962
|
applePayButton.addEventListener('click', this.onApplePayButtonClicked.bind(this));
|
|
23963
|
+
this.applyDisabledStyles();
|
|
23847
23964
|
}
|
|
23848
23965
|
}, {
|
|
23849
23966
|
key: "createRequest",
|
|
@@ -24036,13 +24153,20 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
24036
24153
|
key: "load",
|
|
24037
24154
|
value: function load() {
|
|
24038
24155
|
var _this2 = this;
|
|
24039
|
-
if (!window.Promise)
|
|
24156
|
+
if (!window.Promise) {
|
|
24157
|
+
return this.handleOnUnavailable();
|
|
24158
|
+
}
|
|
24040
24159
|
this.getGatewayWalletConfig().then(function (config) {
|
|
24041
|
-
if (!config || config.type !== 'Paypal' || !config.credentials || !config.credentials.client_auth)
|
|
24160
|
+
if (!config || config.type !== 'Paypal' || !config.credentials || !config.credentials.client_auth) {
|
|
24161
|
+
throw new Error('Invalid configuration');
|
|
24162
|
+
}
|
|
24042
24163
|
_this2.config = config;
|
|
24043
24164
|
_this2.renderPaypalButton();
|
|
24165
|
+
_this2.applyDisabledStyles();
|
|
24044
24166
|
})["catch"](function (err) {
|
|
24045
|
-
if (err)
|
|
24167
|
+
if (err) {
|
|
24168
|
+
_this2.handleOnError(err);
|
|
24169
|
+
}
|
|
24046
24170
|
_this2.handleOnUnavailable();
|
|
24047
24171
|
});
|
|
24048
24172
|
}
|
|
@@ -24059,6 +24183,7 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
24059
24183
|
value: function setMeta(meta) {
|
|
24060
24184
|
this.meta = meta;
|
|
24061
24185
|
this.renderPaypalButton();
|
|
24186
|
+
this.applyDisabledStyles();
|
|
24062
24187
|
}
|
|
24063
24188
|
}, {
|
|
24064
24189
|
key: "renderPaypalButton",
|
|
@@ -24075,7 +24200,7 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
24075
24200
|
var _this3 = this;
|
|
24076
24201
|
var _a, _b;
|
|
24077
24202
|
var buttonId = ((_a = this.container.getElement()) === null || _a === void 0 ? void 0 : _a.id) || '';
|
|
24078
|
-
var paypalScript = document.createElement(
|
|
24203
|
+
var paypalScript = document.createElement('script');
|
|
24079
24204
|
paypalScript.src = "https://www.paypal.com/sdk/js?client-id=".concat((_b = this.config.credentials) === null || _b === void 0 ? void 0 : _b.client_auth, "¤cy=").concat(this.meta.currency).concat(this.meta.pay_later === true ? '&enable-funding=paylater&disable-funding=card' : '&disable-funding=credit,card').concat(!this.meta.capture ? '&intent=authorize' : '');
|
|
24080
24205
|
paypalScript.async = true;
|
|
24081
24206
|
paypalScript.onload = function () {
|
|
@@ -24094,7 +24219,7 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
24094
24219
|
var _this4 = this;
|
|
24095
24220
|
var _a, _b, _c;
|
|
24096
24221
|
var buttonId = ((_a = this.container.getElement()) === null || _a === void 0 ? void 0 : _a.id) || '';
|
|
24097
|
-
var paypalScript = document.createElement(
|
|
24222
|
+
var paypalScript = document.createElement('script');
|
|
24098
24223
|
// buyer-country is only used in Sandbox. It shouldn't be used in production. Based on buyer's geolocation this parameter determine which funding sources are eligible for a given buyer. Refer the link https://developer.paypal.com/sdk/js/configuration/#link-buyercountry
|
|
24099
24224
|
paypalScript.src = "https://www.paypal.com/sdk/js?client-id=".concat((_b = this.config.credentials) === null || _b === void 0 ? void 0 : _b.client_auth, "¤cy=").concat(this.meta.currency, "&components=buttons,funding-eligibility,messages&enable-funding=paylater").concat(!this.meta.capture ? '&intent=authorize' : '').concat(((_c = this.config) === null || _c === void 0 ? void 0 : _c.mode) === 'live' ? '' : '&buyer-country=AU');
|
|
24100
24225
|
paypalScript.async = true;
|
|
@@ -24135,6 +24260,9 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
24135
24260
|
style: this.meta.style
|
|
24136
24261
|
}), {
|
|
24137
24262
|
onClick: function onClick(_data, actions) {
|
|
24263
|
+
if (_this5.isDisabled) {
|
|
24264
|
+
return actions.reject();
|
|
24265
|
+
}
|
|
24138
24266
|
return _this5.handleMerchantOnExpressButtonClickEvent().then(function () {
|
|
24139
24267
|
return actions.resolve();
|
|
24140
24268
|
})["catch"](function () {
|
|
@@ -24145,7 +24273,9 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
24145
24273
|
createOrder: function createOrder() {
|
|
24146
24274
|
return new Promise(function (resolve, reject) {
|
|
24147
24275
|
var _a, _b;
|
|
24148
|
-
if (!_this5.api.auth)
|
|
24276
|
+
if (!_this5.api.auth) {
|
|
24277
|
+
return reject(new Error('Wallet Token not injected. Please handle onClick correctly.'));
|
|
24278
|
+
}
|
|
24149
24279
|
var shipping = (_b = (_a = _this5.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge) === null || _b === void 0 ? void 0 : _b.shipping;
|
|
24150
24280
|
if (shipping) {
|
|
24151
24281
|
var hasCompleteShippingAddress = ['address_line1', 'address_city', 'address_country', 'address_state', 'address_postcode'].every(function (key) {
|
|
@@ -24164,7 +24294,9 @@ var PaypalWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
24164
24294
|
});
|
|
24165
24295
|
},
|
|
24166
24296
|
onApprove: function onApprove(data) {
|
|
24167
|
-
if (_this5.pendingApprovalPromise)
|
|
24297
|
+
if (_this5.pendingApprovalPromise) {
|
|
24298
|
+
return _this5.pendingApprovalPromise;
|
|
24299
|
+
}
|
|
24168
24300
|
_this5.pendingApprovalPromise = _this5.executeWalletCapture({
|
|
24169
24301
|
payment_method_id: data.orderID,
|
|
24170
24302
|
customer: {
|
|
@@ -44342,4 +44474,4 @@ var browser = /*#__PURE__*/Object.freeze({
|
|
|
44342
44474
|
zlibSync: zlibSync
|
|
44343
44475
|
});
|
|
44344
44476
|
|
|
44345
|
-
export { AfterpayCheckoutButton, AfterpayOnSiteMessaging, Api, ApplePayOpenWalletButton, ApplePayWalletButtonExpress, CHECKOUT_BUTTON_EVENT, Canvas3ds, Checkout, ClickToPay, Configuration, ELEMENT, ERROR_OPERATION, EVENT$5 as EVENT, Builder$1 as ExternalCheckoutBuilder, Checker as ExternalCheckoutChecker, FORM_FIELD$1 as FORM_FIELD, FRAUD_PREVENTION_EVENTS, FraudPreventionService, GooglePayOpenWalletButton, HtmlMultiWidget, HtmlPaymentSourceWidget, HtmlWidget, InstructionDebugger, MultiWidget,
|
|
44477
|
+
export { AfterpayCheckoutButton, AfterpayOnSiteMessaging, Api, ApplePayOpenWalletButton, ApplePayWalletButtonExpress, CHECKOUT_BUTTON_EVENT, Canvas3ds, Checkout, ClickToPay, Configuration, ContactShippingEditingMode, ELEMENT, ERROR_OPERATION, EVENT$5 as EVENT, Builder$1 as ExternalCheckoutBuilder, Checker as ExternalCheckoutChecker, FORM_FIELD$1 as FORM_FIELD, FRAUD_PREVENTION_EVENTS, FraudPreventionService, GooglePayOpenWalletButton, HtmlMultiWidget, HtmlPaymentSourceWidget, HtmlWidget, InstructionDebugger, MultiWidget, PAYMENT_TYPE, PURPOSE, PayPalDataCollector, PayPalSavePaymentSourceWidget, Builder as PaymentSourceBuilder, PaymentSourceWidget, PaypalCheckoutButton, PaypalWalletButtonExpress, STYLABLE_ELEMENT, STYLABLE_ELEMENT_STATE, STYLE$2 as STYLE, SUPPORTED_CARD_TYPES, TEXT, TOKEN_TYPE, TRIGGER$1 as TRIGGER, TYPE, VAULT_DISPLAY_STYLE, VaultDisplayWidget, EVENT as WALLET_BUTTONS_EXPRESS_EVENT, WALLET_TYPES, WalletButtons, ZipmoneyCheckoutButton };
|