@economist/web-apple-pay 1.11.0 → 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 CHANGED
@@ -1419,20 +1419,6 @@ var MSG_MISSING_REQUIRED_FIELD = "Missing required field";
1419
1419
  var MSG_EMAIL_WRONG_FORMAT = "That email doesn\u2019t look right. Please enter a valid email address.";
1420
1420
  var MSG_EMAIL_TOO_LONG = "This field must be 80 characters or less.";
1421
1421
  var MSG_UNSUPPORTED_BILLING_COUNTRY = "Billing country does not match offer price zone";
1422
- var BILLING_COUNTRY_MISMATCH_FALLBACK = "Country not supported for this purchase";
1423
- var MSG_BILLING_COUNTRY_MISMATCH_REDIRECT = "This country isn\u2019t supported for this purchase. Try updating your billing address.";
1424
- var buildCountryMismatchMessage = (countryCode) => {
1425
- if (!countryCode) return BILLING_COUNTRY_MISMATCH_FALLBACK;
1426
- try {
1427
- const regionNames = new Intl.DisplayNames(["en"], { type: "region", fallback: "none" });
1428
- const upper = countryCode.toUpperCase();
1429
- const countryName = regionNames.of(upper);
1430
- const isResolved = countryName && countryName !== upper && countryName !== "Unknown Region";
1431
- return isResolved ? `${countryName} address required` : BILLING_COUNTRY_MISMATCH_FALLBACK;
1432
- } catch {
1433
- return BILLING_COUNTRY_MISMATCH_FALLBACK;
1434
- }
1435
- };
1436
1422
  var MSG_PAYMENT_GENERIC_ERROR = "Something went wrong. Please check your payment and billing details and try again or contact us.";
1437
1423
  var MSG_CONTACT_VALIDATION_INTERNAL = "Could not validate Apple Pay contact";
1438
1424
 
@@ -1713,19 +1699,7 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
1713
1699
  });
1714
1700
  } catch (err) {
1715
1701
  if (err instanceof ContactValidationError) {
1716
- const isBillingCountryMismatch = err.errors.some(
1717
- (e) => e.contactField === "countryCode"
1718
- );
1719
- if (isBillingCountryMismatch) {
1720
- const countryCode = event.payment.billingContact?.countryCode;
1721
- const userMessage = buildCountryMismatchMessage(countryCode);
1722
- failApplePaySession(session, [
1723
- new ApplePayError("billingContactInvalid", "countryCode", userMessage)
1724
- ]);
1725
- redirectFallback(skuId, returnUrl, country, { inlineError: MSG_BILLING_COUNTRY_MISMATCH_REDIRECT });
1726
- } else {
1727
- failApplePaySession(session, err.errors);
1728
- }
1702
+ failApplePaySession(session, err.errors);
1729
1703
  return;
1730
1704
  }
1731
1705
  const walletError = parseWalletApiError(err);
@@ -1407,20 +1407,6 @@ var MSG_MISSING_REQUIRED_FIELD = "Missing required field";
1407
1407
  var MSG_EMAIL_WRONG_FORMAT = "That email doesn\u2019t look right. Please enter a valid email address.";
1408
1408
  var MSG_EMAIL_TOO_LONG = "This field must be 80 characters or less.";
1409
1409
  var MSG_UNSUPPORTED_BILLING_COUNTRY = "Billing country does not match offer price zone";
1410
- var BILLING_COUNTRY_MISMATCH_FALLBACK = "Country not supported for this purchase";
1411
- var MSG_BILLING_COUNTRY_MISMATCH_REDIRECT = "This country isn\u2019t supported for this purchase. Try updating your billing address.";
1412
- var buildCountryMismatchMessage = (countryCode) => {
1413
- if (!countryCode) return BILLING_COUNTRY_MISMATCH_FALLBACK;
1414
- try {
1415
- const regionNames = new Intl.DisplayNames(["en"], { type: "region", fallback: "none" });
1416
- const upper = countryCode.toUpperCase();
1417
- const countryName = regionNames.of(upper);
1418
- const isResolved = countryName && countryName !== upper && countryName !== "Unknown Region";
1419
- return isResolved ? `${countryName} address required` : BILLING_COUNTRY_MISMATCH_FALLBACK;
1420
- } catch {
1421
- return BILLING_COUNTRY_MISMATCH_FALLBACK;
1422
- }
1423
- };
1424
1410
  var MSG_PAYMENT_GENERIC_ERROR = "Something went wrong. Please check your payment and billing details and try again or contact us.";
1425
1411
  var MSG_CONTACT_VALIDATION_INTERNAL = "Could not validate Apple Pay contact";
1426
1412
 
@@ -1701,19 +1687,7 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
1701
1687
  });
