@economist/web-apple-pay 0.1.3-beta.10 → 0.1.3-beta.11

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
@@ -942,8 +942,8 @@ var ApplePayModal = class _ApplePayModal extends HTMLElement {
942
942
  () => this.close()
943
943
  );
944
944
  }
945
- open() {
946
- this.#recaptchaTokensPromise = getPurchaseRecaptchaTokens();
945
+ open(recaptchaTokensPromise) {
946
+ this.#recaptchaTokensPromise = recaptchaTokensPromise ?? getPurchaseRecaptchaTokens();
947
947
  this.#triggerElement = document.activeElement;
948
948
  document.body.appendChild(this);
949
949
  this.#keyHandler = (event) => {
@@ -1927,6 +1927,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1927
1927
  #returnUrl = "";
1928
1928
  #supportedBillingCountries = [];
1929
1929
  #entryPoint = "";
1930
+ #recaptchaTokensPromise = null;
1930
1931
  // ─── Public API ─────────────────────────────────────────────────────────────
1931
1932
  get offer() {
1932
1933
  return this.#offer;
@@ -1991,6 +1992,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1991
1992
  this.#paymentOptions = null;
1992
1993
  this.#returnUrl = "";
1993
1994
  this.#supportedBillingCountries = [];
1995
+ this.#recaptchaTokensPromise = null;
1994
1996
  this.querySelector(SEL_CONTAINER)?.remove();
1995
1997
  }
1996
1998
  // ─── Render pipeline ────────────────────────────────────────────────────────
@@ -2105,6 +2107,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
2105
2107
  if (button) {
2106
2108
  button.classList.remove("wap-loading");
2107
2109
  this.#updateDisabledState();
2110
+ this.#recaptchaTokensPromise = getPurchaseRecaptchaTokens();
2108
2111
  trackExpressWalletImpression(this.#offer.sku_id, {
2109
2112
  entryPoint: this.#entryPoint,
2110
2113
  country: this.#country
@@ -2143,7 +2146,8 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
2143
2146
  modal.onConfirm = (recaptchaTokens) => {
2144
2147
  this.#initiateApplePay(skuId, country, recaptchaTokens);
2145
2148
  };
2146
- modal.open();
2149
+ modal.open(this.#recaptchaTokensPromise ?? void 0);
2150
+ this.#recaptchaTokensPromise = getPurchaseRecaptchaTokens();
2147
2151
  }
2148
2152
  async #fetchSession() {
2149
2153
  try {
@@ -937,8 +937,8 @@ var ApplePayModal = class _ApplePayModal extends HTMLElement {
937
937
  () => this.close()
938
938
  );
939
939
  }
940
- open() {
941
- this.#recaptchaTokensPromise = getPurchaseRecaptchaTokens();
940
+ open(recaptchaTokensPromise) {
941
+ this.#recaptchaTokensPromise = recaptchaTokensPromise ?? getPurchaseRecaptchaTokens();
942
942
  this.#triggerElement = document.activeElement;
943
943
  document.body.appendChild(this);
944
944
  this.#keyHandler = (event) => {
@@ -1922,6 +1922,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1922
1922
  #returnUrl = "";
1923
1923
  #supportedBillingCountries = [];
1924
1924
  #entryPoint = "";
1925
+ #recaptchaTokensPromise = null;
1925
1926
  // ─── Public API ─────────────────────────────────────────────────────────────
1926
1927
  get offer() {
1927
1928
  return this.#offer;
@@ -1986,6 +1987,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1986
1987
  this.#paymentOptions = null;
1987
1988
  this.#returnUrl = "";
1988
1989
  this.#supportedBillingCountries = [];
1990
+ this.#recaptchaTokensPromise = null;
1989
1991
  this.querySelector(SEL_CONTAINER)?.remove();
1990
1992
  }
1991
1993
  // ─── Render pipeline ────────────────────────────────────────────────────────
@@ -2100,6 +2102,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
2100
2102
  if (button) {
2101
2103
  button.classList.remove("wap-loading");
2102
2104
  this.#updateDisabledState();
2105
+ this.#recaptchaTokensPromise = getPurchaseRecaptchaTokens();
2103
2106
  trackExpressWalletImpression(this.#offer.sku_id, {
2104
2107
  entryPoint: this.#entryPoint,
2105
2108
  country: this.#country
@@ -2138,7 +2141,8 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
2138
2141
  modal.onConfirm = (recaptchaTokens) => {
2139
2142
  this.#initiateApplePay(skuId, country, recaptchaTokens);
2140
2143
  };
2141
- modal.open();
2144
+ modal.open(this.#recaptchaTokensPromise ?? void 0);
2145
+ this.#recaptchaTokensPromise = getPurchaseRecaptchaTokens();
2142
2146
  }
2143
2147
  async #fetchSession() {
2144
2148
  try {
@@ -945,8 +945,8 @@ var ApplePayModal = class _ApplePayModal extends HTMLElement {
945
945
  () => this.close()
946
946
  );
947
947
  }
948
- open() {
949
- this.#recaptchaTokensPromise = getPurchaseRecaptchaTokens();
948
+ open(recaptchaTokensPromise) {
949
+ this.#recaptchaTokensPromise = recaptchaTokensPromise ?? getPurchaseRecaptchaTokens();
950
950
  this.#triggerElement = document.activeElement;
951
951
  document.body.appendChild(this);
952
952
  this.#keyHandler = (event) => {
@@ -1930,6 +1930,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1930
1930
  #returnUrl = "";
1931
1931
  #supportedBillingCountries = [];
1932
1932
  #entryPoint = "";
1933
+ #recaptchaTokensPromise = null;
1933
1934
  // ─── Public API ─────────────────────────────────────────────────────────────
1934
1935
  get offer() {
1935
1936
  return this.#offer;
@@ -1994,6 +1995,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1994
1995
  this.#paymentOptions = null;
1995
1996
  this.#returnUrl = "";
1996
1997
  this.#supportedBillingCountries = [];
1998
+ this.#recaptchaTokensPromise = null;
1997
1999
  this.querySelector(SEL_CONTAINER)?.remove();
1998
2000
  }
1999
2001
  // ─── Render pipeline ────────────────────────────────────────────────────────
@@ -2108,6 +2110,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
2108
2110
  if (button) {
2109
2111
  button.classList.remove("wap-loading");
2110
2112
  this.#updateDisabledState();
2113
+ this.#recaptchaTokensPromise = getPurchaseRecaptchaTokens();
2111
2114
  trackExpressWalletImpression(this.#offer.sku_id, {
2112
2115
  entryPoint: this.#entryPoint,
2113
2116
  country: this.#country
@@ -2146,7 +2149,8 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
2146
2149
  modal.onConfirm = (recaptchaTokens) => {
2147
2150
  this.#initiateApplePay(skuId, country, recaptchaTokens);
2148
2151
  };
2149
- modal.open();
2152
+ modal.open(this.#recaptchaTokensPromise ?? void 0);
2153
+ this.#recaptchaTokensPromise = getPurchaseRecaptchaTokens();
2150
2154
  }
2151
2155
  async #fetchSession() {
2152
2156
  try {
@@ -21,7 +21,7 @@ export declare class ApplePayModal extends HTMLElement {
21
21
  get country(): string;
22
22
  set country(value: string);
23
23
  connectedCallback(): void;
24
- open(): void;
24
+ open(recaptchaTokensPromise?: Promise<RecaptchaTokens>): void;
25
25
  close(): void;
26
26
  }
27
27
  export {};
@@ -937,8 +937,8 @@ var ApplePayModal = class _ApplePayModal extends HTMLElement {
937
937
  () => this.close()
938
938
  );
939
939
  }
940
- open() {
941
- this.#recaptchaTokensPromise = getPurchaseRecaptchaTokens();
940
+ open(recaptchaTokensPromise) {
941
+ this.#recaptchaTokensPromise = recaptchaTokensPromise ?? getPurchaseRecaptchaTokens();
942
942
  this.#triggerElement = document.activeElement;
943
943
  document.body.appendChild(this);
944
944
  this.#keyHandler = (event) => {
@@ -937,8 +937,8 @@ var ApplePayModal = class _ApplePayModal extends HTMLElement {
937
937
  () => this.close()
938
938
  );
939
939
  }
940
- open() {
941
- this.#recaptchaTokensPromise = getPurchaseRecaptchaTokens();
940
+ open(recaptchaTokensPromise) {
941
+ this.#recaptchaTokensPromise = recaptchaTokensPromise ?? getPurchaseRecaptchaTokens();
942
942
  this.#triggerElement = document.activeElement;
943
943
  document.body.appendChild(this);
944
944
  this.#keyHandler = (event) => {
@@ -1922,6 +1922,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1922
1922
  #returnUrl = "";
1923
1923
  #supportedBillingCountries = [];
1924
1924
  #entryPoint = "";
1925
+ #recaptchaTokensPromise = null;
1925
1926
  // ─── Public API ─────────────────────────────────────────────────────────────
1926
1927
  get offer() {
1927
1928
  return this.#offer;
@@ -1986,6 +1987,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1986
1987
  this.#paymentOptions = null;
1987
1988
  this.#returnUrl = "";
1988
1989
  this.#supportedBillingCountries = [];
1990
+ this.#recaptchaTokensPromise = null;
1989
1991
  this.querySelector(SEL_CONTAINER)?.remove();
1990
1992
  }
1991
1993
  // ─── Render pipeline ────────────────────────────────────────────────────────
@@ -2100,6 +2102,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
2100
2102
  if (button) {
2101
2103
  button.classList.remove("wap-loading");
2102
2104
  this.#updateDisabledState();
2105
+ this.#recaptchaTokensPromise = getPurchaseRecaptchaTokens();
2103
2106
  trackExpressWalletImpression(this.#offer.sku_id, {
2104
2107
  entryPoint: this.#entryPoint,
2105
2108
  country: this.#country
@@ -2138,7 +2141,8 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
2138
2141
  modal.onConfirm = (recaptchaTokens) => {
2139
2142
  this.#initiateApplePay(skuId, country, recaptchaTokens);
2140
2143
  };
2141
- modal.open();
2144
+ modal.open(this.#recaptchaTokensPromise ?? void 0);
2145
+ this.#recaptchaTokensPromise = getPurchaseRecaptchaTokens();
2142
2146
  }
2143
2147
  async #fetchSession() {
2144
2148
  try {
package/dist/src/index.js CHANGED
@@ -942,8 +942,8 @@ var ApplePayModal = class _ApplePayModal extends HTMLElement {
942
942
  () => this.close()
943
943
  );
944
944
  }
945
- open() {
946
- this.#recaptchaTokensPromise = getPurchaseRecaptchaTokens();
945
+ open(recaptchaTokensPromise) {
946
+ this.#recaptchaTokensPromise = recaptchaTokensPromise ?? getPurchaseRecaptchaTokens();
947
947
  this.#triggerElement = document.activeElement;
948
948
  document.body.appendChild(this);
949
949
  this.#keyHandler = (event) => {
@@ -1927,6 +1927,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1927
1927
  #returnUrl = "";
1928
1928
  #supportedBillingCountries = [];
1929
1929
  #entryPoint = "";
1930
+ #recaptchaTokensPromise = null;
1930
1931
  // ─── Public API ─────────────────────────────────────────────────────────────
1931
1932
  get offer() {
1932
1933
  return this.#offer;
@@ -1991,6 +1992,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1991
1992
  this.#paymentOptions = null;
1992
1993
  this.#returnUrl = "";
1993
1994
  this.#supportedBillingCountries = [];
1995
+ this.#recaptchaTokensPromise = null;
1994
1996
  this.querySelector(SEL_CONTAINER)?.remove();
1995
1997
  }
1996
1998
  // ─── Render pipeline ────────────────────────────────────────────────────────
@@ -2105,6 +2107,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
2105
2107
  if (button) {
2106
2108
  button.classList.remove("wap-loading");
2107
2109
  this.#updateDisabledState();
2110
+ this.#recaptchaTokensPromise = getPurchaseRecaptchaTokens();
2108
2111
  trackExpressWalletImpression(this.#offer.sku_id, {
2109
2112
  entryPoint: this.#entryPoint,
2110
2113
  country: this.#country
@@ -2143,7 +2146,8 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
2143
2146
  modal.onConfirm = (recaptchaTokens) => {
2144
2147
  this.#initiateApplePay(skuId, country, recaptchaTokens);
2145
2148
  };
2146
- modal.open();
2149
+ modal.open(this.#recaptchaTokensPromise ?? void 0);
2150
+ this.#recaptchaTokensPromise = getPurchaseRecaptchaTokens();
2147
2151
  }
2148
2152
  async #fetchSession() {
2149
2153
  try {
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.10",
4
+ "version": "0.1.3-beta.11",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",