@economist/web-apple-pay 0.1.3-beta.1 → 0.1.3-beta.3

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
@@ -439,91 +439,7 @@ var ApplePayModal = class _ApplePayModal extends HTMLElement {
439
439
  };
440
440
 
441
441
  // src/templates/apple-pay-button.template.html
442
- var apple_pay_button_template_default = `<style>
443
- /* Use CSS variables for layout so parent walls can easily override placement and sizing */
444
- teg-apple-pay-button {
445
- display: block;
446
- margin: var(--apple-pay-margin, 0);
447
- width: 100%;
448
- height: 100%;
449
- }
450
-
451
- teg-apple-pay-button .apple-pay-container {
452
- display: flex;
453
- flex-direction: column;
454
- align-items: stretch;
455
- width: 100%;
456
- height: 100%;
457
- }
458
-
459
- teg-apple-pay-button .apple-pay-btn {
460
- display: flex;
461
- align-items: center;
462
- justify-content: center;
463
- gap: 0.375rem;
464
- width: 100%;
465
- min-width: 0;
466
- height: 100%;
467
- min-height: var(--apple-pay-height, 2.75rem);
468
- background-color: #000;
469
- color: #fff;
470
- border: none;
471
- border-radius: var(--apple-pay-border-radius, 1.375rem);
472
- cursor: pointer;
473
- font-family: var(--mb-typeface-sans, var(--wall-type-system-sans));
474
- font-size: 1.0625rem;
475
- font-weight: 500;
476
- }
477
-
478
- teg-apple-pay-button .apple-pay-btn svg {
479
- flex-shrink: 0;
480
- display: block;
481
- }
482
-
483
- teg-apple-pay-button .apple-pay-btn.wap-loading {
484
- position: relative;
485
- cursor: default;
486
- }
487
-
488
- teg-apple-pay-button .apple-pay-btn.wap-loading svg {
489
- visibility: hidden;
490
- }
491
-
492
- teg-apple-pay-button .apple-pay-btn.wap-loading::after {
493
- content: '';
494
- position: absolute;
495
- left: 50%;
496
- top: 50%;
497
- margin-left: -0.625rem;
498
- margin-top: -0.625rem;
499
- width: 1.25rem;
500
- height: 1.25rem;
501
- border: 2px solid rgba(255, 255, 255, 0.2);
502
- border-top-color: #fff;
503
- border-radius: 50%;
504
- animation: wap-button-spinner 0.8s linear infinite;
505
- }
506
-
507
- @keyframes wap-button-spinner {
508
- to {
509
- transform: rotate(360deg);
510
- }
511
- }
512
- </style>
513
-
514
- <div class="apple-pay-container" aria-label="Express checkout with Apple Pay">
515
- <button
516
- class="apple-pay-btn"
517
- type="button"
518
- aria-label="Pay with Apple Pay"
519
- data-analytics="paywall:apple-pay-checkout"
520
- >
521
- <svg width="51" height="22" aria-label="Apple Pay" role="img">
522
- <use href="#apple-pay-logo" />
523
- </svg>
524
- </button>
525
- </div>
526
- `;
442
+ var apple_pay_button_template_default = '<style>\n /* Use CSS variables for layout so parent walls can easily override placement and sizing */\n teg-apple-pay-button {\n display: block;\n margin: var(--apple-pay-margin, 0);\n width: 100%;\n height: 100%;\n }\n\n teg-apple-pay-button .apple-pay-container {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n width: 100%;\n height: 100%;\n }\n\n teg-apple-pay-button .apple-pay-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.375rem;\n width: 100%;\n min-width: 0;\n height: 100%;\n min-height: var(--apple-pay-height, 2.75rem);\n background-color: #000;\n color: #fff;\n border: none;\n border-radius: var(--apple-pay-border-radius, 1.375rem);\n cursor: pointer;\n font-family: var(--mb-typeface-sans, var(--wall-type-system-sans));\n font-size: 1.0625rem;\n font-weight: 500;\n }\n\n teg-apple-pay-button .apple-pay-btn svg {\n flex-shrink: 0;\n display: block;\n }\n</style>\n\n<div class="apple-pay-container" aria-label="Express checkout with Apple Pay">\n <button\n class="apple-pay-btn"\n type="button"\n aria-label="Pay with Apple Pay"\n data-analytics="paywall:apple-pay-checkout"\n >\n <svg width="51" height="22" aria-label="Apple Pay" role="img">\n <use href="#apple-pay-logo" />\n </svg>\n </button>\n</div>\n';
527
443
 
528
444
  // src/clients/payment-checkout/config.ts
529
445
  var runtimeConfig = null;
