@paydock/client-sdk 1.123.2 → 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.mjs.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.
|
|
@@ -28,6 +28,7 @@ export declare class AppleWalletService extends WalletService implements IWallet
|
|
|
28
28
|
protected isShippingRequired(): boolean;
|
|
29
29
|
protected hasShippingOptions(): boolean;
|
|
30
30
|
load(container: Container): Promise<void>;
|
|
31
|
+
private onScriptLoaded;
|
|
31
32
|
update(data: IWalletServiceUpdate): void;
|
|
32
33
|
private checkAvailability;
|
|
33
34
|
private mount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apple.wallet-service.d.ts","sourceRoot":"","sources":["../../../src/wallet-buttons/wallet-services/apple.wallet-service.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"apple.wallet-service.d.ts","sourceRoot":"","sources":["../../../src/wallet-buttons/wallet-services/apple.wallet-service.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EACH,KAAK,6BAA6B,EAClC,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAI/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAEH,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAEzB,aAAa,EAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,eAAe,EAAE,eAAe,CAAC;KACpC;CACJ;AAED,UAAU,kBAAkB;IACxB,eAAe,CAAC,EAAE,UAAU,CAAC,sBAAsB,CAAC;IACpD,cAAc,CAAC,EAAE,UAAU,CAAC,sBAAsB,CAAC;CACtD;AAID,qBAAa,kBAAmB,SAAQ,aAAc,YAAW,cAAc;IAOlB,SAAS,CAAC,WAAW,EAAE,MAAM;IAAE,SAAS,CAAC,YAAY,EAAE,YAAY;IAN5H,OAAO,CAAC,cAAc,CAAkB;IACxC,SAAS,CAAC,kCAAkC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACvE,SAAS,CAAC,iCAAiC,EAAE,MAAM,IAAI,CAAC;IACxD,SAAS,CAAC,sBAAsB,EAAE,uBAAuB,CAAC;IAC1D,SAAS,CAAC,kBAAkB,EAAE,kBAAkB,CAAM;gBAE1C,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAY,WAAW,EAAE,MAAM,EAAY,YAAY,EAAE,YAAY;IAK5H,SAAS,CAAC,cAAc,IAAI,MAAM;IAIlC,SAAS,CAAC,aAAa,IAAI,MAAM;IAIjC,SAAS,CAAC,aAAa,IAAI,cAAc;IAmBzC,SAAS,CAAC,4BAA4B,IAAI,6BAA6B;IAmBvE,SAAS,CAAC,kBAAkB,IAAI,OAAO;IAIvC,SAAS,CAAC,kBAAkB,IAAI,OAAO;IAIhC,IAAI,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IA2BhD,OAAO,CAAC,cAAc;IAmBf,MAAM,CAAC,IAAI,EAAE,oBAAoB;IAqCxC,OAAO,CAAC,iBAAiB;IAwBzB,OAAO,CAAC,KAAK;IAoBb,OAAO,CAAC,uBAAuB;IAW/B,OAAO,CAAC,eAAe,CAEtB;IAED,OAAO,CAAC,aAAa;IAwCrB,OAAO,CAAC,kBAAkB;IAiB1B,OAAO,CAAC,kBAAkB,CAczB;IAED,OAAO,CAAC,gCAAgC;IAqBxC,OAAO,CAAC,mBAAmB,CA6C1B;IAED,OAAO,CAAC,yBAAyB,CAShC;IAED,OAAO,CAAC,wBAAwB,CAW/B;IAED,OAAO,CAAC,eAAe,CAmBrB;IAEF,OAAO,CAAC,qBAAqB,CAM1B;IAEH,OAAO,CAAC,kBAAkB;IAU1B,OAAO,CAAC,iBAAiB;CAW5B"}
|
package/bundles/types/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ declare class ApplePayWalletButtonExpress extends BaseWalletButton<ApplePayWalle
|
|
|
27
27
|
* button.load();
|
|
28
28
|
*/
|
|
29
29
|
load(): void;
|
|
30
|
+
private onScriptLoaded;
|
|
30
31
|
/**
|
|
31
32
|
* Call this method if updating the originally-provided meta object after order information changed.
|
|
32
33
|
* For example, if the order amount has changed from the time where the button was originally rendered.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apple-pay.wallet-button-express.d.ts","sourceRoot":"","sources":["../../../../src/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apple-pay.wallet-button-express.d.ts","sourceRoot":"","sources":["../../../../src/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAGpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAMvF;;;;;;;;;;;;;;GAcG;AACH,cAAM,2BAA4B,SAAQ,gBAAgB,CAAC,kBAAkB,CAAC;IAC1E,OAAO,CAAC,cAAc,CAAkB;IAExC,kBAAkB,aACN,QAAQ,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB;IAIzG;;;;;;;OAOG;IACI,IAAI;IAwBX,OAAO,CAAC,cAAc;IAyBtB;;;;;;;;OAQG;IACI,OAAO,CAAC,IAAI,EAAE,kBAAkB,GAAG,IAAI;IAI9C,OAAO,CAAC,iBAAiB;IAwBzB,OAAO,CAAC,KAAK;IAoBb,OAAO,CAAC,uBAAuB,CAS9B;IAED,OAAO,CAAC,aAAa;IA4BrB,OAAO,CAAC,kBAAkB,CAczB;IAED,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,mBAAmB,CA0B1B;IAED,OAAO,CAAC,kBAAkB;IAU1B,OAAO,CAAC,eAAe,CAEtB;IAED,OAAO,CAAC,oBAAoB;IAuB5B,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,+BAA+B,CAyBtC;IAED,OAAO,CAAC,8BAA8B,CAarC;IAED,OAAO,CAAC,8BAA8B;IAStC,OAAO,CAAC,+BAA+B;IAqBvC,OAAO,CAAC,iBAAiB;CAuB5B;AAED,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
|
package/bundles/widget.umd.js
CHANGED
|
@@ -958,7 +958,7 @@
|
|
|
958
958
|
version: 'x-sdk-version',
|
|
959
959
|
type: 'x-sdk-type'
|
|
960
960
|
});
|
|
961
|
-
SDK._version = 'v1.123.
|
|
961
|
+
SDK._version = 'v1.123.8';
|
|
962
962
|
|
|
963
963
|
/******************************************************************************
|
|
964
964
|
Copyright (c) Microsoft Corporation.
|
|
@@ -4239,11 +4239,11 @@
|
|
|
4239
4239
|
var gateway = 'bam.nr-data.net';
|
|
4240
4240
|
var params = {
|
|
4241
4241
|
enabled: 'true',
|
|
4242
|
-
accountId: '
|
|
4243
|
-
agentId: '
|
|
4244
|
-
applicationId: '
|
|
4245
|
-
licenseKey: '
|
|
4246
|
-
trustKey: '
|
|
4242
|
+
accountId: '',
|
|
4243
|
+
agentId: '',
|
|
4244
|
+
applicationId: '',
|
|
4245
|
+
licenseKey: '',
|
|
4246
|
+
trustKey: ''
|
|
4247
4247
|
};
|
|
4248
4248
|
var disabled = function disabled() {
|
|
4249
4249
|
return {
|
|
@@ -13205,10 +13205,13 @@
|
|
|
13205
13205
|
var _a, _b, _c;
|
|
13206
13206
|
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') {
|
|
13207
13207
|
var metaStyles = JSON.parse(JSON.stringify((_c = this.meta) === null || _c === void 0 ? void 0 : _c.style));
|
|
13208
|
-
if ('google' in metaStyles)
|
|
13208
|
+
if ('google' in metaStyles) {
|
|
13209
13209
|
// biome-ignore lint/performance/noDelete: <explanation>
|
|
13210
13210
|
metaStyles === null || metaStyles === void 0 ? true : delete metaStyles.google; // to offer backward compatibility
|
|
13211
|
-
|
|
13211
|
+
}
|
|
13212
|
+
if ('apple' in metaStyles) {
|
|
13213
|
+
return metaStyles === null || metaStyles === void 0 ? void 0 : metaStyles.apple;
|
|
13214
|
+
}
|
|
13212
13215
|
return metaStyles; // to offer backward compatibility
|
|
13213
13216
|
}
|
|
13214
13217
|
return null;
|
|
@@ -13219,10 +13222,13 @@
|
|
|
13219
13222
|
var _a, _b, _c, _d;
|
|
13220
13223
|
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') {
|
|
13221
13224
|
var metaRawDataInit = JSON.parse(JSON.stringify((_d = this.meta) === null || _d === void 0 ? void 0 : _d.raw_data_initialization));
|
|
13222
|
-
if ('google' in metaRawDataInit)
|
|
13225
|
+
if ('google' in metaRawDataInit) {
|
|
13223
13226
|
// biome-ignore lint/performance/noDelete: <explanation>
|
|
13224
13227
|
metaRawDataInit === null || metaRawDataInit === void 0 ? true : delete metaRawDataInit.google; // to offer backward compatibility
|
|
13225
|
-
|
|
13228
|
+
}
|
|
13229
|
+
if ('apple' in metaRawDataInit) {
|
|
13230
|
+
return metaRawDataInit === null || metaRawDataInit === void 0 ? void 0 : metaRawDataInit.apple;
|
|
13231
|
+
}
|
|
13226
13232
|
return metaRawDataInit; // to offer backward compatibility
|
|
13227
13233
|
}
|
|
13228
13234
|
return null;
|
|
@@ -13250,28 +13256,16 @@
|
|
|
13250
13256
|
});
|
|
13251
13257
|
return;
|
|
13252
13258
|
}
|
|
13259
|
+
if (customElements === null || customElements === void 0 ? void 0 : customElements.get('apple-pay-button')) {
|
|
13260
|
+
this.onScriptLoaded(container);
|
|
13261
|
+
return;
|
|
13262
|
+
}
|
|
13253
13263
|
var applePayScript = document.createElement('script');
|
|
13254
13264
|
applePayScript.src = "https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js";
|
|
13255
13265
|
applePayScript.type = "text/javascript";
|
|
13256
13266
|
applePayScript.crossOrigin = 'anonymous';
|
|
13257
13267
|
applePayScript.onload = function () {
|
|
13258
|
-
_this2.
|
|
13259
|
-
var _a;
|
|
13260
|
-
if (!available) {
|
|
13261
|
-
_this2.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, {
|
|
13262
|
-
wallet: WALLET_TYPE.APPLE
|
|
13263
|
-
});
|
|
13264
|
-
return;
|
|
13265
|
-
}
|
|
13266
|
-
// Store default shipping option
|
|
13267
|
-
if (_this2.isShippingRequired() && _this2.hasShippingOptions()) {
|
|
13268
|
-
_this2.selectedShippingOption = (_a = _this2.meta) === null || _a === void 0 ? void 0 : _a.shipping_options[0];
|
|
13269
|
-
_this2.latestShippingData.shippingMethod = _this2.formatShippingOptions([_this2.selectedShippingOption])[0];
|
|
13270
|
-
}
|
|
13271
|
-
_this2.mount(container);
|
|
13272
|
-
})["catch"](function (err) {
|
|
13273
|
-
return console.error("Error checking ApplePay availability", err);
|
|
13274
|
-
});
|
|
13268
|
+
_this2.onScriptLoaded(container);
|
|
13275
13269
|
};
|
|
13276
13270
|
applePayScript.onerror = function (err) {
|
|
13277
13271
|
console.error("AppleWalletService: Error loading ApplePay script", err);
|
|
@@ -13282,15 +13276,43 @@
|
|
|
13282
13276
|
};
|
|
13283
13277
|
document.head.appendChild(applePayScript);
|
|
13284
13278
|
}
|
|
13279
|
+
}, {
|
|
13280
|
+
key: "onScriptLoaded",
|
|
13281
|
+
value: function onScriptLoaded(container) {
|
|
13282
|
+
var _this3 = this;
|
|
13283
|
+
this.checkAvailability().then(function (available) {
|
|
13284
|
+
var _a;
|
|
13285
|
+
if (!available) {
|
|
13286
|
+
_this3.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, {
|
|
13287
|
+
wallet: WALLET_TYPE.APPLE
|
|
13288
|
+
});
|
|
13289
|
+
return;
|
|
13290
|
+
}
|
|
13291
|
+
// Store default shipping option
|
|
13292
|
+
if (_this3.isShippingRequired() && _this3.hasShippingOptions()) {
|
|
13293
|
+
_this3.selectedShippingOption = (_a = _this3.meta) === null || _a === void 0 ? void 0 : _a.shipping_options[0];
|
|
13294
|
+
_this3.latestShippingData.shippingMethod = _this3.formatShippingOptions([_this3.selectedShippingOption])[0];
|
|
13295
|
+
}
|
|
13296
|
+
_this3.mount(container);
|
|
13297
|
+
})["catch"](function (err) {
|
|
13298
|
+
return console.error("Error checking ApplePay availability", err);
|
|
13299
|
+
});
|
|
13300
|
+
}
|
|
13285
13301
|
}, {
|
|
13286
13302
|
key: "update",
|
|
13287
13303
|
value: function update(data) {
|
|
13288
13304
|
var _a, _b, _c;
|
|
13289
|
-
if (!this.latestShippingChangePromiseResolve || !this.latestShippingChangePromiseReject)
|
|
13290
|
-
|
|
13305
|
+
if (!this.latestShippingChangePromiseResolve || !this.latestShippingChangePromiseReject) {
|
|
13306
|
+
return;
|
|
13307
|
+
}
|
|
13308
|
+
if (!data.success || !data.body) {
|
|
13309
|
+
return this.latestShippingChangePromiseReject();
|
|
13310
|
+
}
|
|
13291
13311
|
var newAmount = (_a = data === null || data === void 0 ? void 0 : data.body) === null || _a === void 0 ? void 0 : _a.amount;
|
|
13292
13312
|
var newShippingOptions = (_b = data === null || data === void 0 ? void 0 : data.body) === null || _b === void 0 ? void 0 : _b.shipping_options;
|
|
13293
|
-
if (newAmount)
|
|
13313
|
+
if (newAmount) {
|
|
13314
|
+
this.meta.amount = newAmount;
|
|
13315
|
+
}
|
|
13294
13316
|
if (newShippingOptions) {
|
|
13295
13317
|
this.meta.shipping_options = newShippingOptions;
|
|
13296
13318
|
this.selectedShippingOption = newShippingOptions ? newShippingOptions[0] : undefined;
|
|
@@ -13310,17 +13332,17 @@
|
|
|
13310
13332
|
}, {
|
|
13311
13333
|
key: "checkAvailability",
|
|
13312
13334
|
value: function checkAvailability() {
|
|
13313
|
-
var
|
|
13335
|
+
var _this4 = this;
|
|
13314
13336
|
return new Promise(function (resolve, _reject) {
|
|
13315
13337
|
var _a;
|
|
13316
13338
|
if (!window.ApplePaySession || !ApplePaySession) {
|
|
13317
13339
|
resolve(false);
|
|
13318
13340
|
}
|
|
13319
13341
|
var formattedCapabilities = DEFAULT_APPLE_PAY_CAPABILITIES$1;
|
|
13320
|
-
if (((_a =
|
|
13321
|
-
formattedCapabilities =
|
|
13342
|
+
if (((_a = _this4.meta.apple_pay_capabilities) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
13343
|
+
formattedCapabilities = _this4.formatCapabilities(_this4.meta.apple_pay_capabilities);
|
|
13322
13344
|
}
|
|
13323
|
-
ApplePaySession.applePayCapabilities(
|
|
13345
|
+
ApplePaySession.applePayCapabilities(_this4.getMerchantId()).then(function (capabilities) {
|
|
13324
13346
|
var canMakePayment = formattedCapabilities.includes(capabilities === null || capabilities === void 0 ? void 0 : capabilities.paymentCredentialStatus);
|
|
13325
13347
|
resolve(canMakePayment);
|
|
13326
13348
|
})["catch"](function (_err) {
|
|
@@ -13368,11 +13390,17 @@
|
|
|
13368
13390
|
var _a;
|
|
13369
13391
|
var rawDataInitialization = this.getMetaRawDataInitialization();
|
|
13370
13392
|
if (rawDataInitialization && _typeof$1(rawDataInitialization) === 'object') {
|
|
13371
|
-
if (_typeof$1(rawDataInitialization.total) === 'object')
|
|
13372
|
-
|
|
13373
|
-
|
|
13374
|
-
|
|
13375
|
-
|
|
13393
|
+
if (_typeof$1(rawDataInitialization.total) === 'object') {
|
|
13394
|
+
rawDataInitialization.total.amount = this.meta.amount.toString();
|
|
13395
|
+
} else {
|
|
13396
|
+
rawDataInitialization.total = {
|
|
13397
|
+
label: ((_a = this.meta) === null || _a === void 0 ? void 0 : _a.amount_label) || '',
|
|
13398
|
+
amount: this.meta.amount.toString()
|
|
13399
|
+
};
|
|
13400
|
+
}
|
|
13401
|
+
if (this.isShippingRequired() && this.hasShippingOptions()) {
|
|
13402
|
+
rawDataInitialization.shippingMethods = this.formatShippingOptions(this.meta.shipping_options);
|
|
13403
|
+
}
|
|
13376
13404
|
}
|
|
13377
13405
|
return rawDataInitialization || _extends(_extends(_extends({
|
|
13378
13406
|
countryCode: this.meta.country.toUpperCase(),
|
|
@@ -13396,22 +13424,22 @@
|
|
|
13396
13424
|
}, {
|
|
13397
13425
|
key: "getMerchantSession",
|
|
13398
13426
|
value: function getMerchantSession() {
|
|
13399
|
-
var
|
|
13427
|
+
var _this5 = this;
|
|
13400
13428
|
return new Promise(function (resolve, reject) {
|
|
13401
|
-
return
|
|
13429
|
+
return _this5.eventEmitter.emit(WALLET_EVENT.CALLBACK, {
|
|
13402
13430
|
data: _extends({
|
|
13403
13431
|
request_type: "CREATE_SESSION",
|
|
13404
13432
|
wallet_type: WALLET_TYPE.APPLE,
|
|
13405
13433
|
session_id: window.location.hostname
|
|
13406
|
-
},
|
|
13407
|
-
request_shipping:
|
|
13434
|
+
}, _this5.isShippingRequired() && {
|
|
13435
|
+
request_shipping: _this5.meta.request_shipping
|
|
13408
13436
|
}),
|
|
13409
13437
|
onSuccess: function onSuccess(res) {
|
|
13410
13438
|
return resolve(res);
|
|
13411
13439
|
},
|
|
13412
13440
|
onError: function onError(message) {
|
|
13413
13441
|
console.error('Error generating order id', message);
|
|
13414
|
-
|
|
13442
|
+
_this5.eventEmitter.emit(WALLET_EVENT.PAYMENT_ERROR, {
|
|
13415
13443
|
message: message
|
|
13416
13444
|
});
|
|
13417
13445
|
reject(message);
|
|
@@ -13422,10 +13450,10 @@
|
|
|
13422
13450
|
}, {
|
|
13423
13451
|
key: "handleMerchantOnButtonClickEvent",
|
|
13424
13452
|
value: function handleMerchantOnButtonClickEvent() {
|
|
13425
|
-
var
|
|
13453
|
+
var _this6 = this;
|
|
13426
13454
|
return new Promise(function (resolve, reject) {
|
|
13427
13455
|
var merchantResult;
|
|
13428
|
-
|
|
13456
|
+
_this6.eventEmitter.emit(WALLET_EVENT.BUTTON_CLICK, {
|
|
13429
13457
|
attachResult: function attachResult(value) {
|
|
13430
13458
|
merchantResult = value;
|
|
13431
13459
|
}
|
|
@@ -19293,17 +19321,13 @@
|
|
|
19293
19321
|
_classCallCheck(this, ApplePayWalletButtonExpress);
|
|
19294
19322
|
_this = _callSuper(this, ApplePayWalletButtonExpress, [selector, publicKeyOrAccessToken, gatewayId, meta, ['amount_label', 'country']]);
|
|
19295
19323
|
_this.onApplePayButtonClicked = function () {
|
|
19296
|
-
|
|
19297
|
-
|
|
19298
|
-
|
|
19299
|
-
|
|
19300
|
-
|
|
19301
|
-
|
|
19302
|
-
|
|
19303
|
-
_this.paymentSession.begin();
|
|
19304
|
-
})["catch"](function () {
|
|
19305
|
-
_this.handleCheckoutClose();
|
|
19306
|
-
});
|
|
19324
|
+
_this.paymentSession = new ApplePaySession(14, _this.createRequest());
|
|
19325
|
+
_this.paymentSession.onvalidatemerchant = _this.onValidateMerchant;
|
|
19326
|
+
_this.paymentSession.onpaymentauthorized = _this.onPaymentAuthorized;
|
|
19327
|
+
_this.paymentSession.oncancel = _this.onCancelPayment;
|
|
19328
|
+
_this.paymentSession.onshippingmethodselected = _this.onApplePayShippingMethodUpdate;
|
|
19329
|
+
_this.paymentSession.onshippingcontactselected = _this.onApplePayShippingContactUpdate;
|
|
19330
|
+
_this.paymentSession.begin();
|
|
19307
19331
|
};
|
|
19308
19332
|
_this.onValidateMerchant = function (event) {
|
|
19309
19333
|
_this.handleMerchantOnExpressButtonClickEvent().then(function () {
|
|
@@ -19429,22 +19453,18 @@
|
|
|
19429
19453
|
key: "load",
|
|
19430
19454
|
value: function load() {
|
|
19431
19455
|
var _this4 = this;
|
|
19432
|
-
if (!window.Promise)
|
|
19456
|
+
if (!window.Promise) {
|
|
19457
|
+
return this.handleOnUnavailable();
|
|
19458
|
+
}
|
|
19459
|
+
if (customElements === null || customElements === void 0 ? void 0 : customElements.get('apple-pay-button')) {
|
|
19460
|
+
return this.onScriptLoaded();
|
|
19461
|
+
}
|
|
19433
19462
|
var applePayScript = document.createElement('script');
|
|
19434
19463
|
applePayScript.src = "https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js";
|
|
19435
19464
|
applePayScript.type = "text/javascript";
|
|
19436
19465
|
applePayScript.crossOrigin = 'anonymous';
|
|
19437
19466
|
applePayScript.onload = function () {
|
|
19438
|
-
_this4.
|
|
19439
|
-
if (!config || config.type !== 'MasterCard' || !config.credentials || !config.credentials.apple || !config.credentials.apple.merchant) throw new Error('Invalid configuration');
|
|
19440
|
-
return _this4.checkAvailability(config);
|
|
19441
|
-
}).then(function (available) {
|
|
19442
|
-
if (!available) return _this4.handleOnUnavailable();
|
|
19443
|
-
return _this4.mount();
|
|
19444
|
-
})["catch"](function (err) {
|
|
19445
|
-
if (err) _this4.handleOnError(err);
|
|
19446
|
-
_this4.handleOnUnavailable();
|
|
19447
|
-
});
|
|
19467
|
+
_this4.onScriptLoaded();
|
|
19448
19468
|
};
|
|
19449
19469
|
applePayScript.onerror = function (err) {
|
|
19450
19470
|
console.error("ApplePayWalletButtonExpress: Error loading ApplePay script", err);
|
|
@@ -19453,6 +19473,27 @@
|
|
|
19453
19473
|
};
|
|
19454
19474
|
document.head.appendChild(applePayScript);
|
|
19455
19475
|
}
|
|
19476
|
+
}, {
|
|
19477
|
+
key: "onScriptLoaded",
|
|
19478
|
+
value: function onScriptLoaded() {
|
|
19479
|
+
var _this5 = this;
|
|
19480
|
+
this.getGatewayWalletConfig().then(function (config) {
|
|
19481
|
+
if (!config || config.type !== 'MasterCard' || !config.credentials || !config.credentials.apple || !config.credentials.apple.merchant) {
|
|
19482
|
+
throw new Error('Invalid configuration');
|
|
19483
|
+
}
|
|
19484
|
+
return _this5.checkAvailability(config);
|
|
19485
|
+
}).then(function (available) {
|
|
19486
|
+
if (!available) {
|
|
19487
|
+
return _this5.handleOnUnavailable();
|
|
19488
|
+
}
|
|
19489
|
+
return _this5.mount();
|
|
19490
|
+
})["catch"](function (err) {
|
|
19491
|
+
if (err) {
|
|
19492
|
+
_this5.handleOnError(err);
|
|
19493
|
+
}
|
|
19494
|
+
_this5.handleOnUnavailable();
|
|
19495
|
+
});
|
|
19496
|
+
}
|
|
19456
19497
|
/**
|
|
19457
19498
|
* Call this method if updating the originally-provided meta object after order information changed.
|
|
19458
19499
|
* For example, if the order amount has changed from the time where the button was originally rendered.
|
|
@@ -19470,15 +19511,15 @@
|
|
|
19470
19511
|
}, {
|
|
19471
19512
|
key: "checkAvailability",
|
|
19472
19513
|
value: function checkAvailability(config) {
|
|
19473
|
-
var
|
|
19514
|
+
var _this6 = this;
|
|
19474
19515
|
return new Promise(function (resolve, _reject) {
|
|
19475
19516
|
var _a;
|
|
19476
19517
|
if (!window.ApplePaySession || !ApplePaySession) {
|
|
19477
19518
|
resolve(false);
|
|
19478
19519
|
}
|
|
19479
19520
|
var formattedCapabilities = DEFAULT_APPLE_PAY_CAPABILITIES;
|
|
19480
|
-
if (((_a =
|
|
19481
|
-
formattedCapabilities =
|
|
19521
|
+
if (((_a = _this6.meta.apple_pay_capabilities) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
19522
|
+
formattedCapabilities = _this6.formatCapabilities(_this6.meta.apple_pay_capabilities);
|
|
19482
19523
|
}
|
|
19483
19524
|
ApplePaySession.applePayCapabilities(config.credentials[WALLET_TYPE.APPLE].merchant).then(function (capabilities) {
|
|
19484
19525
|
var canMakePayment = formattedCapabilities.includes(capabilities === null || capabilities === void 0 ? void 0 : capabilities.paymentCredentialStatus);
|
|
@@ -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.
|
|
@@ -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.
|