@economist/web-apple-pay 0.1.3-beta.40 → 0.1.3-beta.41
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
|
@@ -2109,8 +2109,16 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
2109
2109
|
*/
|
|
2110
2110
|
async #fetchAndCacheOptions() {
|
|
2111
2111
|
this.#paymentOptions = await this.#fetchPaymentOptions();
|
|
2112
|
-
if (!this.#paymentOptions
|
|
2113
|
-
console.
|
|
2112
|
+
if (!this.#paymentOptions) {
|
|
2113
|
+
console.warn("[web-apple-pay] button removed from DOM \u2014 reason: getPaymentOptions threw an error (see previous log for details)");
|
|
2114
|
+
this.style.display = "none";
|
|
2115
|
+
this.querySelector(SEL_CONTAINER)?.remove();
|
|
2116
|
+
return true;
|
|
2117
|
+
}
|
|
2118
|
+
if (!this.#paymentOptions.options?.apple_pay) {
|
|
2119
|
+
console.log("[web-apple-pay] button removed from DOM \u2014 reason: BFF responded but apple_pay is absent from payment options", {
|
|
2120
|
+
receivedOptions: this.#paymentOptions.options
|
|
2121
|
+
});
|
|
2114
2122
|
this.style.display = "none";
|
|
2115
2123
|
this.querySelector(SEL_CONTAINER)?.remove();
|
|
2116
2124
|
return true;
|
|
@@ -2208,13 +2216,16 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
2208
2216
|
}
|
|
2209
2217
|
async #fetchPaymentOptions() {
|
|
2210
2218
|
try {
|
|
2211
|
-
|
|
2219
|
+
const options = await getPaymentOptions({
|
|
2212
2220
|
sku: this.#offer.sku_id,
|
|
2213
2221
|
countryCode: this.#country,
|
|
2214
2222
|
currencyCode: this.#offer.price?.currency_code ?? DEFAULT_CURRENCY,
|
|
2215
2223
|
checkoutUrl: this.#returnUrl
|
|
2216
2224
|
});
|
|
2217
|
-
|
|
2225
|
+
console.log("[web-apple-pay] getPaymentOptions response received", options);
|
|
2226
|
+
return options;
|
|
2227
|
+
} catch (error) {
|
|
2228
|
+
console.warn("[web-apple-pay] getPaymentOptions fetch failed \u2014 returning null", error);
|
|
2218
2229
|
return null;
|
|
2219
2230
|
}
|
|
2220
2231
|
}
|
|
@@ -2104,8 +2104,16 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
2104
2104
|
*/
|
|
2105
2105
|
async #fetchAndCacheOptions() {
|
|
2106
2106
|
this.#paymentOptions = await this.#fetchPaymentOptions();
|
|
2107
|
-
if (!this.#paymentOptions
|
|
2108
|
-
console.
|
|
2107
|
+
if (!this.#paymentOptions) {
|
|
2108
|
+
console.warn("[web-apple-pay] button removed from DOM \u2014 reason: getPaymentOptions threw an error (see previous log for details)");
|
|
2109
|
+
this.style.display = "none";
|
|
2110
|
+
this.querySelector(SEL_CONTAINER)?.remove();
|
|
2111
|
+
return true;
|
|
2112
|
+
}
|
|
2113
|
+
if (!this.#paymentOptions.options?.apple_pay) {
|
|
2114
|
+
console.log("[web-apple-pay] button removed from DOM \u2014 reason: BFF responded but apple_pay is absent from payment options", {
|
|
2115
|
+
receivedOptions: this.#paymentOptions.options
|
|
2116
|
+
});
|
|
2109
2117
|
this.style.display = "none";
|
|
2110
2118
|
this.querySelector(SEL_CONTAINER)?.remove();
|
|
2111
2119
|
return true;
|
|
@@ -2203,13 +2211,16 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
2203
2211
|
}
|
|
2204
2212
|
async #fetchPaymentOptions() {
|
|
2205
2213
|
try {
|
|
2206
|
-
|
|
2214
|
+
const options = await getPaymentOptions({
|
|
2207
2215
|
sku: this.#offer.sku_id,
|
|
2208
2216
|
countryCode: this.#country,
|
|
2209
2217
|
currencyCode: this.#offer.price?.currency_code ?? DEFAULT_CURRENCY,
|
|
2210
2218
|
checkoutUrl: this.#returnUrl
|
|
2211
2219
|
});
|
|
2212
|
-
|
|
2220
|
+
console.log("[web-apple-pay] getPaymentOptions response received", options);
|
|
2221
|
+
return options;
|
|
2222
|
+
} catch (error) {
|
|
2223
|
+
console.warn("[web-apple-pay] getPaymentOptions fetch failed \u2014 returning null", error);
|
|
2213
2224
|
return null;
|
|
2214
2225
|
}
|
|
2215
2226
|
}
|
|
@@ -2112,8 +2112,16 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
2112
2112
|
*/
|
|
2113
2113
|
async #fetchAndCacheOptions() {
|
|
2114
2114
|
this.#paymentOptions = await this.#fetchPaymentOptions();
|
|
2115
|
-
if (!this.#paymentOptions
|
|
2116
|
-
console.
|
|
2115
|
+
if (!this.#paymentOptions) {
|
|
2116
|
+
console.warn("[web-apple-pay] button removed from DOM \u2014 reason: getPaymentOptions threw an error (see previous log for details)");
|
|
2117
|
+
this.style.display = "none";
|
|
2118
|
+
this.querySelector(SEL_CONTAINER)?.remove();
|
|
2119
|
+
return true;
|
|
2120
|
+
}
|
|
2121
|
+
if (!this.#paymentOptions.options?.apple_pay) {
|
|
2122
|
+
console.log("[web-apple-pay] button removed from DOM \u2014 reason: BFF responded but apple_pay is absent from payment options", {
|
|
2123
|
+
receivedOptions: this.#paymentOptions.options
|
|
2124
|
+
});
|
|
2117
2125
|
this.style.display = "none";
|
|
2118
2126
|
this.querySelector(SEL_CONTAINER)?.remove();
|
|
2119
2127
|
return true;
|
|
@@ -2211,13 +2219,16 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
2211
2219
|
}
|
|
2212
2220
|
async #fetchPaymentOptions() {
|
|
2213
2221
|
try {
|
|
2214
|
-
|
|
2222
|
+
const options = await getPaymentOptions({
|
|
2215
2223
|
sku: this.#offer.sku_id,
|
|
2216
2224
|
countryCode: this.#country,
|
|
2217
2225
|
currencyCode: this.#offer.price?.currency_code ?? DEFAULT_CURRENCY,
|
|
2218
2226
|
checkoutUrl: this.#returnUrl
|
|
2219
2227
|
});
|
|
2220
|
-
|
|
2228
|
+
console.log("[web-apple-pay] getPaymentOptions response received", options);
|
|
2229
|
+
return options;
|
|
2230
|
+
} catch (error) {
|
|
2231
|
+
console.warn("[web-apple-pay] getPaymentOptions fetch failed \u2014 returning null", error);
|
|
2221
2232
|
return null;
|
|
2222
2233
|
}
|
|
2223
2234
|
}
|
|
@@ -2104,8 +2104,16 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
2104
2104
|
*/
|
|
2105
2105
|
async #fetchAndCacheOptions() {
|
|
2106
2106
|
this.#paymentOptions = await this.#fetchPaymentOptions();
|
|
2107
|
-
if (!this.#paymentOptions
|
|
2108
|
-
console.
|
|
2107
|
+
if (!this.#paymentOptions) {
|
|
2108
|
+
console.warn("[web-apple-pay] button removed from DOM \u2014 reason: getPaymentOptions threw an error (see previous log for details)");
|
|
2109
|
+
this.style.display = "none";
|
|
2110
|
+
this.querySelector(SEL_CONTAINER)?.remove();
|
|
2111
|
+
return true;
|
|
2112
|
+
}
|
|
2113
|
+
if (!this.#paymentOptions.options?.apple_pay) {
|
|
2114
|
+
console.log("[web-apple-pay] button removed from DOM \u2014 reason: BFF responded but apple_pay is absent from payment options", {
|
|
2115
|
+
receivedOptions: this.#paymentOptions.options
|
|
2116
|
+
});
|
|
2109
2117
|
this.style.display = "none";
|
|
2110
2118
|
this.querySelector(SEL_CONTAINER)?.remove();
|
|
2111
2119
|
return true;
|
|
@@ -2203,13 +2211,16 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
2203
2211
|
}
|
|
2204
2212
|
async #fetchPaymentOptions() {
|
|
2205
2213
|
try {
|
|
2206
|
-
|
|
2214
|
+
const options = await getPaymentOptions({
|
|
2207
2215
|
sku: this.#offer.sku_id,
|
|
2208
2216
|
countryCode: this.#country,
|
|
2209
2217
|
currencyCode: this.#offer.price?.currency_code ?? DEFAULT_CURRENCY,
|
|
2210
2218
|
checkoutUrl: this.#returnUrl
|
|
2211
2219
|
});
|
|
2212
|
-
|
|
2220
|
+
console.log("[web-apple-pay] getPaymentOptions response received", options);
|
|
2221
|
+
return options;
|
|
2222
|
+
} catch (error) {
|
|
2223
|
+
console.warn("[web-apple-pay] getPaymentOptions fetch failed \u2014 returning null", error);
|
|
2213
2224
|
return null;
|
|
2214
2225
|
}
|
|
2215
2226
|
}
|
package/dist/src/index.js
CHANGED
|
@@ -2109,8 +2109,16 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
2109
2109
|
*/
|
|
2110
2110
|
async #fetchAndCacheOptions() {
|
|
2111
2111
|
this.#paymentOptions = await this.#fetchPaymentOptions();
|
|
2112
|
-
if (!this.#paymentOptions
|
|
2113
|
-
console.
|
|
2112
|
+
if (!this.#paymentOptions) {
|
|
2113
|
+
console.warn("[web-apple-pay] button removed from DOM \u2014 reason: getPaymentOptions threw an error (see previous log for details)");
|
|
2114
|
+
this.style.display = "none";
|
|
2115
|
+
this.querySelector(SEL_CONTAINER)?.remove();
|
|
2116
|
+
return true;
|
|
2117
|
+
}
|
|
2118
|
+
if (!this.#paymentOptions.options?.apple_pay) {
|
|
2119
|
+
console.log("[web-apple-pay] button removed from DOM \u2014 reason: BFF responded but apple_pay is absent from payment options", {
|
|
2120
|
+
receivedOptions: this.#paymentOptions.options
|
|
2121
|
+
});
|
|
2114
2122
|
this.style.display = "none";
|
|
2115
2123
|
this.querySelector(SEL_CONTAINER)?.remove();
|
|
2116
2124
|
return true;
|
|
@@ -2208,13 +2216,16 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
2208
2216
|
}
|
|
2209
2217
|
async #fetchPaymentOptions() {
|
|
2210
2218
|
try {
|
|
2211
|
-
|
|
2219
|
+
const options = await getPaymentOptions({
|
|
2212
2220
|
sku: this.#offer.sku_id,
|
|
2213
2221
|
countryCode: this.#country,
|
|
2214
2222
|
currencyCode: this.#offer.price?.currency_code ?? DEFAULT_CURRENCY,
|
|
2215
2223
|
checkoutUrl: this.#returnUrl
|
|
2216
2224
|
});
|
|
2217
|
-
|
|
2225
|
+
console.log("[web-apple-pay] getPaymentOptions response received", options);
|
|
2226
|
+
return options;
|
|
2227
|
+
} catch (error) {
|
|
2228
|
+
console.warn("[web-apple-pay] getPaymentOptions fetch failed \u2014 returning null", error);
|
|
2218
2229
|
return null;
|
|
2219
2230
|
}
|
|
2220
2231
|
}
|
package/package.json
CHANGED