@@ -1075,6 +991,7 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
1075
991
  const result = await performPurchase({
1076
992
  applePayToken: event.payment.token,
1077
993
  skuId: config.skuId,
994
+ currency: config.currency,
1078
995
  billingContact: event.payment.billingContact,
1079
996
  ...event.payment.shippingContact && {
1080
997
  shippingContact: event.payment.shippingContact
@@ -1491,16 +1408,14 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1491
1408
  async #run() {
1492
1409
  try {
1493
1410
  if (await this.#checkAvailability()) return;
1494
- if (this.#checkOffer()) return;
1495
- this.#renderTemplate();
1496
1411
  if (await this.#checkSession()) return;
1412
+ if (this.#checkOffer()) return;
1497
1413
  this.#captureReturnUrl();
1498
1414
  this.#computeBillingCountries();
1499
1415
  if (await this.#fetchAndCacheOptions()) return;
1500
- this.#finishLoading();
1416
+ this.#renderTemplate();
1501
1417
  } catch {
1502
1418
  this.style.display = "none";
1503
- this.querySelector(SEL_CONTAINER)?.remove();
1504
1419
  } finally {
1505
1420
  this.#rendering = false;
1506
1421
  }
@@ -1522,7 +1437,6 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1522
1437
  this.#sessionData = await this.#fetchSession();
1523
1438
  if (this.#sessionData?.loggedIn && (this.#sessionData.userType === "active-subscription" || this.#sessionData.userType === "b2b-user")) {
1524
1439
  this.style.display = "none";
1525
- this.querySelector(SEL_CONTAINER)?.remove();
1526
1440
  return true;
1527
1441
  }
1528
1442
  return false;
@@ -1558,7 +1472,6 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1558
1472
  this.#paymentOptions = await this.#fetchPaymentOptions();
1559
1473
  if (!this.#paymentOptions?.apple_pay) {
1560
1474
  this.style.display = "none";
1561
- this.querySelector(SEL_CONTAINER)?.remove();
1562
1475
  return true;
1563
1476
  }
1564
1477
  return false;
@@ -1570,13 +1483,13 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1570
1483
  const template = document.createElement("template");
1571
1484
  template.innerHTML = apple_pay_button_template_default;
1572
1485
  this.appendChild(template.content.cloneNode(true));
1486
+ this.#updateDisabledState();
1487
+ trackExpressWalletImpression(this.#offer.sku_id, {
1488
+ entryPoint: this.#entryPoint,
1489
+ country: this.#country
1490
+ });
1573
1491
  const button = this.querySelector(SEL_BUTTON);
1574
- button.classList.add("wap-loading");
1575
- button.setAttribute("disabled", "");
1576
- button.setAttribute("aria-disabled", "true");
1577
- button.setAttribute("aria-busy", "true");
1578
1492
  button.addEventListener("click", () => {
1579
- if (button.classList.contains("wap-loading")) return;
1580
1493
  this.#openModal();
1581
1494
  });
1582
1495
  this.addEventListener("apple-pay-confirmed", (event) => {
@@ -1584,17 +1497,6 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1584
1497
  this.#initiateApplePay(skuId, country);
1585
1498
  });
1586
1499
  }
1587
- #finishLoading() {
1588
- const button = this.querySelector(SEL_BUTTON);
1589
- if (button) {
1590
- button.classList.remove("wap-loading");
1591
- this.#updateDisabledState();
1592
- trackExpressWalletImpression(this.#offer.sku_id, {
1593
- entryPoint: this.#entryPoint,
1594
- country: this.#country
1595
- });
1596
- }
1597
- }
1598
1500
  // ─── Private helpers ────────────────────────────────────────────────────────
1599
1501
  #updateDisabledState() {
1600
1502
  const button = this.querySelector(SEL_BUTTON);
@@ -1602,7 +1504,6 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1602
1504
  if (this.#offer) {
1603
1505
  button.removeAttribute("disabled");
1604
1506
  button.removeAttribute("aria-disabled");
1605
- button.removeAttribute("aria-busy");
1606
1507
  return;
1607
1508
  }
1608
1509
  button.setAttribute("disabled", "");
@@ -1654,6 +1555,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1654
1555
  onPaymentAuthorized: (event, session) => handlePaymentAuthorized(event, session, sessionData, {
1655
1556
  skuId,
1656
1557
  country,
1558
+ currency: offer.price?.currency_code ?? DEFAULT_CURRENCY,
1657
1559
  returnUrl: this.#returnUrl,
1658
1560
  queryString: buildQueryString(),
1659
1561
  supportedBillingCountries: this.#supportedBillingCountries,
@@ -439,91 +439,7 @@ var ApplePayModal = class _ApplePayModal extends HTMLElement {
439
439
  };
440
440
 
441
441
  // src/templates/apple-pay-button.template.html
442
- var apple_pay_button_template_default = `<style>
443
- /* Use CSS variables for layout so parent walls can easily override placement and sizing */
444
- teg-apple-pay-button {
445
- display: block;
446
- margin: var(--apple-pay-margin, 0);
447
- width: 100%;
448
- height: 100%;
449
- }
450
-
451
- teg-apple-pay-button .apple-pay-container {
452
- display: flex;
453
- flex-direction: column;
454
- align-items: stretch;
455
- width: 100%;
456
- height: 100%;
457
- }
458
-
459
- teg-apple-pay-button .apple-pay-btn {
460
- display: flex;
461
- align-items: center;
462
- justify-content: center;
463
- gap: 0.375rem;
464
- width: 100%;
465
- min-width: 0;
466
- height: 100%;
467
- min-height: var(--apple-pay-height, 2.75rem);
468
- background-color: #000;
469
- color: #fff;
470
- border: none;
471
- border-radius: var(--apple-pay-border-radius, 1.375rem);
472
- cursor: pointer;
473
- font-family: var(--mb-typeface-sans, var(--wall-type-system-sans));
474
- font-size: 1.0625rem;
475
- font-weight: 500;
476
- }
477
-
478
- teg-apple-pay-button .apple-pay-btn svg {
479
- flex-shrink: 0;
480
- display: block;
481
- }
482
-
483
- teg-apple-pay-button .apple-pay-btn.wap-loading {
484
- position: relative;
485
- cursor: default;
486
- }
487
-
488
- teg-apple-pay-button .apple-pay-btn.wap-loading svg {
489
- visibility: hidden;
490
- }
491
-
492
- teg-apple-pay-button .apple-pay-btn.wap-loading::after {
493
- content: '';
494
- position: absolute;
495
- left: 50%;
496
- top: 50%;
497
- margin-left: -0.625rem;
498
- margin-top: -0.625rem;
499
- width: 1.25rem;
500
- height: 1.25rem;
501
- border: 2px solid rgba(255, 255, 255, 0.2);
502
- border-top-color: #fff;
503
- border-radius: 50%;
504
- animation: wap-button-spinner 0.8s linear infinite;
505
- }
506
-
507
- @keyframes wap-button-spinner {
508
- to {
509
- transform: rotate(360deg);
510
- }
511
- }
512
- </style>
513
-
514
- <div class="apple-pay-container" aria-label="Express checkout with Apple Pay">
515
- <button
516
- class="apple-pay-btn"
517
- type="button"
518
- aria-label="Pay with Apple Pay"
519
- data-analytics="paywall:apple-pay-checkout"
520
- >
521
- <svg width="51" height="22" aria-label="Apple Pay" role="img">
522
- <use href="#apple-pay-logo" />
523
- </svg>
524
- </button>
525
- </div>
526
- `;
442
+ var apple_pay_button_template_default = '<style>\n /* Use CSS variables for layout so parent walls can easily override placement and sizing */\n teg-apple-pay-button {\n display: block;\n margin: var(--apple-pay-margin, 0);\n width: 100%;\n height: 100%;\n }\n\n teg-apple-pay-button .apple-pay-container {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n width: 100%;\n height: 100%;\n }\n\n teg-apple-pay-button .apple-pay-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.375rem;\n width: 100%;\n min-width: 0;\n height: 100%;\n min-height: var(--apple-pay-height, 2.75rem);\n background-color: #000;\n color: #fff;\n border: none;\n border-radius: var(--apple-pay-border-radius, 1.375rem);\n cursor: pointer;\n font-family: var(--mb-typeface-sans, var(--wall-type-system-sans));\n font-size: 1.0625rem;\n font-weight: 500;\n }\n\n teg-apple-pay-button .apple-pay-btn svg {\n flex-shrink: 0;\n display: block;\n }\n</style>\n\n<div class="apple-pay-container" aria-label="Express checkout with Apple Pay">\n <button\n class="apple-pay-btn"\n type="button"\n aria-label="Pay with Apple Pay"\n data-analytics="paywall:apple-pay-checkout"\n >\n <svg width="51" height="22" aria-label="Apple Pay" role="img">\n <use href="#apple-pay-logo" />\n </svg>\n </button>\n</div>\n';
527
443
 
528
444
  // src/clients/payment-checkout/config.ts
529
445
  var runtimeConfig = null;
@@ -1070,6 +986,7 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
1070
986
  const result = await performPurchase({
1071
987
  applePayToken: event.payment.token,
1072
988
  skuId: config.skuId,
989
+ currency: config.currency,
1073
990
  billingContact: event.payment.billingContact,
1074
991
  ...event.payment.shippingContact && {
1075
992
  shippingContact: event.payment.shippingContact
@@ -1486,16 +1403,14 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1486
1403
  async #run() {
1487
1404
  try {
1488
1405
  if (await this.#checkAvailability()) return;
1489
- if (this.#checkOffer()) return;
1490
- this.#renderTemplate();
1491
1406
  if (await this.#checkSession()) return;
1407
+ if (this.#checkOffer()) return;
1492
1408
  this.#captureReturnUrl();
1493
1409
  this.#computeBillingCountries();
1494
1410
  if (await this.#fetchAndCacheOptions()) return;
1495
- this.#finishLoading();
1411
+ this.#renderTemplate();
1496
1412
  } catch {
1497
1413
  this.style.display = "none";
1498
- this.querySelector(SEL_CONTAINER)?.remove();
1499
1414
  } finally {
1500
1415
  this.#rendering = false;
1501
1416
  }
@@ -1517,7 +1432,6 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1517
1432
  this.#sessionData = await this.#fetchSession();
1518
1433
  if (this.#sessionData?.loggedIn && (this.#sessionData.userType === "active-subscription" || this.#sessionData.userType === "b2b-user")) {
1519
1434
  this.style.display = "none";
1520
- this.querySelector(SEL_CONTAINER)?.remove();
1521
1435
  return true;
1522
1436
  }
1523
1437
  return false;
@@ -1553,7 +1467,6 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1553
1467
  this.#paymentOptions = await this.#fetchPaymentOptions();
1554
1468
  if (!this.#paymentOptions?.apple_pay) {
1555
1469
  this.style.display = "none";
1556
- this.querySelector(SEL_CONTAINER)?.remove();
1557
1470
  return true;
1558
1471
  }
1559
1472
  return false;
@@ -1565,13 +1478,13 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1565
1478
  const template = document.createElement("template");
1566
1479
  template.innerHTML = apple_pay_button_template_default;
1567
1480
  this.appendChild(template.content.cloneNode(true));
1481
+ this.#updateDisabledState();
1482
+ trackExpressWalletImpression(this.#offer.sku_id, {
1483
+ entryPoint: this.#entryPoint,
1484
+ country: this.#country
1485
+ });
1568
1486
  const button = this.querySelector(SEL_BUTTON);
1569
- button.classList.add("wap-loading");
1570
- button.setAttribute("disabled", "");
1571
- button.setAttribute("aria-disabled", "true");
1572
- button.setAttribute("aria-busy", "true");
1573
1487
  button.addEventListener("click", () => {
1574
- if (button.classList.contains("wap-loading")) return;
1575
1488
  this.#openModal();
1576
1489
  });
1577
1490
  this.addEventListener("apple-pay-confirmed", (event) => {
@@ -1579,17 +1492,6 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1579
1492
  this.#initiateApplePay(skuId, country);
1580
1493
  });
1581
1494
  }
1582
- #finishLoading() {
1583
- const button = this.querySelector(SEL_BUTTON);
1584
- if (button) {
1585
- button.classList.remove("wap-loading");
1586
- this.#updateDisabledState();
1587
- trackExpressWalletImpression(this.#offer.sku_id, {
1588
- entryPoint: this.#entryPoint,
1589
- country: this.#country
1590
- });
1591
- }
1592
- }
1593
1495
  // ─── Private helpers ────────────────────────────────────────────────────────
1594
1496
  #updateDisabledState() {
1595
1497
  const button = this.querySelector(SEL_BUTTON);
@@ -1597,7 +1499,6 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1597
1499
  if (this.#offer) {
1598
1500
  button.removeAttribute("disabled");
1599
1501
  button.removeAttribute("aria-disabled");
1600
- button.removeAttribute("aria-busy");
1601
1502
  return;
1602
1503
  }
1603
1504
  button.setAttribute("disabled", "");
@@ -1649,6 +1550,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1649
1550
  onPaymentAuthorized: (event, session) => handlePaymentAuthorized(event, session, sessionData, {
1650
1551
  skuId,
1651
1552
  country,
1553
+ currency: offer.price?.currency_code ?? DEFAULT_CURRENCY,
1652
1554
  returnUrl: this.#returnUrl,
1653
1555
  queryString: buildQueryString(),
1654
1556
  supportedBillingCountries: this.#supportedBillingCountries,
@@ -439,91 +439,7 @@ var ApplePayModal = class _ApplePayModal extends HTMLElement {
439
439
  };
440
440
 
441
441
  // src/templates/apple-pay-button.template.html
442
- var apple_pay_button_template_default = `<style>
443
- /* Use CSS variables for layout so parent walls can easily override placement and sizing */
444
- teg-apple-pay-button {
445
- display: block;
446
- margin: var(--apple-pay-margin, 0);
447
- width: 100%;
448
- height: 100%;
449
- }
450
-
451
- teg-apple-pay-button .apple-pay-container {
452
- display: flex;
453
- flex-direction: column;
454
- align-items: stretch;
455
- width: 100%;
456
- height: 100%;
457
- }
458
-
459
- teg-apple-pay-button .apple-pay-btn {
460
- display: flex;
461
- align-items: center;
462
- justify-content: center;
463
- gap: 0.375rem;
464
- width: 100%;
465
- min-width: 0;
466
- height: 100%;
467
- min-height: var(--apple-pay-height, 2.75rem);
468
- background-color: #000;
469
- color: #fff;
470
- border: none;
471
- border-radius: var(--apple-pay-border-radius, 1.375rem);
472
- cursor: pointer;
473
- font-family: var(--mb-typeface-sans, var(--wall-type-system-sans));
474
- font-size: 1.0625rem;
475
- font-weight: 500;
476
- }
477
-
478
- teg-apple-pay-button .apple-pay-btn svg {
479
- flex-shrink: 0;
480
- display: block;
481
- }
482
-
483
- teg-apple-pay-button .apple-pay-btn.wap-loading {
484
- position: relative;
485
- cursor: default;
486
- }
487
-
488
- teg-apple-pay-button .apple-pay-btn.wap-loading svg {
489
- visibility: hidden;
490
- }
491
-
492
- teg-apple-pay-button .apple-pay-btn.wap-loading::after {
493
- content: '';
494
- position: absolute;
495
- left: 50%;
496
- top: 50%;
497
- margin-left: -0.625rem;
498
- margin-top: -0.625rem;
499
- width: 1.25rem;
500
- height: 1.25rem;
501
- border: 2px solid rgba(255, 255, 255, 0.2);
502
- border-top-color: #fff;
503
- border-radius: 50%;
504
- animation: wap-button-spinner 0.8s linear infinite;
505
- }
506
-
507
- @keyframes wap-button-spinner {
508
- to {
509
- transform: rotate(360deg);
510
- }
511
- }
512
- </style>
513
-
514
- <div class="apple-pay-container" aria-label="Express checkout with Apple Pay">
515
- <button
516
- class="apple-pay-btn"
517
- type="button"
518
- aria-label="Pay with Apple Pay"
519
- data-analytics="paywall:apple-pay-checkout"
520
- >
521
- <svg width="51" height="22" aria-label="Apple Pay" role="img">
522
- <use href="#apple-pay-logo" />
523
- </svg>
524
- </button>
525
- </div>
526
- `;
442
+ var apple_pay_button_template_default = '<style>\n /* Use CSS variables for layout so parent walls can easily override placement and sizing */\n teg-apple-pay-button {\n display: block;\n margin: var(--apple-pay-margin, 0);\n width: 100%;\n height: 100%;\n }\n\n teg-apple-pay-button .apple-pay-container {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n width: 100%;\n height: 100%;\n }\n\n teg-apple-pay-button .apple-pay-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.375rem;\n width: 100%;\n min-width: 0;\n height: 100%;\n min-height: var(--apple-pay-height, 2.75rem);\n background-color: #000;\n color: #fff;\n border: none;\n border-radius: var(--apple-pay-border-radius, 1.375rem);\n cursor: pointer;\n font-family: var(--mb-typeface-sans, var(--wall-type-system-sans));\n font-size: 1.0625rem;\n font-weight: 500;\n }\n\n teg-apple-pay-button .apple-pay-btn svg {\n flex-shrink: 0;\n display: block;\n }\n</style>\n\n<div class="apple-pay-container" aria-label="Express checkout with Apple Pay">\n <button\n class="apple-pay-btn"\n type="button"\n aria-label="Pay with Apple Pay"\n data-analytics="paywall:apple-pay-checkout"\n >\n <svg width="51" height="22" aria-label="Apple Pay" role="img">\n <use href="#apple-pay-logo" />\n </svg>\n </button>\n</div>\n';
527
443
 
528
444
  // src/clients/payment-checkout/config.ts
529
445
  var runtimeConfig = null;
@@ -1078,6 +994,7 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
1078
994
  const result = await performPurchase({
1079
995
  applePayToken: event.payment.token,
1080
996
  skuId: config.skuId,
997
+ currency: config.currency,
1081
998
  billingContact: event.payment.billingContact,
1082
999
  ...event.payment.shippingContact && {
1083
1000
  shippingContact: event.payment.shippingContact
@@ -1494,16 +1411,14 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1494
1411
  async #run() {
1495
1412
  try {
1496
1413
  if (await this.#checkAvailability()) return;
1497
- if (this.#checkOffer()) return;
1498
- this.#renderTemplate();
1499
1414
  if (await this.#checkSession()) return;
1415
+ if (this.#checkOffer()) return;
1500
1416
  this.#captureReturnUrl();
1501
1417
  this.#computeBillingCountries();
1502
1418
  if (await this.#fetchAndCacheOptions()) return;
1503
- this.#finishLoading();
1419
+ this.#renderTemplate();
1504
1420
  } catch {
1505
1421
  this.style.display = "none";
1506
- this.querySelector(SEL_CONTAINER)?.remove();
1507
1422
  } finally {
1508
1423
  this.#rendering = false;
1509
1424
  }
@@ -1525,7 +1440,6 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1525
1440
  this.#sessionData = await this.#fetchSession();
1526
1441
  if (this.#sessionData?.loggedIn && (this.#sessionData.userType === "active-subscription" || this.#sessionData.userType === "b2b-user")) {
1527
1442
  this.style.display = "none";
1528
- this.querySelector(SEL_CONTAINER)?.remove();
1529
1443
  return true;
1530
1444
  }
1531
1445
  return false;
@@ -1561,7 +1475,6 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1561
1475
  this.#paymentOptions = await this.#fetchPaymentOptions();
1562
1476
  if (!this.#paymentOptions?.apple_pay) {
1563
1477
  this.style.display = "none";
1564
- this.querySelector(SEL_CONTAINER)?.remove();
1565
1478
  return true;
1566
1479
  }
1567
1480
  return false;
@@ -1573,13 +1486,13 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1573
1486
  const template = document.createElement("template");
1574
1487
  template.innerHTML = apple_pay_button_template_default;
1575
1488
  this.appendChild(template.content.cloneNode(true));
1489
+ this.#updateDisabledState();
1490
+ trackExpressWalletImpression(this.#offer.sku_id, {
1491
+ entryPoint: this.#entryPoint,
1492
+ country: this.#country
1493
+ });
1576
1494
  const button = this.querySelector(SEL_BUTTON);
1577
- button.classList.add("wap-loading");
1578
- button.setAttribute("disabled", "");
1579
- button.setAttribute("aria-disabled", "true");
1580
- button.setAttribute("aria-busy", "true");
1581
1495
  button.addEventListener("click", () => {
1582
- if (button.classList.contains("wap-loading")) return;
1583
1496
  this.#openModal();
1584
1497
  });
1585
1498
  this.addEventListener("apple-pay-confirmed", (event) => {
@@ -1587,17 +1500,6 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1587
1500
  this.#initiateApplePay(skuId, country);
1588
1501
  });
1589
1502
  }
1590
- #finishLoading() {
1591
- const button = this.querySelector(SEL_BUTTON);
1592
- if (button) {
1593
- button.classList.remove("wap-loading");
1594
- this.#updateDisabledState();
1595
- trackExpressWalletImpression(this.#offer.sku_id, {
1596
- entryPoint: this.#entryPoint,
1597
- country: this.#country
1598
- });
1599
- }
1600
- }
1601
1503
  // ─── Private helpers ────────────────────────────────────────────────────────
1602
1504
  #updateDisabledState() {
1603
1505
  const button = this.querySelector(SEL_BUTTON);
@@ -1605,7 +1507,6 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1605
1507
  if (this.#offer) {
1606
1508
  button.removeAttribute("disabled");
1607
1509
  button.removeAttribute("aria-disabled");
1608
- button.removeAttribute("aria-busy");
1609
1510
  return;
1610
1511
  }
1611
1512
  button.setAttribute("disabled", "");
@@ -1657,6 +1558,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1657
1558
  onPaymentAuthorized: (event, session) => handlePaymentAuthorized(event, session, sessionData, {
1658
1559
  skuId,
1659
1560
  country,
1561
+ currency: offer.price?.currency_code ?? DEFAULT_CURRENCY,
1660
1562
  returnUrl: this.#returnUrl,
1661
1563
  queryString: buildQueryString(),
1662
1564
  supportedBillingCountries: this.#supportedBillingCountries,
@@ -439,91 +439,7 @@ var ApplePayModal = class _ApplePayModal extends HTMLElement {
439
439
  };
440
440
 
441
441
  // src/templates/apple-pay-button.template.html
442
- var apple_pay_button_template_default = `<style>
443
- /* Use CSS variables for layout so parent walls can easily override placement and sizing */
444
- teg-apple-pay-button {
445
- display: block;
446
- margin: var(--apple-pay-margin, 0);
447
- width: 100%;
448
- height: 100%;
449
- }
450
-
451
- teg-apple-pay-button .apple-pay-container {
452
- display: flex;
453
- flex-direction: column;
454
- align-items: stretch;
455
- width: 100%;
456
- height: 100%;
457
- }
458
-
459
- teg-apple-pay-button .apple-pay-btn {
460
- display: flex;
461
- align-items: center;
462
- justify-content: center;
463
- gap: 0.375rem;
464
- width: 100%;
465
- min-width: 0;
466
- height: 100%;
467
- min-height: var(--apple-pay-height, 2.75rem);
468
- background-color: #000;
469
- color: #fff;
470
- border: none;
471
- border-radius: var(--apple-pay-border-radius, 1.375rem);
472
- cursor: pointer;
473
- font-family: var(--mb-typeface-sans, var(--wall-type-system-sans));
474
- font-size: 1.0625rem;
475
- font-weight: 500;
476
- }
477
-
478
- teg-apple-pay-button .apple-pay-btn svg {
479
- flex-shrink: 0;
480
- display: block;
481
- }
482
-
483
- teg-apple-pay-button .apple-pay-btn.wap-loading {
484
- position: relative;
485
- cursor: default;
486
- }
487
-
488
- teg-apple-pay-button .apple-pay-btn.wap-loading svg {
489
- visibility: hidden;
490
- }
491
-
492
- teg-apple-pay-button .apple-pay-btn.wap-loading::after {
493
- content: '';
494
- position: absolute;
495
- left: 50%;
496
- top: 50%;
497
- margin-left: -0.625rem;
498
- margin-top: -0.625rem;
499
- width: 1.25rem;
500
- height: 1.25rem;
501
- border: 2px solid rgba(255, 255, 255, 0.2);
502
- border-top-color: #fff;
503
- border-radius: 50%;
504
- animation: wap-button-spinner 0.8s linear infinite;
505
- }
506
-
507
- @keyframes wap-button-spinner {
508
- to {
509
- transform: rotate(360deg);
510
- }
511
- }
512
- </style>
513
-
514
- <div class="apple-pay-container" aria-label="Express checkout with Apple Pay">
515
- <button
516
- class="apple-pay-btn"
517
- type="button"
518
- aria-label="Pay with Apple Pay"
519
- data-analytics="paywall:apple-pay-checkout"
520
- >
521
- <svg width="51" height="22" aria-label="Apple Pay" role="img">
522
- <use href="#apple-pay-logo" />
523
- </svg>
524
- </button>
525
- </div>
526
- `;
442
+ var apple_pay_button_template_default = '<style>\n /* Use CSS variables for layout so parent walls can easily override placement and sizing */\n teg-apple-pay-button {\n display: block;\n margin: var(--apple-pay-margin, 0);\n width: 100%;\n height: 100%;\n }\n\n teg-apple-pay-button .apple-pay-container {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n width: 100%;\n height: 100%;\n }\n\n teg-apple-pay-button .apple-pay-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.375rem;\n width: 100%;\n min-width: 0;\n height: 100%;\n min-height: var(--apple-pay-height, 2.75rem);\n background-color: #000;\n color: #fff;\n border: none;\n border-radius: var(--apple-pay-border-radius, 1.375rem);\n cursor: pointer;\n font-family: var(--mb-typeface-sans, var(--wall-type-system-sans));\n font-size: 1.0625rem;\n font-weight: 500;\n }\n\n teg-apple-pay-button .apple-pay-btn svg {\n flex-shrink: 0;\n display: block;\n }\n</style>\n\n<div class="apple-pay-container" aria-label="Express checkout with Apple Pay">\n <button\n class="apple-pay-btn"\n type="button"\n aria-label="Pay with Apple Pay"\n data-analytics="paywall:apple-pay-checkout"\n >\n <svg width="51" height="22" aria-label="Apple Pay" role="img">\n <use href="#apple-pay-logo" />\n </svg>\n </button>\n</div>\n';
527
443
 
528
444
  // src/clients/payment-checkout/config.ts
529
445
  var runtimeConfig = null;
@@ -1070,6 +986,7 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
1070
986
  const result = await performPurchase({
1071
987
  applePayToken: event.payment.token,
1072
988
  skuId: config.skuId,
989
+ currency: config.currency,
1073
990
  billingContact: event.payment.billingContact,
1074
991
  ...event.payment.shippingContact && {
1075
992
  shippingContact: event.payment.shippingContact
@@ -1486,16 +1403,14 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1486
1403
  async #run() {
1487
1404
  try {
1488
1405
  if (await this.#checkAvailability()) return;
1489
- if (this.#checkOffer()) return;
1490
- this.#renderTemplate();
1491
1406
  if (await this.#checkSession()) return;
1407
+ if (this.#checkOffer()) return;
1492
1408
  this.#captureReturnUrl();
1493
1409
  this.#computeBillingCountries();
1494
1410
  if (await this.#fetchAndCacheOptions()) return;
1495
- this.#finishLoading();
1411
+ this.#renderTemplate();
1496
1412
  } catch {
1497
1413
  this.style.display = "none";
1498
- this.querySelector(SEL_CONTAINER)?.remove();
1499
1414
  } finally {
1500
1415
  this.#rendering = false;
1501
1416
  }
@@ -1517,7 +1432,6 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1517
1432
  this.#sessionData = await this.#fetchSession();
1518
1433
  if (this.#sessionData?.loggedIn && (this.#sessionData.userType === "active-subscription" || this.#sessionData.userType === "b2b-user")) {
1519
1434
  this.style.display = "none";
1520
- this.querySelector(SEL_CONTAINER)?.remove();
1521
1435
  return true;
1522
1436
  }
1523
1437
  return false;
@@ -1553,7 +1467,6 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1553
1467
  this.#paymentOptions = await this.#fetchPaymentOptions();
1554
1468
  if (!this.#paymentOptions?.apple_pay) {
1555
1469
  this.style.display = "none";
1556
- this.querySelector(SEL_CONTAINER)?.remove();
1557
1470
  return true;
1558
1471
  }
1559
1472
  return false;
@@ -1565,13 +1478,13 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1565
1478
  const template = document.createElement("template");
1566
1479
  template.innerHTML = apple_pay_button_template_default;
1567
1480
  this.appendChild(template.content.cloneNode(true));
1481
+ this.#updateDisabledState();
1482
+ trackExpressWalletImpression(this.#offer.sku_id, {
1483
+ entryPoint: this.#entryPoint,
1484
+ country: this.#country
1485
+ });
1568
1486
  const button = this.querySelector(SEL_BUTTON);
1569
- button.classList.add("wap-loading");
1570
- button.setAttribute("disabled", "");
1571
- button.setAttribute("aria-disabled", "true");
1572
- button.setAttribute("aria-busy", "true");
1573
1487
  button.addEventListener("click", () => {
1574
- if (button.classList.contains("wap-loading")) return;
1575
1488
  this.#openModal();
1576
1489
  });
1577
1490
  this.addEventListener("apple-pay-confirmed", (event) => {
@@ -1579,17 +1492,6 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1579
1492
  this.#initiateApplePay(skuId, country);
1580
1493
  });
1581
1494
  }
1582
- #finishLoading() {
1583
- const button = this.querySelector(SEL_BUTTON);
1584
- if (button) {
1585
- button.classList.remove("wap-loading");
1586
- this.#updateDisabledState();
1587
- trackExpressWalletImpression(this.#offer.sku_id, {
1588
- entryPoint: this.#entryPoint,
1589
- country: this.#country
1590
- });
1591
- }
1592
- }
1593
1495
  // ─── Private helpers ────────────────────────────────────────────────────────
1594
1496
  #updateDisabledState() {
1595
1497
  const button = this.querySelector(SEL_BUTTON);
@@ -1597,7 +1499,6 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1597
1499
  if (this.#offer) {
1598
1500
  button.removeAttribute("disabled");
1599
1501
  button.removeAttribute("aria-disabled");
1600
- button.removeAttribute("aria-busy");
1601
1502
  return;
1602
1503
  }
1603
1504
  button.setAttribute("disabled", "");
@@ -1649,6 +1550,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1649
1550
  onPaymentAuthorized: (event, session) => handlePaymentAuthorized(event, session, sessionData, {
1650
1551
  skuId,
1651
1552
  country,
1553
+ currency: offer.price?.currency_code ?? DEFAULT_CURRENCY,
1652
1554
  returnUrl: this.#returnUrl,
1653
1555
  queryString: buildQueryString(),
1654
1556
  supportedBillingCountries: this.#supportedBillingCountries,
@@ -17,6 +17,7 @@ import type { SessionResponse } from './types';
17
17
  export type PaymentHandlerConfig = {
18
18
  skuId: string;
19
19
  country: string;
20
+ currency: string;
20
21
  returnUrl: string;
21
22
  /**
22
23
  * Optional `&country=` query param captured from the page URL at the moment
@@ -338,6 +338,7 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
338
338
  const result = await performPurchase({
339
339
  applePayToken: event.payment.token,
340
340
  skuId: config.skuId,
341
+ currency: config.currency,
341
342
  billingContact: event.payment.billingContact,
342
343
  ...event.payment.shippingContact && {
343
344
  shippingContact: event.payment.shippingContact
@@ -85,6 +85,7 @@ export type PurchaseRequest = {
85
85
  * only provide a `skuId`. Frontend uses `skuId` directly — BFF must be aligned.
86
86
  */
87
87
  skuId: string;
88
+ currency: string;
88
89
  billingContact: ApplePayPaymentContact;
89
90
  /** Required if loggedIn: false — contains emailAddress from Apple Pay sheet. */
90
91
  shippingContact?: ApplePayPaymentContact;
package/dist/src/index.js CHANGED
@@ -439,91 +439,7 @@ var ApplePayModal = class _ApplePayModal extends HTMLElement {
439
439
  };
440
440
 
441
441
  // src/templates/apple-pay-button.template.html
442
- var apple_pay_button_template_default = `<style>
443
- /* Use CSS variables for layout so parent walls can easily override placement and sizing */
444
- teg-apple-pay-button {
445
- display: block;
446
- margin: var(--apple-pay-margin, 0);
447
- width: 100%;
448
- height: 100%;
449
- }
450
-
451
- teg-apple-pay-button .apple-pay-container {
452
- display: flex;
453
- flex-direction: column;
454
- align-items: stretch;
455
- width: 100%;
456
- height: 100%;
457
- }
458
-
459
- teg-apple-pay-button .apple-pay-btn {
460
- display: flex;
461
- align-items: center;
462
- justify-content: center;
463
- gap: 0.375rem;
464
- width: 100%;
465
- min-width: 0;
466
- height: 100%;
467
- min-height: var(--apple-pay-height, 2.75rem);
468
- background-color: #000;
469
- color: #fff;
470
- border: none;
471
- border-radius: var(--apple-pay-border-radius, 1.375rem);
472
- cursor: pointer;
473
- font-family: var(--mb-typeface-sans, var(--wall-type-system-sans));
474
- font-size: 1.0625rem;
475
- font-weight: 500;
476
- }
477
-
478
- teg-apple-pay-button .apple-pay-btn svg {
479
- flex-shrink: 0;
480
- display: block;
481
- }
482
-
483
- teg-apple-pay-button .apple-pay-btn.wap-loading {
484
- position: relative;
485
- cursor: default;
486
- }
487
-
488
- teg-apple-pay-button .apple-pay-btn.wap-loading svg {
489
- visibility: hidden;
490
- }
491
-
492
- teg-apple-pay-button .apple-pay-btn.wap-loading::after {
493
- content: '';
494
- position: absolute;
495
- left: 50%;
496
- top: 50%;
497
- margin-left: -0.625rem;
498
- margin-top: -0.625rem;
499
- width: 1.25rem;
500
- height: 1.25rem;
501
- border: 2px solid rgba(255, 255, 255, 0.2);
502
- border-top-color: #fff;
503
- border-radius: 50%;
504
- animation: wap-button-spinner 0.8s linear infinite;
505
- }
506
-
507
- @keyframes wap-button-spinner {
508
- to {
509
- transform: rotate(360deg);
510
- }
511
- }
512
- </style>
513
-
514
- <div class="apple-pay-container" aria-label="Express checkout with Apple Pay">
515
- <button
516
- class="apple-pay-btn"
517
- type="button"
518
- aria-label="Pay with Apple Pay"
519
- data-analytics="paywall:apple-pay-checkout"
520
- >
521
- <svg width="51" height="22" aria-label="Apple Pay" role="img">
522
- <use href="#apple-pay-logo" />
523
- </svg>
524
- </button>
525
- </div>
526
- `;
442
+ var apple_pay_button_template_default = '<style>\n /* Use CSS variables for layout so parent walls can easily override placement and sizing */\n teg-apple-pay-button {\n display: block;\n margin: var(--apple-pay-margin, 0);\n width: 100%;\n height: 100%;\n }\n\n teg-apple-pay-button .apple-pay-container {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n width: 100%;\n height: 100%;\n }\n\n teg-apple-pay-button .apple-pay-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.375rem;\n width: 100%;\n min-width: 0;\n height: 100%;\n min-height: var(--apple-pay-height, 2.75rem);\n background-color: #000;\n color: #fff;\n border: none;\n border-radius: var(--apple-pay-border-radius, 1.375rem);\n cursor: pointer;\n font-family: var(--mb-typeface-sans, var(--wall-type-system-sans));\n font-size: 1.0625rem;\n font-weight: 500;\n }\n\n teg-apple-pay-button .apple-pay-btn svg {\n flex-shrink: 0;\n display: block;\n }\n</style>\n\n<div class="apple-pay-container" aria-label="Express checkout with Apple Pay">\n <button\n class="apple-pay-btn"\n type="button"\n aria-label="Pay with Apple Pay"\n data-analytics="paywall:apple-pay-checkout"\n >\n <svg width="51" height="22" aria-label="Apple Pay" role="img">\n <use href="#apple-pay-logo" />\n </svg>\n </button>\n</div>\n';
527
443
 
528
444
  // src/clients/payment-checkout/config.ts
529
445
  var runtimeConfig = null;
@@ -1075,6 +991,7 @@ async function handlePaymentAuthorized(event, session, sessionData, config) {
1075
991
  const result = await performPurchase({
1076
992
  applePayToken: event.payment.token,
1077
993
  skuId: config.skuId,
994
+ currency: config.currency,
1078
995
  billingContact: event.payment.billingContact,
1079
996
  ...event.payment.shippingContact && {
1080
997
  shippingContact: event.payment.shippingContact
@@ -1491,16 +1408,14 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1491
1408
  async #run() {
1492
1409
  try {
1493
1410
  if (await this.#checkAvailability()) return;
1494
- if (this.#checkOffer()) return;
1495
- this.#renderTemplate();
1496
1411
  if (await this.#checkSession()) return;
1412
+ if (this.#checkOffer()) return;
1497
1413
  this.#captureReturnUrl();
1498
1414
  this.#computeBillingCountries();
1499
1415
  if (await this.#fetchAndCacheOptions()) return;
1500
- this.#finishLoading();
1416
+ this.#renderTemplate();
1501
1417
  } catch {
1502
1418
  this.style.display = "none";
1503
- this.querySelector(SEL_CONTAINER)?.remove();
1504
1419
  } finally {
1505
1420
  this.#rendering = false;
1506
1421
  }
@@ -1522,7 +1437,6 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1522
1437
  this.#sessionData = await this.#fetchSession();
1523
1438
  if (this.#sessionData?.loggedIn && (this.#sessionData.userType === "active-subscription" || this.#sessionData.userType === "b2b-user")) {
1524
1439
  this.style.display = "none";
1525
- this.querySelector(SEL_CONTAINER)?.remove();
1526
1440
  return true;
1527
1441
  }
1528
1442
  return false;
@@ -1558,7 +1472,6 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1558
1472
  this.#paymentOptions = await this.#fetchPaymentOptions();
1559
1473
  if (!this.#paymentOptions?.apple_pay) {
1560
1474
  this.style.display = "none";
1561
- this.querySelector(SEL_CONTAINER)?.remove();
1562
1475
  return true;
1563
1476
  }
1564
1477
  return false;
@@ -1570,13 +1483,13 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1570
1483
  const template = document.createElement("template");
1571
1484
  template.innerHTML = apple_pay_button_template_default;
1572
1485
  this.appendChild(template.content.cloneNode(true));
1486
+ this.#updateDisabledState();
1487
+ trackExpressWalletImpression(this.#offer.sku_id, {
1488
+ entryPoint: this.#entryPoint,
1489
+ country: this.#country
1490
+ });
1573
1491
  const button = this.querySelector(SEL_BUTTON);
1574
- button.classList.add("wap-loading");
1575
- button.setAttribute("disabled", "");
1576
- button.setAttribute("aria-disabled", "true");
1577
- button.setAttribute("aria-busy", "true");
1578
1492
  button.addEventListener("click", () => {
1579
- if (button.classList.contains("wap-loading")) return;
1580
1493
  this.#openModal();
1581
1494
  });
1582
1495
  this.addEventListener("apple-pay-confirmed", (event) => {
@@ -1584,17 +1497,6 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1584
1497
  this.#initiateApplePay(skuId, country);
1585
1498
  });
1586
1499
  }
1587
- #finishLoading() {
1588
- const button = this.querySelector(SEL_BUTTON);
1589
- if (button) {
1590
- button.classList.remove("wap-loading");
1591
- this.#updateDisabledState();
1592
- trackExpressWalletImpression(this.#offer.sku_id, {
1593
- entryPoint: this.#entryPoint,
1594
- country: this.#country
1595
- });
1596
- }
1597
- }
1598
1500
  // ─── Private helpers ────────────────────────────────────────────────────────
1599
1501
  #updateDisabledState() {
1600
1502
  const button = this.querySelector(SEL_BUTTON);
@@ -1602,7 +1504,6 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1602
1504
  if (this.#offer) {
1603
1505
  button.removeAttribute("disabled");
1604
1506
  button.removeAttribute("aria-disabled");
1605
- button.removeAttribute("aria-busy");
1606
1507
  return;
1607
1508
  }
1608
1509
  button.setAttribute("disabled", "");
@@ -1654,6 +1555,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1654
1555
  onPaymentAuthorized: (event, session) => handlePaymentAuthorized(event, session, sessionData, {
1655
1556
  skuId,
1656
1557
  country,
1558
+ currency: offer.price?.currency_code ?? DEFAULT_CURRENCY,
1657
1559
  returnUrl: this.#returnUrl,
1658
1560
  queryString: buildQueryString(),
1659
1561
  supportedBillingCountries: this.#supportedBillingCountries,
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.1",
4
+ "version": "0.1.3-beta.3",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",