@economist/web-apple-pay 0.1.3-beta.44 → 0.1.3-beta.45

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
@@ -1381,22 +1381,28 @@ async function handleMerchantValidation(event, session, config) {
1381
1381
  try {
1382
1382
  const validationHost = new URL(event.validationURL).host;
1383
1383
  if (!validationHost.endsWith("apple.com")) {
1384
+ console.error("[web-apple-pay] Merchant validation URL is not from apple.com \u2014 aborting session", { validationURL: event.validationURL });
1384
1385
  session.abort();
1385
1386
  redirectToFallbackCheckout(config);
1386
1387
  return;
1387
1388
  }
1389
+ console.info("[web-apple-pay] Merchant validation started", { validationHost });
1388
1390
  const recaptchaToken = await getRecaptchaToken("verifyMerchant");
1391
+ console.info("[web-apple-pay] verifyMerchant reCAPTCHA token acquired \u2014 calling validateAppleMerchant");
1389
1392
  const response = await validateAppleMerchant({
1390
1393
  validationURL: event.validationURL,
1391
1394
  recaptchaToken
1392
1395
  });
1393
1396
  if (!response?.merchantSession) {
1397
+ console.error("[web-apple-pay] Merchant validation response missing merchantSession \u2014 aborting session", { response });
1394
1398
  session.abort();
1395
1399
  redirectToFallbackCheckout(config);
1396
1400
  return;
1397
1401
  }
1402
+ console.info("[web-apple-pay] Merchant validation succeeded \u2014 completing merchant validation");
1398
1403
  session.completeMerchantValidation(response.merchantSession);
1399
- } catch {
1404
+ } catch (error) {
1405
+ console.error("[web-apple-pay] Merchant validation threw an error \u2014 aborting session", error);
1400
1406
  session.abort();
1401
1407
  redirectToFallbackCheckout(config);
1402
1408
  }
@@ -1417,6 +1423,7 @@ function startApplePaySession(config) {
1417
1423
  };
1418
1424
  try {
1419
1425
  const session = new ApplePaySession(3, paymentRequest);
1426
+ console.info("[web-apple-pay] ApplePaySession created successfully");
1420
1427
  session.onvalidatemerchant = async (event) => {
1421
1428
  await handleMerchantValidation(event, session, config);
1422
1429
  };
@@ -1429,7 +1436,9 @@ function startApplePaySession(config) {
1429
1436
  };
1430
1437
  trackWalletPaymentSheetOpen(config.skuId);
1431
1438
  session.begin();
1432
- } catch {
1439
+ console.info("[web-apple-pay] ApplePaySession.begin() called \u2014 payment sheet should appear");
1440
+ } catch (error) {
1441
+ console.error("[web-apple-pay] ApplePaySession creation or begin() threw \u2014 redirecting to fallback checkout", error);
1433
1442
  redirectToFallbackCheckout(config);
1434
1443
  }
1435
1444
  }
