@paydock/client-sdk 1.123.2-beta → 1.123.8
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/bundles/index.cjs +112 -71
- package/bundles/index.cjs.d.ts +1 -0
- package/bundles/index.mjs +112 -71
- package/bundles/index.mjs.d.ts +1 -0
- package/bundles/types/wallet-buttons/wallet-services/apple.wallet-service.d.ts +1 -0
- package/bundles/types/wallet-buttons/wallet-services/apple.wallet-service.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.d.ts +1 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.d.ts.map +1 -1
- package/bundles/widget.umd.js +112 -71
- package/bundles/widget.umd.js.d.ts +1 -0
- package/bundles/widget.umd.js.min.d.ts +1 -0
- package/bundles/widget.umd.min.js +1 -1
- package/package.json +1 -1
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.123.
|
|
957
|
+
SDK._version = 'v1.123.8';
|
|
958
958
|
|
|
959
959
|
/******************************************************************************
|
|
960
960
|
Copyright (c) Microsoft Corporation.
|
|
@@ -4235,11 +4235,11 @@ function createNewrelicConfig() {
|
|
|
4235
4235
|
var gateway = 'bam.nr-data.net';
|
|
4236
4236
|
var params = {
|
|
4237
4237
|
enabled: 'true',
|
|
4238
|
-
accountId: '
|
|
4239
|
-
agentId: '
|
|
4240
|
-
applicationId: '
|
|
4241
|
-
licenseKey: '
|
|
4242
|
-
trustKey: '
|
|
4238
|
+
accountId: '',
|
|
4239
|
+
agentId: '',
|
|
4240
|
+
applicationId: '',
|
|
4241
|
+
licenseKey: '',
|
|
4242
|
+
trustKey: ''
|
|
4243
4243
|
};
|
|
4244
4244
|
var disabled = function disabled() {
|
|
4245
4245
|
return {
|
|
@@ -13201,10 +13201,13 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
13201
13201
|
var _a, _b, _c;
|
|
13202
13202
|
if (((_a = this.meta) === null || _a === void 0 ? void 0 : _a.style) && _typeof$1((_b = this.meta) === null || _b === void 0 ? void 0 : _b.style) === 'object') {
|
|
13203
13203
|
var metaStyles = JSON.parse(JSON.stringify((_c = this.meta) === null || _c === void 0 ? void 0 : _c.style));
|
|
13204
|
-
if ('google' in metaStyles)
|
|
13204
|
+
if ('google' in metaStyles) {
|
|
13205
13205
|
// biome-ignore lint/performance/noDelete: <explanation>
|
|
13206
13206
|
metaStyles === null || metaStyles === void 0 ? true : delete metaStyles.google; // to offer backward compatibility
|
|
13207
|
-
|
|
13207
|
+
}
|
|
13208
|
+
if ('apple' in metaStyles) {
|
|
13209
|
+
return metaStyles === null || metaStyles === void 0 ? void 0 : metaStyles.apple;
|
|
13210
|
+
}
|
|
13208
13211
|
return metaStyles; // to offer backward compatibility
|
|
13209
13212
|
}
|
|
13210
13213
|
return null;
|
|
@@ -13215,10 +13218,13 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
13215
13218
|
var _a, _b, _c, _d;
|
|
13216
13219
|
if (((_a = this.meta) === null || _a === void 0 ? void 0 : _a.raw_data_initialization) && ((_b = this.meta) === null || _b === void 0 ? void 0 : _b.raw_data_initialization) && _typeof$1((_c = this.meta) === null || _c === void 0 ? void 0 : _c.raw_data_initialization) === 'object') {
|
|
13217
13220
|
var metaRawDataInit = JSON.parse(JSON.stringify((_d = this.meta) === null || _d === void 0 ? void 0 : _d.raw_data_initialization));
|
|
13218
|
-
if ('google' in metaRawDataInit)
|
|
13221
|
+
if ('google' in metaRawDataInit) {
|
|
13219
13222
|
// biome-ignore lint/performance/noDelete: <explanation>
|
|
13220
13223
|
metaRawDataInit === null || metaRawDataInit === void 0 ? true : delete metaRawDataInit.google; // to offer backward compatibility
|
|
13221
|
-
|
|
13224
|
+
}
|
|
13225
|
+
if ('apple' in metaRawDataInit) {
|
|
13226
|
+
return metaRawDataInit === null || metaRawDataInit === void 0 ? void 0 : metaRawDataInit.apple;
|
|
13227
|
+
}
|
|
13222
13228
|
return metaRawDataInit; // to offer backward compatibility
|
|
13223
13229
|
}
|
|
13224
13230
|
return null;
|
|
@@ -13246,28 +13252,16 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
13246
13252
|
});
|
|
13247
13253
|
return;
|
|
13248
13254
|
}
|
|
13255
|
+
if (customElements === null || customElements === void 0 ? void 0 : customElements.get('apple-pay-button')) {
|
|
13256
|
+
this.onScriptLoaded(container);
|
|
13257
|
+
return;
|
|
13258
|
+
}
|
|
13249
13259
|
var applePayScript = document.createElement('script');
|
|
13250
13260
|
applePayScript.src = "https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js";
|
|
13251
13261
|
applePayScript.type = "text/javascript";
|
|
13252
13262
|
applePayScript.crossOrigin = 'anonymous';
|
|
13253
13263
|
applePayScript.onload = function () {
|
|
13254
|
-
_this2.
|
|
13255
|
-
var _a;
|
|
13256
|
-
if (!available) {
|
|
13257
|
-
_this2.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, {
|
|
13258
|
-
wallet: WALLET_TYPE.APPLE
|
|
13259
|
-
});
|
|
13260
|
-
return;
|
|
13261
|
-
}
|
|
13262
|
-
// Store default shipping option
|
|
13263
|
-
if (_this2.isShippingRequired() && _this2.hasShippingOptions()) {
|
|
13264
|
-
_this2.selectedShippingOption = (_a = _this2.meta) === null || _a === void 0 ? void 0 : _a.shipping_options[0];
|
|
13265
|
-
_this2.latestShippingData.shippingMethod = _this2.formatShippingOptions([_this2.selectedShippingOption])[0];
|
|
13266
|
-
}
|
|
13267
|
-
_this2.mount(container);
|
|
13268
|
-
})["catch"](function (err) {
|
|
13269
|
-
return console.error("Error checking ApplePay availability", err);
|
|
13270
|
-
});
|
|
13264
|
+
_this2.onScriptLoaded(container);
|
|
13271
13265
|
};
|
|
13272
13266
|
applePayScript.onerror = function (err) {
|
|
13273
13267
|
console.error("AppleWalletService: Error loading ApplePay script", err);
|
|
@@ -13278,15 +13272,43 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
13278
13272
|
};
|
|
13279
13273
|
document.head.appendChild(applePayScript);
|
|
13280
13274
|
}
|
|
13275
|
+
}, {
|
|
13276
|
+
key: "onScriptLoaded",
|
|
13277
|
+
value: function onScriptLoaded(container) {
|
|
13278
|
+
var _this3 = this;
|
|
13279
|
+
this.checkAvailability().then(function (available) {
|
|
13280
|
+
var _a;
|
|
13281
|
+
if (!available) {
|
|
13282
|
+
_this3.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, {
|
|
13283
|
+
wallet: WALLET_TYPE.APPLE
|
|
13284
|
+
});
|
|
13285
|
+
return;
|
|
13286
|
+
}
|
|
13287
|
+
// Store default shipping option
|
|
13288
|
+
if (_this3.isShippingRequired() && _this3.hasShippingOptions()) {
|
|
13289
|
+
_this3.selectedShippingOption = (_a = _this3.meta) === null || _a === void 0 ? void 0 : _a.shipping_options[0];
|
|
13290
|
+
_this3.latestShippingData.shippingMethod = _this3.formatShippingOptions([_this3.selectedShippingOption])[0];
|
|
13291
|
+
}
|
|
13292
|
+
_this3.mount(container);
|
|
13293
|
+
})["catch"](function (err) {
|
|
13294
|
+
return console.error("Error checking ApplePay availability", err);
|
|
13295
|
+
});
|
|
13296
|
+
}
|
|
13281
13297
|
}, {
|
|
13282
13298
|
key: "update",
|
|
13283
13299
|
value: function update(data) {
|
|
13284
13300
|
var _a, _b, _c;
|
|
13285
|
-
if (!this.latestShippingChangePromiseResolve || !this.latestShippingChangePromiseReject)
|
|
13286
|
-
|
|
13301
|
+
if (!this.latestShippingChangePromiseResolve || !this.latestShippingChangePromiseReject) {
|
|
13302
|
+
return;
|
|
13303
|
+
}
|
|
13304
|
+
if (!data.success || !data.body) {
|
|
13305
|
+
return this.latestShippingChangePromiseReject();
|
|
13306
|
+
}
|
|
13287
13307
|
var newAmount = (_a = data === null || data === void 0 ? void 0 : data.body) === null || _a === void 0 ? void 0 : _a.amount;
|
|
13288
13308
|
var newShippingOptions = (_b = data === null || data === void 0 ? void 0 : data.body) === null || _b === void 0 ? void 0 : _b.shipping_options;
|
|
13289
|
-
if (newAmount)
|
|
13309
|
+
if (newAmount) {
|
|
13310
|
+
this.meta.amount = newAmount;
|
|
13311
|
+
}
|
|
13290
13312
|
if (newShippingOptions) {
|
|
13291
13313
|
this.meta.shipping_options = newShippingOptions;
|
|
13292
13314
|
this.selectedShippingOption = newShippingOptions ? newShippingOptions[0] : undefined;
|
|
@@ -13306,17 +13328,17 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
13306
13328
|
}, {
|
|
13307
13329
|
key: "checkAvailability",
|
|
13308
13330
|
value: function checkAvailability() {
|
|
13309
|
-
var
|
|
13331
|
+
var _this4 = this;
|
|
13310
13332
|
return new Promise(function (resolve, _reject) {
|
|
13311
13333
|
var _a;
|
|
13312
13334
|
if (!window.ApplePaySession || !ApplePaySession) {
|
|
13313
13335
|
resolve(false);
|
|
13314
13336
|
}
|
|
13315
13337
|
var formattedCapabilities = DEFAULT_APPLE_PAY_CAPABILITIES$1;
|
|
13316
|
-
if (((_a =
|
|
13317
|
-
formattedCapabilities =
|
|
13338
|
+
if (((_a = _this4.meta.apple_pay_capabilities) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
13339
|
+
formattedCapabilities = _this4.formatCapabilities(_this4.meta.apple_pay_capabilities);
|
|
13318
13340
|
}
|
|
13319
|
-
ApplePaySession.applePayCapabilities(
|
|
13341
|
+
ApplePaySession.applePayCapabilities(_this4.getMerchantId()).then(function (capabilities) {
|
|
13320
13342
|
var canMakePayment = formattedCapabilities.includes(capabilities === null || capabilities === void 0 ? void 0 : capabilities.paymentCredentialStatus);
|
|
13321
13343
|
resolve(canMakePayment);
|
|
13322
13344
|
})["catch"](function (_err) {
|
|
@@ -13364,11 +13386,17 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
13364
13386
|
var _a;
|
|
13365
13387
|
var rawDataInitialization = this.getMetaRawDataInitialization();
|
|
13366
13388
|
if (rawDataInitialization && _typeof$1(rawDataInitialization) === 'object') {
|
|
13367
|
-
if (_typeof$1(rawDataInitialization.total) === 'object')
|
|
13368
|
-
|
|
13369
|
-
|
|
13370
|
-
|
|
13371
|
-
|
|
13389
|
+
if (_typeof$1(rawDataInitialization.total) === 'object') {
|
|
13390
|
+
rawDataInitialization.total.amount = this.meta.amount.toString();
|
|
13391
|
+
} else {
|
|
13392
|
+
rawDataInitialization.total = {
|
|
13393
|
+
label: ((_a = this.meta) === null || _a === void 0 ? void 0 : _a.amount_label) || '',
|
|
13394
|
+
amount: this.meta.amount.toString()
|
|
13395
|
+
};
|
|
13396
|
+
}
|
|
13397
|
+
if (this.isShippingRequired() && this.hasShippingOptions()) {
|
|
13398
|
+
rawDataInitialization.shippingMethods = this.formatShippingOptions(this.meta.shipping_options);
|
|
13399
|
+
}
|
|
13372
13400
|
}
|
|
13373
13401
|
return rawDataInitialization || _extends(_extends(_extends({
|
|
13374
13402
|
countryCode: this.meta.country.toUpperCase(),
|
|
@@ -13392,22 +13420,22 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
13392
13420
|
}, {
|
|
13393
13421
|
key: "getMerchantSession",
|
|
13394
13422
|
value: function getMerchantSession() {
|
|
13395
|
-
var
|
|
13423
|
+
var _this5 = this;
|
|
13396
13424
|
return new Promise(function (resolve, reject) {
|
|
13397
|
-
return
|
|
13425
|
+
return _this5.eventEmitter.emit(WALLET_EVENT.CALLBACK, {
|
|
13398
13426
|
data: _extends({
|
|
13399
13427
|
request_type: "CREATE_SESSION",
|
|
13400
13428
|
wallet_type: WALLET_TYPE.APPLE,
|
|
13401
13429
|
session_id: window.location.hostname
|
|
13402
|
-
},
|
|
13403
|
-
request_shipping:
|
|
13430
|
+
}, _this5.isShippingRequired() && {
|
|
13431
|
+
request_shipping: _this5.meta.request_shipping
|
|
13404
13432
|
}),
|
|
13405
13433
|
onSuccess: function onSuccess(res) {
|
|
13406
13434
|
return resolve(res);
|
|
13407
13435
|
},
|
|
13408
13436
|
onError: function onError(message) {
|
|
13409
13437
|
console.error('Error generating order id', message);
|
|
13410
|
-
|
|
13438
|
+
_this5.eventEmitter.emit(WALLET_EVENT.PAYMENT_ERROR, {
|
|
13411
13439
|
message: message
|
|
13412
13440
|
});
|
|
13413
13441
|
reject(message);
|
|
@@ -13418,10 +13446,10 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
13418
13446
|
}, {
|
|
13419
13447
|
key: "handleMerchantOnButtonClickEvent",
|
|
13420
13448
|
value: function handleMerchantOnButtonClickEvent() {
|
|
13421
|
-
var
|
|
13449
|
+
var _this6 = this;
|
|
13422
13450
|
return new Promise(function (resolve, reject) {
|
|
13423
13451
|
var merchantResult;
|
|
13424
|
-
|
|
13452
|
+
_this6.eventEmitter.emit(WALLET_EVENT.BUTTON_CLICK, {
|
|
13425
13453
|
attachResult: function attachResult(value) {
|
|
13426
13454
|
merchantResult = value;
|
|
13427
13455
|
}
|
|
@@ -19289,17 +19317,13 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
19289
19317
|
_classCallCheck(this, ApplePayWalletButtonExpress);
|
|
19290
19318
|
_this = _callSuper(this, ApplePayWalletButtonExpress, [selector, publicKeyOrAccessToken, gatewayId, meta, ['amount_label', 'country']]);
|
|
19291
19319
|
_this.onApplePayButtonClicked = function () {
|
|
19292
|
-
|
|
19293
|
-
|
|
19294
|
-
|
|
19295
|
-
|
|
19296
|
-
|
|
19297
|
-
|
|
19298
|
-
|
|
19299
|
-
_this.paymentSession.begin();
|
|
19300
|
-
})["catch"](function () {
|
|
19301
|
-
_this.handleCheckoutClose();
|
|
19302
|
-
});
|
|
19320
|
+
_this.paymentSession = new ApplePaySession(14, _this.createRequest());
|
|
19321
|
+
_this.paymentSession.onvalidatemerchant = _this.onValidateMerchant;
|
|
19322
|
+
_this.paymentSession.onpaymentauthorized = _this.onPaymentAuthorized;
|
|
19323
|
+
_this.paymentSession.oncancel = _this.onCancelPayment;
|
|
19324
|
+
_this.paymentSession.onshippingmethodselected = _this.onApplePayShippingMethodUpdate;
|
|
19325
|
+
_this.paymentSession.onshippingcontactselected = _this.onApplePayShippingContactUpdate;
|
|
19326
|
+
_this.paymentSession.begin();
|
|
19303
19327
|
};
|
|
19304
19328
|
_this.onValidateMerchant = function (event) {
|
|
19305
19329
|
_this.handleMerchantOnExpressButtonClickEvent().then(function () {
|
|
@@ -19425,22 +19449,18 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
19425
19449
|
key: "load",
|
|
19426
19450
|
value: function load() {
|
|
19427
19451
|
var _this4 = this;
|
|
19428
|
-
if (!window.Promise)
|
|
19452
|
+
if (!window.Promise) {
|
|
19453
|
+
return this.handleOnUnavailable();
|
|
19454
|
+
}
|
|
19455
|
+
if (customElements === null || customElements === void 0 ? void 0 : customElements.get('apple-pay-button')) {
|
|
19456
|
+
return this.onScriptLoaded();
|
|
19457
|
+
}
|
|
19429
19458
|
var applePayScript = document.createElement('script');
|
|
19430
19459
|
applePayScript.src = "https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js";
|
|
19431
19460
|
applePayScript.type = "text/javascript";
|
|
19432
19461
|
applePayScript.crossOrigin = 'anonymous';
|
|
19433
19462
|
applePayScript.onload = function () {
|
|
19434
|
-
_this4.
|
|
19435
|
-
if (!config || config.type !== 'MasterCard' || !config.credentials || !config.credentials.apple || !config.credentials.apple.merchant) throw new Error('Invalid configuration');
|
|
19436
|
-
return _this4.checkAvailability(config);
|
|
19437
|
-
}).then(function (available) {
|
|
19438
|
-
if (!available) return _this4.handleOnUnavailable();
|
|
19439
|
-
return _this4.mount();
|
|
19440
|
-
})["catch"](function (err) {
|
|
19441
|
-
if (err) _this4.handleOnError(err);
|
|
19442
|
-
_this4.handleOnUnavailable();
|
|
19443
|
-
});
|
|
19463
|
+
_this4.onScriptLoaded();
|
|
19444
19464
|
};
|
|
19445
19465
|
applePayScript.onerror = function (err) {
|
|
19446
19466
|
console.error("ApplePayWalletButtonExpress: Error loading ApplePay script", err);
|
|
@@ -19449,6 +19469,27 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
19449
19469
|
};
|
|
19450
19470
|
document.head.appendChild(applePayScript);
|
|
19451
19471
|
}
|
|
19472
|
+
}, {
|
|
19473
|
+
key: "onScriptLoaded",
|
|
19474
|
+
value: function onScriptLoaded() {
|
|
19475
|
+
var _this5 = this;
|
|
19476
|
+
this.getGatewayWalletConfig().then(function (config) {
|
|
19477
|
+
if (!config || config.type !== 'MasterCard' || !config.credentials || !config.credentials.apple || !config.credentials.apple.merchant) {
|
|
19478
|
+
throw new Error('Invalid configuration');
|
|
19479
|
+
}
|
|
19480
|
+
return _this5.checkAvailability(config);
|
|
19481
|
+
}).then(function (available) {
|
|
19482
|
+
if (!available) {
|
|
19483
|
+
return _this5.handleOnUnavailable();
|
|
19484
|
+
}
|
|
19485
|
+
return _this5.mount();
|
|
19486
|
+
})["catch"](function (err) {
|
|
19487
|
+
if (err) {
|
|
19488
|
+
_this5.handleOnError(err);
|
|
19489
|
+
}
|
|
19490
|
+
_this5.handleOnUnavailable();
|
|
19491
|
+
});
|
|
19492
|
+
}
|
|
19452
19493
|
/**
|
|
19453
19494
|
* Call this method if updating the originally-provided meta object after order information changed.
|
|
19454
19495
|
* For example, if the order amount has changed from the time where the button was originally rendered.
|
|
@@ -19466,15 +19507,15 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
19466
19507
|
}, {
|
|
19467
19508
|
key: "checkAvailability",
|
|
19468
19509
|
value: function checkAvailability(config) {
|
|
19469
|
-
var
|
|
19510
|
+
var _this6 = this;
|
|
19470
19511
|
return new Promise(function (resolve, _reject) {
|
|
19471
19512
|
var _a;
|
|
19472
19513
|
if (!window.ApplePaySession || !ApplePaySession) {
|
|
19473
19514
|
resolve(false);
|
|
19474
19515
|
}
|
|
19475
19516
|
var formattedCapabilities = DEFAULT_APPLE_PAY_CAPABILITIES;
|
|
19476
|
-
if (((_a =
|
|
19477
|
-
formattedCapabilities =
|
|
19517
|
+
if (((_a = _this6.meta.apple_pay_capabilities) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
19518
|
+
formattedCapabilities = _this6.formatCapabilities(_this6.meta.apple_pay_capabilities);
|
|
19478
19519
|
}
|
|
19479
19520
|
ApplePaySession.applePayCapabilities(config.credentials[WALLET_TYPE.APPLE].merchant).then(function (capabilities) {
|
|
19480
19521
|
var canMakePayment = formattedCapabilities.includes(capabilities === null || capabilities === void 0 ? void 0 : capabilities.paymentCredentialStatus);
|
package/bundles/index.cjs.d.ts
CHANGED
|
@@ -4269,6 +4269,7 @@ declare class ApplePayWalletButtonExpress extends BaseWalletButton<ApplePayWalle
|
|
|
4269
4269
|
* button.load();
|
|
4270
4270
|
*/
|
|
4271
4271
|
load(): void;
|
|
4272
|
+
private onScriptLoaded;
|
|
4272
4273
|
/**
|
|
4273
4274
|
* Call this method if updating the originally-provided meta object after order information changed.
|
|
4274
4275
|
* For example, if the order amount has changed from the time where the button was originally rendered.
|
package/bundles/index.mjs
CHANGED
|
@@ -952,7 +952,7 @@ SDK.headerKeys = Object.freeze({
|
|
|
952
952
|
version: 'x-sdk-version',
|
|
953
953
|
type: 'x-sdk-type'
|
|
954
954
|
});
|
|
955
|
-
SDK._version = 'v1.123.
|
|
955
|
+
SDK._version = 'v1.123.8';
|
|
956
956
|
|
|
957
957
|
/******************************************************************************
|
|
958
958
|
Copyright (c) Microsoft Corporation.
|
|
@@ -4233,11 +4233,11 @@ function createNewrelicConfig() {
|
|
|
4233
4233
|
var gateway = 'bam.nr-data.net';
|
|
4234
4234
|
var params = {
|
|
4235
4235
|
enabled: 'true',
|
|
4236
|
-
accountId: '
|
|
4237
|
-
agentId: '
|
|
4238
|
-
applicationId: '
|
|
4239
|
-
licenseKey: '
|
|
4240
|
-
trustKey: '
|
|
4236
|
+
accountId: '',
|
|
4237
|
+
agentId: '',
|
|
4238
|
+
applicationId: '',
|
|
4239
|
+
licenseKey: '',
|
|
4240
|
+
trustKey: ''
|
|
4241
4241
|
};
|
|
4242
4242
|
var disabled = function disabled() {
|
|
4243
4243
|
return {
|
|
@@ -13199,10 +13199,13 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
13199
13199
|
var _a, _b, _c;
|
|
13200
13200
|
if (((_a = this.meta) === null || _a === void 0 ? void 0 : _a.style) && _typeof$1((_b = this.meta) === null || _b === void 0 ? void 0 : _b.style) === 'object') {
|
|
13201
13201
|
var metaStyles = JSON.parse(JSON.stringify((_c = this.meta) === null || _c === void 0 ? void 0 : _c.style));
|
|
13202
|
-
if ('google' in metaStyles)
|
|
13202
|
+
if ('google' in metaStyles) {
|
|
13203
13203
|
// biome-ignore lint/performance/noDelete: <explanation>
|
|
13204
13204
|
metaStyles === null || metaStyles === void 0 ? true : delete metaStyles.google; // to offer backward compatibility
|
|
13205
|
-
|
|
13205
|
+
}
|
|
13206
|
+
if ('apple' in metaStyles) {
|
|
13207
|
+
return metaStyles === null || metaStyles === void 0 ? void 0 : metaStyles.apple;
|
|
13208
|
+
}
|
|
13206
13209
|
return metaStyles; // to offer backward compatibility
|
|
13207
13210
|
}
|
|
13208
13211
|
return null;
|
|
@@ -13213,10 +13216,13 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
13213
13216
|
var _a, _b, _c, _d;
|
|
13214
13217
|
if (((_a = this.meta) === null || _a === void 0 ? void 0 : _a.raw_data_initialization) && ((_b = this.meta) === null || _b === void 0 ? void 0 : _b.raw_data_initialization) && _typeof$1((_c = this.meta) === null || _c === void 0 ? void 0 : _c.raw_data_initialization) === 'object') {
|
|
13215
13218
|
var metaRawDataInit = JSON.parse(JSON.stringify((_d = this.meta) === null || _d === void 0 ? void 0 : _d.raw_data_initialization));
|
|
13216
|
-
if ('google' in metaRawDataInit)
|
|
13219
|
+
if ('google' in metaRawDataInit) {
|
|
13217
13220
|
// biome-ignore lint/performance/noDelete: <explanation>
|
|
13218
13221
|
metaRawDataInit === null || metaRawDataInit === void 0 ? true : delete metaRawDataInit.google; // to offer backward compatibility
|
|
13219
|
-
|
|
13222
|
+
}
|
|
13223
|
+
if ('apple' in metaRawDataInit) {
|
|
13224
|
+
return metaRawDataInit === null || metaRawDataInit === void 0 ? void 0 : metaRawDataInit.apple;
|
|
13225
|
+
}
|
|
13220
13226
|
return metaRawDataInit; // to offer backward compatibility
|
|
13221
13227
|
}
|
|
13222
13228
|
return null;
|
|
@@ -13244,28 +13250,16 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
13244
13250
|
});
|
|
13245
13251
|
return;
|
|
13246
13252
|
}
|
|
13253
|
+
if (customElements === null || customElements === void 0 ? void 0 : customElements.get('apple-pay-button')) {
|
|
13254
|
+
this.onScriptLoaded(container);
|
|
13255
|
+
return;
|
|
13256
|
+
}
|
|
13247
13257
|
var applePayScript = document.createElement('script');
|
|
13248
13258
|
applePayScript.src = "https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js";
|
|
13249
13259
|
applePayScript.type = "text/javascript";
|
|
13250
13260
|
applePayScript.crossOrigin = 'anonymous';
|
|
13251
13261
|
applePayScript.onload = function () {
|
|
13252
|
-
_this2.
|
|
13253
|
-
var _a;
|
|
13254
|
-
if (!available) {
|
|
13255
|
-
_this2.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, {
|
|
13256
|
-
wallet: WALLET_TYPE.APPLE
|
|
13257
|
-
});
|
|
13258
|
-
return;
|
|
13259
|
-
}
|
|
13260
|
-
// Store default shipping option
|
|
13261
|
-
if (_this2.isShippingRequired() && _this2.hasShippingOptions()) {
|
|
13262
|
-
_this2.selectedShippingOption = (_a = _this2.meta) === null || _a === void 0 ? void 0 : _a.shipping_options[0];
|
|
13263
|
-
_this2.latestShippingData.shippingMethod = _this2.formatShippingOptions([_this2.selectedShippingOption])[0];
|
|
13264
|
-
}
|
|
13265
|
-
_this2.mount(container);
|
|
13266
|
-
})["catch"](function (err) {
|
|
13267
|
-
return console.error("Error checking ApplePay availability", err);
|
|
13268
|
-
});
|
|
13262
|
+
_this2.onScriptLoaded(container);
|
|
13269
13263
|
};
|
|
13270
13264
|
applePayScript.onerror = function (err) {
|
|
13271
13265
|
console.error("AppleWalletService: Error loading ApplePay script", err);
|
|
@@ -13276,15 +13270,43 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
13276
13270
|
};
|
|
13277
13271
|
document.head.appendChild(applePayScript);
|
|
13278
13272
|
}
|
|
13273
|
+
}, {
|
|
13274
|
+
key: "onScriptLoaded",
|
|
13275
|
+
value: function onScriptLoaded(container) {
|
|
13276
|
+
var _this3 = this;
|
|
13277
|
+
this.checkAvailability().then(function (available) {
|
|
13278
|
+
var _a;
|
|
13279
|
+
if (!available) {
|
|
13280
|
+
_this3.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, {
|
|
13281
|
+
wallet: WALLET_TYPE.APPLE
|
|
13282
|
+
});
|
|
13283
|
+
return;
|
|
13284
|
+
}
|
|
13285
|
+
// Store default shipping option
|
|
13286
|
+
if (_this3.isShippingRequired() && _this3.hasShippingOptions()) {
|
|
13287
|
+
_this3.selectedShippingOption = (_a = _this3.meta) === null || _a === void 0 ? void 0 : _a.shipping_options[0];
|
|
13288
|
+
_this3.latestShippingData.shippingMethod = _this3.formatShippingOptions([_this3.selectedShippingOption])[0];
|
|
13289
|
+
}
|
|
13290
|
+
_this3.mount(container);
|
|
13291
|
+
})["catch"](function (err) {
|
|
13292
|
+
return console.error("Error checking ApplePay availability", err);
|
|
13293
|
+
});
|
|
13294
|
+
}
|
|
13279
13295
|
}, {
|
|
13280
13296
|
key: "update",
|
|
13281
13297
|
value: function update(data) {
|
|
13282
13298
|
var _a, _b, _c;
|
|
13283
|
-
if (!this.latestShippingChangePromiseResolve || !this.latestShippingChangePromiseReject)
|
|
13284
|
-
|
|
13299
|
+
if (!this.latestShippingChangePromiseResolve || !this.latestShippingChangePromiseReject) {
|
|
13300
|
+
return;
|
|
13301
|
+
}
|
|
13302
|
+
if (!data.success || !data.body) {
|
|
13303
|
+
return this.latestShippingChangePromiseReject();
|
|
13304
|
+
}
|
|
13285
13305
|
var newAmount = (_a = data === null || data === void 0 ? void 0 : data.body) === null || _a === void 0 ? void 0 : _a.amount;
|
|
13286
13306
|
var newShippingOptions = (_b = data === null || data === void 0 ? void 0 : data.body) === null || _b === void 0 ? void 0 : _b.shipping_options;
|
|
13287
|
-
if (newAmount)
|
|
13307
|
+
if (newAmount) {
|
|
13308
|
+
this.meta.amount = newAmount;
|
|
13309
|
+
}
|
|
13288
13310
|
if (newShippingOptions) {
|
|
13289
13311
|
this.meta.shipping_options = newShippingOptions;
|
|
13290
13312
|
this.selectedShippingOption = newShippingOptions ? newShippingOptions[0] : undefined;
|
|
@@ -13304,17 +13326,17 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
13304
13326
|
}, {
|
|
13305
13327
|
key: "checkAvailability",
|
|
13306
13328
|
value: function checkAvailability() {
|
|
13307
|
-
var
|
|
13329
|
+
var _this4 = this;
|
|
13308
13330
|
return new Promise(function (resolve, _reject) {
|
|
13309
13331
|
var _a;
|
|
13310
13332
|
if (!window.ApplePaySession || !ApplePaySession) {
|
|
13311
13333
|
resolve(false);
|
|
13312
13334
|
}
|
|
13313
13335
|
var formattedCapabilities = DEFAULT_APPLE_PAY_CAPABILITIES$1;
|
|
13314
|
-
if (((_a =
|
|
13315
|
-
formattedCapabilities =
|
|
13336
|
+
if (((_a = _this4.meta.apple_pay_capabilities) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
13337
|
+
formattedCapabilities = _this4.formatCapabilities(_this4.meta.apple_pay_capabilities);
|
|
13316
13338
|
}
|
|
13317
|
-
ApplePaySession.applePayCapabilities(
|
|
13339
|
+
ApplePaySession.applePayCapabilities(_this4.getMerchantId()).then(function (capabilities) {
|
|
13318
13340
|
var canMakePayment = formattedCapabilities.includes(capabilities === null || capabilities === void 0 ? void 0 : capabilities.paymentCredentialStatus);
|
|
13319
13341
|
resolve(canMakePayment);
|
|
13320
13342
|
})["catch"](function (_err) {
|
|
@@ -13362,11 +13384,17 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
13362
13384
|
var _a;
|
|
13363
13385
|
var rawDataInitialization = this.getMetaRawDataInitialization();
|
|
13364
13386
|
if (rawDataInitialization && _typeof$1(rawDataInitialization) === 'object') {
|
|
13365
|
-
if (_typeof$1(rawDataInitialization.total) === 'object')
|
|
13366
|
-
|
|
13367
|
-
|
|
13368
|
-
|
|
13369
|
-
|
|
13387
|
+
if (_typeof$1(rawDataInitialization.total) === 'object') {
|
|
13388
|
+
rawDataInitialization.total.amount = this.meta.amount.toString();
|
|
13389
|
+
} else {
|
|
13390
|
+
rawDataInitialization.total = {
|
|
13391
|
+
label: ((_a = this.meta) === null || _a === void 0 ? void 0 : _a.amount_label) || '',
|
|
13392
|
+
amount: this.meta.amount.toString()
|
|
13393
|
+
};
|
|
13394
|
+
}
|
|
13395
|
+
if (this.isShippingRequired() && this.hasShippingOptions()) {
|
|
13396
|
+
rawDataInitialization.shippingMethods = this.formatShippingOptions(this.meta.shipping_options);
|
|
13397
|
+
}
|
|
13370
13398
|
}
|
|
13371
13399
|
return rawDataInitialization || _extends(_extends(_extends({
|
|
13372
13400
|
countryCode: this.meta.country.toUpperCase(),
|
|
@@ -13390,22 +13418,22 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
13390
13418
|
}, {
|
|
13391
13419
|
key: "getMerchantSession",
|
|
13392
13420
|
value: function getMerchantSession() {
|
|
13393
|
-
var
|
|
13421
|
+
var _this5 = this;
|
|
13394
13422
|
return new Promise(function (resolve, reject) {
|
|
13395
|
-
return
|
|
13423
|
+
return _this5.eventEmitter.emit(WALLET_EVENT.CALLBACK, {
|
|
13396
13424
|
data: _extends({
|
|
13397
13425
|
request_type: "CREATE_SESSION",
|
|
13398
13426
|
wallet_type: WALLET_TYPE.APPLE,
|
|
13399
13427
|
session_id: window.location.hostname
|
|
13400
|
-
},
|
|
13401
|
-
request_shipping:
|
|
13428
|
+
}, _this5.isShippingRequired() && {
|
|
13429
|
+
request_shipping: _this5.meta.request_shipping
|
|
13402
13430
|
}),
|
|
13403
13431
|
onSuccess: function onSuccess(res) {
|
|
13404
13432
|
return resolve(res);
|
|
13405
13433
|
},
|
|
13406
13434
|
onError: function onError(message) {
|
|
13407
13435
|
console.error('Error generating order id', message);
|
|
13408
|
-
|
|
13436
|
+
_this5.eventEmitter.emit(WALLET_EVENT.PAYMENT_ERROR, {
|
|
13409
13437
|
message: message
|
|
13410
13438
|
});
|
|
13411
13439
|
reject(message);
|
|
@@ -13416,10 +13444,10 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
|
|
|
13416
13444
|
}, {
|
|
13417
13445
|
key: "handleMerchantOnButtonClickEvent",
|
|
13418
13446
|
value: function handleMerchantOnButtonClickEvent() {
|
|
13419
|
-
var
|
|
13447
|
+
var _this6 = this;
|
|
13420
13448
|
return new Promise(function (resolve, reject) {
|
|
13421
13449
|
var merchantResult;
|
|
13422
|
-
|
|
13450
|
+
_this6.eventEmitter.emit(WALLET_EVENT.BUTTON_CLICK, {
|
|
13423
13451
|
attachResult: function attachResult(value) {
|
|
13424
13452
|
merchantResult = value;
|
|
13425
13453
|
}
|
|
@@ -19287,17 +19315,13 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
19287
19315
|
_classCallCheck(this, ApplePayWalletButtonExpress);
|
|
19288
19316
|
_this = _callSuper(this, ApplePayWalletButtonExpress, [selector, publicKeyOrAccessToken, gatewayId, meta, ['amount_label', 'country']]);
|
|
19289
19317
|
_this.onApplePayButtonClicked = function () {
|
|
19290
|
-
|
|
19291
|
-
|
|
19292
|
-
|
|
19293
|
-
|
|
19294
|
-
|
|
19295
|
-
|
|
19296
|
-
|
|
19297
|
-
_this.paymentSession.begin();
|
|
19298
|
-
})["catch"](function () {
|
|
19299
|
-
_this.handleCheckoutClose();
|
|
19300
|
-
});
|
|
19318
|
+
_this.paymentSession = new ApplePaySession(14, _this.createRequest());
|
|
19319
|
+
_this.paymentSession.onvalidatemerchant = _this.onValidateMerchant;
|
|
19320
|
+
_this.paymentSession.onpaymentauthorized = _this.onPaymentAuthorized;
|
|
19321
|
+
_this.paymentSession.oncancel = _this.onCancelPayment;
|
|
19322
|
+
_this.paymentSession.onshippingmethodselected = _this.onApplePayShippingMethodUpdate;
|
|
19323
|
+
_this.paymentSession.onshippingcontactselected = _this.onApplePayShippingContactUpdate;
|
|
19324
|
+
_this.paymentSession.begin();
|
|
19301
19325
|
};
|
|
19302
19326
|
_this.onValidateMerchant = function (event) {
|
|
19303
19327
|
_this.handleMerchantOnExpressButtonClickEvent().then(function () {
|
|
@@ -19423,22 +19447,18 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
19423
19447
|
key: "load",
|
|
19424
19448
|
value: function load() {
|
|
19425
19449
|
var _this4 = this;
|
|
19426
|
-
if (!window.Promise)
|
|
19450
|
+
if (!window.Promise) {
|
|
19451
|
+
return this.handleOnUnavailable();
|
|
19452
|
+
}
|
|
19453
|
+
if (customElements === null || customElements === void 0 ? void 0 : customElements.get('apple-pay-button')) {
|
|
19454
|
+
return this.onScriptLoaded();
|
|
19455
|
+
}
|
|
19427
19456
|
var applePayScript = document.createElement('script');
|
|
19428
19457
|
applePayScript.src = "https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js";
|
|
19429
19458
|
applePayScript.type = "text/javascript";
|
|
19430
19459
|
applePayScript.crossOrigin = 'anonymous';
|
|
19431
19460
|
applePayScript.onload = function () {
|
|
19432
|
-
_this4.
|
|
19433
|
-
if (!config || config.type !== 'MasterCard' || !config.credentials || !config.credentials.apple || !config.credentials.apple.merchant) throw new Error('Invalid configuration');
|
|
19434
|
-
return _this4.checkAvailability(config);
|
|
19435
|
-
}).then(function (available) {
|
|
19436
|
-
if (!available) return _this4.handleOnUnavailable();
|
|
19437
|
-
return _this4.mount();
|
|
19438
|
-
})["catch"](function (err) {
|
|
19439
|
-
if (err) _this4.handleOnError(err);
|
|
19440
|
-
_this4.handleOnUnavailable();
|
|
19441
|
-
});
|
|
19461
|
+
_this4.onScriptLoaded();
|
|
19442
19462
|
};
|
|
19443
19463
|
applePayScript.onerror = function (err) {
|
|
19444
19464
|
console.error("ApplePayWalletButtonExpress: Error loading ApplePay script", err);
|
|
@@ -19447,6 +19467,27 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
19447
19467
|
};
|
|
19448
19468
|
document.head.appendChild(applePayScript);
|
|
19449
19469
|
}
|
|
19470
|
+
}, {
|
|
19471
|
+
key: "onScriptLoaded",
|
|
19472
|
+
value: function onScriptLoaded() {
|
|
19473
|
+
var _this5 = this;
|
|
19474
|
+
this.getGatewayWalletConfig().then(function (config) {
|
|
19475
|
+
if (!config || config.type !== 'MasterCard' || !config.credentials || !config.credentials.apple || !config.credentials.apple.merchant) {
|
|
19476
|
+
throw new Error('Invalid configuration');
|
|
19477
|
+
}
|
|
19478
|
+
return _this5.checkAvailability(config);
|
|
19479
|
+
}).then(function (available) {
|
|
19480
|
+
if (!available) {
|
|
19481
|
+
return _this5.handleOnUnavailable();
|
|
19482
|
+
}
|
|
19483
|
+
return _this5.mount();
|
|
19484
|
+
})["catch"](function (err) {
|
|
19485
|
+
if (err) {
|
|
19486
|
+
_this5.handleOnError(err);
|
|
19487
|
+
}
|
|
19488
|
+
_this5.handleOnUnavailable();
|
|
19489
|
+
});
|
|
19490
|
+
}
|
|
19450
19491
|
/**
|
|
19451
19492
|
* Call this method if updating the originally-provided meta object after order information changed.
|
|
19452
19493
|
* For example, if the order amount has changed from the time where the button was originally rendered.
|
|
@@ -19464,15 +19505,15 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
|
|
|
19464
19505
|
}, {
|
|
19465
19506
|
key: "checkAvailability",
|
|
19466
19507
|
value: function checkAvailability(config) {
|
|
19467
|
-
var
|
|
19508
|
+
var _this6 = this;
|
|
19468
19509
|
return new Promise(function (resolve, _reject) {
|
|
19469
19510
|
var _a;
|
|
19470
19511
|
if (!window.ApplePaySession || !ApplePaySession) {
|
|
19471
19512
|
resolve(false);
|
|
19472
19513
|
}
|
|
19473
19514
|
var formattedCapabilities = DEFAULT_APPLE_PAY_CAPABILITIES;
|
|
19474
|
-
if (((_a =
|
|
19475
|
-
formattedCapabilities =
|
|
19515
|
+
if (((_a = _this6.meta.apple_pay_capabilities) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
19516
|
+
formattedCapabilities = _this6.formatCapabilities(_this6.meta.apple_pay_capabilities);
|
|
19476
19517
|
}
|
|
19477
19518
|
ApplePaySession.applePayCapabilities(config.credentials[WALLET_TYPE.APPLE].merchant).then(function (capabilities) {
|
|
19478
19519
|
var canMakePayment = formattedCapabilities.includes(capabilities === null || capabilities === void 0 ? void 0 : capabilities.paymentCredentialStatus);
|