@economist/web-apple-pay 1.11.1-beta.1 → 1.11.1
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/dist/index.js +2 -30
- package/dist/src/apple-pay-button.js +2 -30
- package/dist/src/apple-pay-button.stories.js +2 -30
- package/dist/src/apple-pay-modal.js +1 -3
- package/dist/src/apple-pay-modal.stories.js +2 -30
- package/dist/src/clients/payment-checkout/payment-handler.js +1 -27
- package/dist/src/index.js +2 -30
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -83,9 +83,7 @@ var apple_pay_modal_template_default = `<style>
|
|
|
83
83
|
left: 0;
|
|
84
84
|
width: 100%;
|
|
85
85
|
height: 100%;
|
|
86
|
-
|
|
87
|
-
Was 97 for wall/ribbon hosts only; hosts without a ribbon clamp need this. */
|
|
88
|
-
z-index: 1100;
|
|
86
|
+
z-index: 97;
|
|
89
87
|
background: rgba(13, 13, 13, 0.7);
|
|
90
88
|
display: flex;
|
|
91
89
|
align-items: center;
|
|
@@ -1421,20 +1419,6 @@ var MSG_MISSING_REQUIRED_FIELD = "Missing required field";
|
|
|
1421
1419
|
var MSG_EMAIL_WRONG_FORMAT = "That email doesn\u2019t look right. Please enter a valid email address.";
|
|
1422
1420
|
var MSG_EMAIL_TOO_LONG = "This field must be 80 characters or less.";
|
|
1423
1421
|
var MSG_UNSUPPORTED_BILLING_COUNTRY = "Billing country does not match offer price zone";
|
|
1424
|
-
var BILLING_COUNTRY_MISMATCH_FALLBACK = "Country not supported for this purchase";
|
|
1425
|
-
var MSG_BILLING_COUNTRY_MISMATCH_REDIRECT = "This country isn\u2019t supported for this purchase. Try updating your billing address.";
|
|
1426
|
-
var buildCountryMismatchMessage = (countryCode) => {
|
|
1427
|
-
if (!countryCode) return BILLING_COUNTRY_MISMATCH_FALLBACK;
|
|
1428
|
-
try {
|
|
1429
|
-
const regionNames = new Intl.DisplayNames(["en"], { type: "region", fallback: "none" });
|
|
1430
|
-
const upper = countryCode.toUpperCase();
|
|
1431
|
-
const countryName = regionNames.of(upper);
|
|
1432
|
-
const isResolved = countryName && countryName !== upper && countryName !== "Unknown Region";
|
|
1433
|
-
return isResolved ? `${countryName} address required` : BILLING_COUNTRY_MISMATCH_FALLBACK;
|
|
1434
|
-
} catch {
|
|
1435
|
-
return BILLING_COUNTRY_MISMATCH_FALLBACK;
|
|
1436
|
-
}
|
|
1437
|
-
};
|
|
1438
1422
|
var MSG_PAYMENT_GENERIC_ERROR = "Something went wrong. Please check your payment and billing details and try again or contact us.";
|
|
1439
1423
|
var MSG_CONTACT_VALIDATION_INTERNAL = "Could not validate Apple Pay contact";
|
|
1440
1424
|
|
|
@@ -1715,19 +1699,7 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
|
|
|
1715
1699
|
});
|
|
1716
1700
|
} catch (err) {
|
|
1717
1701
|
if (err instanceof ContactValidationError) {
|
|
1718
|
-
|
|
1719
|
-
(e) => e.contactField === "countryCode"
|
|
1720
|
-
);
|
|
1721
|
-
if (isBillingCountryMismatch) {
|
|
1722
|
-
const countryCode = event.payment.billingContact?.countryCode;
|
|
1723
|
-
const userMessage = buildCountryMismatchMessage(countryCode);
|
|
1724
|
-
failApplePaySession(session, [
|
|
1725
|
-
new ApplePayError("billingContactInvalid", "countryCode", userMessage)
|
|
1726
|
-
]);
|
|
1727
|
-
redirectFallback(skuId, returnUrl, country, { inlineError: MSG_BILLING_COUNTRY_MISMATCH_REDIRECT });
|
|
1728
|
-
} else {
|
|
1729
|
-
failApplePaySession(session, err.errors);
|
|
1730
|
-
}
|
|
1702
|
+
failApplePaySession(session, err.errors);
|
|
1731
1703
|
return;
|
|
1732
1704
|
}
|
|
1733
1705
|
const walletError = parseWalletApiError(err);
|
|
@@ -83,9 +83,7 @@ var apple_pay_modal_template_default = `<style>
|
|
|
83
83
|
left: 0;
|
|
84
84
|
width: 100%;
|
|
85
85
|
height: 100%;
|
|
86
|
-
|
|
87
|
-
Was 97 for wall/ribbon hosts only; hosts without a ribbon clamp need this. */
|
|
88
|
-
z-index: 1100;
|
|
86
|
+
z-index: 97;
|
|
89
87
|
background: rgba(13, 13, 13, 0.7);
|
|
90
88
|
display: flex;
|
|
91
89
|
align-items: center;
|
|
@@ -1409,20 +1407,6 @@ var MSG_MISSING_REQUIRED_FIELD = "Missing required field";
|
|
|
1409
1407
|
var MSG_EMAIL_WRONG_FORMAT = "That email doesn\u2019t look right. Please enter a valid email address.";
|
|
1410
1408
|
var MSG_EMAIL_TOO_LONG = "This field must be 80 characters or less.";
|
|
1411
1409
|
var MSG_UNSUPPORTED_BILLING_COUNTRY = "Billing country does not match offer price zone";
|
|
1412
|
-
var BILLING_COUNTRY_MISMATCH_FALLBACK = "Country not supported for this purchase";
|
|
1413
|
-
var MSG_BILLING_COUNTRY_MISMATCH_REDIRECT = "This country isn\u2019t supported for this purchase. Try updating your billing address.";
|
|
1414
|
-
var buildCountryMismatchMessage = (countryCode) => {
|
|
1415
|
-
if (!countryCode) return BILLING_COUNTRY_MISMATCH_FALLBACK;
|
|
1416
|
-
try {
|
|
1417
|
-
const regionNames = new Intl.DisplayNames(["en"], { type: "region", fallback: "none" });
|
|
1418
|
-
const upper = countryCode.toUpperCase();
|
|
1419
|
-
const countryName = regionNames.of(upper);
|
|
1420
|
-
const isResolved = countryName && countryName !== upper && countryName !== "Unknown Region";
|
|
1421
|
-
return isResolved ? `${countryName} address required` : BILLING_COUNTRY_MISMATCH_FALLBACK;
|
|
1422
|
-
} catch {
|
|
1423
|
-
return BILLING_COUNTRY_MISMATCH_FALLBACK;
|
|
1424
|
-
}
|
|
1425
|
-
};
|
|
1426
1410
|
var MSG_PAYMENT_GENERIC_ERROR = "Something went wrong. Please check your payment and billing details and try again or contact us.";
|
|
1427
1411
|
var MSG_CONTACT_VALIDATION_INTERNAL = "Could not validate Apple Pay contact";
|
|
1428
1412
|
|
|
@@ -1703,19 +1687,7 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
|
|
|
1703
1687
|
});
|
|
1704
1688
|
} catch (err) {
|
|
1705
1689
|
if (err instanceof ContactValidationError) {
|
|
1706
|
-
|
|
1707
|
-
(e) => e.contactField === "countryCode"
|
|
1708
|
-
);
|
|
1709
|
-
if (isBillingCountryMismatch) {
|
|
1710
|
-
const countryCode = event.payment.billingContact?.countryCode;
|
|
1711
|
-
const userMessage = buildCountryMismatchMessage(countryCode);
|
|
1712
|
-
failApplePaySession(session, [
|
|
1713
|
-
new ApplePayError("billingContactInvalid", "countryCode", userMessage)
|
|
1714
|
-
]);
|
|
1715
|
-
redirectFallback(skuId, returnUrl, country, { inlineError: MSG_BILLING_COUNTRY_MISMATCH_REDIRECT });
|
|
1716
|
-
} else {
|
|
1717
|
-
failApplePaySession(session, err.errors);
|
|
1718
|
-
}
|
|
1690
|
+
failApplePaySession(session, err.errors);
|
|
1719
1691
|
return;
|
|
1720
1692
|
}
|
|
1721
1693
|
const walletError = parseWalletApiError(err);
|
|
@@ -83,9 +83,7 @@ var apple_pay_modal_template_default = `<style>
|
|
|
83
83
|
left: 0;
|
|
84
84
|
width: 100%;
|
|
85
85
|
height: 100%;
|
|
86
|
-
|
|
87
|
-
Was 97 for wall/ribbon hosts only; hosts without a ribbon clamp need this. */
|
|
88
|
-
z-index: 1100;
|
|
86
|
+
z-index: 97;
|
|
89
87
|
background: rgba(13, 13, 13, 0.7);
|
|
90
88
|
display: flex;
|
|
91
89
|
align-items: center;
|
|
@@ -1417,20 +1415,6 @@ var MSG_MISSING_REQUIRED_FIELD = "Missing required field";
|
|
|
1417
1415
|
var MSG_EMAIL_WRONG_FORMAT = "That email doesn\u2019t look right. Please enter a valid email address.";
|
|
1418
1416
|
var MSG_EMAIL_TOO_LONG = "This field must be 80 characters or less.";
|
|
1419
1417
|
var MSG_UNSUPPORTED_BILLING_COUNTRY = "Billing country does not match offer price zone";
|
|
1420
|
-
var BILLING_COUNTRY_MISMATCH_FALLBACK = "Country not supported for this purchase";
|
|
1421
|
-
var MSG_BILLING_COUNTRY_MISMATCH_REDIRECT = "This country isn\u2019t supported for this purchase. Try updating your billing address.";
|
|
1422
|
-
var buildCountryMismatchMessage = (countryCode) => {
|
|
1423
|
-
if (!countryCode) return BILLING_COUNTRY_MISMATCH_FALLBACK;
|
|
1424
|
-
try {
|
|
1425
|
-
const regionNames = new Intl.DisplayNames(["en"], { type: "region", fallback: "none" });
|
|
1426
|
-
const upper = countryCode.toUpperCase();
|
|
1427
|
-
const countryName = regionNames.of(upper);
|
|
1428
|
-
const isResolved = countryName && countryName !== upper && countryName !== "Unknown Region";
|
|
1429
|
-
return isResolved ? `${countryName} address required` : BILLING_COUNTRY_MISMATCH_FALLBACK;
|
|
1430
|
-
} catch {
|
|
1431
|
-
return BILLING_COUNTRY_MISMATCH_FALLBACK;
|
|
1432
|
-
}
|
|
1433
|
-
};
|
|
1434
1418
|
var MSG_PAYMENT_GENERIC_ERROR = "Something went wrong. Please check your payment and billing details and try again or contact us.";
|
|
1435
1419
|
var MSG_CONTACT_VALIDATION_INTERNAL = "Could not validate Apple Pay contact";
|
|
1436
1420
|
|
|
@@ -1711,19 +1695,7 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
|
|
|
1711
1695
|
});
|
|
1712
1696
|
} catch (err) {
|
|
1713
1697
|
if (err instanceof ContactValidationError) {
|
|
1714
|
-
|
|
1715
|
-
(e) => e.contactField === "countryCode"
|
|
1716
|
-
);
|
|
1717
|
-
if (isBillingCountryMismatch) {
|
|
1718
|
-
const countryCode = event.payment.billingContact?.countryCode;
|
|
1719
|
-
const userMessage = buildCountryMismatchMessage(countryCode);
|
|
1720
|
-
failApplePaySession(session, [
|
|
1721
|
-
new ApplePayError("billingContactInvalid", "countryCode", userMessage)
|
|
1722
|
-
]);
|
|
1723
|
-
redirectFallback(skuId, returnUrl, country, { inlineError: MSG_BILLING_COUNTRY_MISMATCH_REDIRECT });
|
|
1724
|
-
} else {
|
|
1725
|
-
failApplePaySession(session, err.errors);
|
|
1726
|
-
}
|
|
1698
|
+
failApplePaySession(session, err.errors);
|
|
1727
1699
|
return;
|
|
1728
1700
|
}
|
|
1729
1701
|
const walletError = parseWalletApiError(err);
|
|
@@ -83,9 +83,7 @@ var apple_pay_modal_template_default = `<style>
|
|
|
83
83
|
left: 0;
|
|
84
84
|
width: 100%;
|
|
85
85
|
height: 100%;
|
|
86
|
-
|
|
87
|
-
Was 97 for wall/ribbon hosts only; hosts without a ribbon clamp need this. */
|
|
88
|
-
z-index: 1100;
|
|
86
|
+
z-index: 97;
|
|
89
87
|
background: rgba(13, 13, 13, 0.7);
|
|
90
88
|
display: flex;
|
|
91
89
|
align-items: center;
|
|
@@ -83,9 +83,7 @@ var apple_pay_modal_template_default = `<style>
|
|
|
83
83
|
left: 0;
|
|
84
84
|
width: 100%;
|
|
85
85
|
height: 100%;
|
|
86
|
-
|
|
87
|
-
Was 97 for wall/ribbon hosts only; hosts without a ribbon clamp need this. */
|
|
88
|
-
z-index: 1100;
|
|
86
|
+
z-index: 97;
|
|
89
87
|
background: rgba(13, 13, 13, 0.7);
|
|
90
88
|
display: flex;
|
|
91
89
|
align-items: center;
|
|
@@ -1409,20 +1407,6 @@ var MSG_MISSING_REQUIRED_FIELD = "Missing required field";
|
|
|
1409
1407
|
var MSG_EMAIL_WRONG_FORMAT = "That email doesn\u2019t look right. Please enter a valid email address.";
|
|
1410
1408
|
var MSG_EMAIL_TOO_LONG = "This field must be 80 characters or less.";
|
|
1411
1409
|
var MSG_UNSUPPORTED_BILLING_COUNTRY = "Billing country does not match offer price zone";
|
|
1412
|
-
var BILLING_COUNTRY_MISMATCH_FALLBACK = "Country not supported for this purchase";
|
|
1413
|
-
var MSG_BILLING_COUNTRY_MISMATCH_REDIRECT = "This country isn\u2019t supported for this purchase. Try updating your billing address.";
|
|
1414
|
-
var buildCountryMismatchMessage = (countryCode) => {
|
|
1415
|
-
if (!countryCode) return BILLING_COUNTRY_MISMATCH_FALLBACK;
|
|
1416
|
-
try {
|
|
1417
|
-
const regionNames = new Intl.DisplayNames(["en"], { type: "region", fallback: "none" });
|
|
1418
|
-
const upper = countryCode.toUpperCase();
|
|
1419
|
-
const countryName = regionNames.of(upper);
|
|
1420
|
-
const isResolved = countryName && countryName !== upper && countryName !== "Unknown Region";
|
|
1421
|
-
return isResolved ? `${countryName} address required` : BILLING_COUNTRY_MISMATCH_FALLBACK;
|
|
1422
|
-
} catch {
|
|
1423
|
-
return BILLING_COUNTRY_MISMATCH_FALLBACK;
|
|
1424
|
-
}
|
|
1425
|
-
};
|
|
1426
1410
|
var MSG_PAYMENT_GENERIC_ERROR = "Something went wrong. Please check your payment and billing details and try again or contact us.";
|
|
1427
1411
|
var MSG_CONTACT_VALIDATION_INTERNAL = "Could not validate Apple Pay contact";
|
|
1428
1412
|
|
|
@@ -1703,19 +1687,7 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
|
|
|
1703
1687
|
});
|
|
1704
1688
|
} catch (err) {
|
|
1705
1689
|
if (err instanceof ContactValidationError) {
|
|
1706
|
-
|
|
1707
|
-
(e) => e.contactField === "countryCode"
|
|
1708
|
-
);
|
|
1709
|
-
if (isBillingCountryMismatch) {
|
|
1710
|
-
const countryCode = event.payment.billingContact?.countryCode;
|
|
1711
|
-
const userMessage = buildCountryMismatchMessage(countryCode);
|
|
1712
|
-
failApplePaySession(session, [
|
|
1713
|
-
new ApplePayError("billingContactInvalid", "countryCode", userMessage)
|
|
1714
|
-
]);
|
|
1715
|
-
redirectFallback(skuId, returnUrl, country, { inlineError: MSG_BILLING_COUNTRY_MISMATCH_REDIRECT });
|
|
1716
|
-
} else {
|
|
1717
|
-
failApplePaySession(session, err.errors);
|
|
1718
|
-
}
|
|
1690
|
+
failApplePaySession(session, err.errors);
|
|
1719
1691
|
return;
|
|
1720
1692
|
}
|
|
1721
1693
|
const walletError = parseWalletApiError(err);
|
|
@@ -117,20 +117,6 @@ var MSG_MISSING_REQUIRED_FIELD = "Missing required field";
|
|
|
117
117
|
var MSG_EMAIL_WRONG_FORMAT = "That email doesn\u2019t look right. Please enter a valid email address.";
|
|
118
118
|
var MSG_EMAIL_TOO_LONG = "This field must be 80 characters or less.";
|
|
119
119
|
var MSG_UNSUPPORTED_BILLING_COUNTRY = "Billing country does not match offer price zone";
|
|
120
|
-
var BILLING_COUNTRY_MISMATCH_FALLBACK = "Country not supported for this purchase";
|
|
121
|
-
var MSG_BILLING_COUNTRY_MISMATCH_REDIRECT = "This country isn\u2019t supported for this purchase. Try updating your billing address.";
|
|
122
|
-
var buildCountryMismatchMessage = (countryCode) => {
|
|
123
|
-
if (!countryCode) return BILLING_COUNTRY_MISMATCH_FALLBACK;
|
|
124
|
-
try {
|
|
125
|
-
const regionNames = new Intl.DisplayNames(["en"], { type: "region", fallback: "none" });
|
|
126
|
-
const upper = countryCode.toUpperCase();
|
|
127
|
-
const countryName = regionNames.of(upper);
|
|
128
|
-
const isResolved = countryName && countryName !== upper && countryName !== "Unknown Region";
|
|
129
|
-
return isResolved ? `${countryName} address required` : BILLING_COUNTRY_MISMATCH_FALLBACK;
|
|
130
|
-
} catch {
|
|
131
|
-
return BILLING_COUNTRY_MISMATCH_FALLBACK;
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
120
|
var MSG_PAYMENT_GENERIC_ERROR = "Something went wrong. Please check your payment and billing details and try again or contact us.";
|
|
135
121
|
var MSG_CONTACT_VALIDATION_INTERNAL = "Could not validate Apple Pay contact";
|
|
136
122
|
|
|
@@ -389,19 +375,7 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
|
|
|
389
375
|
});
|
|
390
376
|
} catch (err) {
|
|
391
377
|
if (err instanceof ContactValidationError) {
|
|
392
|
-
|
|
393
|
-
(e) => e.contactField === "countryCode"
|
|
394
|
-
);
|
|
395
|
-
if (isBillingCountryMismatch) {
|
|
396
|
-
const countryCode = event.payment.billingContact?.countryCode;
|
|
397
|
-
const userMessage = buildCountryMismatchMessage(countryCode);
|
|
398
|
-
failApplePaySession(session, [
|
|
399
|
-
new ApplePayError("billingContactInvalid", "countryCode", userMessage)
|
|
400
|
-
]);
|
|
401
|
-
redirectFallback(skuId, returnUrl, country, { inlineError: MSG_BILLING_COUNTRY_MISMATCH_REDIRECT });
|
|
402
|
-
} else {
|
|
403
|
-
failApplePaySession(session, err.errors);
|
|
404
|
-
}
|
|
378
|
+
failApplePaySession(session, err.errors);
|
|
405
379
|
return;
|
|
406
380
|
}
|
|
407
381
|
const walletError = parseWalletApiError(err);
|
package/dist/src/index.js
CHANGED
|
@@ -83,9 +83,7 @@ var apple_pay_modal_template_default = `<style>
|
|
|
83
83
|
left: 0;
|
|
84
84
|
width: 100%;
|
|
85
85
|
height: 100%;
|
|
86
|
-
|
|
87
|
-
Was 97 for wall/ribbon hosts only; hosts without a ribbon clamp need this. */
|
|
88
|
-
z-index: 1100;
|
|
86
|
+
z-index: 97;
|
|
89
87
|
background: rgba(13, 13, 13, 0.7);
|
|
90
88
|
display: flex;
|
|
91
89
|
align-items: center;
|
|
@@ -1421,20 +1419,6 @@ var MSG_MISSING_REQUIRED_FIELD = "Missing required field";
|
|
|
1421
1419
|
var MSG_EMAIL_WRONG_FORMAT = "That email doesn\u2019t look right. Please enter a valid email address.";
|
|
1422
1420
|
var MSG_EMAIL_TOO_LONG = "This field must be 80 characters or less.";
|
|
1423
1421
|
var MSG_UNSUPPORTED_BILLING_COUNTRY = "Billing country does not match offer price zone";
|
|
1424
|
-
var BILLING_COUNTRY_MISMATCH_FALLBACK = "Country not supported for this purchase";
|
|
1425
|
-
var MSG_BILLING_COUNTRY_MISMATCH_REDIRECT = "This country isn\u2019t supported for this purchase. Try updating your billing address.";
|
|
1426
|
-
var buildCountryMismatchMessage = (countryCode) => {
|
|
1427
|
-
if (!countryCode) return BILLING_COUNTRY_MISMATCH_FALLBACK;
|
|
1428
|
-
try {
|
|
1429
|
-
const regionNames = new Intl.DisplayNames(["en"], { type: "region", fallback: "none" });
|
|
1430
|
-
const upper = countryCode.toUpperCase();
|
|
1431
|
-
const countryName = regionNames.of(upper);
|
|
1432
|
-
const isResolved = countryName && countryName !== upper && countryName !== "Unknown Region";
|
|
1433
|
-
return isResolved ? `${countryName} address required` : BILLING_COUNTRY_MISMATCH_FALLBACK;
|
|
1434
|
-
} catch {
|
|
1435
|
-
return BILLING_COUNTRY_MISMATCH_FALLBACK;
|
|
1436
|
-
}
|
|
1437
|
-
};
|
|
1438
1422
|
var MSG_PAYMENT_GENERIC_ERROR = "Something went wrong. Please check your payment and billing details and try again or contact us.";
|
|
1439
1423
|
var MSG_CONTACT_VALIDATION_INTERNAL = "Could not validate Apple Pay contact";
|
|
1440
1424
|
|
|
@@ -1715,19 +1699,7 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
|
|
|
1715
1699
|
});
|
|
1716
1700
|
} catch (err) {
|
|
1717
1701
|
if (err instanceof ContactValidationError) {
|
|
1718
|
-
|
|
1719
|
-
(e) => e.contactField === "countryCode"
|
|
1720
|
-
);
|
|
1721
|
-
if (isBillingCountryMismatch) {
|
|
1722
|
-
const countryCode = event.payment.billingContact?.countryCode;
|
|
1723
|
-
const userMessage = buildCountryMismatchMessage(countryCode);
|
|
1724
|
-
failApplePaySession(session, [
|
|
1725
|
-
new ApplePayError("billingContactInvalid", "countryCode", userMessage)
|
|
1726
|
-
]);
|
|
1727
|
-
redirectFallback(skuId, returnUrl, country, { inlineError: MSG_BILLING_COUNTRY_MISMATCH_REDIRECT });
|
|
1728
|
-
} else {
|
|
1729
|
-
failApplePaySession(session, err.errors);
|
|
1730
|
-
}
|
|
1702
|
+
failApplePaySession(session, err.errors);
|
|
1731
1703
|
return;
|
|
1732
1704
|
}
|
|
1733
1705
|
const walletError = parseWalletApiError(err);
|
package/package.json
CHANGED