@economist/web-apple-pay 2.0.0-beta.2 → 2.0.0-beta.4

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.
Files changed (56) hide show
  1. package/README.md +20 -12
  2. package/dist/index.js +681 -361
  3. package/dist/src/apple-pay-button.d.ts +18 -16
  4. package/dist/src/apple-pay-button.js +670 -352
  5. package/dist/src/apple-pay-button.stories.js +667 -351
  6. package/dist/src/apple-pay-modal.js +44 -39
  7. package/dist/src/apple-pay-modal.stories.js +667 -351
  8. package/dist/src/clients/payment-checkout/apple-session.d.ts +14 -1
  9. package/dist/src/clients/payment-checkout/apple-session.js +66 -17
  10. package/dist/src/clients/payment-checkout/billing-contact-details.js +43 -0
  11. package/dist/src/clients/payment-checkout/delivery-contact-details.d.ts +16 -0
  12. package/dist/src/clients/payment-checkout/delivery-contact-details.js +397 -0
  13. package/dist/src/clients/payment-checkout/detects.d.ts +5 -0
  14. package/dist/src/clients/payment-checkout/detects.js +18 -14
  15. package/dist/src/clients/payment-checkout/messages.d.ts +6 -0
  16. package/dist/src/clients/payment-checkout/messages.js +7 -1
  17. package/dist/src/clients/payment-checkout/payment-handler.d.ts +10 -1
  18. package/dist/src/clients/payment-checkout/payment-handler.js +414 -36
  19. package/dist/src/clients/payment-checkout/session.js +13 -1
  20. package/dist/src/clients/payment-checkout/types.d.ts +11 -0
  21. package/dist/src/constants.d.ts +7 -28
  22. package/dist/src/constants.js +3 -7
  23. package/dist/src/index.d.ts +2 -4
  24. package/dist/src/index.js +681 -361
  25. package/dist/src/types/offer.types.d.ts +1 -1
  26. package/dist/src/utils/address-rules.d.ts +29 -0
  27. package/dist/src/utils/address-rules.js +260 -0
  28. package/dist/src/utils/addressParityFlag.d.ts +13 -0
  29. package/dist/src/utils/addressParityFlag.js +5 -0
  30. package/dist/src/utils/applePayExpressEligibility.d.ts +5 -6
  31. package/dist/src/utils/applePayExpressEligibility.js +2 -2
  32. package/dist/src/utils/billing-countries.js +46 -37
  33. package/dist/src/utils/buttonCopyFlag.d.ts +22 -0
  34. package/dist/src/utils/buttonCopyFlag.js +12 -0
  35. package/dist/src/utils/delivery-countries.d.ts +9 -0
  36. package/dist/src/utils/delivery-countries.js +255 -0
  37. package/dist/src/utils/expressCheckoutRedirect.d.ts +20 -2
  38. package/dist/src/utils/expressCheckoutRedirect.js +13 -1
  39. package/dist/src/utils/expressCheckoutTracking.d.ts +13 -20
  40. package/dist/src/utils/expressCheckoutTracking.js +22 -37
  41. package/dist/src/utils/latin-characters.d.ts +3 -0
  42. package/dist/src/utils/latin-characters.js +10 -0
  43. package/dist/src/utils/price-zones.d.ts +7 -0
  44. package/dist/src/utils/price-zones.js +212 -0
  45. package/dist/src/utils/print-variants.d.ts +5 -0
  46. package/dist/src/utils/print-variants.js +10 -0
  47. package/dist/src/utils/printOffersFlag.d.ts +11 -0
  48. package/dist/src/utils/printOffersFlag.js +5 -0
  49. package/dist/src/utils/recaptcha.d.ts +3 -2
  50. package/dist/src/utils/recaptcha.js +17 -8
  51. package/package.json +1 -1
  52. package/dist/src/apple-pay-logo.d.ts +0 -1
  53. package/dist/src/apple-pay-logo.js +0 -14
  54. package/dist/src/types/experiment-integration.d.js +0 -0
  55. package/dist/src/utils/getExperimentKeyFromNextData.d.ts +0 -8
  56. package/dist/src/utils/getExperimentKeyFromNextData.js +0 -9
