@economist/web-apple-pay 0.1.1-beta.0
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/README.md +186 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1642 -0
- package/dist/src/apple-pay-button.d.ts +45 -0
- package/dist/src/apple-pay-button.js +1621 -0
- package/dist/src/apple-pay-button.stories.js +1934 -0
- package/dist/src/apple-pay-logo.d.ts +1 -0
- package/dist/src/apple-pay-logo.js +14 -0
- package/dist/src/apple-pay-modal.d.ts +12 -0
- package/dist/src/apple-pay-modal.js +442 -0
- package/dist/src/apple-pay-modal.stories.js +1778 -0
- package/dist/src/clients/payment-checkout/apple-session.d.ts +18 -0
- package/dist/src/clients/payment-checkout/apple-session.js +243 -0
- package/dist/src/clients/payment-checkout/billing-contact-details.d.ts +21 -0
- package/dist/src/clients/payment-checkout/billing-contact-details.js +109 -0
- package/dist/src/clients/payment-checkout/config.d.ts +9 -0
- package/dist/src/clients/payment-checkout/config.js +23 -0
- package/dist/src/clients/payment-checkout/contact-validation.d.ts +21 -0
- package/dist/src/clients/payment-checkout/contact-validation.js +50 -0
- package/dist/src/clients/payment-checkout/detects.d.ts +3 -0
- package/dist/src/clients/payment-checkout/detects.js +56 -0
- package/dist/src/clients/payment-checkout/index.d.ts +5 -0
- package/dist/src/clients/payment-checkout/index.js +83 -0
- package/dist/src/clients/payment-checkout/messages.d.ts +33 -0
- package/dist/src/clients/payment-checkout/messages.js +19 -0
- package/dist/src/clients/payment-checkout/payment-handler.d.ts +36 -0
- package/dist/src/clients/payment-checkout/payment-handler.js +389 -0
- package/dist/src/clients/payment-checkout/session.d.ts +2 -0
- package/dist/src/clients/payment-checkout/session.js +67 -0
- package/dist/src/clients/payment-checkout/shipping-contact-details.d.ts +10 -0
- package/dist/src/clients/payment-checkout/shipping-contact-details.js +83 -0
- package/dist/src/clients/payment-checkout/types.d.ts +118 -0
- package/dist/src/clients/payment-checkout/types.js +14 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/index.js +1642 -0
- package/dist/src/stories/fixtures/offer.d.ts +2 -0
- package/dist/src/stories/fixtures/offer.js +28 -0
- package/dist/src/stories/utils/story-env.d.ts +11 -0
- package/dist/src/stories/utils/story-env.js +148 -0
- package/dist/src/types/html-template.d.js +0 -0
- package/dist/src/types/offer.types.d.ts +73 -0
- package/dist/src/types/offer.types.js +0 -0
- package/dist/src/utils/billing-countries.d.ts +19 -0
- package/dist/src/utils/billing-countries.js +263 -0
- package/dist/src/utils/define.d.ts +1 -0
- package/dist/src/utils/define.js +9 -0
- package/dist/src/utils/expressCheckoutRedirect.d.ts +55 -0
- package/dist/src/utils/expressCheckoutRedirect.js +46 -0
- package/dist/src/utils/expressCheckoutTracking.d.ts +64 -0
- package/dist/src/utils/expressCheckoutTracking.js +84 -0
- package/dist/src/utils/pricing.d.ts +1 -0
- package/dist/src/utils/pricing.js +60 -0
- package/dist/src/utils/recaptcha.d.ts +22 -0
- package/dist/src/utils/recaptcha.js +54 -0
- package/package.json +64 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Offer, ProductVariant } from './types/offer.types';
|
|
2
|
+
export declare const APPLE_PAY_EXCLUDED_VARIANTS: readonly ProductVariant[];
|
|
3
|
+
export declare class ApplePayButton extends HTMLElement {
|
|
4
|
+
#private;
|
|
5
|
+
static readonly tag = "teg-apple-pay-button";
|
|
6
|
+
static define(): void;
|
|
7
|
+
/**
|
|
8
|
+
* Creates and configures an ApplePayButton if the feature flag is present.
|
|
9
|
+
*/
|
|
10
|
+
static createIfEnabled(offer: Offer | undefined, country: string, entryPoint: string): ApplePayButton | null;
|
|
11
|
+
get offer(): Offer | null;
|
|
12
|
+
set offer(value: Offer | null);
|
|
13
|
+
get country(): string;
|
|
14
|
+
set country(value: string);
|
|
15
|
+
get entryPoint(): string;
|
|
16
|
+
set entryPoint(value: string);
|
|
17
|
+
/**
|
|
18
|
+
* Awaitable contract for the component's current render lifecycle.
|
|
19
|
+
*
|
|
20
|
+
* - If called **after** the element has been appended to the DOM, resolves
|
|
21
|
+
* once `connectedCallback` finishes — whether Apple Pay rendered
|
|
22
|
+
* successfully or was hidden (unavailable / suppressed by session).
|
|
23
|
+
* - If called **before** the element is appended (or if it has never been
|
|
24
|
+
* connected), resolves immediately to `undefined`. It does **not** wait
|
|
25
|
+
* for a future connection, so always `await whenReady()` after `appendChild`:
|
|
26
|
+
*
|
|
27
|
+
* ```ts
|
|
28
|
+
* container.appendChild(btn); // browser fires connectedCallback
|
|
29
|
+
* await btn.whenReady(); // waits for render to finish
|
|
30
|
+
* if (btn.style.display !== 'none') { /* available *\/ }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
whenReady(): Promise<void>;
|
|
34
|
+
connectedCallback(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Resets all render state when the element is removed from the DOM.
|
|
37
|
+
*
|
|
38
|
+
* A shared library component cannot assume it won't be moved in the DOM
|
|
39
|
+
* (e.g. lazy panels, SPA route changes). Resetting on disconnect means
|
|
40
|
+
* reattach always triggers a fresh `#run()` — new session check, new payment
|
|
41
|
+
* options fetch, fresh event listeners — preventing stale data from persisting
|
|
42
|
+
* and eliminating the implicit reliance on the DOM as a render-state flag.
|
|
43
|
+
*/
|
|
44
|
+
disconnectedCallback(): void;
|
|
45
|
+
}
|