@@ -1376,22 +1376,28 @@ async function handleMerchantValidation(event, session, config) {
1376
1376
  try {
1377
1377
  const validationHost = new URL(event.validationURL).host;
1378
1378
  if (!validationHost.endsWith("apple.com")) {
1379
+ console.error("[web-apple-pay] Merchant validation URL is not from apple.com \u2014 aborting session", { validationURL: event.validationURL });
1379
1380
  session.abort();
1380
1381
  redirectToFallbackCheckout(config);
1381
1382
  return;
1382
1383
  }
1384
+ console.info("[web-apple-pay] Merchant validation started", { validationHost });
1383
1385
  const recaptchaToken = await getRecaptchaToken("verifyMerchant");
1386
+ console.info("[web-apple-pay] verifyMerchant reCAPTCHA token acquired \u2014 calling validateAppleMerchant");
1384
1387
  const response = await validateAppleMerchant({
1385
1388
  validationURL: event.validationURL,
1386
1389
  recaptchaToken
1387
1390
  });
1388
1391
  if (!response?.merchantSession) {
1392
+ console.error("[web-apple-pay] Merchant validation response missing merchantSession \u2014 aborting session", { response });
1389
1393
  session.abort();
1390
1394
  redirectToFallbackCheckout(config);
1391
1395
  return;
1392
1396
  }
1397
+ console.info("[web-apple-pay] Merchant validation succeeded \u2014 completing merchant validation");
1393
1398
  session.completeMerchantValidation(response.merchantSession);
1394
- } catch {
1399
+ } catch (error) {
1400
+ console.error("[web-apple-pay] Merchant validation threw an error \u2014 aborting session", error);
1395
1401
  session.abort();
1396
1402
  redirectToFallbackCheckout(config);
1397
1403
  }
@@ -1412,6 +1418,7 @@ function startApplePaySession(config) {
1412
1418
  };
1413
1419
  try {
1414
1420
  const session = new ApplePaySession(3, paymentRequest);
1421
+ console.info("[web-apple-pay] ApplePaySession created successfully");
1415
1422
  session.onvalidatemerchant = async (event) => {
1416
1423
  await handleMerchantValidation(event, session, config);
1417
1424
  };
@@ -1424,7 +1431,9 @@ function startApplePaySession(config) {
1424
1431
  };
1425
1432
  trackWalletPaymentSheetOpen(config.skuId);
1426
1433
  session.begin();
1427
- } catch {
1434
+ console.info("[web-apple-pay] ApplePaySession.begin() called \u2014 payment sheet should appear");
1435
+ } catch (error) {
1436
+ console.error("[web-apple-pay] ApplePaySession creation or begin() threw \u2014 redirecting to fallback checkout", error);
1428
1437
  redirectToFallbackCheckout(config);
1429
1438
  }
1430
1439
  }
@@ -1384,22 +1384,28 @@ async function handleMerchantValidation(event, session, config) {
1384
1384
  try {
1385
1385
  const validationHost = new URL(event.validationURL).host;
1386
1386
  if (!validationHost.endsWith("apple.com")) {
1387
+ console.error("[web-apple-pay] Merchant validation URL is not from apple.com \u2014 aborting session", { validationURL: event.validationURL });
1387
1388
  session.abort();
1388
1389
  redirectToFallbackCheckout(config);
1389
1390
  return;
1390
1391
  }
1392
+ console.info("[web-apple-pay] Merchant validation started", { validationHost });
1391
1393
  const recaptchaToken = await getRecaptchaToken("verifyMerchant");
1394
+ console.info("[web-apple-pay] verifyMerchant reCAPTCHA token acquired \u2014 calling validateAppleMerchant");
1392
1395
  const response = await validateAppleMerchant({
1393
1396
  validationURL: event.validationURL,
1394
1397
  recaptchaToken
1395
1398
  });
1396
1399
  if (!response?.merchantSession) {
1400
+ console.error("[web-apple-pay] Merchant validation response missing merchantSession \u2014 aborting session", { response });
1397
1401
  session.abort();
1398
1402
  redirectToFallbackCheckout(config);
1399
1403
  return;
1400
1404
  }
1405
+ console.info("[web-apple-pay] Merchant validation succeeded \u2014 completing merchant validation");
1401
1406
  session.completeMerchantValidation(response.merchantSession);
1402
- } catch {
1407
+ } catch (error) {
1408
+ console.error("[web-apple-pay] Merchant validation threw an error \u2014 aborting session", error);
1403
1409
  session.abort();
1404
1410
  redirectToFallbackCheckout(config);
1405
1411
  }
@@ -1420,6 +1426,7 @@ function startApplePaySession(config) {
1420
1426
  };
1421
1427
  try {
1422
1428
  const session = new ApplePaySession(3, paymentRequest);
1429
+ console.info("[web-apple-pay] ApplePaySession created successfully");
1423
1430
  session.onvalidatemerchant = async (event) => {
1424
1431
  await handleMerchantValidation(event, session, config);
1425
1432
  };
@@ -1432,7 +1439,9 @@ function startApplePaySession(config) {
1432
1439
  };
1433
1440
  trackWalletPaymentSheetOpen(config.skuId);
1434
1441
  session.begin();
1435
- } catch {
1442
+ console.info("[web-apple-pay] ApplePaySession.begin() called \u2014 payment sheet should appear");
1443
+ } catch (error) {
1444
+ console.error("[web-apple-pay] ApplePaySession creation or begin() threw \u2014 redirecting to fallback checkout", error);
1436
1445
  redirectToFallbackCheckout(config);
1437
1446
  }
1438
1447
  }