1702
1688
  } catch (err) {
1703
1689
  if (err instanceof ContactValidationError) {
1704
- const isBillingCountryMismatch = err.errors.some(
1705
- (e) => e.contactField === "countryCode"
1706
- );
1707
- if (isBillingCountryMismatch) {
1708
- const countryCode = event.payment.billingContact?.countryCode;
1709
- const userMessage = buildCountryMismatchMessage(countryCode);
1710
- failApplePaySession(session, [
1711
- new ApplePayError("billingContactInvalid", "countryCode", userMessage)
1712
- ]);
1713
- redirectFallback(skuId, returnUrl, country, { inlineError: MSG_BILLING_COUNTRY_MISMATCH_REDIRECT });
1714
- } else {
1715
- failApplePaySession(session, err.errors);
1716
- }
1690
+ failApplePaySession(session, err.errors);
1717
1691
  return;
1718
1692
  }
1719
1693
  const walletError = parseWalletApiError(err);
@@ -1415,20 +1415,6 @@ var MSG_MISSING_REQUIRED_FIELD = "Missing required field";
1415
1415
  var MSG_EMAIL_WRONG_FORMAT = "That email doesn\u2019t look right. Please enter a valid email address.";
1416
1416
  var MSG_EMAIL_TOO_LONG = "This field must be 80 characters or less.";
1417
1417
  var MSG_UNSUPPORTED_BILLING_COUNTRY = "Billing country does not match offer price zone";
1418
- var BILLING_COUNTRY_MISMATCH_FALLBACK = "Country not supported for this purchase";
1419
- var MSG_BILLING_COUNTRY_MISMATCH_REDIRECT = "This country isn\u2019t supported for this purchase. Try updating your billing address.";
1420
- var buildCountryMismatchMessage = (countryCode) => {
1421
- if (!countryCode) return BILLING_COUNTRY_MISMATCH_FALLBACK;
1422
- try {
1423
- const regionNames = new Intl.DisplayNames(["en"], { type: "region", fallback: "none" });
1424
- const upper = countryCode.toUpperCase();
1425
- const countryName = regionNames.of(upper);
1426
- const isResolved = countryName && countryName !== upper && countryName !== "Unknown Region";
1427
- return isResolved ? `${countryName} address required` : BILLING_COUNTRY_MISMATCH_FALLBACK;
1428
- } catch {
1429
- return BILLING_COUNTRY_MISMATCH_FALLBACK;
1430
- }
1431
- };
1432
1418
  var MSG_PAYMENT_GENERIC_ERROR = "Something went wrong. Please check your payment and billing details and try again or contact us.";
1433
1419
  var MSG_CONTACT_VALIDATION_INTERNAL = "Could not validate Apple Pay contact";
1434
1420
 
@@ -1709,19 +1695,7 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
1709
1695
  });
1710
1696
  } catch (err) {
1711
1697
  if (err instanceof ContactValidationError) {
1712
- const isBillingCountryMismatch = err.errors.some(
1713
- (e) => e.contactField === "countryCode"
1714
- );
1715
- if (isBillingCountryMismatch) {
1716
- const countryCode = event.payment.billingContact?.countryCode;
1717
- const userMessage = buildCountryMismatchMessage(countryCode);
1718
- failApplePaySession(session, [
1719
- new ApplePayError("billingContactInvalid", "countryCode", userMessage)
1720
- ]);
1721
- redirectFallback(skuId, returnUrl, country, { inlineError: MSG_BILLING_COUNTRY_MISMATCH_REDIRECT });
1722
- } else {
1723
- failApplePaySession(session, err.errors);
1724
- }
1698
+ failApplePaySession(session, err.errors);
1725
1699
  return;
1726
1700
  }
1727
1701
  const walletError = parseWalletApiError(err);
@@ -1407,20 +1407,6 @@ var MSG_MISSING_REQUIRED_FIELD = "Missing required field";
1407
1407
  var MSG_EMAIL_WRONG_FORMAT = "That email doesn\u2019t look right. Please enter a valid email address.";
1408
1408
  var MSG_EMAIL_TOO_LONG = "This field must be 80 characters or less.";
1409
1409
  var MSG_UNSUPPORTED_BILLING_COUNTRY = "Billing country does not match offer price zone";
1410
- var BILLING_COUNTRY_MISMATCH_FALLBACK = "Country not supported for this purchase";
1411
- var MSG_BILLING_COUNTRY_MISMATCH_REDIRECT = "This country isn\u2019t supported for this purchase. Try updating your billing address.";
1412
- var buildCountryMismatchMessage = (countryCode) => {
1413
- if (!countryCode) return BILLING_COUNTRY_MISMATCH_FALLBACK;
1414
- try {
1415
- const regionNames = new Intl.DisplayNames(["en"], { type: "region", fallback: "none" });
1416
- const upper = countryCode.toUpperCase();
1417
- const countryName = regionNames.of(upper);
1418
- const isResolved = countryName && countryName !== upper && countryName !== "Unknown Region";
1419
- return isResolved ? `${countryName} address required` : BILLING_COUNTRY_MISMATCH_FALLBACK;
1420
- } catch {
1421
- return BILLING_COUNTRY_MISMATCH_FALLBACK;
1422
- }
1423
- };
1424
1410
  var MSG_PAYMENT_GENERIC_ERROR = "Something went wrong. Please check your payment and billing details and try again or contact us.";
1425
1411
  var MSG_CONTACT_VALIDATION_INTERNAL = "Could not validate Apple Pay contact";
1426
1412
 
@@ -1701,19 +1687,7 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
1701
1687
  });
