@economist/web-apple-pay 1.11.1-beta.1 → 1.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -27
- package/dist/src/apple-pay-button.js +1 -27
- package/dist/src/apple-pay-button.stories.js +1 -27
- package/dist/src/apple-pay-modal.stories.js +1 -27
- package/dist/src/clients/payment-checkout/payment-handler.js +1 -27
- package/dist/src/index.js +1 -27
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1421,20 +1421,6 @@ var MSG_MISSING_REQUIRED_FIELD = "Missing required field";
|
|
|
1421
1421
|
var MSG_EMAIL_WRONG_FORMAT = "That email doesn\u2019t look right. Please enter a valid email address.";
|
|
1422
1422
|
var MSG_EMAIL_TOO_LONG = "This field must be 80 characters or less.";
|
|
1423
1423
|
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
1424
|
var MSG_PAYMENT_GENERIC_ERROR = "Something went wrong. Please check your payment and billing details and try again or contact us.";
|
|
1439
1425
|
var MSG_CONTACT_VALIDATION_INTERNAL = "Could not validate Apple Pay contact";
|
|
1440
1426
|
|
|
@@ -1715,19 +1701,7 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
|
|
|
1715
1701
|
});
|
|
1716
1702
|
} catch (err) {
|
|
1717
1703
|
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
|
-
}
|
|
1704
|
+
failApplePaySession(session, err.errors);
|
|
1731
1705
|
return;
|
|
1732
1706
|
}
|
|
1733
1707
|
const walletError = parseWalletApiError(err);
|
|
@@ -1409,20 +1409,6 @@ var MSG_MISSING_REQUIRED_FIELD = "Missing required field";
|
|
|
1409
1409
|
var MSG_EMAIL_WRONG_FORMAT = "That email doesn\u2019t look right. Please enter a valid email address.";
|
|
1410
1410
|
var MSG_EMAIL_TOO_LONG = "This field must be 80 characters or less.";
|
|
1411
1411
|
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
1412
|
var MSG_PAYMENT_GENERIC_ERROR = "Something went wrong. Please check your payment and billing details and try again or contact us.";
|
|
1427
1413
|
var MSG_CONTACT_VALIDATION_INTERNAL = "Could not validate Apple Pay contact";
|
|
1428
1414
|
|
|
@@ -1703,19 +1689,7 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
|
|
|
1703
1689
|
});
|
|
1704
1690
|
} catch (err) {
|
|
1705
1691
|
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
|
-
}
|
|
1692
|
+
failApplePaySession(session, err.errors);
|
|
1719
1693
|
return;
|
|
1720
1694
|
}
|
|
1721
1695
|
const walletError = parseWalletApiError(err);
|
|
@@ -1417,20 +1417,6 @@ var MSG_MISSING_REQUIRED_FIELD = "Missing required field";
|
|
|
1417
1417
|
var MSG_EMAIL_WRONG_FORMAT = "That email doesn\u2019t look right. Please enter a valid email address.";
|
|
1418
1418
|
var MSG_EMAIL_TOO_LONG = "This field must be 80 characters or less.";
|
|
1419
1419
|
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
1420
|
var MSG_PAYMENT_GENERIC_ERROR = "Something went wrong. Please check your payment and billing details and try again or contact us.";
|
|
1435
1421
|
var MSG_CONTACT_VALIDATION_INTERNAL = "Could not validate Apple Pay contact";
|
|
1436
1422
|
|
|
@@ -1711,19 +1697,7 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
|
|
|
1711
1697
|
});
|
|
1712
1698
|
} catch (err) {
|
|
1713
1699
|
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
|
-
}
|
|
1700
|
+
failApplePaySession(session, err.errors);
|
|
1727
1701
|
return;
|
|
1728
1702
|
}
|
|
1729
1703
|
const walletError = parseWalletApiError(err);
|
|
@@ -1409,20 +1409,6 @@ var MSG_MISSING_REQUIRED_FIELD = "Missing required field";
|
|
|
1409
1409
|
var MSG_EMAIL_WRONG_FORMAT = "That email doesn\u2019t look right. Please enter a valid email address.";
|
|
1410
1410
|
var MSG_EMAIL_TOO_LONG = "This field must be 80 characters or less.";
|
|
1411
1411
|
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
1412
|
var MSG_PAYMENT_GENERIC_ERROR = "Something went wrong. Please check your payment and billing details and try again or contact us.";
|
|
1427
1413
|
var MSG_CONTACT_VALIDATION_INTERNAL = "Could not validate Apple Pay contact";
|
|
1428
1414
|
|
|
@@ -1703,19 +1689,7 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
|
|
|
1703
1689
|
});
|
|
1704
1690
|
} catch (err) {
|
|
1705
1691
|
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
|
-
}
|
|
1692
|
+
failApplePaySession(session, err.errors);
|
|
1719
1693
|
return;
|
|
1720
1694
|
}
|
|
1721
1695
|
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
|
@@ -1421,20 +1421,6 @@ var MSG_MISSING_REQUIRED_FIELD = "Missing required field";
|
|
|
1421
1421
|
var MSG_EMAIL_WRONG_FORMAT = "That email doesn\u2019t look right. Please enter a valid email address.";
|
|
1422
1422
|
var MSG_EMAIL_TOO_LONG = "This field must be 80 characters or less.";
|
|
1423
1423
|
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
1424
|
var MSG_PAYMENT_GENERIC_ERROR = "Something went wrong. Please check your payment and billing details and try again or contact us.";
|
|
1439
1425
|
var MSG_CONTACT_VALIDATION_INTERNAL = "Could not validate Apple Pay contact";
|
|
1440
1426
|
|
|
@@ -1715,19 +1701,7 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
|
|
|
1715
1701
|
});
|
|
1716
1702
|
} catch (err) {
|
|
1717
1703
|
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
|
-
}
|
|
1704
|
+
failApplePaySession(session, err.errors);
|
|
1731
1705
|
return;
|
|
1732
1706
|
}
|
|
1733
1707
|
const walletError = parseWalletApiError(err);
|
package/package.json
CHANGED