@economist/web-apple-pay 2.0.0-beta.4 → 2.0.0-beta.5

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
@@ -2095,15 +2095,15 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
2095
2095
  const result = await performPurchase({
2096
2096
  applePayToken: event.payment.token,
2097
2097
  skuId: config.skuId,
2098
- // Offer/geo country — must not fall back to billing country on the BFF (print billing is unrestricted).
2099
- countryCode: config.country,
2100
2098
  currency: config.currency,
2101
2099
  billingContact: event.payment.billingContact,
2102
- supportedBillingCountries: config.supportedBillingCountries,
2103
2100
  ...event.payment.shippingContact && {
2104
2101
  shippingContact: event.payment.shippingContact
2105
2102
  },
2103
+ // Print only: billing is unrestricted, so the BFF must not fall back to the billing country for the offer.
2106
2104
  ...config.delivery && {
2105
+ countryCode: config.country,
2106
+ supportedBillingCountries: config.supportedBillingCountries,
2107
2107
  supportedDeliveryCountries: config.delivery.supportedCountries
2108
2108
  },
2109
2109
  ...ADDRESS_PARITY_ENABLED ? { strictAddressRules: true } : {},
@@ -2090,15 +2090,15 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
2090
2090
  const result = await performPurchase({
2091
2091
  applePayToken: event.payment.token,
2092
2092
  skuId: config.skuId,
2093
- // Offer/geo country — must not fall back to billing country on the BFF (print billing is unrestricted).
2094
- countryCode: config.country,
2095
2093
  currency: config.currency,
2096
2094
  billingContact: event.payment.billingContact,
2097
- supportedBillingCountries: config.supportedBillingCountries,
2098
2095
  ...event.payment.shippingContact && {
2099
2096
  shippingContact: event.payment.shippingContact
2100
2097
  },
2098
+ // Print only: billing is unrestricted, so the BFF must not fall back to the billing country for the offer.
2101
2099
  ...config.delivery && {
2100
+ countryCode: config.country,
2101
+ supportedBillingCountries: config.supportedBillingCountries,
2102
2102
  supportedDeliveryCountries: config.delivery.supportedCountries
2103
2103
  },
2104
2104
  ...ADDRESS_PARITY_ENABLED ? { strictAddressRules: true } : {},
@@ -2098,15 +2098,15 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
2098
2098
  const result = await performPurchase({
2099
2099
  applePayToken: event.payment.token,
2100
2100
  skuId: config.skuId,
2101
- // Offer/geo country — must not fall back to billing country on the BFF (print billing is unrestricted).
2102
- countryCode: config.country,
2103
2101
  currency: config.currency,
2104
2102
  billingContact: event.payment.billingContact,
2105
- supportedBillingCountries: config.supportedBillingCountries,
2106
2103
  ...event.payment.shippingContact && {
2107
2104
  shippingContact: event.payment.shippingContact
2108
2105
  },
2106
+ // Print only: billing is unrestricted, so the BFF must not fall back to the billing country for the offer.
2109
2107
  ...config.delivery && {
2108
+ countryCode: config.country,
2109
+ supportedBillingCountries: config.supportedBillingCountries,
2110
2110
  supportedDeliveryCountries: config.delivery.supportedCountries
2111
2111
  },
2112
2112
  ...ADDRESS_PARITY_ENABLED ? { strictAddressRules: true } : {},
@@ -2090,15 +2090,15 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
2090
2090
  const result = await performPurchase({
2091
2091
  applePayToken: event.payment.token,
2092
2092
  skuId: config.skuId,
2093
- // Offer/geo country — must not fall back to billing country on the BFF (print billing is unrestricted).
2094
- countryCode: config.country,
2095
2093
  currency: config.currency,
2096
2094
  billingContact: event.payment.billingContact,
2097
- supportedBillingCountries: config.supportedBillingCountries,
2098
2095
  ...event.payment.shippingContact && {
2099
2096
  shippingContact: event.payment.shippingContact
2100
2097
  },
2098
+ // Print only: billing is unrestricted, so the BFF must not fall back to the billing country for the offer.
2101
2099
  ...config.delivery && {
2100
+ countryCode: config.country,
2101
+ supportedBillingCountries: config.supportedBillingCountries,
2102
2102
  supportedDeliveryCountries: config.delivery.supportedCountries
2103
2103
  },
2104
2104
  ...ADDRESS_PARITY_ENABLED ? { strictAddressRules: true } : {},
@@ -751,15 +751,15 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
751
751
  const result = await performPurchase({
752
752
  applePayToken: event.payment.token,
753
753
  skuId: config.skuId,
754
- // Offer/geo country — must not fall back to billing country on the BFF (print billing is unrestricted).
755
- countryCode: config.country,
756
754
  currency: config.currency,
757
755
  billingContact: event.payment.billingContact,
758
- supportedBillingCountries: config.supportedBillingCountries,
759
756
  ...event.payment.shippingContact && {
760
757
  shippingContact: event.payment.shippingContact
761
758
  },
759
+ // Print only: billing is unrestricted, so the BFF must not fall back to the billing country for the offer.
762
760
  ...config.delivery && {
761
+ countryCode: config.country,
762
+ supportedBillingCountries: config.supportedBillingCountries,
763
763
  supportedDeliveryCountries: config.delivery.supportedCountries
764
764
  },
765
765
  ...ADDRESS_PARITY_ENABLED ? { strictAddressRules: true } : {},
@@ -87,14 +87,17 @@ export type PurchaseRequest = {
87
87
  * only provide a `skuId`. Frontend uses `skuId` directly — BFF must be aligned.
88
88
  */
89
89
  skuId: string;
90
- /** Offer/geo country for basket pricing and delivery zone rules (not the wallet billing country). */
91
- countryCode: string;
90
+ /**
91
+ * Print (bundle) offers only: offer/geo country for basket pricing and delivery zone rules. Digital omits it
92
+ * and the BFF uses the billing country.
93
+ */
94
+ countryCode?: string;
92
95
  currency: string;
93
96
  billingContact: ApplePayPaymentContact;
94
97
  /** Required if loggedIn: false — contains emailAddress from Apple Pay sheet. */
95
98
  shippingContact?: ApplePayPaymentContact;
96
- /** Countries the offer may be billed to (print is unrestricted; digital is price-zone limited). */
97
- supportedBillingCountries: string[];
99
+ /** Print (bundle) offers only: countries the offer may be billed to (unrestricted for print). */
100
+ supportedBillingCountries?: string[];
98
101
  /**
99
102
  * Print (bundle) offers only: the countries the offer can be delivered to. The BFF requires the delivery
100
103
  * country to be in this list, same pattern as `supportedBillingCountries`.
package/dist/src/index.js CHANGED
@@ -2095,15 +2095,15 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
2095
2095
  const result = await performPurchase({
2096
2096
  applePayToken: event.payment.token,
2097
2097
  skuId: config.skuId,
2098
- // Offer/geo country — must not fall back to billing country on the BFF (print billing is unrestricted).
2099
- countryCode: config.country,
2100
2098
  currency: config.currency,
2101
2099
  billingContact: event.payment.billingContact,
2102
- supportedBillingCountries: config.supportedBillingCountries,
2103
2100
  ...event.payment.shippingContact && {
2104
2101
  shippingContact: event.payment.shippingContact
2105
2102
  },
2103
+ // Print only: billing is unrestricted, so the BFF must not fall back to the billing country for the offer.
2106
2104
  ...config.delivery && {
2105
+ countryCode: config.country,
2106
+ supportedBillingCountries: config.supportedBillingCountries,
2107
2107
  supportedDeliveryCountries: config.delivery.supportedCountries
2108
2108
  },
2109
2109
  ...ADDRESS_PARITY_ENABLED ? { strictAddressRules: true } : {},
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": "2.0.0-beta.4",
4
+ "version": "2.0.0-beta.5",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",