@@ -1,6 +1,16 @@
1
1
  import type { Offer, ProductVariant } from './types/offer.types';
2
2
  import { ApplePayEntryPoint } from './constants';
3
+ /**
4
+ * @deprecated Print offers are now excluded per entry point; use `getExcludedVariants(entryPoint)`. Kept as
5
+ * the default (surfaces that do not take print offers) so existing hosts behave exactly as before.
6
+ */
3
7
  export declare const APPLE_PAY_EXCLUDED_VARIANTS: readonly ProductVariant[];
8
+ /**
9
+ * Variants an entry point never offers Apple Pay for (unknown / missing entry points use the default
10
+ * entry point's rule, as in `createIfEnabled`). Hosts that update `button.offer` in place use this to apply
11
+ * the same rule `createIfEnabled` applies on creation.
12
+ */
13
+ export declare const getExcludedVariants: (entryPoint?: ApplePayEntryPoint) => readonly ProductVariant[];
4
14
  export declare class ApplePayButton extends HTMLElement {
5
15
  #private;
6
16
  static readonly tag = "teg-apple-pay-button";
@@ -9,26 +19,18 @@ export declare class ApplePayButton extends HTMLElement {
9
19
  * Creates and configures an ApplePayButton when the entry point allows it.
10
20
  *
11
21
  * - `DUAL_OFFER_BANNER` (or omitted): always-on after offer exclusions —
12
- * no homepage/Safari gate here, no banners experiment read, and no banners
13
- * `$exposure`.
22
+ * no homepage/Safari gate here. Safari/Apple is enforced later by
23
+ * `isApplePayAvailable()` on mount.
14
24
  * - `FREE_TRIAL_BANNER`: same always-on-after-exclusions gate as Dual; distinct
15
25
  * TEDL `entry_point` string (`free_trial_banner`) for wallet impression attribution.
16
- * - `PAYWALL`: experiment-gated via {@link APPLE_PAY_EXPRESS_PAYWALLS_EXPERIMENT_KEY}
17
- * (`treatment` or QA URL param). The host must set up
18
- * `window.experimentIntegration` before calling for this entry point.
26
+ * - `FREE_TRIAL_POPUP`: same always-on-after-exclusions gate. Distinct TEDL
27
+ * `entry_point` (`free_trial_popup`).
28
+ * - `PAYWALL`: always-on after offer exclusions + Safari/Apple placement
29
+ * eligibility. No Amplitude experiment / `$exposure`.
19
30
  * - `REGWALL`: inert — always returns null.
20
31
  *
21
- * **PAYWALL only — transition period:** the legacy
22
- * `FEATURE_APPLE_PAY_EXPRESS_CHECKOUT` URL param can show the button without
23
- * treatment (and without inflating `$exposure`). For banners there is no
24
- * experiment gate; `BYPASS_APPLE_PAY_CHECKS` only skips device checks in
25
- * `isApplePayAvailable()` on mount.
26
- *
27
- * **Eligibility:**
28
- * - `DUAL_OFFER_BANNER` / `FREE_TRIAL_BANNER` (or omitted): always eligible at
29
- * this gate (homepage placement is host-owned; Safari/Apple is enforced
30
- * later by `isApplePayAvailable()` on mount)
31
- * - `PAYWALL`: Safari/Apple device only (no homepage) — article paywalls
32
+ * `BYPASS_APPLE_PAY_CHECKS` skips placement eligibility here and device checks
33
+ * in `isApplePayAvailable()` on mount (QA on non-Apple browsers).
32
34
  *
33
35
  * @param offer - The offer to display in the Apple Pay flow.
34
36
  * @param country - The user's country code.