@@ -1376,22 +1376,28 @@ async function handleMerchantValidation(event, session, config) {
1376
1376
  try {
1377
1377
  const validationHost = new URL(event.validationURL).host;
1378
1378
  if (!validationHost.endsWith("apple.com")) {
1379
+ console.error("[web-apple-pay] Merchant validation URL is not from apple.com \u2014 aborting session", { validationURL: event.validationURL });
1379
1380
  session.abort();
1380
1381
  redirectToFallbackCheckout(config);
1381
1382
  return;
1382
1383
  }
1384
+ console.info("[web-apple-pay] Merchant validation started", { validationHost });
1383
1385
  const recaptchaToken = await getRecaptchaToken("verifyMerchant");
1386
+ console.info("[web-apple-pay] verifyMerchant reCAPTCHA token acquired \u2014 calling validateAppleMerchant");
1384
1387
  const response = await validateAppleMerchant({
1385
1388
  validationURL: event.validationURL,
1386
1389
  recaptchaToken
1387
1390
  });
1388
1391
  if (!response?.merchantSession) {
1392
+ console.error("[web-apple-pay] Merchant validation response missing merchantSession \u2014 aborting session", { response });
1389
1393
  session.abort();
1390
1394
  redirectToFallbackCheckout(config);
1391
1395
  return;
1392
1396
  }
1397
+ console.info("[web-apple-pay] Merchant validation succeeded \u2014 completing merchant validation");
1393
1398
  session.completeMerchantValidation(response.merchantSession);
1394
- } catch {
1399
+ } catch (error) {
1400
+ console.error("[web-apple-pay] Merchant validation threw an error \u2014 aborting session", error);
1395
1401
  session.abort();
1396
1402
  redirectToFallbackCheckout(config);
1397
1403
  }
@@ -1412,6 +1418,7 @@ function startApplePaySession(config) {
1412
1418
  };
1413
1419
  try {
1414
1420
  const session = new ApplePaySession(3, paymentRequest);
1421
+ console.info("[web-apple-pay] ApplePaySession created successfully");
1415
1422
  session.onvalidatemerchant = async (event) => {
1416
1423
  await handleMerchantValidation(event, session, config);
1417
1424
  };
@@ -1424,7 +1431,9 @@ function startApplePaySession(config) {
1424
1431
  };
1425
1432
  trackWalletPaymentSheetOpen(config.skuId);
1426
1433
  session.begin();
1427
- } catch {
1434
+ console.info("[web-apple-pay] ApplePaySession.begin() called \u2014 payment sheet should appear");
1435
+ } catch (error) {
1436
+ console.error("[web-apple-pay] ApplePaySession creation or begin() threw \u2014 redirecting to fallback checkout", error);
1428
1437
  redirectToFallbackCheckout(config);
1429
1438
  }
1430
1439
  }
@@ -201,22 +201,28 @@ async function handleMerchantValidation(event, session, config) {
201
201
  try {
202
202
  const validationHost = new URL(event.validationURL).host;
203
203
  if (!validationHost.endsWith("apple.com")) {
204
+ console.error("[web-apple-pay] Merchant validation URL is not from apple.com \u2014 aborting session", { validationURL: event.validationURL });
204
205
  session.abort();
205
206
  redirectToFallbackCheckout(config);
206
207
  return;
207
208
  }
209
+ console.info("[web-apple-pay] Merchant validation started", { validationHost });
208
210
  const recaptchaToken = await getRecaptchaToken("verifyMerchant");
211
+ console.info("[web-apple-pay] verifyMerchant reCAPTCHA token acquired \u2014 calling validateAppleMerchant");
209
212
  const response = await validateAppleMerchant({
210
213
  validationURL: event.validationURL,
211
214
  recaptchaToken
212
215
  });
213
216
  if (!response?.merchantSession) {
217
+ console.error("[web-apple-pay] Merchant validation response missing merchantSession \u2014 aborting session", { response });
214
218
  session.abort();
215
219
  redirectToFallbackCheckout(config);
216
220
  return;
217
221
  }
222
+ console.info("[web-apple-pay] Merchant validation succeeded \u2014 completing merchant validation");
218
223
  session.completeMerchantValidation(response.merchantSession);
219
- } catch {
224
+ } catch (error) {
225
+ console.error("[web-apple-pay] Merchant validation threw an error \u2014 aborting session", error);
220
226
  session.abort();
221
227
  redirectToFallbackCheckout(config);
222
228
  }
@@ -237,6 +243,7 @@ function startApplePaySession(config) {
237
243
  };
238
244
  try {
239
245
  const session = new ApplePaySession(3, paymentRequest);
246
+ console.info("[web-apple-pay] ApplePaySession created successfully");
240
247
  session.onvalidatemerchant = async (event) => {
241
248
  await handleMerchantValidation(event, session, config);
242
249
  };
@@ -249,7 +256,9 @@ function startApplePaySession(config) {
249
256
  };
250
257
  trackWalletPaymentSheetOpen(config.skuId);
251
258
  session.begin();
252
- } catch {
259
+ console.info("[web-apple-pay] ApplePaySession.begin() called \u2014 payment sheet should appear");
260
+ } catch (error) {
261
+ console.error("[web-apple-pay] ApplePaySession creation or begin() threw \u2014 redirecting to fallback checkout", error);
253
262
  redirectToFallbackCheckout(config);
254
263
  }
255
264
  }
