@economist/web-apple-pay 1.6.0 → 1.6.1
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 +4 -4
- package/dist/src/apple-pay-button.js +4 -4
- package/dist/src/apple-pay-button.stories.js +4 -4
- package/dist/src/apple-pay-modal.stories.js +4 -4
- package/dist/src/clients/payment-checkout/index.js +1 -1
- package/dist/src/clients/payment-checkout/types.d.ts +6 -32
- package/dist/src/index.js +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -545,7 +545,7 @@ var getPaymentOptions = (data) => {
|
|
|
545
545
|
const { sku, countryCode, currencyCode, checkoutUrl } = data;
|
|
546
546
|
const params = new URLSearchParams({ checkoutUrl });
|
|
547
547
|
return apiFetch(
|
|
548
|
-
`/
|
|
548
|
+
`/v1/wallet/payment-options/sku/${sku}/${countryCode}/${currencyCode}?${params}`,
|
|
549
549
|
{ method: "GET" }
|
|
550
550
|
);
|
|
551
551
|
};
|
|
@@ -1464,12 +1464,12 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
1464
1464
|
);
|
|
1465
1465
|
}
|
|
1466
1466
|
/**
|
|
1467
|
-
* Returns `true` (hide) when
|
|
1467
|
+
* Returns `true` (hide) when the wallet BFF reports Apple Pay is unavailable
|
|
1468
1468
|
* for this offer. The response is cached and reused in `#initiateApplePay`.
|
|
1469
1469
|
*/
|
|
1470
1470
|
async #fetchAndCacheOptions() {
|
|
1471
1471
|
this.#paymentOptions = await this.#fetchPaymentOptions();
|
|
1472
|
-
if (!this.#paymentOptions?.
|
|
1472
|
+
if (!this.#paymentOptions?.apple_pay) {
|
|
1473
1473
|
this.style.display = "none";
|
|
1474
1474
|
return true;
|
|
1475
1475
|
}
|
|
@@ -1545,7 +1545,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
1545
1545
|
return {
|
|
1546
1546
|
countryCode: country,
|
|
1547
1547
|
currencyCode: offer.price?.currency_code ?? DEFAULT_CURRENCY,
|
|
1548
|
-
supportedNetworks: paymentOptions.
|
|
1548
|
+
supportedNetworks: paymentOptions.apple_pay.settings.supported_networks,
|
|
1549
1549
|
totalAmount,
|
|
1550
1550
|
totalLabel: TOTAL_LABEL,
|
|
1551
1551
|
skuId,
|
|
@@ -540,7 +540,7 @@ var getPaymentOptions = (data) => {
|
|
|
540
540
|
const { sku, countryCode, currencyCode, checkoutUrl } = data;
|
|
541
541
|
const params = new URLSearchParams({ checkoutUrl });
|
|
542
542
|
return apiFetch(
|
|
543
|
-
`/
|
|
543
|
+
`/v1/wallet/payment-options/sku/${sku}/${countryCode}/${currencyCode}?${params}`,
|
|
544
544
|
{ method: "GET" }
|
|
545
545
|
);
|
|
546
546
|
};
|
|
@@ -1459,12 +1459,12 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
1459
1459
|
);
|
|
1460
1460
|
}
|
|
1461
1461
|
/**
|
|
1462
|
-
* Returns `true` (hide) when
|
|
1462
|
+
* Returns `true` (hide) when the wallet BFF reports Apple Pay is unavailable
|
|
1463
1463
|
* for this offer. The response is cached and reused in `#initiateApplePay`.
|
|
1464
1464
|
*/
|
|
1465
1465
|
async #fetchAndCacheOptions() {
|
|
1466
1466
|
this.#paymentOptions = await this.#fetchPaymentOptions();
|
|
1467
|
-
if (!this.#paymentOptions?.
|
|
1467
|
+
if (!this.#paymentOptions?.apple_pay) {
|
|
1468
1468
|
this.style.display = "none";
|
|
1469
1469
|
return true;
|
|
1470
1470
|
}
|
|
@@ -1540,7 +1540,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
1540
1540
|
return {
|
|
1541
1541
|
countryCode: country,
|
|
1542
1542
|
currencyCode: offer.price?.currency_code ?? DEFAULT_CURRENCY,
|
|
1543
|
-
supportedNetworks: paymentOptions.
|
|
1543
|
+
supportedNetworks: paymentOptions.apple_pay.settings.supported_networks,
|
|
1544
1544
|
totalAmount,
|
|
1545
1545
|
totalLabel: TOTAL_LABEL,
|
|
1546
1546
|
skuId,
|
|
@@ -548,7 +548,7 @@ var getPaymentOptions = (data) => {
|
|
|
548
548
|
const { sku, countryCode, currencyCode, checkoutUrl } = data;
|
|
549
549
|
const params = new URLSearchParams({ checkoutUrl });
|
|
550
550
|
return apiFetch(
|
|
551
|
-
`/
|
|
551
|
+
`/v1/wallet/payment-options/sku/${sku}/${countryCode}/${currencyCode}?${params}`,
|
|
552
552
|
{ method: "GET" }
|
|
553
553
|
);
|
|
554
554
|
};
|
|
@@ -1467,12 +1467,12 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
1467
1467
|
);
|
|
1468
1468
|
}
|
|
1469
1469
|
/**
|
|
1470
|
-
* Returns `true` (hide) when
|
|
1470
|
+
* Returns `true` (hide) when the wallet BFF reports Apple Pay is unavailable
|
|
1471
1471
|
* for this offer. The response is cached and reused in `#initiateApplePay`.
|
|
1472
1472
|
*/
|
|
1473
1473
|
async #fetchAndCacheOptions() {
|
|
1474
1474
|
this.#paymentOptions = await this.#fetchPaymentOptions();
|
|
1475
|
-
if (!this.#paymentOptions?.
|
|
1475
|
+
if (!this.#paymentOptions?.apple_pay) {
|
|
1476
1476
|
this.style.display = "none";
|
|
1477
1477
|
return true;
|
|
1478
1478
|
}
|
|
@@ -1548,7 +1548,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
1548
1548
|
return {
|
|
1549
1549
|
countryCode: country,
|
|
1550
1550
|
currencyCode: offer.price?.currency_code ?? DEFAULT_CURRENCY,
|
|
1551
|
-
supportedNetworks: paymentOptions.
|
|
1551
|
+
supportedNetworks: paymentOptions.apple_pay.settings.supported_networks,
|
|
1552
1552
|
totalAmount,
|
|
1553
1553
|
totalLabel: TOTAL_LABEL,
|
|
1554
1554
|
skuId,
|
|
@@ -540,7 +540,7 @@ var getPaymentOptions = (data) => {
|
|
|
540
540
|
const { sku, countryCode, currencyCode, checkoutUrl } = data;
|
|
541
541
|
const params = new URLSearchParams({ checkoutUrl });
|
|
542
542
|
return apiFetch(
|
|
543
|
-
`/
|
|
543
|
+
`/v1/wallet/payment-options/sku/${sku}/${countryCode}/${currencyCode}?${params}`,
|
|
544
544
|
{ method: "GET" }
|
|
545
545
|
);
|
|
546
546
|
};
|
|
@@ -1459,12 +1459,12 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
1459
1459
|
);
|
|
1460
1460
|
}
|
|
1461
1461
|
/**
|
|
1462
|
-
* Returns `true` (hide) when
|
|
1462
|
+
* Returns `true` (hide) when the wallet BFF reports Apple Pay is unavailable
|
|
1463
1463
|
* for this offer. The response is cached and reused in `#initiateApplePay`.
|
|
1464
1464
|
*/
|
|
1465
1465
|
async #fetchAndCacheOptions() {
|
|
1466
1466
|
this.#paymentOptions = await this.#fetchPaymentOptions();
|
|
1467
|
-
if (!this.#paymentOptions?.
|
|
1467
|
+
if (!this.#paymentOptions?.apple_pay) {
|
|
1468
1468
|
this.style.display = "none";
|
|
1469
1469
|
return true;
|
|
1470
1470
|
}
|
|
@@ -1540,7 +1540,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
1540
1540
|
return {
|
|
1541
1541
|
countryCode: country,
|
|
1542
1542
|
currencyCode: offer.price?.currency_code ?? DEFAULT_CURRENCY,
|
|
1543
|
-
supportedNetworks: paymentOptions.
|
|
1543
|
+
supportedNetworks: paymentOptions.apple_pay.settings.supported_networks,
|
|
1544
1544
|
totalAmount,
|
|
1545
1545
|
totalLabel: TOTAL_LABEL,
|
|
1546
1546
|
skuId,
|
|
@@ -58,7 +58,7 @@ var getPaymentOptions = (data) => {
|
|
|
58
58
|
const { sku, countryCode, currencyCode, checkoutUrl } = data;
|
|
59
59
|
const params = new URLSearchParams({ checkoutUrl });
|
|
60
60
|
return apiFetch(
|
|
61
|
-
`/
|
|
61
|
+
`/v1/wallet/payment-options/sku/${sku}/${countryCode}/${currencyCode}?${params}`,
|
|
62
62
|
{ method: "GET" }
|
|
63
63
|
);
|
|
64
64
|
};
|
|
@@ -10,40 +10,14 @@ export type PaymentOptionsRequest = {
|
|
|
10
10
|
checkoutUrl: string;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* Relevant subset of the wallet-payments-api BFF GET /v1/wallet/payment-options/sku/:sku/:countryCode/:currencyCode response.
|
|
14
|
+
* Only the apple_pay field is consumed by this package.
|
|
15
15
|
*/
|
|
16
16
|
export type PaymentOptionsResponse = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
supportedNetworks: string[];
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
payPal?: {
|
|
25
|
-
provider: string;
|
|
26
|
-
};
|
|
27
|
-
googlePay?: {
|
|
28
|
-
provider: string;
|
|
29
|
-
settings: {
|
|
30
|
-
supportedNetworks: string[];
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
creditDebit?: {
|
|
34
|
-
provider: string;
|
|
35
|
-
settings: {
|
|
36
|
-
tenantId: string;
|
|
37
|
-
id: string;
|
|
38
|
-
token: string;
|
|
39
|
-
signature: string;
|
|
40
|
-
key: string;
|
|
41
|
-
locale: string;
|
|
42
|
-
url: string;
|
|
43
|
-
paymentGateway: string;
|
|
44
|
-
height: number;
|
|
45
|
-
supportedNetworks: string[];
|
|
46
|
-
};
|
|
17
|
+
apple_pay?: {
|
|
18
|
+
provider: string;
|
|
19
|
+
settings: {
|
|
20
|
+
supported_networks: string[];
|
|
47
21
|
};
|
|
48
22
|
};
|
|
49
23
|
};
|
package/dist/src/index.js
CHANGED
|
@@ -545,7 +545,7 @@ var getPaymentOptions = (data) => {
|
|
|
545
545
|
const { sku, countryCode, currencyCode, checkoutUrl } = data;
|
|
546
546
|
const params = new URLSearchParams({ checkoutUrl });
|
|
547
547
|
return apiFetch(
|
|
548
|
-
`/
|
|
548
|
+
`/v1/wallet/payment-options/sku/${sku}/${countryCode}/${currencyCode}?${params}`,
|
|
549
549
|
{ method: "GET" }
|
|
550
550
|
);
|
|
551
551
|
};
|
|
@@ -1464,12 +1464,12 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
1464
1464
|
);
|
|
1465
1465
|
}
|
|
1466
1466
|
/**
|
|
1467
|
-
* Returns `true` (hide) when
|
|
1467
|
+
* Returns `true` (hide) when the wallet BFF reports Apple Pay is unavailable
|
|
1468
1468
|
* for this offer. The response is cached and reused in `#initiateApplePay`.
|
|
1469
1469
|
*/
|
|
1470
1470
|
async #fetchAndCacheOptions() {
|
|
1471
1471
|
this.#paymentOptions = await this.#fetchPaymentOptions();
|
|
1472
|
-
if (!this.#paymentOptions?.
|
|
1472
|
+
if (!this.#paymentOptions?.apple_pay) {
|
|
1473
1473
|
this.style.display = "none";
|
|
1474
1474
|
return true;
|
|
1475
1475
|
}
|
|
@@ -1545,7 +1545,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
1545
1545
|
return {
|
|
1546
1546
|
countryCode: country,
|
|
1547
1547
|
currencyCode: offer.price?.currency_code ?? DEFAULT_CURRENCY,
|
|
1548
|
-
supportedNetworks: paymentOptions.
|
|
1548
|
+
supportedNetworks: paymentOptions.apple_pay.settings.supported_networks,
|
|
1549
1549
|
totalAmount,
|
|
1550
1550
|
totalLabel: TOTAL_LABEL,
|
|
1551
1551
|
skuId,
|