1702
1688
  } catch (err) {
1703
1689
  if (err instanceof ContactValidationError) {
1704
- const isBillingCountryMismatch = err.errors.some(
1705
- (e) => e.contactField === "countryCode"
1706
- );
1707
- if (isBillingCountryMismatch) {
1708
- const countryCode = event.payment.billingContact?.countryCode;
1709
- const userMessage = buildCountryMismatchMessage(countryCode);
1710
- failApplePaySession(session, [
1711
- new ApplePayError("billingContactInvalid", "countryCode", userMessage)
1712
- ]);
1713
- redirectFallback(skuId, returnUrl, country, { inlineError: MSG_BILLING_COUNTRY_MISMATCH_REDIRECT });
1714
- } else {
1715
- failApplePaySession(session, err.errors);
1716
- }
1690
+ failApplePaySession(session, err.errors);
1717
1691
  return;
1718
1692
  }
1719
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
- const isBillingCountryMismatch = err.errors.some(
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
@@ -1419,20 +1419,6 @@ var MSG_MISSING_REQUIRED_FIELD = "Missing required field";
1419
1419
  var MSG_EMAIL_WRONG_FORMAT = "That email doesn\u2019t look right. Please enter a valid email address.";
1420
1420
  var MSG_EMAIL_TOO_LONG = "This field must be 80 characters or less.";
1421
1421
  var MSG_UNSUPPORTED_BILLING_COUNTRY = "Billing country does not match offer price zone";
1422
- var BILLING_COUNTRY_MISMATCH_FALLBACK = "Country not supported for this purchase";
1423
- var MSG_BILLING_COUNTRY_MISMATCH_REDIRECT = "This country isn\u2019t supported for this purchase. Try updating your billing address.";
1424
- var buildCountryMismatchMessage = (countryCode) => {
1425
- if (!countryCode) return BILLING_COUNTRY_MISMATCH_FALLBACK;
1426
- try {
1427
- const regionNames = new Intl.DisplayNames(["en"], { type: "region", fallback: "none" });
1428
- const upper = countryCode.toUpperCase();
1429
- const countryName = regionNames.of(upper);
1430
- const isResolved = countryName && countryName !== upper && countryName !== "Unknown Region";
1431
- return isResolved ? `${countryName} address required` : BILLING_COUNTRY_MISMATCH_FALLBACK;
1432
- } catch {
1433
- return BILLING_COUNTRY_MISMATCH_FALLBACK;
1434
- }
1435
- };
1436
1422
  var MSG_PAYMENT_GENERIC_ERROR = "Something went wrong. Please check your payment and billing details and try again or contact us.";
1437
1423
  var MSG_CONTACT_VALIDATION_INTERNAL = "Could not validate Apple Pay contact";
1438
1424
 
@@ -1713,19 +1699,7 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
1713
1699
  });
1714
1700
  } catch (err) {
1715
1701
  if (err instanceof ContactValidationError) {
1716
- const isBillingCountryMismatch = err.errors.some(
1717
- (e) => e.contactField === "countryCode"
1718
- );
1719
- if (isBillingCountryMismatch) {
1720
- const countryCode = event.payment.billingContact?.countryCode;
1721
- const userMessage = buildCountryMismatchMessage(countryCode);
1722
- failApplePaySession(session, [
1723
- new ApplePayError("billingContactInvalid", "countryCode", userMessage)
1724
- ]);
1725
- redirectFallback(skuId, returnUrl, country, { inlineError: MSG_BILLING_COUNTRY_MISMATCH_REDIRECT });
1726
- } else {
1727
- failApplePaySession(session, err.errors);
1728
- }
1702
+ failApplePaySession(session, err.errors);
1729
1703
  return;
1730
1704
  }
1731
1705
  const walletError = parseWalletApiError(err);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@economist/web-apple-pay",
3
3
  "description": "Web component package for Apple Pay checkout UI",
4
- "version": "1.11.0",
4
+ "version": "1.11.1",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",