package/dist/src/index.js CHANGED
@@ -1381,22 +1381,28 @@ async function handleMerchantValidation(event, session, config) {
1381
1381
  try {
1382
1382
  const validationHost = new URL(event.validationURL).host;
1383
1383
  if (!validationHost.endsWith("apple.com")) {
1384
+ console.error("[web-apple-pay] Merchant validation URL is not from apple.com \u2014 aborting session", { validationURL: event.validationURL });
1384
1385
  session.abort();
1385
1386
  redirectToFallbackCheckout(config);
1386
1387
  return;
1387
1388
  }
1389
+ console.info("[web-apple-pay] Merchant validation started", { validationHost });
1388
1390
  const recaptchaToken = await getRecaptchaToken("verifyMerchant");
1391
+ console.info("[web-apple-pay] verifyMerchant reCAPTCHA token acquired \u2014 calling validateAppleMerchant");
1389
1392
  const response = await validateAppleMerchant({
1390
1393
  validationURL: event.validationURL,
1391
1394
  recaptchaToken
1392
1395
  });
1393
1396
  if (!response?.merchantSession) {
1397
+ console.error("[web-apple-pay] Merchant validation response missing merchantSession \u2014 aborting session", { response });
1394
1398
  session.abort();
1395
1399
  redirectToFallbackCheckout(config);
1396
1400
  return;
1397
1401
  }
1402
+ console.info("[web-apple-pay] Merchant validation succeeded \u2014 completing merchant validation");
1398
1403
  session.completeMerchantValidation(response.merchantSession);
1399
- } catch {
1404
+ } catch (error) {
1405
+ console.error("[web-apple-pay] Merchant validation threw an error \u2014 aborting session", error);
1400
1406
  session.abort();
1401
1407
  redirectToFallbackCheckout(config);
1402
1408
  }
@@ -1417,6 +1423,7 @@ function startApplePaySession(config) {
1417
1423
  };
1418
1424
  try {
1419
1425
  const session = new ApplePaySession(3, paymentRequest);
1426
+ console.info("[web-apple-pay] ApplePaySession created successfully");
1420
1427
  session.onvalidatemerchant = async (event) => {
1421
1428
  await handleMerchantValidation(event, session, config);
1422
1429
  };
@@ -1429,7 +1436,9 @@ function startApplePaySession(config) {
1429
1436
  };
1430
1437
  trackWalletPaymentSheetOpen(config.skuId);
1431
1438
  session.begin();
1432
- } catch {
1439
+ console.info("[web-apple-pay] ApplePaySession.begin() called \u2014 payment sheet should appear");
1440
+ } catch (error) {
1441
+ console.error("[web-apple-pay] ApplePaySession creation or begin() threw \u2014 redirecting to fallback checkout", error);
1433
1442
  redirectToFallbackCheckout(config);
1434
1443
  }
1435
1444
  }
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": "0.1.3-beta.44",
4
+ "version": "0.1.3-beta.45",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",